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

add turbopack-image #4621

Merged
merged 5 commits into from
Apr 19, 2023
Merged

add turbopack-image #4621

merged 5 commits into from
Apr 19, 2023

Conversation

sokra
Copy link
Member

@sokra sokra commented Apr 18, 2023

Description

allows to have custom plugins for module types

add turbopack-image crate which adds some image processing and blur placholder generation

next.js PR: vercel/next.js#48531

@vercel
Copy link

vercel bot commented Apr 18, 2023

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
examples-nonmonorepo 🔄 Building (Inspect) Apr 19, 2023 2:18pm
turbo-site ✅ Ready (Inspect) Visit Preview 💬 Add feedback Apr 19, 2023 2:18pm
9 Ignored Deployments
Name Status Preview Comments Updated (UTC)
examples-basic-web ⬜️ Ignored (Inspect) Apr 19, 2023 2:18pm
examples-cra-web ⬜️ Ignored (Inspect) Apr 19, 2023 2:18pm
examples-designsystem-docs ⬜️ Ignored (Inspect) Apr 19, 2023 2:18pm
examples-gatsby-web ⬜️ Ignored (Inspect) Apr 19, 2023 2:18pm
examples-kitchensink-blog ⬜️ Ignored (Inspect) Apr 19, 2023 2:18pm
examples-native-web ⬜️ Ignored (Inspect) Apr 19, 2023 2:18pm
examples-svelte-web ⬜️ Ignored (Inspect) Apr 19, 2023 2:18pm
examples-tailwind-web ⬜️ Ignored (Inspect) Apr 19, 2023 2:18pm
examples-vite-web ⬜️ Ignored (Inspect) Apr 19, 2023 2:18pm

@github-actions
Copy link
Contributor

✅ This changes can build next-swc

@github-actions
Copy link
Contributor

Benchmark for b799c7a

Click to view benchmark
Test Base PR % Significant %
bench_hmr_to_commit/Turbopack CSR/1000 modules 8562.74µs ± 42.64µs 8486.31µs ± 67.71µs -0.89%
bench_hmr_to_eval/Turbopack CSR/1000 modules 7658.82µs ± 46.80µs 7664.96µs ± 41.34µs +0.08%
bench_startup/Turbopack CSR/1000 modules 858.54ms ± 1.97ms 857.45ms ± 1.84ms -0.13%

@github-actions
Copy link
Contributor

Benchmark for bcc1a7d

Click to view benchmark
Test Base PR % Significant %
bench_hmr_to_commit/Turbopack CSR/1000 modules 8887.36µs ± 42.68µs 8830.87µs ± 51.30µs -0.64%
bench_hmr_to_eval/Turbopack CSR/1000 modules 7840.25µs ± 66.89µs 7813.83µs ± 66.20µs -0.34%
bench_startup/Turbopack CSR/1000 modules 862.24ms ± 1.40ms 857.85ms ± 3.03ms -0.51%

@github-actions
Copy link
Contributor

github-actions bot commented Apr 18, 2023

⚠️ CI failed ⚠️

The following steps have failed in CI:

  • Turbopack Rust tests (mac/win, non-blocking)

See workflow summary for details

@sokra sokra marked this pull request as ready for review April 18, 2023 13:56
@sokra sokra requested review from a team as code owners April 18, 2023 13:56
crates/turbopack-image/src/process.rs Outdated Show resolved Hide resolved
crates/turbopack-image/src/process.rs Outdated Show resolved Hide resolved
crates/turbopack-image/src/process.rs Outdated Show resolved Hide resolved
crates/turbopack-image/src/process.rs Outdated Show resolved Hide resolved
image: image::DynamicImage,
format: ImageFormat,
) -> Result<(String, u32, u32)> {
let small_image = image.resize(BLUR_IMG_SIZE, BLUR_IMG_SIZE, FilterType::Triangle);
Copy link
Contributor

Choose a reason for hiding this comment

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

So we're not going with Lanczos after all?

Copy link
Member Author

Choose a reason for hiding this comment

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

I don't think it's worth it for a 8x8 image...

crates/turbopack-image/src/process.rs Show resolved Hide resolved
@sokra sokra force-pushed the sokra/image-processing branch from 3860e0e to 1c73cfc Compare April 19, 2023 14:17
@sokra sokra merged commit 776e9d2 into main Apr 19, 2023
@sokra sokra deleted the sokra/image-processing branch April 19, 2023 16:21
sokra added a commit to vercel/next.js that referenced this pull request Apr 20, 2023
### What?

add support for blur placeholder generation to turbopack

add `StructuredImageModuleType` which is used with `ModuleType::Custom`
to allow importing an image as `{ url, width, height, blurDataURL,
blurWidth, blurHeight }`

in contrast to next.js with webpack this will also generate blur
placeholder in development instead of using a _next/image reference.
This should lead to more production-like experience (at the cost of a
little bit of compilation time).

turbo PR: vercel/turborepo#4621

### Why?

Turbopack was crashing on `placeholder="blur"` before.

fixes WEB-534

### Turbopack changes

* vercel/turborepo#4521 <!-- OJ Kwon -
feat(contextcondition): support InPath contextcondition -->
* vercel/turborepo#4601 <!-- Alex Kirszenberg -
Chunking Context Refactor pt. 3: Address PR comments from pt. 2 -->
* vercel/turborepo#4623 <!-- Tobias Koppers -
exclude turborepo from turbopack bench tests -->
* vercel/turborepo#4399 <!-- Leah - support
require.context -->
* vercel/turborepo#4610 <!-- OJ Kwon - test(subset):
add mdx test into subset -->
* vercel/turborepo#4624 <!-- Tobias Koppers - run
benchmarks on windows and macOS too -->
* vercel/turborepo#4620 <!-- Alex Kirszenberg - Make
ContainmentTree fully generic -->
* vercel/turborepo#4600 <!-- Tobias Koppers - add
getChunkPath method -->
* vercel/turborepo#4621 <!-- Tobias Koppers - add
turbopack-image -->
* vercel/turborepo#4639 <!-- Tobias Koppers -
restrict snapshot path for windows path length limit -->
* vercel/turborepo#4641 <!-- Tobias Koppers - put
webp behind a feature flag -->
NicholasLYang pushed a commit to NicholasLYang/turbo that referenced this pull request Apr 21, 2023
### Description

allows to have custom plugins for module types

add turbopack-image crate which adds some image processing and blur
placholder generation

next.js PR: vercel/next.js#48531
ForsakenHarmony pushed a commit to vercel/next.js that referenced this pull request Jul 25, 2024
### Description

allows to have custom plugins for module types

add turbopack-image crate which adds some image processing and blur
placholder generation

next.js PR: #48531
ForsakenHarmony pushed a commit to vercel/next.js that referenced this pull request Jul 29, 2024
### Description

allows to have custom plugins for module types

add turbopack-image crate which adds some image processing and blur
placholder generation

next.js PR: #48531
ForsakenHarmony pushed a commit to vercel/next.js that referenced this pull request Aug 1, 2024
### Description

allows to have custom plugins for module types

add turbopack-image crate which adds some image processing and blur
placholder generation

next.js PR: #48531
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants