File tree Expand file tree Collapse file tree 1 file changed +7
-4
lines changed Expand file tree Collapse file tree 1 file changed +7
-4
lines changed Original file line number Diff line number Diff line change @@ -48,6 +48,11 @@ const main = async args => {
48
48
( node . matches ?. ( 'link:not([itemprop])' ) &&
49
49
[ ...node . relList ] . some ( rel => ! rel . match ( bodyOkRelPatt ) ) ) ;
50
50
const insertDom = JSDOM . fragment ( resolved ) ;
51
+ // Node.js v22+:
52
+ // const { headInserts, bodyInserts } = Object.groupBy(
53
+ // insertDom.childNodes,
54
+ // node => (forceHead(node) ? 'headInserts' : 'bodyInserts'),
55
+ // );
51
56
const headInserts = [ ] , bodyInserts = [ ] ;
52
57
for ( const node of insertDom . childNodes ) {
53
58
if ( forceHead ( node ) ) headInserts . push ( node ) ;
@@ -69,10 +74,8 @@ const main = async args => {
69
74
fs . writeFileSync ( file , dom . serialize ( ) , 'utf8' ) ;
70
75
} ) ) ;
71
76
72
- const failures = results . flatMap ( result =>
73
- result . status === 'fulfilled' ? [ ] : [ result . reason ] ,
74
- ) ;
75
- if ( failures . length > 0 ) throw AggregateError ( failures ) ;
77
+ const failures = results . filter ( result => result . status !== 'fulfilled' ) ;
78
+ if ( failures . length > 0 ) throw AggregateError ( failures . map ( r => r . reason ) ) ;
76
79
} ;
77
80
78
81
main ( cliArgs ) . catch ( err => {
You can’t perform that action at this time.
0 commit comments