@@ -76,10 +76,10 @@ export default function VitePluginVanJS(options = {}) {
7676 enforce : "pre" ,
7777 buildStart ( ) {
7878 context = this ;
79- viteVersion = ( context . meta ?. viteVersion [ 0 ] ) ;
79+ viteVersion = context . meta ?. viteVersion [ 0 ] ;
8080 isOxc = Number ( viteVersion ) >= 8 ;
8181 } ,
82- // @ts -expect-error - this is temporary esbuild will be
82+ // @ts -expect-error - this is temporary esbuild will be
8383 config ( ) {
8484 return {
8585 optimizeDeps : {
@@ -106,20 +106,22 @@ export default function VitePluginVanJS(options = {}) {
106106 } ,
107107 } ,
108108 ...(
109- isOxc ? {
110- oxc : {
111- include : / \. ( j s x ? | t s x ? ) $ / ,
112- jsx : {
113- runtime : 'preserve' , // Options: 'automatic', 'classic', 'preserve'
114- importSource : "@vanjs/jsx" , // Default import source
109+ isOxc
110+ ? {
111+ oxc : {
112+ include : / \. ( j s x ? | t s x ? ) $ / ,
113+ jsx : {
114+ runtime : "preserve" , // Options: 'automatic', 'classic', 'preserve'
115+ importSource : "@vanjs/jsx" , // Default import source
116+ } ,
115117 } ,
116118 }
117- } : {
118- esbuild : {
119- jsx : "automatic" ,
120- jsxImportSource : "@vanjs/jsx" ,
119+ : {
120+ esbuild : {
121+ jsx : "automatic" ,
122+ jsxImportSource : "@vanjs/jsx" ,
123+ } ,
121124 }
122- }
123125 ) ,
124126 } ;
125127 } ,
@@ -201,12 +203,12 @@ export default function VitePluginVanJS(options = {}) {
201203 isResolvedVanFile || ( source === "vanjs-core" && ! isSetupFile )
202204 ? "@vanjs/van"
203205 : isResolvedVanXFile ||
204- ( source === "vanjs-ext" &&
205- ! isImportedVanXFile )
206- ? "@vanjs/vanX"
207- : isResolvedSetupFile && ( ! ssr && isSetupFile || ssr && ! isSetupFile )
208- ? "@vanjs/setup"
209- : null ;
206+ ( source === "vanjs-ext" &&
207+ ! isImportedVanXFile )
208+ ? "@vanjs/vanX"
209+ : isResolvedSetupFile && ( ! ssr && isSetupFile || ssr && ! isSetupFile )
210+ ? "@vanjs/setup"
211+ : null ;
210212 const resolvedPath = matchedSource ? aliases [ matchedSource ] : null ;
211213
212214 if ( resolvedPath ) {
@@ -236,16 +238,15 @@ routes.length = 0;
236238
237239// Register routes
238240${ currentRoutes . map ( generateRoute ) . join ( "\n" ) }
239- ${ ( ops && ops . ssr && currentRoutes . length )
241+ ${
242+ ( ops && ops . ssr && currentRoutes . length )
240243 ? `console.log(\`🍦 @vanjs/router registered ${ currentRoutes . length } routes.\`)`
241- : /* istanbul ignore next @preserve */ ""
242- }
244+ : /* istanbul ignore next @preserve */ ""
245+ }
243246` ;
244247
245248 const vite = await import ( "vite" ) ;
246- const transformer = isOxc
247- ? "transformWithOxc"
248- : "transformWithEsbuild" ;
249+ const transformer = isOxc ? "transformWithOxc" : "transformWithEsbuild" ;
249250 const langProp = isOxc ? "lang" : "loader" ;
250251 // const mapProp = isOxc ? "source_map" : "sourcemap";
251252
@@ -256,11 +257,13 @@ ${(ops && ops.ssr && currentRoutes.length)
256257
257258 return {
258259 code : result . code ,
259- map : result . map ? (
260- typeof result . map === "string"
261- ? JSON . parse ( result . map )
262- : /* istanbul ignore next @preserve */ result . map
263- ) : /* istanbul ignore next @preserve */ null ,
260+ map : result . map
261+ ? (
262+ typeof result . map === "string"
263+ ? JSON . parse ( result . map )
264+ : /* istanbul ignore next @preserve */ result . map
265+ )
266+ : /* istanbul ignore next @preserve */ null ,
264267 } ;
265268 }
266269 return null ;
0 commit comments