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

feat: provide custom FILE_CDN url generator from adapter #38735

Merged
merged 11 commits into from Dec 6, 2023

Conversation

pieh
Copy link
Contributor

@pieh pieh commented Dec 4, 2023

Description

This is just very quick draft building on top of #38685 (a lot of similar code being replicated from IMAGE_CDN to FILE_CDN - needs more work, but at least let's try to see it in practice (completely untested even locally yet)

Documentation

Tests

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 Dec 4, 2023
@pieh pieh added topic: media Related to gatsby-plugin-image, or general image/media processing topics and removed status: triage needed Issue or pull request that need to be triaged and assigned to a reviewer labels Dec 4, 2023
@@ -455,6 +455,8 @@ jobs:

e2e_tests_adapters:
<<: *e2e-executor
docker:
- image: cypress/browsers:node-18.16.1-chrome-114.0.5735.133-1-ff-114.0.2-edge-114.0.1823.51-1
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Newer node than e2e default needed for latest netlify-cli. As gatsby itself has node 18.0.0 min, we should not bump it in other tests so default stayed as is

@pieh pieh marked this pull request as ready for review December 6, 2023 08:17
@pieh pieh merged commit d82f88f into alternate-image-url Dec 6, 2023
28 of 33 checks passed
@pieh pieh deleted the alternate-file-url branch December 6, 2023 08:36
pieh added a commit that referenced this pull request Dec 15, 2023
* alternate image url construction

* try using image cdn in e2e site

* Update netlify.toml

* have separate check for dispatching image and file service

* fix tests?

* try to use images from deploy (so we can avoid using ones hosted externally)

* replicate prod-runtime imagecdn tests in adapters

* fix import

* adjusting remote-file tests

* adjusting remote-file tests 2

* cleanup/test

* assert naturalWidth/height in image-cdn tests (both adapters and production-runtime)

* remove unused

* don't use path prefix for alternate image cdn url

* _gatsby/file is prefixed

* feat: move custom image cdn url generator implementation to adapter (#38715)

* feat: move custom image cdn url generator implementation to adapter

* provide public types for custom image cdn url generator function signature and individual arguments

* use position/cover

* update comment

* update docs

* chore: types/jsdocs shuffle

* apply suggestion from #38685

* remove docs from feature branch

* feat: provide custom FILE_CDN url generator from adapter (#38735)

* feat: provide file cdn from adapters

* update test

* fix tests

* use edge function for non-image File CDN

* why edge function was not deployed?

* bump netlify-cli

* ?

* bump node for adapters tests

* add execa to dev deps

* cleanup

* some jsdocs updates

* add note that generated urls ideally are relative, but can be absolute as well

* feat: allow adding remote file allowed url patterns (#38719)

* feat: move custom image cdn url generator implementation to adapter

* provide public types for custom image cdn url generator function signature and individual arguments

* feat: allow adding image cdn allowed url patterns

* Module.createRequireFromPath doesn't exist anymore in Node 18, and because package requires at least that version we remove it

* fix contentful source image url

* fix wordpress source image url

* rename ImageCdnAllowed to RemoteFileAllowed as it's not just for image cdn

* compare allowed remote urls in netlify.toml with ones generated by gatsby

* url testing in filecdn

* jsdocs

* print warnings for netlify.toml about missing remote_images patterns

* test if any existing pattern in netlify.toml allow needed remote url instead of just string comparison

* chore: update adapter README about imageCDN

* use correct remote_images for adapters e2e site

---------

Co-authored-by: Michal Piechowiak <misiek.piechowiak@gmail.com>
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
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant