-
-
Notifications
You must be signed in to change notification settings - Fork 2.3k
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
Image transformer #4209
Image transformer #4209
Conversation
Benchmark Resultspackages/benchmarks/three ✅
Timings
Cold BundlesNo bundle changes detected. Cached Bundles
packages/benchmarks/kitchen-sink ✅
Timings
Cold Bundles
Cached Bundles
packages/benchmarks/react-hn ✅
Timings
Cold Bundles
Cached Bundles
packages/benchmarks/ak-editor 🚨
Timings
Cold BundlesNo bundles found, this is probably a failed build... Cached BundlesNo bundles found, this is probably a failed build... |
@@ -87,6 +88,10 @@ class BaseAsset { | |||
return this.#asset.value.filePath; | |||
} | |||
|
|||
get query(): QueryParameters { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should transformers be able to add additional data to the query?
Only example I can think of is html-transformer that would add width and height from srcset to the image asset, but that's probably something with addDependency anyway
@@ -32,6 +35,26 @@ type Module = {| | |||
filePath?: FilePath, | |||
|}; | |||
|
|||
const parseFilePath = ( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not entirely sure if this is the correct place for this.
I do believe we should pass queryparams to the resolver, in case it should resolve to some remote asset like deno
does for example... But maybe we should make the resolverrunner handle this and pass it as an argument to each resolver so they can opt in to caring about it or not?
let dirContent = await outputFS.readdir(distDir); | ||
console.log(dirContent); | ||
|
||
assert.equal(dirContent.length, 8); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should output an image for each format, it just outputs one.
I tried updating the key but it does not seem to work. Not entirely sure how I should fix this. I thought it might be a bundling thing but the assets should be isolated?
I'm not entirely sure if this is already the case, but I think query params should generally only be allowed when explicitly specifying a pipeline (for the same reason that we went with a protocol-like syntax for pipelines instead of query params). |
@mischnic Maybe I misunderstood but I don't think it should be explicitly specified as a pipeline (in parcelrc). That would result in a lot of pipeline config (I think)? |
This pull request has been linked to and will mark 1 task as "Done" when merged:
|
Gonna rework this... Too much conflicts at this point |
↪️ Pull Request
Allow resizing of images using query parameters and sharp
Closes #3737
Closes #3736
Closes #3477
Closes T-6
💻 Examples
🚨 Test instructions
Run kitchen sink example
✔️ PR Todo