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
10 changes: 10 additions & 0 deletions .github/workflows/tests-e2e.yml
Original file line number Diff line number Diff line change
Expand Up @@ -158,18 +158,28 @@ jobs:
working-directory: ../test-website
env:
E2E_TEST: true

- name: TypeCheck website
# TODO: there're some lingering issues with PnP + tsc. Enable tsc in PnP later.
if: matrix.variant == '-st' && matrix.nodeLinker != 'pnp'
working-directory: ../test-website
run: yarn typecheck

- name: TypeCheck website - min version - v5.1
# TODO: there're some lingering issues with PnP + tsc. Enable tsc in PnP later.
if: matrix.variant == '-st' && matrix.nodeLinker != 'pnp'
working-directory: ../test-website
run: |
yarn add typescript@5.1.6 --exact

# Downgrade TS ignoreDeprecations option
node -e "const fs = require('fs'); const f = 'tsconfig.json'; fs.writeFileSync(f, fs.readFileSync(f,'utf8').replace('\"ignoreDeprecations\": \"6.0\"', '\"ignoreDeprecations\": \"5.0\"'))"

yarn typecheck

# Restore TS ignoreDeprecations option
node -e "const fs = require('fs'); const f = 'tsconfig.json'; fs.writeFileSync(f, fs.readFileSync(f,'utf8').replace('\"ignoreDeprecations\": \"5.0\"', '\"ignoreDeprecations\": \"6.0\"'))"

- name: TypeCheck website - max version - Latest
# TODO: there're some lingering issues with PnP + tsc. Enable tsc in PnP later.
if: matrix.variant == '-st' && matrix.nodeLinker != 'pnp'
Expand Down
17 changes: 11 additions & 6 deletions .github/workflows/tests-windows.yml
Original file line number Diff line number Diff line change
Expand Up @@ -61,18 +61,23 @@ jobs:
- name: TypeCheck website
# see https://github.com/facebook/docusaurus/pull/10486
run: yarn workspace website typecheck

- name: TypeCheck website - max version - Latest
# For latest TS there are often lib check errors, so we disable it
# Details: https://github.com/facebook/docusaurus/pull/10486
run: |
yarn add typescript@latest --exact -D -W --ignore-scripts
yarn workspace website typecheck --project tsconfig.skipLibCheck.json

- name: TypeCheck website - min version - v5.1
run: |
yarn add typescript@5.1.6 --exact -D -W --ignore-scripts

# Downgrade TS ignoreDeprecations option
node -e 'const fs = require("fs"); const f = "website/tsconfig.json"; fs.writeFileSync(f, fs.readFileSync(f, "utf8").replace(/"ignoreDeprecations"\s*:\s*"6\.0"/, "\"ignoreDeprecations\": \"5.0\""));'

# DocSearch@4/ai@5 doesn't support TS 5.1 (with skipLibCheck=false)
jq '.resolutions."@docsearch/react" = "^3.9.0"' package.json > package.json.tmp && mv -Force package.json.tmp package.json
yarn add @docsearch/react@^3.9.0 --exact -D -W --ignore-scripts

yarn workspace website typecheck
- name: TypeCheck website - max version - Latest
# For latest TS there are often lib check errors, so we disable it
# Details: https://github.com/facebook/docusaurus/pull/10486
run: |
yarn add typescript@latest --exact -D -W --ignore-scripts
yarn workspace website typecheck --project tsconfig.skipLibCheck.json
8 changes: 8 additions & 0 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -58,15 +58,23 @@ jobs:
- name: TypeCheck website
# see https://github.com/facebook/docusaurus/pull/10486
run: yarn workspace website typecheck

- name: TypeCheck website - min version - v5.1
run: |
yarn add typescript@5.1.6 --exact -D -W --ignore-scripts

# Downgrade TS ignoreDeprecations option
node -e "const fs = require('fs'); const f = 'website/tsconfig.json'; fs.writeFileSync(f, fs.readFileSync(f,'utf8').replace('\"ignoreDeprecations\": \"6.0\"', '\"ignoreDeprecations\": \"5.0\"'))"

# DocSearch@4/ai@5 doesn't support TS 5.1 (with skipLibCheck=false)
jq '.resolutions."@docsearch/react" = "^3.9.0"' package.json > package.json.tmp && mv -f package.json.tmp package.json
yarn add @docsearch/react@^3.9.0 --exact -D -W --ignore-scripts

yarn workspace website typecheck

# Restore TS ignoreDeprecations option
node -e "const fs = require('fs'); const f = 'website/tsconfig.json'; fs.writeFileSync(f, fs.readFileSync(f,'utf8').replace('\"ignoreDeprecations\": \"5.0\"', '\"ignoreDeprecations\": \"6.0\"'))"

- name: TypeCheck website - max version - Latest
# For latest TS there are often lib check errors, so we disable it
# Details: https://github.com/facebook/docusaurus/pull/10486
Expand Down
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@
"@types/fs-extra": "^9.0.13",
"@types/jest": "^30.0.0",
"@types/lodash": "^4.14.197",
"@types/node": "^18.16.19",
"@types/node": "^20.19.37",
"@types/prompts": "^2.4.4",
"@types/react": "^19.2.10",
"@types/semver": "^7.5.0",
Expand Down Expand Up @@ -128,7 +128,7 @@
"stylelint": "^14.16.1",
"stylelint-config-prettier": "^9.0.5",
"stylelint-config-standard": "^29.0.0",
"typescript": "~5.8.2"
"typescript": "~6.0.2"
},
"resolutions": {
"**/pretty-format/react-is": "^19.2.4"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
"@docusaurus/tsconfig": "3.9.2",
"@docusaurus/types": "3.9.2",
"@types/react": "^19.0.0",
"typescript": "~5.6.2"
"typescript": "~6.0.2"
},
"browserslist": {
"production": [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
"extends": "@docusaurus/tsconfig",
"compilerOptions": {
"baseUrl": ".",
"ignoreDeprecations": "6.0",
"strict": true
},
"exclude": [".docusaurus", "build"]
Expand Down
2 changes: 1 addition & 1 deletion packages/docusaurus-faster/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
"license": "MIT",
"dependencies": {
"@docusaurus/types": "3.9.2",
"@rspack/core": "^1.7.5",
"@rspack/core": "^1.7.10",
"@swc/core": "^1.7.39",
"@swc/html": "^1.13.5",
"browserslist": "^4.24.2",
Expand Down
4 changes: 3 additions & 1 deletion packages/docusaurus-logger/src/perfLogger.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,9 @@
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
import {AsyncLocalStorage} from 'async_hooks';

import {AsyncLocalStorage} from 'node:async_hooks';
import {type PerformanceMark} from 'node:perf_hooks';
import logger from './logger';

// For now this is a private env variable we use internally
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"extends": "../../tsconfig.base.client.json",
"include": ["src/client", "src/*.d.ts"],
"exclude": ["**/__tests__/**"]
"exclude": ["**/__tests__/**", "**/*.test.ts"]
}
2 changes: 1 addition & 1 deletion packages/docusaurus-plugin-content-blog/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,5 @@
"noEmit": false
},
"include": ["src"],
"exclude": ["src/client", "**/__tests__/**"]
"exclude": ["src/client", "**/__tests__/**", "**/*.test.ts"]
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"extends": "../../tsconfig.base.client.json",
"include": ["src/client", "src/*.d.ts"],
"exclude": ["**/__tests__/**"]
"exclude": ["**/__tests__/**", "**/*.test.ts"]
}
2 changes: 1 addition & 1 deletion packages/docusaurus-plugin-content-docs/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,5 @@
"noEmit": false
},
"include": ["src"],
"exclude": ["src/client", "**/__tests__/**"]
"exclude": ["src/client", "**/__tests__/**", "**/*.test.ts"]
}
3 changes: 3 additions & 0 deletions packages/docusaurus-plugin-google-gtag/tsconfig.client.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
{
"extends": "../../tsconfig.base.client.json",
"compilerOptions": {
"types": ["gtag.js"]
},
"include": ["src/gtag.ts", "src/*.d.ts"],
"exclude": ["**/__tests__/**"]
}
3 changes: 1 addition & 2 deletions packages/docusaurus-plugin-pwa/tsconfig.worker.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,7 @@
"tsBuildInfoFile": "lib/.tsbuildinfo-worker",
"moduleResolution": "bundler",
"module": "esnext",
"target": "esnext",
"types": ["node"]
"target": "esnext"
},
"include": ["src/sw.ts"],
"exclude": ["**/__tests__/**"]
Expand Down
3 changes: 2 additions & 1 deletion packages/docusaurus/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@
"prompts": "^2.4.2",
"react-helmet-async": "npm:@slorber/react-helmet-async@1.3.0",
"react-loadable": "npm:@docusaurus/react-loadable@6.0.0",
"react-loadable-ssr-addon-v5-slorber": "^1.0.1",
"react-loadable-ssr-addon-v5-slorber": "^1.0.3",
"react-router": "^5.3.4",
"react-router-config": "^5.1.1",
"react-router-dom": "^5.3.4",
Expand All @@ -86,6 +86,7 @@
"@types/serve-handler": "^6.1.4",
"@types/update-notifier": "^6.0.4",
"@types/webpack-bundle-analyzer": "^4.7.0",
"@types/webpack-env": "^1.18.8",
"tmp-promise": "^3.0.3",
"tree-node-cli": "^1.6.0"
},
Expand Down
6 changes: 0 additions & 6 deletions packages/docusaurus/src/client/clientEntry.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,6 @@ function Router({children}: {children: ReactNode}): ReactNode {
);
}

declare global {
interface NodeModule {
hot?: {accept: () => void};
}
}

const hydrate = Boolean(process.env.HYDRATE_CLIENT_ENTRY);

// Client-side render (e.g: running in browser) to become single-page
Expand Down
3 changes: 1 addition & 2 deletions packages/docusaurus/src/client/docusaurus.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,7 @@ const fetched = new Set<string>();
const loaded = new Set<string>();

declare global {
// eslint-disable-next-line camelcase, no-underscore-dangle
const __webpack_require__: {gca: (name: string) => string};
// See https://github.com/microsoft/TypeScript/issues/56962
interface Navigator {
connection?: {effectiveType: string; saveData: boolean};
}
Expand Down
6 changes: 0 additions & 6 deletions packages/docusaurus/src/client/exports/ComponentCreator.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,6 @@ import flat from '../flat';
import {RouteContextProvider} from '../routeContext';
import type {RouteContext} from '@docusaurus/types';

declare global {
interface NodeRequire {
resolveWeak: (name: string) => number;
}
}

export default function ComponentCreator(
path: string,
hash: string,
Expand Down
20 changes: 0 additions & 20 deletions packages/docusaurus/src/server/configValidation.ts
Original file line number Diff line number Diff line change
Expand Up @@ -576,26 +576,6 @@ function postProcessDocusaurusConfig(config: DocusaurusConfig) {
}
}

// Docusaurus Faster doesn't fully support Yarn PnP :s
// Until we support Rspack + PnP, we simply revert to Webpack with a warning
// See https://github.com/facebook/docusaurus/issues/10787
if (process.versions.pnp) {
if (config.future.faster.rspackBundler) {
logger.warn(`Docusaurus Faster doesn't fully support the Yarn PnP linker yet.
We recommend to use Yarn node-linker instead.
Docusaurus will still attempt to build your app with Webpack (instead of Rspack) and use slower minimizers.
See also https://github.com/facebook/docusaurus/issues/10787`);
config.future.faster.rspackBundler = false;
config.future.faster.rspackPersistentCache = false;

// This also won't work due to Webpack libs using peerDependencies :s
// This could eventually work if the deps are added at the site level
// TODO Docusaurus v4 clean this up
config.future.faster.lightningCssMinimizer = false;
config.future.faster.swcJsMinimizer = false;
}
}

if (config.onBrokenMarkdownLinks) {
logger.warn`The code=${'siteConfig.onBrokenMarkdownLinks'} config option is deprecated and will be removed in Docusaurus v4.
Please migrate and move this option to code=${'siteConfig.markdown.hooks.onBrokenMarkdownLinks'} instead.`;
Expand Down
3 changes: 1 addition & 2 deletions packages/docusaurus/src/server/i18n.ts
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,6 @@ function getDefaultCalendar(localeStr: string) {
// See https://developer.mozilla.org/fr/docs/Web/JavaScript/Reference/Global_Objects/Intl/Locale/getCalendars
// See https://caniuse.com/mdn-javascript_builtins_intl_locale_getcalendars
const calendars =
// @ts-expect-error: new std method (Bun/JSC/WebKit)
locale.getCalendars?.() ??
// @ts-expect-error: non-std attribute (V8/Chromium/Node)
locale.calendars;
Expand All @@ -84,7 +83,7 @@ function getDefaultDirection(localeStr: string) {
// 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;
return textInto.direction ?? 'ltr';
}

export function getDefaultLocaleConfig(
Expand Down
5 changes: 4 additions & 1 deletion packages/docusaurus/tsconfig.client.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
{
"extends": "../../tsconfig.base.client.json",
"include": ["src/client", "src/*.d.ts"],
"exclude": ["**/__tests__/**"]
"exclude": ["**/__tests__/**"],
"compilerOptions": {
"types": ["node", "webpack-env"]
}
}
4 changes: 3 additions & 1 deletion tsconfig.base.client.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,11 @@
"extends": "./tsconfig.base.json",
"compilerOptions": {
"tsBuildInfoFile": "${configDir}/lib/.tsbuildinfo-client",
"lib": ["DOM", "ESNext"],
"noEmit": false,
"moduleResolution": "bundler",
"module": "esnext",
"target": "esnext"
"target": "esnext",
"types": []
}
}
1 change: 1 addition & 0 deletions tsconfig.base.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
"incremental": true,
"tsBuildInfoFile": "${configDir}/lib/.tsbuildinfo",
"erasableSyntaxOnly": true,
"types": ["node"],
/* Emit */
"target": "ES2020",
"lib": ["ESNext"],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,8 +65,6 @@ MDX/HTML comments with invalid file references should not be resolved nor report

{/* [doesNotExist.mdx](doesNotExist.mdx) */}

<!-- [doesNotExist.mdx](doesNotExist.mdx) -->

## Reference-style links

The following should also work:
Expand Down
23 changes: 9 additions & 14 deletions website/_dogfooding/_pages tests/markdown-tests-mdx.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -50,23 +50,18 @@ import TabItem from '@theme/TabItem';

## Comments

Html comment: <!-- comment -->

Html comment multi-line:

<!--
comment
-->

<!-- prettier-ignore -->
MDX comment: {/* comment */}

MDX comment multi-line:
MDX comment in JSX:

<!-- prettier-ignore -->
{/*
comment
*/}
<>
{/* comment */}
<span>
{/* comment */}
TEST
{/* comment */}
</span>
</>

## Import code block from source code file

Expand Down
2 changes: 1 addition & 1 deletion website/docusaurus.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -235,7 +235,7 @@ export default async function createConfigAsync() {
},
mdx1Compat: {
headingIds: false,
// comments: false,
comments: false,
},
remarkRehypeOptions: {
footnoteLabel: getLocalizedConfigValue('remarkRehypeOptions_footnotes'),
Expand Down
1 change: 1 addition & 0 deletions website/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
"compilerOptions": {
"lib": ["DOM", "ESNext"],
"baseUrl": ".",
"ignoreDeprecations": "6.0",
"resolveJsonModule": true,
"allowArbitraryExtensions": true,

Expand Down
Loading
Loading