Skip to content

Conversation

pieh
Copy link
Contributor

@pieh pieh commented Jun 19, 2025

Description

Less disruptive alternative to #39297 that ensures that globally installed libvips in build environment does not impact produced functions (and allow them to be always self-contained)

Related Issues

@gatsbot gatsbot bot added the status: triage needed Issue or pull request that need to be triaged and assigned to a reviewer label Jun 19, 2025
@pieh pieh added topic: media Related to gatsby-plugin-image, or general image/media processing topics topic: render-mode Related to Gatsby's different rendering modes and removed status: triage needed Issue or pull request that need to be triaged and assigned to a reviewer labels Jun 19, 2025
}

return checkIfInstalledInInternalPackagesCache(
{
needToInstall: true,
packageName: `sharp`,
packageVersion: sharpVersion,
packageVersion:
sharp.versions.sharp ?? require(`sharp/package.json`).version,
Copy link
Contributor Author

Choose a reason for hiding this comment

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

sharp.versions.sharp is string | undefined, hence the fallback to previous method. This is mostly to satisfy typechecking as I did not manage to repro undefined case myself and sharp version was always set, but still probably good idea to have fallback even if I didn't manage to ever hit it myself

@@ -1,5 +1,7 @@
import { applyTrailingSlashOption } from "../../utils"
Copy link
Contributor Author

@pieh pieh Jun 20, 2025

Choose a reason for hiding this comment

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

Those changes in this test are not related to sharp changes.

I'm not exactly sure what changed that those tests started failing now, but without the changes we are now making header assertions on 301 redirects instead of 200 html responses. Those changes ensure we do direct visit to expected html route thus avoiding 301 redirect (that's redirect for trailing slash) that is messing our assertions

@@ -114,7 +119,9 @@ describe("Headers", () => {
})

it("should contain correct headers for index page", () => {
cy.visit("/").waitForRouteChange()
cy.visit(
applyTrailingSlashOption(Cypress.config().baseUrl, TRAILING_SLASH)
Copy link
Contributor Author

Choose a reason for hiding this comment

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

note, using baseUrl here to get full url, so that applyTrailingSlashOption can work correctly - otherwise it will always want to set / on "index" which would lead to redirect

@pieh pieh marked this pull request as ready for review June 20, 2025 14:05
@pieh pieh merged commit 1371440 into master Jun 20, 2025
38 checks passed
@pieh pieh deleted the fix/engines-ensure-vendored-libvips branch June 20, 2025 15:53
@github-project-automation github-project-automation bot moved this to To cherry-pick in V5 Release hotfixes Jun 20, 2025
pieh added a commit that referenced this pull request Jun 20, 2025
* fix: ensure rendering engine has vendored libvips

* chore: bump caniuse

* test: visit and intercept direct html routes and avoid hitting redirects which mess up html header assertions

(cherry picked from commit 1371440)
@pieh pieh moved this from To cherry-pick to Backport PR opened in V5 Release hotfixes Jun 20, 2025
pieh added a commit that referenced this pull request Jun 20, 2025
* fix: ensure rendering engine has vendored libvips

* chore: bump caniuse

* test: visit and intercept direct html routes and avoid hitting redirects which mess up html header assertions

(cherry picked from commit 1371440)

Co-authored-by: Michal Piechowiak <misiek.piechowiak@gmail.com>
@pieh pieh moved this from Backport PR opened to Backported in V5 Release hotfixes Jun 20, 2025
@pieh
Copy link
Contributor Author

pieh commented Jun 20, 2025

Successfully published:
 - gatsby@5.14.5
lerna success published 1 package

@pieh pieh moved this from Backported to Published in V5 Release hotfixes Jun 20, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
topic: media Related to gatsby-plugin-image, or general image/media processing topics topic: render-mode Related to Gatsby's different rendering modes
Projects
Status: Published
Development

Successfully merging this pull request may close these issues.

2 participants