@@ -137,6 +137,70 @@ describe('transformAssets', () => {
137137 } )
138138 } )
139139
140+ it ( 'only treats stylesheet links in route.assets as stylesheet transforms' , async ( ) => {
141+ const transformFn = vi . fn ( ( { url } ) => ( {
142+ href : `https://cdn.example.com${ url } ` ,
143+ } ) )
144+
145+ const manifest = await transformManifestAssets (
146+ {
147+ manifest : {
148+ routes : {
149+ __root__ : {
150+ preloads : [ ] ,
151+ assets : [
152+ {
153+ tag : 'link' ,
154+ attrs : { rel : 'stylesheet preload' , href : '/assets/app.css' } ,
155+ } ,
156+ {
157+ tag : 'link' ,
158+ attrs : { rel : 'icon' , href : '/favicon.ico' } ,
159+ } ,
160+ ] ,
161+ } ,
162+ } ,
163+ } ,
164+ clientEntry : '/assets/entry.js' ,
165+ } ,
166+ transformFn ,
167+ { clone : true } ,
168+ )
169+
170+ expect ( transformFn ) . toHaveBeenCalledWith ( {
171+ kind : 'stylesheet' ,
172+ url : '/assets/app.css' ,
173+ } )
174+ expect ( transformFn ) . not . toHaveBeenCalledWith ( {
175+ kind : 'stylesheet' ,
176+ url : '/favicon.ico' ,
177+ } )
178+ expect ( manifest . routes . __root__ ?. assets ) . toEqual ( [
179+ {
180+ tag : 'link' ,
181+ attrs : {
182+ rel : 'stylesheet preload' ,
183+ href : 'https://cdn.example.com/assets/app.css' ,
184+ } ,
185+ } ,
186+ {
187+ tag : 'link' ,
188+ attrs : {
189+ rel : 'icon' ,
190+ href : '/favicon.ico' ,
191+ } ,
192+ } ,
193+ {
194+ tag : 'script' ,
195+ attrs : {
196+ type : 'module' ,
197+ async : true ,
198+ } ,
199+ children : 'import("https://cdn.example.com/assets/entry.js")' ,
200+ } ,
201+ ] )
202+ } )
203+
140204 describe ( 'object shorthand' , ( ) => {
141205 it ( 'supports { prefix } — same as string shorthand' , ( ) => {
142206 const config = resolveTransformAssetsConfig ( {
0 commit comments