@@ -6,7 +6,7 @@ import glob from 'fast-glob'
6
6
import type { Plugin } from 'rolldown'
7
7
import { scan } from 'rolldown/experimental'
8
8
import type { Loader } from 'esbuild'
9
- import { transform } from 'esbuild'
9
+ import { transform } from 'esbuild'
10
10
import colors from 'picocolors'
11
11
import type { ResolvedConfig } from '..'
12
12
import {
@@ -101,15 +101,13 @@ export function scanImports(config: ResolvedConfig): {
101
101
if ( ! context || scanContext ?. cancelled ) {
102
102
return { deps : { } , missing : { } }
103
103
}
104
- return context
105
- . build ( )
106
- . then ( ( ) => {
107
- return {
108
- // Ensure a fixed order so hashes are stable and improve logs
109
- deps : orderedDependencies ( deps ) ,
110
- missing,
111
- }
112
- } )
104
+ return context . build ( ) . then ( ( ) => {
105
+ return {
106
+ // Ensure a fixed order so hashes are stable and improve logs
107
+ deps : orderedDependencies ( deps ) ,
108
+ missing,
109
+ }
110
+ } )
113
111
} )
114
112
. catch ( async ( e ) => {
115
113
// if (e.errors && e.message.includes('The build was canceled')) {
@@ -130,7 +128,7 @@ export function scanImports(config: ResolvedConfig): {
130
128
// })
131
129
// e.message = prependMessage + msgs.join('\n')
132
130
// } else {
133
- e . message = prependMessage + e . message
131
+ e . message = prependMessage + e . message
134
132
// }
135
133
throw e
136
134
} )
@@ -381,11 +379,12 @@ function rolldownScanPlugin(
381
379
if ( contents . includes ( 'import.meta.glob' ) ) {
382
380
scripts [ key ] = {
383
381
contents : await doTransformGlobImport ( contents , p ) ,
384
- loader
382
+ loader,
385
383
}
386
384
} else {
387
385
scripts [ key ] = {
388
- contents, loader
386
+ contents,
387
+ loader,
389
388
}
390
389
}
391
390
@@ -418,10 +417,13 @@ function rolldownScanPlugin(
418
417
return js
419
418
}
420
419
421
- const scripts : Record < string , {
422
- contents : string ,
423
- loader : Loader ,
424
- } > = { }
420
+ const scripts : Record <
421
+ string ,
422
+ {
423
+ contents : string
424
+ loader : Loader
425
+ }
426
+ > = { }
425
427
426
428
const ASSET_TYPE_RE = new RegExp ( `\\.(${ KNOWN_ASSET_TYPES . join ( '|' ) } )$` )
427
429
@@ -577,7 +579,7 @@ function rolldownScanPlugin(
577
579
if ( htmlTypesRE . test ( id ) ) {
578
580
return {
579
581
code : await htmlTypeOnLoadCallback ( id ) ,
580
- moduleType : 'js'
582
+ moduleType : 'js' ,
581
583
}
582
584
}
583
585
@@ -598,7 +600,7 @@ function rolldownScanPlugin(
598
600
if ( loader !== 'js' ) {
599
601
let tsconfigRaw
600
602
const tsconfigResult = await loadTsconfigJsonForFile (
601
- path . join ( config . root , '_dummy.js' ) ,
603
+ path . join ( config . root , '_dummy.js' ) ,
602
604
)
603
605
if ( tsconfigResult . compilerOptions ?. experimentalDecorators ) {
604
606
tsconfigRaw = { compilerOptions : { experimentalDecorators : true } }
@@ -622,7 +624,6 @@ function rolldownScanPlugin(
622
624
}
623
625
}
624
626
625
-
626
627
/**
627
628
* when using TS + (Vue + `<script setup>`) or Svelte, imports may seem
628
629
* unused to esbuild and dropped in the build output, which prevents
@@ -664,4 +665,4 @@ function isScannable(id: string, extensions: string[] | undefined): boolean {
664
665
extensions ?. includes ( path . extname ( id ) ) ||
665
666
false
666
667
)
667
- }
668
+ }
0 commit comments