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: allow adding remote file allowed url patterns #38719

Merged
merged 14 commits into from
Dec 11, 2023

Conversation

pieh
Copy link
Contributor

@pieh pieh commented Nov 30, 2023

Description

This builds on top of #38685 (tho not directly related and can be handled separately, but it is part of same problem space).

It adds a way for users and source plugins to define allowed external urls that are used for image source for Image CDN transformations and pass that information down to adapter to be able to configure platform specific image cdn (in case a platform need that information)

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 Nov 30, 2023
Base automatically changed from adapters-image-cdn to alternate-image-url November 30, 2023 14:45
@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 1, 2023
@pieh pieh changed the title feat: allow adding image cdn allowed url patterns feat: allow adding remote file allowed url patterns Dec 6, 2023
@pieh pieh marked this pull request as ready for review December 11, 2023 08:39
@pieh pieh merged commit 7de5336 into alternate-image-url Dec 11, 2023
33 checks passed
@pieh pieh deleted the image-cdn-allowed-urls branch December 11, 2023 08:40
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 https://github.com/gatsbyjs/gatsby/pull/38685\#discussion_r1414135797

* 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.

1 participant