File tree Expand file tree Collapse file tree 4 files changed +6
-9
lines changed
docusaurus-plugin-ideal-image/src/theme/IdealImageLegacy/components
docusaurus-theme-common/src/utils
docusaurus/src/commands/swizzle/__tests__ Expand file tree Collapse file tree 4 files changed +6
-9
lines changed Original file line number Diff line number Diff line change @@ -480,7 +480,7 @@ Available document ids are:
480
480
481
481
export function toDocNavigationLink (
482
482
doc : DocMetadataBase ,
483
- options ?: { sidebarItemLabel ?: string | undefined } ,
483
+ options ?: { sidebarItemLabel ?: string } ,
484
484
) : PropNavigationLink {
485
485
const {
486
486
title,
Original file line number Diff line number Diff line change @@ -86,7 +86,7 @@ export const bytesToSize = (bytes) => {
86
86
const detectWebpSupport = ( ) => {
87
87
if ( ssr ) return false ;
88
88
const elem = document . createElement ( 'canvas' ) ;
89
- if ( elem . getContext && elem . getContext ( '2d' ) ) {
89
+ if ( elem . getContext ?. ( '2d' ) ) {
90
90
// was able or not to get WebP representation
91
91
return elem . toDataURL ( 'image/webp' ) . indexOf ( 'data:image/webp' ) === 0 ;
92
92
} else {
@@ -97,8 +97,7 @@ const detectWebpSupport = () => {
97
97
98
98
export const supportsWebp = detectWebpSupport ( ) ;
99
99
100
- const isWebp = ( x ) =>
101
- x . format === 'webp' || ( x . src && x . src . match ( / \. w e b p ( $ | \? .* ) / i) ) ;
100
+ const isWebp = ( x ) => x . format === 'webp' || x . src ?. match ( / \. w e b p ( $ | \? .* ) / i) ;
102
101
103
102
// eslint-disable-next-line no-shadow
104
103
export const selectSrc = ( { srcSet, maxImageWidth, supportsWebp} ) => {
Original file line number Diff line number Diff line change @@ -15,7 +15,7 @@ export type DocsVersionPersistence = 'localStorage' | 'none';
15
15
16
16
// TODO improve types, use unions
17
17
export type NavbarItem = {
18
- type ?: string | undefined ;
18
+ type ?: string ;
19
19
items ?: NavbarItem [ ] ;
20
20
label ?: string ;
21
21
position ?: 'left' | 'right' ;
Original file line number Diff line number Diff line change @@ -91,13 +91,11 @@ async function createTestSite() {
91
91
const siteThemePathPosix = posixPath ( siteThemePath ) ;
92
92
expect ( tree ( siteThemePathPosix ) ) . toMatchSnapshot ( 'theme dir tree' ) ;
93
93
94
- const files = ( await Globby ( siteThemePathPosix ) )
95
- . map ( ( file ) => path . posix . relative ( siteThemePathPosix , file ) )
96
- . sort ( ) ;
94
+ const files = await Globby ( '**/*' , { cwd : siteThemePath } ) ;
97
95
98
96
for ( const file of files ) {
99
97
const fileContent = await fs . readFile (
100
- path . posix . join ( siteThemePath , file ) ,
98
+ path . join ( siteThemePath , file ) ,
101
99
'utf-8' ,
102
100
) ;
103
101
expect ( fileContent ) . toMatchSnapshot ( file ) ;
You can’t perform that action at this time.
0 commit comments