-
Notifications
You must be signed in to change notification settings - Fork 27.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: codemod
next/image
within monorepo
- Loading branch information
Showing
7 changed files
with
53 additions
and
7 deletions.
There are no files selected for viewing
6 changes: 6 additions & 0 deletions
6
...sforms/__testfixtures__/next-image-experimental-loader/monorepo/input/app1/next.config.js
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,6 @@ | ||
module.exports = { | ||
images: { | ||
loader: "imgix", | ||
path: "https://example.com/" | ||
}, | ||
} |
6 changes: 6 additions & 0 deletions
6
...sforms/__testfixtures__/next-image-experimental-loader/monorepo/input/app2/next.config.js
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,6 @@ | ||
module.exports = { | ||
images: { | ||
loader: "cloudinary", | ||
path: "https://example.com/" | ||
}, | ||
} |
10 changes: 10 additions & 0 deletions
10
...orms/__testfixtures__/next-image-experimental-loader/monorepo/output/app1/imgix-loader.js
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,10 @@ | ||
const normalizeSrc = (src) => src[0] === '/' ? src.slice(1) : src | ||
export default function imgixLoader({ src, width, quality }) { | ||
const url = new URL('https://example.com/' + normalizeSrc(src)) | ||
const params = url.searchParams | ||
params.set('auto', params.getAll('auto').join(',') || 'format') | ||
params.set('fit', params.get('fit') || 'max') | ||
params.set('w', params.get('w') || width.toString()) | ||
if (quality) { params.set('q', quality.toString()) } | ||
return url.href | ||
} |
6 changes: 6 additions & 0 deletions
6
...forms/__testfixtures__/next-image-experimental-loader/monorepo/output/app1/next.config.js
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,6 @@ | ||
module.exports = { | ||
images: { | ||
loader: "custom", | ||
loaderFile: "./imgix-loader.js" | ||
}, | ||
} |
6 changes: 6 additions & 0 deletions
6
...__testfixtures__/next-image-experimental-loader/monorepo/output/app2/cloudinary-loader.js
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,6 @@ | ||
const normalizeSrc = (src) => src[0] === '/' ? src.slice(1) : src | ||
export default function cloudinaryLoader({ src, width, quality }) { | ||
const params = ['f_auto', 'c_limit', 'w_' + width, 'q_' + (quality || 'auto')] | ||
const paramsString = params.join(',') + '/' | ||
return 'https://example.com/' + paramsString + normalizeSrc(src) | ||
} |
6 changes: 6 additions & 0 deletions
6
...forms/__testfixtures__/next-image-experimental-loader/monorepo/output/app2/next.config.js
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,6 @@ | ||
module.exports = { | ||
images: { | ||
loader: "custom", | ||
loaderFile: "./cloudinary-loader.js" | ||
}, | ||
} |
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