Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(gatsby-transformer-sharp): Resolver API changes #27783

Merged
merged 184 commits into from
Nov 10, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
184 commits
Select commit Hold shift + click to select a range
4814d60
Add static image plugin
ascorbic Sep 16, 2020
5509d90
Parse static image files
ascorbic Sep 16, 2020
6585d84
Fix package.json
ascorbic Sep 16, 2020
83b0321
Better static analysis
ascorbic Sep 17, 2020
b430e5a
Use jsx utils package
ascorbic Sep 18, 2020
96df1b8
Fix typings
ascorbic Sep 18, 2020
f98f56a
Typecheck fix
ascorbic Sep 18, 2020
e48da0a
Fix repo fields
ascorbic Sep 21, 2020
c11c2a4
Helpful warning
ascorbic Sep 21, 2020
7f16e80
Re-enable duotone
ascorbic Sep 22, 2020
146bd6e
Update readme
ascorbic Sep 22, 2020
f46f3e0
Improve typings
ascorbic Sep 22, 2020
65d06a4
Merge branch 'master' into feat/static-image-babel
ascorbic Sep 29, 2020
45a223f
wip fixed image fields for tracedSVG and webP
gillkyle Sep 30, 2020
836fe1d
handle fluid images as well
gillkyle Sep 30, 2020
97a5b77
Use require rather than JSON import
ascorbic Oct 1, 2020
46e5807
Watch files for changes, and use relative paths
ascorbic Oct 1, 2020
0d66f40
Merge branch 'add-missing-static-image-fields' into feat/static-image…
ascorbic Oct 1, 2020
5e41c30
Improve types
ascorbic Oct 1, 2020
0ebbf06
Add type
ascorbic Oct 2, 2020
41a3cce
Merge branch 'master' into feat/static-image-babel
ascorbic Oct 2, 2020
12597fa
Update yarn.lock
ascorbic Oct 2, 2020
4036bb3
Add lots of comments and remove unused stuff
ascorbic Oct 2, 2020
b548429
Create and watch our own nodes
ascorbic Oct 2, 2020
3242599
Update readme
ascorbic Oct 2, 2020
935e91a
Merge remote-tracking branch 'origin/master' into feat/static-image-b…
ascorbic Oct 2, 2020
70616e2
Update deps
ascorbic Oct 2, 2020
67ea9ef
Only watch in develop
ascorbic Oct 2, 2020
4f68363
Rename to gatsby-plugin-image
ascorbic Oct 5, 2020
f5dc9f7
Rearrange, ready for merger
ascorbic Oct 5, 2020
13e1ca8
Import @wardpeet 's gatsby-image-netxtgen
ascorbic Oct 5, 2020
6569d06
Update typings and further merge packages
ascorbic Oct 5, 2020
f3598f0
Build babel plugin
ascorbic Oct 5, 2020
94e4b7e
More merging
ascorbic Oct 5, 2020
7635d59
Add server/browser static image variants
ascorbic Oct 5, 2020
5060df6
include webpack changes
Oct 5, 2020
812ab51
change error message to use gatsby-plugin-image
Oct 5, 2020
80c9155
Merge remote-tracking branch 'origin/master' into feat/static-image-b…
ascorbic Oct 6, 2020
5f1aa5a
Fix compat compilation
ascorbic Oct 6, 2020
4f8824e
Fix SSR
ascorbic Oct 6, 2020
5155374
Merge readmes
ascorbic Oct 6, 2020
e93480f
Build browser bundle
ascorbic Oct 6, 2020
e581396
Export correctly from browser entry point
ascorbic Oct 6, 2020
f6e1156
Remove hook import
ascorbic Oct 6, 2020
24ffaa2
Apply suggestions from code review
ascorbic Oct 6, 2020
ff4d0a9
Merge branch 'feat/static-image-babel' of github.com:gatsbyjs/gatsby …
ascorbic Oct 6, 2020
ea4bf65
Changes from review
ascorbic Oct 6, 2020
2e5912f
add path prefix, static image do e2e test
Oct 6, 2020
aee3dc9
Add prepare script
ascorbic Oct 7, 2020
9ecea93
Apply README suggestions from code review
ascorbic Oct 7, 2020
284d34c
Fix image component in e2e test
ascorbic Oct 7, 2020
8badae4
Better error messages
ascorbic Oct 7, 2020
121e344
Merge branch 'feat/static-image-babel' of github.com:gatsbyjs/gatsby …
ascorbic Oct 7, 2020
618bd75
Prefer svg over base64. Warn for unsupported art direction
ascorbic Oct 7, 2020
e2d84d8
Fix type
ascorbic Oct 7, 2020
f84853f
Use "layout" instead of fixed/fluid
ascorbic Oct 7, 2020
31b8594
add static images to production runtime site
Oct 7, 2020
cc7c571
add path prefix tests
Oct 7, 2020
5426dcf
Reorg types. Change private prop name
ascorbic Oct 7, 2020
a3305a9
Merge branch 'feat/static-image-babel' of github.com:gatsbyjs/gatsby …
ascorbic Oct 7, 2020
a80fa20
initial gatsby static image tests
Oct 7, 2020
3f15544
add test suite to circle ci
Oct 7, 2020
d891b8d
add test suite to circle ci
Oct 7, 2020
0a19484
add test suite to circle ci
Oct 7, 2020
c97041c
remove unused imports, use valid fluid setting
Oct 7, 2020
1c2c89e
Use new fluid props syntax
ascorbic Oct 8, 2020
127840e
Better var name
ascorbic Oct 8, 2020
8e93857
update tests
Oct 8, 2020
8125d34
remove tests that no longer match the expected DOM
Oct 8, 2020
a76ea81
Merge branch 'feat/static-image-babel' of github.com:gatsbyjs/gatsby …
ascorbic Oct 8, 2020
5aa7ec6
Merge remote-tracking branch 'origin/master' into feat/static-image-b…
ascorbic Oct 9, 2020
f999a45
More compat-fixes
ascorbic Oct 9, 2020
81e7ee7
Change classname to match old version
ascorbic Oct 9, 2020
df2e14b
Compat improvements
ascorbic Oct 9, 2020
a4d991e
Update tests to match new classname
ascorbic Oct 9, 2020
2a8d141
Merge remote-tracking branch 'upstream/master' into feat/static-image…
Oct 9, 2020
6d05bc1
Merge remote-tracking branch 'origin/master' into feat/static-image-b…
ascorbic Oct 13, 2020
46f33b7
v0.0.1
ascorbic Oct 13, 2020
b2620c7
Add readme caveat
ascorbic Oct 13, 2020
870ceff
Update version in packages
ascorbic Oct 13, 2020
5db8d30
Remove forcewrapper
ascorbic Oct 13, 2020
c095f4b
wip
ascorbic Oct 13, 2020
02e6495
have static image use gatsbyImageProps function
Oct 13, 2020
4de8330
Merge remote-tracking branch 'origin/master' into feat/image-resolvers
ascorbic Oct 14, 2020
683b57a
Upgrade sharp
ascorbic Oct 14, 2020
559b571
Fix static image type
ascorbic Oct 14, 2020
d52c4a0
First steps to update API
ascorbic Oct 14, 2020
13e3423
Add descriptions
ascorbic Oct 14, 2020
1d440ce
Merge remote-tracking branch 'origin/master' into feat/static-image-b…
ascorbic Oct 14, 2020
03e894a
Merge branch 'feat/static-image-babel' into feat/image-resolvers
ascorbic Oct 14, 2020
60d554f
TypeScript fixes
ascorbic Oct 14, 2020
d5b1f1a
Compile ts
ascorbic Oct 14, 2020
f78bb88
Merge remote-tracking branch 'origin/master' into feat/image-resolvers
ascorbic Oct 15, 2020
6a0c0b0
Add @gillkyle's calculateImageSizes util funciton
ascorbic Oct 15, 2020
86f9af0
remove unused file
Oct 15, 2020
9e1f556
unbump sharp until sharp PR is merged
Oct 15, 2020
ffddd6f
comment out import
Oct 15, 2020
70cdb59
update snapshots
Oct 15, 2020
c1558f2
change JSX to take image prop
Oct 15, 2020
3127a0a
static image uses new image props
Oct 15, 2020
4a31afb
Rename all the things
ascorbic Oct 15, 2020
4b57129
Turns out it wasn't all of them
ascorbic Oct 15, 2020
a1d967d
Update schema
ascorbic Oct 15, 2020
b601e9d
fix intrinsic issue 1px problem, still doesn't seem to reach the corr…
Oct 15, 2020
a5ba190
Fix layout
ascorbic Oct 16, 2020
1e1dba6
Update readme
ascorbic Oct 16, 2020
e1b3b62
Merge remote-tracking branch 'origin/master' into feat/image-resolvers
ascorbic Oct 16, 2020
edb5a7a
Fix dep
ascorbic Oct 16, 2020
8449710
Shouldn;t be in this
ascorbic Oct 16, 2020
1888a2f
Fix sharp function name
ascorbic Oct 16, 2020
8568329
Version
ascorbic Oct 16, 2020
483adb8
Merge remote-tracking branch 'origin/master' into feat/image-resolvers
ascorbic Oct 16, 2020
6abf47d
What is this snapshot out of date?
ascorbic Oct 16, 2020
f30d823
Add a helper funciton
ascorbic Oct 16, 2020
abd9052
Make backgroundColor work
ascorbic Oct 16, 2020
b0e1a39
update layout for images
Oct 16, 2020
dc905ac
no longer using base64 so remove that test
Oct 16, 2020
6307d9b
placeholder not getting passed from static, so this is still busted
Oct 16, 2020
cde4d27
Fix passing of props
ascorbic Oct 16, 2020
267af4d
Merge branch 'feat/image-resolvers' of github.com:gatsbyjs/gatsby int…
ascorbic Oct 16, 2020
a02fadb
Add TODO comments
ascorbic Oct 16, 2020
03e26e8
Merge remote-tracking branch 'origin/master' into feat/image-resolvers
ascorbic Oct 19, 2020
2a78089
Merge remote-tracking branch 'origin/master' into feat/image-resolvers
ascorbic Oct 19, 2020
087d792
Export batch queue function
ascorbic Oct 19, 2020
48ffac8
Handle the default sizes elsewhere, as it depends on layout
ascorbic Oct 19, 2020
99d5c77
feat(gatsby-plugin-sharp): create image sizes helper (#27554)
gillkyle Oct 20, 2020
dd903e7
Use passed-in reporter
ascorbic Oct 20, 2020
6f96517
Use shared function to handle fit calculation
ascorbic Oct 20, 2020
b048019
Return presentationW/H and aspect ratio from sizes function
ascorbic Oct 20, 2020
0924270
Round sizes
ascorbic Oct 20, 2020
050450d
Use new resizing functions
ascorbic Oct 20, 2020
b49e8c8
default layout wasn't passed to createImageSizes
Oct 20, 2020
0809801
add fixed width default and round calculated height
Oct 20, 2020
f65ed05
reversed logic for aspect ratio calculations
gillkyle Oct 20, 2020
2a08433
Merge remote-tracking branch 'origin' into feat/image-resolvers
ascorbic Oct 21, 2020
ee0f51a
Correct description for outputPixelDensities resolver
ascorbic Oct 21, 2020
22f4e8a
Remove log
ascorbic Oct 21, 2020
9523fc3
Handle null image in SSR
ascorbic Oct 21, 2020
d6c0b3b
Version fix
ascorbic Oct 21, 2020
59ee72c
fix(gatsby-plugin-utils): skip libcheck during typegen
ascorbic Oct 21, 2020
046a614
Remove unused func
ascorbic Oct 21, 2020
35df109
Remove dominantColor from fixed and fluid
ascorbic Oct 22, 2020
0108c2c
sizing code for KG to drive refactor
Oct 22, 2020
130ba02
remove isSmaller
gillkyle Oct 22, 2020
8fbca1d
fix tests
gillkyle Oct 22, 2020
3c264eb
Merge remote-tracking branch 'origin' into feat/image-resolvers
ascorbic Oct 23, 2020
838b01a
Fix sizes and srcset generation
ascorbic Oct 23, 2020
781af53
Merge branch 'feat/image-resolvers' of github.com:gatsbyjs/gatsby int…
ascorbic Oct 23, 2020
92768e1
Add object-fit
ascorbic Oct 23, 2020
72645ad
rename placeholder function for consistency
Oct 23, 2020
2f73b31
Update readme
ascorbic Oct 23, 2020
d7d8617
Merge branch 'feat/image-resolvers' of github.com:gatsbyjs/gatsby int…
ascorbic Oct 23, 2020
abda06a
fix path prefix images
Oct 23, 2020
a086ef7
Merge branch 'feat/image-resolvers' of https://github.com/gatsbyjs/ga…
Oct 23, 2020
2a9b0fe
fix sizing when larger image dimensions are requested, fix warning as…
Oct 23, 2020
f3e114a
rename file to match constrained naming
Oct 23, 2020
b5c546a
Changes from review
ascorbic Oct 26, 2020
89764a8
Merge remote-tracking branch 'origin' into feat/image-resolvers
ascorbic Oct 26, 2020
950b131
Add alpha warning
ascorbic Oct 26, 2020
2568f00
Change from review
ascorbic Oct 26, 2020
43bb48b
fix placeholder opacity
Oct 26, 2020
fb616c3
fix placeholder bug
Oct 26, 2020
3508808
only change placeholder size for background color div
Oct 26, 2020
d66f3b2
tests: Add visual regression tests (#27619)
ascorbic Oct 27, 2020
9c3b7cb
Fix e2e test
ascorbic Oct 27, 2020
d0ff2c8
Merge branch 'feat/image-resolvers' of github.com:gatsbyjs/gatsby int…
ascorbic Oct 27, 2020
f9e36bb
Merge remote-tracking branch 'origin' into feat/image-resolvers
ascorbic Oct 27, 2020
4cfc7c3
Merge remote-tracking branch 'origin' into feat/image-resolvers
ascorbic Oct 27, 2020
de6c6a1
dont flash placeholder image when removing opacity
gillkyle Oct 27, 2020
b0c27ec
Merge branch 'feat/image-resolvers' of github.com:gatsbyjs/gatsby int…
gillkyle Oct 27, 2020
d8675ce
Fix dependency
ascorbic Oct 27, 2020
fd702cf
Continue moving options into options objects
ascorbic Oct 28, 2020
8bddbf7
Merge remote-tracking branch 'origin' into resolver-api-changes
ascorbic Nov 2, 2020
9232ba9
Update API
ascorbic Nov 2, 2020
ee1cd08
Default to blurred
ascorbic Nov 2, 2020
61b0f95
Fix test
ascorbic Nov 2, 2020
e00256f
Fix default
ascorbic Nov 2, 2020
eff996b
Change from review
ascorbic Nov 5, 2020
5ae0918
Updates to fixed sizing
ascorbic Nov 9, 2020
abe9a35
Update snapshots
ascorbic Nov 9, 2020
4871108
Merge remote-tracking branch 'origin' into resolver-api-changes
ascorbic Nov 9, 2020
91b4838
fix readme, clean up unused variable
Nov 9, 2020
23afa88
fix lint
Nov 9, 2020
248abf3
weird readme lint issue
Nov 9, 2020
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 1 addition & 3 deletions e2e-tests/visual-regression/src/pages/images/constrained.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,7 @@ const Page = () => {
query {
file(relativePath: { eq: "cornwall.jpg" }) {
childImageSharp {
gatsbyImage(maxWidth: 1024, layout: CONSTRAINED) {
imageData
}
gatsbyImageData(maxWidth: 1024, layout: CONSTRAINED)
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,7 @@ const Page = () => {
query {
file(relativePath: { eq: "landsend.jpg" }) {
childImageSharp {
gatsbyImage(width: 500, height: 500, layout: FIXED) {
imageData
}
gatsbyImageData(width: 500, height: 500, layout: FIXED)
}
}
}
Expand Down
4 changes: 1 addition & 3 deletions e2e-tests/visual-regression/src/pages/images/fixed.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,7 @@ const Page = () => {
query {
file(relativePath: { eq: "cornwall.jpg" }) {
childImageSharp {
gatsbyImage(width: 240, height: 100, layout: FIXED) {
imageData
}
gatsbyImageData(width: 240, height: 100, layout: FIXED)
}
}
}
Expand Down
4 changes: 1 addition & 3 deletions e2e-tests/visual-regression/src/pages/images/fluid.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,7 @@ const Page = () => {
query {
file(relativePath: { eq: "cornwall.jpg" }) {
childImageSharp {
gatsbyImage(maxWidth: 1024, layout: FLUID) {
imageData
}
gatsbyImageData(maxWidth: 1024, layout: FLUID)
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,6 @@ const Page = () => {
layout="constrained"
alt="cornwall"
maxWidth={1024}
placeholder="blurred"
webP
/>
</TestWrapper>
</Layout>
Expand Down
4 changes: 1 addition & 3 deletions packages/gatsby-plugin-image/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -284,9 +284,7 @@ export const query = graphql`
childImageSharp {
# Specify the image processing specifications right in the query.
# Makes it trivial to update as your page's design changes.
gatsbyImage(layout: FIXED, width: 125, height: 125) {
imageData
}
gatsbyImageData(layout: FIXED, width: 125, height: 125)
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🤦‍♂️

}
}
}
Expand Down
22 changes: 5 additions & 17 deletions packages/gatsby-plugin-image/src/babel-helpers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,29 +9,17 @@ export const SHARP_ATTRIBUTES = new Set([
`maxWidth`,
`maxHeight`,
`quality`,
`jpegQuality`,
`pngQuality`,
`webpQuality`,
`grayscale`,
`toFormat`,
`cropFocus`,
`pngCompressionSpeed`,
`rotate`,
`duotone`,
`jpegOptions`,
`pngOptions`,
`webpOptions`,
`blurredOptions`,
`transformOptions`,
`width`,
`height`,
`placeholder`,
`tracedSVGOptions`,
`webP`,
`outputPixelDensities`,
`sizes`,
`fit`,
`background`,
`base64Width`,
`jpegProgressive`,
`toFormatBase64`,
`trim`,
`srcSetBreakpoints`,
])

export function evaluateImageAttributes(
Expand Down
6 changes: 2 additions & 4 deletions packages/gatsby-plugin-image/src/components/hooks.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,14 +32,12 @@ export function hasImageLoaded(cacheKey: string): boolean {

export type FileNode = Node & {
childImageSharp?: Node & {
gatsbyImage?: Node & {
imageData: ISharpGatsbyImageData
}
gatsbyImageData?: ISharpGatsbyImageData
}
}

export const getImage = (file: FileNode): ISharpGatsbyImageData | undefined =>
file?.childImageSharp?.gatsbyImage?.imageData
file?.childImageSharp?.gatsbyImageData

export function getWrapperProps(
width: number,
Expand Down
1 change: 0 additions & 1 deletion packages/gatsby-plugin-image/src/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@ export interface ICommonImageProps {
export interface IFluidImageProps extends ICommonImageProps {
maxWidth?: number
maxHeight?: number
srcSetBreakpoints?: Array<number>
fit?: number
background?: number
}
Expand Down
1 change: 1 addition & 0 deletions packages/gatsby-plugin-sharp/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
"devDependencies": {
"@babel/cli": "^7.11.6",
"@babel/core": "^7.11.6",
"@types/sharp": "^0.26.0",
"babel-preset-gatsby-package": "^0.6.0-next.0",
"cross-env": "^7.0.2",
"gatsby-plugin-image": "^0.1.0-next.0"
Expand Down
72 changes: 60 additions & 12 deletions packages/gatsby-plugin-sharp/src/__tests__/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -292,28 +292,52 @@ describe(`calculateImageSizes (fluid & constrained)`, () => {
const testsCases = [
{ args: { maxWidth: 20, maxHeight: 20 }, result: [20, 20] },
{
args: { maxWidth: 20, maxHeight: 20, fit: sharp.fit.fill },
args: {
maxWidth: 20,
maxHeight: 20,
transformOptions: { fit: sharp.fit.fill },
},
result: [20, 20],
},
{
args: { maxWidth: 20, maxHeight: 20, fit: sharp.fit.inside },
args: {
maxWidth: 20,
maxHeight: 20,
transformOptions: { fit: sharp.fit.inside },
},
result: [20, 10],
},
{
args: { maxWidth: 20, maxHeight: 20, fit: sharp.fit.outside },
args: {
maxWidth: 20,
maxHeight: 20,
transformOptions: { fit: sharp.fit.outside },
},
result: [41, 20],
},
{ args: { maxWidth: 200, maxHeight: 200 }, result: [200, 200] },
{
args: { maxWidth: 200, maxHeight: 200, fit: sharp.fit.fill },
args: {
maxWidth: 200,
maxHeight: 200,
transformOptions: { fit: sharp.fit.fill },
},
result: [200, 200],
},
{
args: { maxWidth: 200, maxHeight: 200, fit: sharp.fit.inside },
args: {
maxWidth: 200,
maxHeight: 200,
transformOptions: { fit: sharp.fit.inside },
},
result: [200, 97],
},
{
args: { maxWidth: 200, maxHeight: 200, fit: sharp.fit.outside },
args: {
maxWidth: 200,
maxHeight: 200,
transformOptions: { fit: sharp.fit.outside },
},
result: [413, 200],
},
]
Expand Down Expand Up @@ -341,28 +365,52 @@ describe(`calculateImageSizes (fluid & constrained)`, () => {
const testsCases = [
{ args: { width: 20, height: 20 }, result: [20, 20] },
{
args: { width: 20, height: 20, fit: sharp.fit.fill },
args: {
width: 20,
height: 20,
transformOptions: { fit: sharp.fit.fill },
},
result: [20, 20],
},
{
args: { width: 20, height: 20, fit: sharp.fit.inside },
args: {
width: 20,
height: 20,
transformOptions: { fit: sharp.fit.inside },
},
result: [20, 10],
},
{
args: { width: 20, height: 20, fit: sharp.fit.outside },
args: {
width: 20,
height: 20,
transformOptions: { fit: sharp.fit.outside },
},
result: [41, 20],
},
{ args: { width: 200, height: 200 }, result: [200, 200] },
{
args: { width: 200, height: 200, fit: sharp.fit.fill },
args: {
width: 200,
height: 200,
transformOptions: { fit: sharp.fit.fill },
},
result: [200, 200],
},
{
args: { width: 200, height: 200, fit: sharp.fit.inside },
args: {
width: 200,
height: 200,
transformOptions: { fit: sharp.fit.inside },
},
result: [200, 97],
},
{
args: { width: 200, height: 200, fit: sharp.fit.outside },
args: {
width: 200,
height: 200,
transformOptions: { fit: sharp.fit.outside },
},
result: [413, 200],
},
]
Expand Down
Loading