File tree Expand file tree Collapse file tree 2 files changed +15
-0
lines changed
packages/astro/src/vite-plugin-inject-env-ts Expand file tree Collapse file tree 2 files changed +15
-0
lines changed Original file line number Diff line number Diff line change 1+ ---
2+ ' astro ' : patch
3+ ---
4+
5+ Automatically update user's env.d.ts with the proper types to help out migrating away from assets being experimental
Original file line number Diff line number Diff line change @@ -50,6 +50,16 @@ export async function setUpEnvTs({
5050 if ( fs . existsSync ( envTsPath ) ) {
5151 let typesEnvContents = await fs . promises . readFile ( envTsPath , 'utf-8' ) ;
5252
53+ // TODO: Remove this in 4.0, this code is only to help users migrate away from assets being experimental for a long time
54+ if ( typesEnvContents . includes ( 'types="astro/client-image"' ) ) {
55+ typesEnvContents = typesEnvContents . replace (
56+ 'types="astro/client-image"' ,
57+ 'types="astro/client"'
58+ ) ;
59+ await fs . promises . writeFile ( envTsPath , typesEnvContents , 'utf-8' ) ;
60+ info ( logging , 'assets' , `Removed ${ bold ( envTsPathRelativetoRoot ) } types` ) ;
61+ }
62+
5363 if ( ! fs . existsSync ( dotAstroDir ) )
5464 // Add `.astro` types reference if none exists
5565 return ;
You can’t perform that action at this time.
0 commit comments