File tree Expand file tree Collapse file tree 1 file changed +15
-12
lines changed
Expand file tree Collapse file tree 1 file changed +15
-12
lines changed Original file line number Diff line number Diff line change @@ -90,22 +90,24 @@ export default function rehypePictures(options) {
9090 /** @type {Set<string> } */
9191 const available = new Set ( )
9292 // See which images exist.
93- /** @type {Array<() => Promise<undefined>> } */
93+ /** @type {Array<Promise<undefined>> } */
9494 const tasks = [ ]
9595
9696 for ( const d of sources ) {
97- tasks . push ( async function ( ) {
98- const file = new VFile ( { path : localUrl } )
99- rename ( file , d )
100-
101- try {
102- await fs . access ( file . path , fs . constants . R_OK )
103- } catch {
104- return
105- }
97+ tasks . push (
98+ ( async function ( ) {
99+ const file = new VFile ( { path : localUrl } )
100+ rename ( file , d )
101+
102+ try {
103+ await fs . access ( file . path , fs . constants . R_OK )
104+ } catch {
105+ return
106+ }
106107
107- available . add ( file . path )
108- } )
108+ available . add ( file . path )
109+ } ) ( )
110+ )
109111 }
110112
111113 await Promise . all ( tasks )
@@ -159,6 +161,7 @@ export default function rehypePictures(options) {
159161
160162 node . properties . height = info . height
161163 node . properties . loading = 'lazy'
164+ node . properties . sizes = 'auto'
162165 node . properties . width = info . width
163166
164167 const siblings = parent . children
You can’t perform that action at this time.
0 commit comments