-
-
Notifications
You must be signed in to change notification settings - Fork 2.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: add noop service and make integrations that needs it use it (#7903
- Loading branch information
Showing
5 changed files
with
41 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
--- | ||
'@astrojs/cloudflare': major | ||
'@astrojs/netlify': major | ||
'@astrojs/vercel': major | ||
'astro': major | ||
--- | ||
|
||
When using an adapter that supports neither Squoosh or Sharp, Astro will now automatically use an image service that does not support processing, but still provides the other benefits of `astro:assets` such as enforcing `alt`, no CLS etc to users |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
import { baseService, type LocalImageService } from './service.js'; | ||
|
||
// Empty service used for platforms that neither support Squoosh or Sharp. | ||
const noopService: LocalImageService = { | ||
validateOptions: baseService.validateOptions, | ||
getURL: baseService.getURL, | ||
parseURL: baseService.parseURL, | ||
getHTMLAttributes: baseService.getHTMLAttributes, | ||
async transform(inputBuffer, transformOptions) { | ||
return { | ||
data: inputBuffer, | ||
format: transformOptions.format, | ||
}; | ||
}, | ||
}; | ||
|
||
export default noopService; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters