Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
82c6609
initial refactor
styfle Jun 12, 2023
4d1cbaa
Refactor into `getImageProps()`
styfle Jun 12, 2023
4a1b107
Fix bug by returning meta object
styfle Jun 13, 2023
9a7dba3
Delete undefined props
styfle Jun 13, 2023
cb90783
Ensure test checks for the order
styfle Jun 13, 2023
5fad8a4
Update order and add more tests
styfle Jun 23, 2023
3190106
Merge branch 'canary' into styfle/next-257-getimageprops
styfle Jun 23, 2023
d862981
Refactor to avoid `use client` impacting `getImgProps()`
styfle Jun 24, 2023
03fcd08
move image entry to shared
huozhi Jun 26, 2023
ce5d0e5
Rename other ./client/image to ./shared/image
styfle Jun 26, 2023
3f61ffe
Remove unnecessary log
styfle Jun 28, 2023
1ac45ca
Add plugin to compile with swc (currently broken)
styfle Jun 28, 2023
0911227
Fix import
styfle Jun 28, 2023
a73ec12
Fix swc opts
styfle Jun 28, 2023
435e83c
Revert "Fix swc opts"
styfle Jun 28, 2023
f87a69c
Revert "Fix import"
styfle Jun 28, 2023
781441a
Revert "Add plugin to compile with swc (currently broken)"
styfle Jun 28, 2023
364f505
Still not working - add console.log()
styfle Jun 28, 2023
3369e14
Fix `images.loaderFile`
styfle Jun 28, 2023
986133b
Merge branch 'canary' into styfle/next-257-getimageprops
styfle Jun 28, 2023
cb3f54e
Rename to `image-external` to avoid `isNextExternal` regex incorrectl…
styfle Jun 28, 2023
c20c569
Import `image-loader` in both files
styfle Jun 28, 2023
99bb6cf
Add tests for `<picture>` via `getImageProps()`
styfle Jun 28, 2023
2b40209
Merge branch 'canary' into styfle/next-257-getimageprops
styfle Jun 28, 2023
da24a0a
Add "Warning:" prefix
styfle Jun 28, 2023
6a7b518
Merge branch 'canary' into styfle/next-257-getimageprops
kodiakhq[bot] Jun 29, 2023
870cb6e
Merge branch 'canary' into styfle/next-257-getimageprops
kodiakhq[bot] Jun 29, 2023
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
16 changes: 8 additions & 8 deletions packages/next/image-types/global.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
// if the static image import handling is enabled

declare module '*.png' {
const content: import('../dist/client/image').StaticImageData
const content: import('../dist/shared/lib/image-external').StaticImageData

export default content
}
Expand All @@ -19,43 +19,43 @@ declare module '*.svg' {
}

declare module '*.jpg' {
const content: import('../dist/client/image').StaticImageData
const content: import('../dist/shared/lib/image-external').StaticImageData

export default content
}

declare module '*.jpeg' {
const content: import('../dist/client/image').StaticImageData
const content: import('../dist/shared/lib/image-external').StaticImageData

export default content
}

declare module '*.gif' {
const content: import('../dist/client/image').StaticImageData
const content: import('../dist/shared/lib/image-external').StaticImageData

export default content
}

declare module '*.webp' {
const content: import('../dist/client/image').StaticImageData
const content: import('../dist/shared/lib/image-external').StaticImageData

export default content
}

declare module '*.avif' {
const content: import('../dist/client/image').StaticImageData
const content: import('../dist/shared/lib/image-external').StaticImageData

export default content
}

declare module '*.ico' {
const content: import('../dist/client/image').StaticImageData
const content: import('../dist/shared/lib/image-external').StaticImageData

export default content
}

declare module '*.bmp' {
const content: import('../dist/client/image').StaticImageData
const content: import('../dist/shared/lib/image-external').StaticImageData

export default content
}
4 changes: 2 additions & 2 deletions packages/next/image.d.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
import Image from './dist/client/image'
export * from './dist/client/image'
import Image from './dist/shared/lib/image-external'
export * from './dist/shared/lib/image-external'
export default Image
2 changes: 1 addition & 1 deletion packages/next/image.js
Original file line number Diff line number Diff line change
@@ -1 +1 @@
module.exports = require('./dist/client/image')
module.exports = require('./dist/shared/lib/image-external')
6 changes: 3 additions & 3 deletions packages/next/src/build/webpack-config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1103,8 +1103,8 @@ export default async function getBaseWebpackConfig(
'next/dist/esm/server/web/exports/index',
[`${NEXT_PROJECT_ROOT}/dist/client/link`]:
'next/dist/esm/client/link',
[`${NEXT_PROJECT_ROOT}/dist/client/image`]:
'next/dist/esm/client/image',
[`${NEXT_PROJECT_ROOT}/dist/shared/lib/image-external`]:
'next/dist/esm/shared/lib/image-external',
[`${NEXT_PROJECT_ROOT}/dist/client/script`]:
'next/dist/esm/client/script',
[`${NEXT_PROJECT_ROOT}/dist/client/router`]:
Expand Down Expand Up @@ -1403,7 +1403,7 @@ export default async function getBaseWebpackConfig(
}

const isNextExternal =
/next[/\\]dist[/\\](esm[\\/])?(shared|server)[/\\](?!lib[/\\](router[/\\]router|dynamic|app-dynamic|lazy-dynamic|head[^-]))/.test(
/next[/\\]dist[/\\](esm[\\/])?(shared|server)[/\\](?!lib[/\\](router[/\\]router|dynamic|app-dynamic|image-external|lazy-dynamic|head[^-]))/.test(
localRes
)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { optimizeImage } from '../../../../server/image-optimizer'

const BLUR_IMG_SIZE = 8
const BLUR_QUALITY = 70
const VALID_BLUR_EXT = ['jpeg', 'png', 'webp', 'avif'] // should match next/client/image.tsx
const VALID_BLUR_EXT = ['jpeg', 'png', 'webp', 'avif'] // should match other usages

export async function getBlurImage(
content: Buffer,
Expand Down
Loading