Skip to content

Commit d98d5b9

Browse files
committed
Merge branch 'main' into tinyglobby
2 parents ca54f5d + ba18a8b commit d98d5b9

File tree

4 files changed

+6
-9
lines changed
  • packages

4 files changed

+6
-9
lines changed

packages/docusaurus-plugin-content-docs/src/sidebars/utils.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -480,7 +480,7 @@ Available document ids are:
480480

481481
export function toDocNavigationLink(
482482
doc: DocMetadataBase,
483-
options?: {sidebarItemLabel?: string | undefined},
483+
options?: {sidebarItemLabel?: string},
484484
): PropNavigationLink {
485485
const {
486486
title,

packages/docusaurus-plugin-ideal-image/src/theme/IdealImageLegacy/components/helpers.js

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ export const bytesToSize = (bytes) => {
8686
const detectWebpSupport = () => {
8787
if (ssr) return false;
8888
const elem = document.createElement('canvas');
89-
if (elem.getContext && elem.getContext('2d')) {
89+
if (elem.getContext?.('2d')) {
9090
// was able or not to get WebP representation
9191
return elem.toDataURL('image/webp').indexOf('data:image/webp') === 0;
9292
} else {
@@ -97,8 +97,7 @@ const detectWebpSupport = () => {
9797

9898
export const supportsWebp = detectWebpSupport();
9999

100-
const isWebp = (x) =>
101-
x.format === 'webp' || (x.src && x.src.match(/\.webp($|\?.*)/i));
100+
const isWebp = (x) => x.format === 'webp' || x.src?.match(/\.webp($|\?.*)/i);
102101

103102
// eslint-disable-next-line no-shadow
104103
export const selectSrc = ({srcSet, maxImageWidth, supportsWebp}) => {

packages/docusaurus-theme-common/src/utils/useThemeConfig.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ export type DocsVersionPersistence = 'localStorage' | 'none';
1515

1616
// TODO improve types, use unions
1717
export type NavbarItem = {
18-
type?: string | undefined;
18+
type?: string;
1919
items?: NavbarItem[];
2020
label?: string;
2121
position?: 'left' | 'right';

packages/docusaurus/src/commands/swizzle/__tests__/index.test.ts

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -91,13 +91,11 @@ async function createTestSite() {
9191
const siteThemePathPosix = posixPath(siteThemePath);
9292
expect(tree(siteThemePathPosix)).toMatchSnapshot('theme dir tree');
9393

94-
const files = (await Globby(siteThemePathPosix))
95-
.map((file) => path.posix.relative(siteThemePathPosix, file))
96-
.sort();
94+
const files = await Globby('**/*', {cwd: siteThemePath});
9795

9896
for (const file of files) {
9997
const fileContent = await fs.readFile(
100-
path.posix.join(siteThemePath, file),
98+
path.join(siteThemePath, file),
10199
'utf-8',
102100
);
103101
expect(fileContent).toMatchSnapshot(file);

0 commit comments

Comments
 (0)