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 .stylelintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
*/

module.exports = {
extends: ['stylelint-config-standard', 'stylelint-config-prettier'],
extends: ['stylelint-config-standard'],
plugins: ['stylelint-copyright'],
rules: {
'docusaurus/copyright-header': [
Expand Down
5 changes: 2 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -125,9 +125,8 @@
"rimraf": "^3.0.2",
"sharp": "^0.34.5",
"strip-ansi": "^6.0.1",
"stylelint": "^14.16.1",
"stylelint-config-prettier": "^9.0.5",
"stylelint-config-standard": "^29.0.0",
"stylelint": "^17.12.0",
"stylelint-config-standard": "^40.0.0",
"syncpack": "^14.3.1",
"typescript": "~6.0.3",
"typescript-eslint": "^8.59.3",
Expand Down
3 changes: 1 addition & 2 deletions packages/docusaurus-mdx-loader/src/loader.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ import {
compileToJSX,
createAssetsExportCode,
extractContentTitleData,
promiseWithResolvers,
} from './utils';
import type {WebpackCompilerName} from '@docusaurus/utils';
import type {Options} from './options';
Expand Down Expand Up @@ -202,7 +201,7 @@ async function loadMDXWithCaching({
deleteCacheEntry();
return cacheEntry.promise;
} else {
const {promise, resolve, reject} = promiseWithResolvers<string>();
const {promise, resolve, reject} = Promise.withResolvers<string>();
crossCompilerCache.set(cacheKey, {promise, resolve, reject});
return promise;
}
Expand Down
1 change: 0 additions & 1 deletion packages/docusaurus-mdx-loader/src/options.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
import type {MDXOptions, SimpleProcessors} from './processor';
import type {MarkdownConfig} from '@docusaurus/types';
import type {ResolveMarkdownLink} from './remark/resolveMarkdownLinks';
import type {PromiseWithResolvers} from './utils';

export type Options = Partial<MDXOptions> & {
dependencies?: string[];
Expand Down
17 changes: 0 additions & 17 deletions packages/docusaurus-mdx-loader/src/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -132,20 +132,3 @@ export async function compileToJSX({
);
}
}

// TODO Docusaurus v4, remove temporary polyfill when upgrading to Node 22+
export interface PromiseWithResolvers<T> {
promise: Promise<T>;
resolve: (value: T | PromiseLike<T>) => void;
reject: (reason?: any) => void;
}
// TODO Docusaurus v4, remove temporary polyfill when upgrading to Node 22+
export function promiseWithResolvers<T>(): PromiseWithResolvers<T> {
// @ts-expect-error: it's fine
const out: PromiseWithResolvers<T> = {};
out.promise = new Promise((resolve, reject) => {
out.resolve = resolve;
out.reject = reject;
});
return out;
}
2 changes: 1 addition & 1 deletion packages/docusaurus-plugin-content-blog/assets/atom.css
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ main {
font-family:
system-ui,
-apple-system,
Segoe UI,
'Segoe UI',
Roboto,
Ubuntu,
Cantarell;
Expand Down
2 changes: 1 addition & 1 deletion packages/docusaurus-plugin-content-blog/assets/rss.css
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ main {
font-family:
system-ui,
-apple-system,
Segoe UI,
'Segoe UI',
Roboto,
Ubuntu,
Cantarell;
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@
background-color: #363739;
}

@media screen and (min-width: 800px) {
@media screen and (width >= 800px) {
.nav {
flex-direction: column;
justify-content: flex-start;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
margin: 0;
}

@media screen and (max-width: 500px) {
@media screen and (width <= 500px) {
.popup {
width: 100%;
bottom: 0;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ html[data-announcement-bar-initially-dismissed='true'] .announcementBar {
}
}

@media (min-width: 997px) {
@media (width >= 997px) {
:root {
--docusaurus-announcement-bar-height: 30px;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
/**
Blog post title should be smaller on smaller devices
**/
@media (max-width: 576px) {
@media (width <= 576px) {
.title {
font-size: 2rem;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
color: var(--ifm-color-primary) !important;
}

@media (max-width: 996px) {
@media (width <= 996px) {
.sidebar {
display: none;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
* LICENSE file in the root directory of this source tree.
*/

@media (min-width: 997px) {
@media (width >= 997px) {
.generatedIndexPage {
max-width: 75% !important;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
margin-top: 0;
}

@media (min-width: 997px) {
@media (width >= 997px) {
.docItemCol {
max-width: 75% !important;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
* LICENSE file in the root directory of this source tree.
*/

@media (min-width: 997px) {
@media (width >= 997px) {
/* Prevent hydration FOUC, as the mobile TOC needs to be server-rendered */
.tocMobile {
display: none;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
width: 100%;
}

@media (min-width: 997px) {
@media (width >= 997px) {
.docMainContainer {
flex-grow: 1;
max-width: calc(100% - var(--doc-sidebar-width));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
* LICENSE file in the root directory of this source tree.
*/

@media (min-width: 997px) {
@media (width >= 997px) {
.expandButton {
position: absolute;
top: 0;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
display: none;
}

@media (min-width: 997px) {
@media (width >= 997px) {
.docSidebarContainer {
display: block;
width: var(--doc-sidebar-width);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
--docusaurus-collapse-button-bg-hover: rgb(255 255 255 / 10%);
}

@media (min-width: 997px) {
@media (width >= 997px) {
.collapseSidebarButton {
display: block !important;
background-color: var(--docusaurus-collapse-button-bg);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,12 @@
* LICENSE file in the root directory of this source tree.
*/

@media (min-width: 997px) {
@media (width >= 997px) {
.menu {
flex-grow: 1;
padding: 0.5rem;
}

@supports (scrollbar-gutter: stable) {
.menu {
padding: 0.5rem 0 0.5rem 0.5rem;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
* LICENSE file in the root directory of this source tree.
*/

@media (min-width: 997px) {
@media (width >= 997px) {
.sidebar {
display: flex;
flex-direction: column;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
* LICENSE file in the root directory of this source tree.
*/

@media (min-width: 997px) {
@media (width >= 997px) {
.menuHtmlItem {
padding: var(--ifm-menu-link-padding-vertical)
var(--ifm-menu-link-padding-horizontal);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
margin-top: 0.2rem;
}

@media (min-width: 997px) {
@media (width >= 997px) {
.lastUpdated {
text-align: right;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
/*
Hide color mode toggle in small viewports
*/
@media (max-width: 996px) {
@media (width <= 996px) {
.colorModeToggle {
display: none;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,14 @@ See https://github.com/facebook/docusaurus/pull/9385
display: none;
}

@media (max-width: 996px) {
@media (width <= 996px) {
.navbarSearchContainer {
position: absolute;
right: var(--ifm-navbar-padding-horizontal);
}
}

@media (min-width: 997px) {
@media (width >= 997px) {
.navbarSearchContainer {
padding: 0 var(--ifm-navbar-item-padding-horizontal);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
top: calc(var(--ifm-navbar-height) + 1rem);
}

@media (max-width: 996px) {
@media (width <= 996px) {
.tableOfContents {
display: none;
}
Expand Down
30 changes: 0 additions & 30 deletions packages/docusaurus-theme-common/src/contexts/colorMode.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -55,12 +55,6 @@ type ContextValue = {
readonly colorModeChoice: ColorModeChoice;
/** Set new color mode. */
readonly setColorMode: (colorMode: ColorModeChoice) => void;

// TODO Docusaurus v4
// legacy APIs kept for retro-compatibility: deprecate them
readonly isDarkTheme: boolean;
readonly setLightTheme: () => void;
readonly setDarkTheme: () => void;
};

const Context = React.createContext<ContextValue | undefined>(undefined);
Expand Down Expand Up @@ -237,30 +231,6 @@ function useContextValue(): ContextValue {
colorMode,
colorModeChoice,
setColorMode,
get isDarkTheme() {
if (process.env.NODE_ENV === 'development') {
console.error(
'`useColorMode().isDarkTheme` is deprecated. Please use `useColorMode().colorMode === "dark"` instead.',
);
}
return colorMode === 'dark';
},
setLightTheme() {
if (process.env.NODE_ENV === 'development') {
console.error(
'`useColorMode().setLightTheme` is deprecated. Please use `useColorMode().setColorMode("light")` instead.',
);
}
setColorMode('light');
},
setDarkTheme() {
if (process.env.NODE_ENV === 'development') {
console.error(
'`useColorMode().setDarkTheme` is deprecated. Please use `useColorMode().setColorMode("dark")` instead.',
);
}
setColorMode('dark');
},
}),
[colorMode, colorModeChoice, setColorMode],
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@
font-style: italic;
}

@media only screen and (max-width: 996px) {
@media only screen and (width <= 996px) {
.searchQueryColumn {
max-width: 60% !important;
}
Expand All @@ -89,7 +89,7 @@
}
}

@media screen and (max-width: 576px) {
@media screen and (width <= 576px) {
.searchQueryColumn {
max-width: 100% !important;
}
Expand Down
1 change: 0 additions & 1 deletion packages/docusaurus-types/src/config.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@ export type FasterConfig = {
};

export type FutureV4Config = {
removeLegacyPostBuildHeadAttribute: boolean;
useCssCascadeLayers: boolean;
siteStorageNamespacing: boolean;
fasterByDefault: boolean;
Expand Down
5 changes: 0 additions & 5 deletions packages/docusaurus-types/src/plugin.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ import type {RuleSetRule, Configuration as WebpackConfiguration} from 'webpack';
import type {CustomizeRuleString} from 'webpack-merge/dist/types';
import type {CommanderStatic} from 'commander';
import type Joi from 'joi';
import type {HelmetServerState} from 'react-helmet-async';
import type {ThemeConfig} from './config';
import type {LoadContext, Props} from './context';
import type {SwizzleConfig} from './swizzle';
Expand Down Expand Up @@ -137,10 +136,6 @@ export type Plugin<Content = unknown> = {
postBuild?: (
props: Props & {
content: Content;
// TODO Docusaurus v4: remove old messy unserializable "head" API
// breaking change, replaced by routesBuildMetadata
// Reason: https://github.com/facebook/docusaurus/pull/10826
head: {[location: string]: HelmetServerState};
routesBuildMetadata: {[location: string]: RouteBuildMetadata};
},
) => Promise<void> | void;
Expand Down
16 changes: 6 additions & 10 deletions packages/docusaurus-utils/src/urlUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -165,17 +165,13 @@ export function isValidPathname(str: string): boolean {
}

export function parseURLOrPath(url: string, base?: string | URL): URL {
try {
// TODO Docusaurus v4: use URL.parse()
// Node 24 supports it, use URL.parse could be faster?
// see https://kilianvalkhof.com/2024/javascript/the-problem-with-new-url-and-how-url-parse-fixes-that/
return new URL(url, base ?? 'https://example.com');
} catch (e) {
throw new Error(
`Can't parse URL ${url}${base ? ` with base ${base}` : ''}`,
{cause: e},
);
const parsedURL = URL.parse(url, base ?? 'https://example.com');

if (parsedURL) {
return parsedURL;
}

throw new Error(`Can't parse URL ${url}${base ? ` with base ${base}` : ''}`);
}

export type URLPath = {pathname: string; search?: string; hash?: string};
Expand Down
Loading
Loading