├── .eslintrc
├── .github
├── .kodiak.toml
├── CODEOWNERS
└── workflows
│ ├── ci.yml
│ ├── codeql-analysis.yml
│ ├── labeler.yml
│ └── release-please.yml
├── .gitignore
├── CHANGELOG.md
├── LICENSE
├── README.md
├── example
├── netlify
│ └── functions
│ │ ├── gatsby.ts
│ │ └── ipx.ts
└── public
│ ├── img
│ └── test.jpg
│ └── index.html
├── manifest.yml
├── netlify.toml
├── package.json
├── renovate.json
├── src
├── http.ts
├── index.ts
└── utils.ts
├── test
├── index.test.ts
└── utils.test.ts
├── tsconfig.json
└── yarn.lock
/.eslintrc:
--------------------------------------------------------------------------------
1 | {
2 | "extends": [
3 | "@nuxtjs/eslint-config-typescript"
4 | ],
5 | "ignorePatterns": "dist",
6 | "rules": {
7 | "import/named": "off",
8 | "vue/valid-attribute-name": "off"
9 | }
10 | }
11 |
--------------------------------------------------------------------------------
/.github/.kodiak.toml:
--------------------------------------------------------------------------------
1 | version = 1
2 |
3 | [merge.automerge_dependencies]
4 | versions = ["minor", "patch"]
5 | usernames = ["renovate"]
6 |
7 | [approve]
8 | auto_approve_usernames = ["renovate"]
--------------------------------------------------------------------------------
/.github/CODEOWNERS:
--------------------------------------------------------------------------------
1 | * @netlify/ecosystem-pod-frameworks
2 |
--------------------------------------------------------------------------------
/.github/workflows/ci.yml:
--------------------------------------------------------------------------------
1 | name: ci
2 |
3 | on:
4 | push:
5 | branches:
6 | - main
7 | pull_request:
8 | branches:
9 | - main
10 |
11 | jobs:
12 | ci:
13 | runs-on: ${{ matrix.os }}
14 |
15 | strategy:
16 | matrix:
17 | os: [ubuntu-latest]
18 | node: [18]
19 |
20 | steps:
21 | - uses: actions/setup-node@v3
22 | with:
23 | node-version: ${{ matrix.node }}
24 |
25 | - name: checkout
26 | uses: actions/checkout@master
27 |
28 | - name: cache node_modules
29 | uses: actions/cache@v3
30 | with:
31 | path: node_modules
32 | key: ${{ matrix.os }}-node-v${{ matrix.node }}-deps-${{ hashFiles(format('{0}{1}', github.workspace, '/yarn.lock')) }}
33 |
34 | - name: Install dependencies
35 | if: steps.cache.outputs.cache-hit != 'true'
36 | run: yarn
37 |
38 | - name: Lint
39 | run: yarn lint
40 |
41 | - name: Tests
42 | run: yarn test
43 |
44 | - name: Build
45 | run: yarn build
46 |
--------------------------------------------------------------------------------
/.github/workflows/codeql-analysis.yml:
--------------------------------------------------------------------------------
1 | # For most projects, this workflow file will not need changing; you simply need
2 | # to commit it to your repository.
3 | #
4 | # You may wish to alter this file to override the set of languages analyzed,
5 | # or to provide custom queries or build logic.
6 | #
7 | # ******** NOTE ********
8 | # We have attempted to detect the languages in your repository. Please check
9 | # the `language` matrix defined below to confirm you have the correct set of
10 | # supported CodeQL languages.
11 | #
12 | name: "CodeQL"
13 |
14 | on:
15 | push:
16 | branches: [ "main" ]
17 | pull_request:
18 | # The branches below must be a subset of the branches above
19 | branches: [ "main" ]
20 | schedule:
21 | - cron: '32 9 * * 3'
22 |
23 | jobs:
24 | analyze:
25 | name: Analyze
26 | runs-on: ubuntu-latest
27 | permissions:
28 | actions: read
29 | contents: read
30 | security-events: write
31 |
32 | strategy:
33 | fail-fast: false
34 | matrix:
35 | language: [ 'javascript' ]
36 | # CodeQL supports [ 'cpp', 'csharp', 'go', 'java', 'javascript', 'python', 'ruby' ]
37 | # Learn more about CodeQL language support at https://aka.ms/codeql-docs/language-support
38 |
39 | steps:
40 | - name: Checkout repository
41 | uses: actions/checkout@v4
42 |
43 | # Initializes the CodeQL tools for scanning.
44 | - name: Initialize CodeQL
45 | uses: github/codeql-action/init@v2
46 | with:
47 | languages: ${{ matrix.language }}
48 | # If you wish to specify custom queries, you can do so here or in a config file.
49 | # By default, queries listed here will override any specified in a config file.
50 | # Prefix the list here with "+" to use these queries and those in the config file.
51 |
52 | # Details on CodeQL's query packs refer to : https://docs.github.com/en/code-security/code-scanning/automatically-scanning-your-code-for-vulnerabilities-and-errors/configuring-code-scanning#using-queries-in-ql-packs
53 | # queries: security-extended,security-and-quality
54 |
55 |
56 | # Autobuild attempts to build any compiled languages (C/C++, C#, or Java).
57 | # If this step fails, then you should remove it and run the build manually (see below)
58 | - name: Autobuild
59 | uses: github/codeql-action/autobuild@v2
60 |
61 | # ℹ️ Command-line programs to run using the OS shell.
62 | # 📚 See https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_idstepsrun
63 |
64 | # If the Autobuild fails above, remove it and uncomment the following three lines.
65 | # modify them (or add more) to build your code if your project, please refer to the EXAMPLE below for guidance.
66 |
67 | # - run: |
68 | # echo "Run, Build Application using script"
69 | # ./location_of_script_within_repo/buildscript.sh
70 |
71 | - name: Perform CodeQL Analysis
72 | uses: github/codeql-action/analyze@v2
73 |
--------------------------------------------------------------------------------
/.github/workflows/labeler.yml:
--------------------------------------------------------------------------------
1 | name: Label PR
2 | on:
3 | pull_request:
4 | types: [opened, edited]
5 |
6 | jobs:
7 | label-pr:
8 | if: github.event_name == 'pull_request'
9 | runs-on: ubuntu-latest
10 | strategy:
11 | matrix:
12 | pr:
13 | [
14 | { prefix: 'fix', type: 'bug' },
15 | { prefix: 'chore', type: 'chore' },
16 | { prefix: 'docs', type: 'chore' },
17 | { prefix: 'test', type: 'chore' },
18 | { prefix: 'ci', type: 'chore' },
19 | { prefix: 'feat', type: 'feature' },
20 | { prefix: 'security', type: 'security' },
21 | ]
22 | steps:
23 | - uses: netlify/pr-labeler-action@v1.1.0
24 | if: startsWith(github.event.pull_request.title, matrix.pr.prefix)
25 | with:
26 | token: '${{ secrets.GITHUB_TOKEN }}'
27 | label: 'type: ${{ matrix.pr.type }}'
28 |
--------------------------------------------------------------------------------
/.github/workflows/release-please.yml:
--------------------------------------------------------------------------------
1 | name: release-please
2 | on:
3 | push:
4 | branches:
5 | - main
6 | jobs:
7 | release-please:
8 | runs-on: ubuntu-latest
9 | steps:
10 | - uses: navikt/github-app-token-generator@a3831f44404199df32d8f39f7c0ad9bb8fa18b1c
11 | id: get-token
12 | with:
13 | private-key: ${{ secrets.TOKENS_PRIVATE_KEY }}
14 | app-id: ${{ secrets.TOKENS_APP_ID }}
15 | - uses: GoogleCloudPlatform/release-please-action@v3
16 | id: release
17 | with:
18 | token: ${{ steps.get-token.outputs.token }}
19 | release-type: node
20 | package-name: '@netlify/ipx'
21 | - uses: actions/checkout@v4
22 | if: ${{ steps.release.outputs.release_created }}
23 | - uses: actions/setup-node@v3
24 | with:
25 | node-version: '*'
26 | cache: 'npm'
27 | check-latest: true
28 | registry-url: 'https://registry.npmjs.org'
29 | if: ${{ steps.release.outputs.release_created }}
30 | - name: Install dependencies
31 | run: yarn
32 | if: ${{ steps.release.outputs.release_created }}
33 | - run: npm publish
34 | if: ${{ steps.release.outputs.release_created }}
35 | env:
36 | NODE_AUTH_TOKEN: ${{secrets.NPM_TOKEN}}
37 |
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | node_modules
2 | *.log*
3 | dist
4 | .netlify
5 | .DS_Store
6 |
--------------------------------------------------------------------------------
/CHANGELOG.md:
--------------------------------------------------------------------------------
1 | # Changelog
2 |
3 | All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.
4 |
5 | ## [1.4.6](https://github.com/netlify/netlify-ipx/compare/v1.4.5...v1.4.6) (2023-11-14)
6 |
7 |
8 | ### Bug Fixes
9 |
10 | * **deps:** pin unstorage to 1.9.0 ([#225](https://github.com/netlify/netlify-ipx/issues/225)) ([a81e620](https://github.com/netlify/netlify-ipx/commit/a81e620f6bdd506d818f1a26758163ec3b25724d))
11 | * **deps:** update dependency @netlify/functions to ^2.2.0 ([#207](https://github.com/netlify/netlify-ipx/issues/207)) ([7ea37de](https://github.com/netlify/netlify-ipx/commit/7ea37de51fe63190b886e47b8a75c187cfbee0af))
12 | * **deps:** update dependency @netlify/functions to ^2.2.1 ([#209](https://github.com/netlify/netlify-ipx/issues/209)) ([f2d4630](https://github.com/netlify/netlify-ipx/commit/f2d46300355a2594329013aa4ece1616839e22d8))
13 | * **deps:** update dependency @netlify/functions to ^2.3.0 ([#211](https://github.com/netlify/netlify-ipx/issues/211)) ([b981dc8](https://github.com/netlify/netlify-ipx/commit/b981dc8093acbcb1e5bf51363e8d22b3d4ba818c))
14 | * **deps:** update dependency @netlify/functions to ^2.4.0 ([#222](https://github.com/netlify/netlify-ipx/issues/222)) ([e71a227](https://github.com/netlify/netlify-ipx/commit/e71a2278092c391618b1bf27c557b0975296ea31))
15 |
16 | ## [1.4.5](https://github.com/netlify/netlify-ipx/compare/v1.4.4...v1.4.5) (2023-10-02)
17 |
18 |
19 | ### Bug Fixes
20 |
21 | * **deps:** update dependency @netlify/functions to ^2.0.2 ([#189](https://github.com/netlify/netlify-ipx/issues/189)) ([1839eb1](https://github.com/netlify/netlify-ipx/commit/1839eb16d009bd7e2e1ca3274e01ed24f3809b4d))
22 | * **deps:** update dependency @netlify/functions to ^2.1.0 ([#204](https://github.com/netlify/netlify-ipx/issues/204)) ([90e707c](https://github.com/netlify/netlify-ipx/commit/90e707c02c36ada4a89effd46921a25bd63ed0c6))
23 | * **deps:** update dependency ipx to v1.3.0 ([#198](https://github.com/netlify/netlify-ipx/issues/198)) ([2191a92](https://github.com/netlify/netlify-ipx/commit/2191a922a0fc99f7dfa734643af2ca74220aeb13))
24 | * **deps:** update dependency node-fetch to v2.7.0 ([#194](https://github.com/netlify/netlify-ipx/issues/194)) ([a9e82dc](https://github.com/netlify/netlify-ipx/commit/a9e82dc772a95443124a723b68216e6ecb910b8a))
25 | * **deps:** update dependency ufo to v1.3.0 ([#195](https://github.com/netlify/netlify-ipx/issues/195)) ([13afa43](https://github.com/netlify/netlify-ipx/commit/13afa43a1a65e2c0a936f79eca9169f398f43048))
26 | * **deps:** update dependency ufo to v1.3.1 ([#205](https://github.com/netlify/netlify-ipx/issues/205)) ([3dec84e](https://github.com/netlify/netlify-ipx/commit/3dec84e35deebb925b2a84f682cd1030920238de))
27 | * update to `ipx@1.3.1` ([#206](https://github.com/netlify/netlify-ipx/issues/206)) ([fb85196](https://github.com/netlify/netlify-ipx/commit/fb851968efbae466bdc7c73528f973b6d5579615))
28 |
29 | ## [1.4.4](https://github.com/netlify/netlify-ipx/compare/v1.4.3...v1.4.4) (2023-08-22)
30 |
31 |
32 | ### Bug Fixes
33 |
34 | * **deps:** update dependency @netlify/functions to v2 ([#188](https://github.com/netlify/netlify-ipx/issues/188)) ([fbdab27](https://github.com/netlify/netlify-ipx/commit/fbdab275881e518d5390964518019d21d33644b0))
35 | * **deps:** update dependency node-fetch to v2.6.13 ([#187](https://github.com/netlify/netlify-ipx/issues/187)) ([9f6ad31](https://github.com/netlify/netlify-ipx/commit/9f6ad31b5864132dd522fb8600ba91dab1432a0f))
36 | * **deps:** update dependency unstorage to v1.9.0 ([#184](https://github.com/netlify/netlify-ipx/issues/184)) ([65e6b25](https://github.com/netlify/netlify-ipx/commit/65e6b251bb630ca16c3f48bca47e81c84b4f036c))
37 |
38 | ## [1.4.3](https://github.com/netlify/netlify-ipx/compare/v1.4.2...v1.4.3) (2023-08-10)
39 |
40 |
41 | ### Bug Fixes
42 |
43 | * casing now matches what comes in a Netlify function via event.headers ([#181](https://github.com/netlify/netlify-ipx/issues/181)) ([978f4c8](https://github.com/netlify/netlify-ipx/commit/978f4c868e06d8f4df1a1651ebecf1cffeeb4bba))
44 | * **deps:** update dependency mkdirp to v3 ([#162](https://github.com/netlify/netlify-ipx/issues/162)) ([d946c42](https://github.com/netlify/netlify-ipx/commit/d946c427f2f33aad52cfe956217831400ffc66db))
45 |
46 | ## [1.4.2](https://github.com/netlify/netlify-ipx/compare/v1.4.1...v1.4.2) (2023-08-03)
47 |
48 |
49 | ### Bug Fixes
50 |
51 | * **deps:** update dependency node-fetch to v2.6.12 ([#169](https://github.com/netlify/netlify-ipx/issues/169)) ([6f08164](https://github.com/netlify/netlify-ipx/commit/6f08164358177e6c7555da572bf1d19a1899299a))
52 | * **deps:** update dependency ufo to v1.2.0 ([#177](https://github.com/netlify/netlify-ipx/issues/177)) ([bee9ce2](https://github.com/netlify/netlify-ipx/commit/bee9ce28612be72da3c70ee997a6b0987cb23b51))
53 | * **deps:** update dependency unstorage to v1.7.0 ([#166](https://github.com/netlify/netlify-ipx/issues/166)) ([5133543](https://github.com/netlify/netlify-ipx/commit/51335433beb2a18e2cd4c3e6fdad564ec52c7318))
54 | * **deps:** update dependency unstorage to v1.8.0 ([#175](https://github.com/netlify/netlify-ipx/issues/175)) ([f4e9933](https://github.com/netlify/netlify-ipx/commit/f4e993381be4bae781f9e423abf3ebf5d5b22188))
55 | * now WAF bypass token header is forwarded ([#178](https://github.com/netlify/netlify-ipx/issues/178)) ([95645b8](https://github.com/netlify/netlify-ipx/commit/95645b826b28d28059ad4303ccb14f5e084e55ce))
56 |
57 | ## [1.4.1](https://github.com/netlify/netlify-ipx/compare/v1.4.0...v1.4.1) (2023-06-12)
58 |
59 |
60 | ### Bug Fixes
61 |
62 | * **deps:** update dependency @netlify/functions to ^1.5.0 ([#150](https://github.com/netlify/netlify-ipx/issues/150)) ([75960db](https://github.com/netlify/netlify-ipx/commit/75960db7d4beef420d8701b42aa0760fd085b77a))
63 | * **deps:** update dependency @netlify/functions to ^1.6.0 ([#151](https://github.com/netlify/netlify-ipx/issues/151)) ([00c4ed8](https://github.com/netlify/netlify-ipx/commit/00c4ed85fe4000a3fc854f5e4f81c6e89cac9bae))
64 | * **deps:** update dependency fs-extra to v11.1.1 ([#138](https://github.com/netlify/netlify-ipx/issues/138)) ([f26f91d](https://github.com/netlify/netlify-ipx/commit/f26f91df6c64a1345e75a9e0006b432cca56d3fa))
65 | * **deps:** update dependency ipx to v1 ([#146](https://github.com/netlify/netlify-ipx/issues/146)) ([bc2979f](https://github.com/netlify/netlify-ipx/commit/bc2979f647e88284d23a4e5d38a49c7ec65c4d6b))
66 | * **deps:** update dependency ipx to v1.1.0 ([#153](https://github.com/netlify/netlify-ipx/issues/153)) ([9e01e1d](https://github.com/netlify/netlify-ipx/commit/9e01e1d7f6bf01edd51cfa37f26d594e8559b70a))
67 | * **deps:** update dependency ipx to v1.2.0 ([#163](https://github.com/netlify/netlify-ipx/issues/163)) ([f0447a1](https://github.com/netlify/netlify-ipx/commit/f0447a17def8734b8f817c253cb2e8fecd7b61da))
68 | * **deps:** update dependency node-fetch to v2.6.11 ([#152](https://github.com/netlify/netlify-ipx/issues/152)) ([2ba8693](https://github.com/netlify/netlify-ipx/commit/2ba86933eae06dd4324df6aafd4fe847b7875258))
69 | * **deps:** update dependency ufo to v1.1.2 ([#148](https://github.com/netlify/netlify-ipx/issues/148)) ([3b557bc](https://github.com/netlify/netlify-ipx/commit/3b557bc7dcdfd9f19a8811edbfd7e4b42fbd5aa5))
70 | * **deps:** update dependency unstorage to v1.5.0 ([#141](https://github.com/netlify/netlify-ipx/issues/141)) ([462bf62](https://github.com/netlify/netlify-ipx/commit/462bf6281035ef5007eb29c3f48ef3480bc5bbc7))
71 | * **deps:** update dependency unstorage to v1.6.1 ([#159](https://github.com/netlify/netlify-ipx/issues/159)) ([ead2da5](https://github.com/netlify/netlify-ipx/commit/ead2da58d7fa5f79f7bc8f9ec618e614d66538f0))
72 |
73 | ## [1.4.0](https://github.com/netlify/netlify-ipx/compare/v1.3.3...v1.4.0) (2023-04-06)
74 |
75 |
76 | ### Features
77 |
78 | * add pruning mechanism for source images cache ([#136](https://github.com/netlify/netlify-ipx/issues/136)) ([d7b7424](https://github.com/netlify/netlify-ipx/commit/d7b74247640c057f0432d6ea39f4137abb506578))
79 |
80 |
81 | ### Bug Fixes
82 |
83 | * **deps:** update dependency node-fetch to v2.6.8 ([#112](https://github.com/netlify/netlify-ipx/issues/112)) ([0ec330d](https://github.com/netlify/netlify-ipx/commit/0ec330daeb5c802e825277c879ffb106ee9b9a8a))
84 | * **deps:** update dependency node-fetch to v2.6.9 ([#115](https://github.com/netlify/netlify-ipx/issues/115)) ([3af6712](https://github.com/netlify/netlify-ipx/commit/3af671223fa9303548528a7cb2f5a8806d1b0f7f))
85 | * **deps:** update dependency ufo to v1.1.1 ([#127](https://github.com/netlify/netlify-ipx/issues/127)) ([118bd63](https://github.com/netlify/netlify-ipx/commit/118bd630502f21415ff658addc0e3b7262a874ab))
86 | * **deps:** update dependency unstorage to v1.1.4 ([#119](https://github.com/netlify/netlify-ipx/issues/119)) ([f288273](https://github.com/netlify/netlify-ipx/commit/f288273a2bbd6899d008fe5c18d55d228be858f4))
87 | * **deps:** update dependency unstorage to v1.1.5 ([#121](https://github.com/netlify/netlify-ipx/issues/121)) ([b535f28](https://github.com/netlify/netlify-ipx/commit/b535f28d79416fc5cef7c03537b4137a77d39765))
88 | * **deps:** update dependency unstorage to v1.4.1 ([#133](https://github.com/netlify/netlify-ipx/issues/133)) ([83922e1](https://github.com/netlify/netlify-ipx/commit/83922e1ca5ddaab6f3d256416b23d334fb1d176a))
89 |
90 | ## [1.3.3](https://github.com/netlify/netlify-ipx/compare/v1.3.2...v1.3.3) (2023-01-05)
91 |
92 |
93 | ### Bug Fixes
94 |
95 | * **deps:** update dependency @netlify/functions to ^1.4.0 ([#107](https://github.com/netlify/netlify-ipx/issues/107)) ([1a2009b](https://github.com/netlify/netlify-ipx/commit/1a2009bbd33be34970580f4959242b58aebf2c01))
96 | * **deps:** update dependency fs-extra to v11 ([#102](https://github.com/netlify/netlify-ipx/issues/102)) ([36326cf](https://github.com/netlify/netlify-ipx/commit/36326cf4f8c5f4c1cb4a47701f6adb60af12978d))
97 | * **deps:** update dependency unstorage to v1 ([#105](https://github.com/netlify/netlify-ipx/issues/105)) ([752c47c](https://github.com/netlify/netlify-ipx/commit/752c47cb2b48752ff9eb61b7034f3863e1eac0cb))
98 | * remove quotes from etag ([#103](https://github.com/netlify/netlify-ipx/issues/103)) ([e4101c0](https://github.com/netlify/netlify-ipx/commit/e4101c01f5582543f7fe3b68f336f112bca7fe04))
99 |
100 | ## [1.3.2](https://github.com/netlify/netlify-ipx/compare/v1.3.1...v1.3.2) (2022-12-05)
101 |
102 |
103 | ### Bug Fixes
104 |
105 | * add correct ava + typescript setup ([#96](https://github.com/netlify/netlify-ipx/issues/96)) ([910d8ad](https://github.com/netlify/netlify-ipx/commit/910d8ad8448d6feb9d493b3d827528285921b514))
106 | * add correct ava + typescript setup to enable tests to execute correctly ([910d8ad](https://github.com/netlify/netlify-ipx/commit/910d8ad8448d6feb9d493b3d827528285921b514))
107 | * **deps:** update dependency ufo to v1 ([#95](https://github.com/netlify/netlify-ipx/issues/95)) ([8fcb745](https://github.com/netlify/netlify-ipx/commit/8fcb7457a34b45b67fecde2ab73da8f8e843f090))
108 |
109 | ## [1.3.1](https://github.com/netlify/netlify-ipx/compare/v1.3.0...v1.3.1) (2022-10-17)
110 |
111 |
112 | ### Bug Fixes
113 |
114 | * **deps:** update dependency ufo to v0.8.6 ([#86](https://github.com/netlify/netlify-ipx/issues/86)) ([a0c7526](https://github.com/netlify/netlify-ipx/commit/a0c7526c7d6cc84fb2d45ad619b8b91de6c3377b))
115 | * **deps:** update dependency unstorage to ^0.6.0 ([#87](https://github.com/netlify/netlify-ipx/issues/87)) ([3d3b2e7](https://github.com/netlify/netlify-ipx/commit/3d3b2e730ba2471c3bae1e2ac71c70e86ac5f011))
116 |
117 | ## [1.3.0](https://github.com/netlify/netlify-ipx/compare/v1.2.5...v1.3.0) (2022-10-05)
118 |
119 |
120 | ### Features
121 |
122 | * add prefix filtering and loop detection for local images ([#83](https://github.com/netlify/netlify-ipx/issues/83)) ([f44db69](https://github.com/netlify/netlify-ipx/commit/f44db693f8bc3e4566c69204d74bb89ce5895c66))
123 |
124 |
125 | ### Bug Fixes
126 |
127 | * **deps:** update dependency @netlify/functions to ^1.3.0 ([#82](https://github.com/netlify/netlify-ipx/issues/82)) ([081a8d3](https://github.com/netlify/netlify-ipx/commit/081a8d3ff8cfb9f8c2a8bd43b704ecb87b5b4284))
128 |
129 | ## [1.2.5](https://github.com/netlify/netlify-ipx/compare/v1.2.4...v1.2.5) (2022-09-09)
130 |
131 |
132 | ### Bug Fixes
133 |
134 | * **deps:** upgrade ipx ([#71](https://github.com/netlify/netlify-ipx/issues/71)) ([da4fc2e](https://github.com/netlify/netlify-ipx/commit/da4fc2ed0bba8f4dd62a12371e973527fee86c78))
135 |
136 | ## [1.2.4](https://github.com/netlify/netlify-ipx/compare/v1.2.3...v1.2.4) (2022-09-05)
137 |
138 |
139 | ### Bug Fixes
140 |
141 | * **deps:** update dependency ipx to v0.9.11 ([#68](https://github.com/netlify/netlify-ipx/issues/68)) ([b7551c2](https://github.com/netlify/netlify-ipx/commit/b7551c2abcd1b1c1040cd53824509095eba0b433))
142 |
143 | ## [1.2.3](https://github.com/netlify/netlify-ipx/compare/v1.2.2...v1.2.3) (2022-08-24)
144 |
145 |
146 | ### Bug Fixes
147 |
148 | * x-forwarded-proto is sanitized now ([#61](https://github.com/netlify/netlify-ipx/issues/61)) ([dfa7505](https://github.com/netlify/netlify-ipx/commit/dfa7505a8d47a76fd527570dc40737a61500759b))
149 |
150 | ## [1.2.2](https://github.com/netlify/netlify-ipx/compare/v1.2.1...v1.2.2) (2022-08-16)
151 |
152 |
153 | ### Bug Fixes
154 |
155 | * **deps:** update dependency @netlify/functions to ^1.2.0 ([#57](https://github.com/netlify/netlify-ipx/issues/57)) ([a2223db](https://github.com/netlify/netlify-ipx/commit/a2223dbbce7edff61b507ea917e3d120ff60accf))
156 |
157 | ## [1.2.1](https://github.com/netlify/netlify-ipx/compare/v1.2.0...v1.2.1) (2022-08-15)
158 |
159 |
160 | ### Bug Fixes
161 |
162 | * **deps:** update dependency @netlify/functions to ^1.1.0 ([#54](https://github.com/netlify/netlify-ipx/issues/54)) ([1e7cbfa](https://github.com/netlify/netlify-ipx/commit/1e7cbfa67e340f6ae954da319181ec9189367cee))
163 |
164 | ## [1.2.0](https://github.com/netlify/netlify-ipx/compare/v1.1.4...v1.2.0) (2022-08-10)
165 |
166 |
167 | ### Features
168 |
169 | * support custom response headers ([#51](https://github.com/netlify/netlify-ipx/issues/51)) ([857eb75](https://github.com/netlify/netlify-ipx/commit/857eb7549a75531d64a55d7d3981e470cbd64002))
170 |
171 |
172 | ### Bug Fixes
173 |
174 | * remove tarball that was accidentally merged in ([#53](https://github.com/netlify/netlify-ipx/issues/53)) ([0281ea3](https://github.com/netlify/netlify-ipx/commit/0281ea3138150d5bca37d8c02fd4dd3252e2ea39))
175 |
176 | ## [1.1.4](https://github.com/netlify/netlify-ipx/compare/v1.1.3...v1.1.4) (2022-08-08)
177 |
178 |
179 | ### Bug Fixes
180 |
181 | * **deps:** update dependency ipx to v0.9.10 ([#46](https://github.com/netlify/netlify-ipx/issues/46)) ([8059ab9](https://github.com/netlify/netlify-ipx/commit/8059ab97b8ab9ac6be33652406d519e59967fa04))
182 | * **deps:** update dependency ufo to v0.8.5 ([#47](https://github.com/netlify/netlify-ipx/issues/47)) ([9ba5bbd](https://github.com/netlify/netlify-ipx/commit/9ba5bbd669e7ad3a0b29613088c7c0b8729013de))
183 |
184 | ## [1.1.3](https://github.com/netlify/netlify-ipx/compare/v1.1.2...v1.1.3) (2022-06-30)
185 |
186 |
187 | ### Bug Fixes
188 |
189 | * remote patterns logic ([#42](https://github.com/netlify/netlify-ipx/issues/42)) ([4e775ae](https://github.com/netlify/netlify-ipx/commit/4e775ae3f6a505075bc5293cb880b8fb1b6b7f71))
190 |
191 | ### [1.1.2](https://www.github.com/netlify/netlify-ipx/compare/v1.1.1...v1.1.2) (2022-06-23)
192 |
193 |
194 | ### Bug Fixes
195 |
196 | * **deps:** update dependency ipx to v0.9.9 ([#34](https://www.github.com/netlify/netlify-ipx/issues/34)) ([561bf3d](https://www.github.com/netlify/netlify-ipx/commit/561bf3d18361d42026bec17e68685180364e6e58))
197 | * **deps:** update dependency unstorage to v0.5.1 ([#35](https://www.github.com/netlify/netlify-ipx/issues/35)) ([290570f](https://www.github.com/netlify/netlify-ipx/commit/290570f19c20c5d215561753ce7a78481f14b09f))
198 | * revert upgrade of unstorage ([#38](https://www.github.com/netlify/netlify-ipx/issues/38)) ([bb4479b](https://www.github.com/netlify/netlify-ipx/commit/bb4479b5c7f19f03f32c07a5d6c16a6af4d5f3ab))
199 |
200 | ### [1.1.1](https://www.github.com/netlify/netlify-ipx/compare/v1.1.0...v1.1.1) (2022-06-22)
201 |
202 |
203 | ### Bug Fixes
204 |
205 | * **deps:** update dependency fs-extra to v10.1.0 ([#27](https://www.github.com/netlify/netlify-ipx/issues/27)) ([6230efb](https://www.github.com/netlify/netlify-ipx/commit/6230efb3c0fa8c9fb0a8713b13ab27e47fa898d1))
206 | * **deps:** update dependency ipx to v0.9.6 ([#18](https://www.github.com/netlify/netlify-ipx/issues/18)) ([0e20145](https://www.github.com/netlify/netlify-ipx/commit/0e20145ab0fd14d4a5468755792a03db08f0bddd))
207 | * **deps:** update dependency murmurhash to v2.0.1 ([#19](https://www.github.com/netlify/netlify-ipx/issues/19)) ([ddbe8bf](https://www.github.com/netlify/netlify-ipx/commit/ddbe8bf3ba9085dfaa1703f1470b0e173da8ed19))
208 | * **deps:** update dependency ufo to ^0.8.0 ([#21](https://www.github.com/netlify/netlify-ipx/issues/21)) ([cbdbb69](https://www.github.com/netlify/netlify-ipx/commit/cbdbb6958838200b2ab64913c24ebb55ca476354))
209 | * **deps:** update dependency unstorage to ^0.5.0 ([#24](https://www.github.com/netlify/netlify-ipx/issues/24)) ([d32cc1f](https://www.github.com/netlify/netlify-ipx/commit/d32cc1f71ef29ec74e8e437f58ded1debb7e2759))
210 | * remove content-type check ([#16](https://www.github.com/netlify/netlify-ipx/issues/16)) ([604a3d2](https://www.github.com/netlify/netlify-ipx/commit/604a3d240ce6c680c45bc609cb1fc5629b679790))
211 |
212 | ## [1.1.0](https://github.com/netlify/netlify-ipx/compare/v1.0.1...v1.1.0) (2022-06-09)
213 |
214 |
215 | ### Features
216 |
217 | * add support for NextJS remotePatterns ([#11](https://github.com/netlify/netlify-ipx/issues/11)) ([06ffaf9](https://github.com/netlify/netlify-ipx/commit/06ffaf94481c603578d9150108bd492c296f35df))
218 |
219 | ### [1.0.1](https://github.com/netlify/netlify-ipx/compare/v1.0.0...v1.0.1) (2022-03-10)
220 |
221 |
222 | ### Bug Fixes
223 |
224 | * handle empty content-type header ([#9](https://github.com/netlify/netlify-ipx/issues/9)) ([2650b33](https://github.com/netlify/netlify-ipx/commit/2650b334dfb4c971f41b2bd77f653554528eca35))
225 |
226 | ## [1.0.0](https://github.com/netlify/netlify-ipx/compare/v0.0.10...v1.0.0) (2022-03-01)
227 |
228 |
229 | ### Features
230 |
231 | * add support for quality and position args ([#7](https://github.com/netlify/netlify-ipx/issues/7)) ([1f65eb7](https://github.com/netlify/netlify-ipx/commit/1f65eb77180f520380c298a0c3f3e408a3f64c1e))
232 |
233 |
234 | ### Bug Fixes
235 |
236 | * support bypassing domain check ([#8](https://github.com/netlify/netlify-ipx/issues/8)) ([94caa15](https://github.com/netlify/netlify-ipx/commit/94caa15762c565dd3702aac1fd34a7781cdf13dc))
237 |
238 | ### [0.0.10](https://github.com/netlify/netlify-ipx/compare/v0.0.9...v0.0.10) (2022-02-22)
239 |
240 |
241 | ### Features
242 |
243 | * add support for base64 props ([#6](https://github.com/netlify/netlify-ipx/issues/6)) ([eca4c08](https://github.com/netlify/netlify-ipx/commit/eca4c08a00ea653a7cc81fe7c92ea1ced315bc82))
244 |
245 | ### [0.0.9](https://github.com/netlify/netlify-ipx/compare/v0.0.7...v0.0.9) (2022-01-31)
246 |
247 |
248 | ### Bug Fixes
249 |
250 | * improve conditional responses ([d9c6850](https://github.com/netlify/netlify-ipx/commit/d9c68501aa8366a6eb7a608599cf38a0f9885c45))
251 |
252 | ### [0.0.7](https://github.com/netlify/netlify-ipx/compare/v0.0.6...v0.0.7) (2021-10-05)
253 |
254 |
255 | ### Bug Fixes
256 |
257 | * correct auth logic ([7097932](https://github.com/netlify/netlify-ipx/commit/709793219dba6bff8a3bcfccb65420abd3c7982f))
258 | * demo ([a73dee0](https://github.com/netlify/netlify-ipx/commit/a73dee0d35bd3cc2efeacbbf6ec66664c2a73933))
259 | * set content-type for errors ([bb374aa](https://github.com/netlify/netlify-ipx/commit/bb374aac5b296303ecde76498b37306e332ec54e))
260 |
261 | ### [0.0.6](https://github.com/netlify/netlify-ipx/compare/v0.0.5...v0.0.6) (2021-10-05)
262 |
263 |
264 | ### Features
265 |
266 | * pass auth headers to local requests ([7fa6709](https://github.com/netlify/netlify-ipx/commit/7fa6709c8b81fc553de9f0fafef6df60c2b35107))
267 |
268 | ### [0.0.5](https://github.com/netlify/netlify-ipx/compare/v0.0.4...v0.0.5) (2021-09-25)
269 |
270 | ### [0.0.4](https://github.com/netlify/netlify-ipx/compare/v0.0.3...v0.0.4) (2021-09-24)
271 |
272 |
273 | ### Bug Fixes
274 |
275 | * decode uri ([008de0f](https://github.com/netlify/netlify-ipx/commit/008de0f9584c11f97934c1be61bf072e3d386d72))
276 |
277 | ### [0.0.3](https://github.com/netlify/netlify-ipx/compare/v0.0.2...v0.0.3) (2021-09-24)
278 |
279 |
280 | ### Bug Fixes
281 |
282 | * downgrade node fetch and allow manual base path ([19bdad8](https://github.com/netlify/netlify-ipx/commit/19bdad8e8088811111c9b415c67272e69799e384))
283 |
284 | ### 0.0.2 (2021-09-24)
285 |
286 |
287 | ### Features
288 |
289 | * convert from plugin to library ([d77f606](https://github.com/netlify/netlify-ipx/commit/d77f6063fd7618148a913490c312c19140b4383a))
290 |
291 | ### [0.0.1](https://github.com/nuxt-contrib/netlify-ipx/compare/v0.0.0...v0.0.1) (2021-07-01)
292 |
293 | ## 0.0.0 (2021-07-01)
294 |
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 | MIT License
2 |
3 | Copyright (c) 2020
4 |
5 | Permission is hereby granted, free of charge, to any person obtaining a copy
6 | of this software and associated documentation files (the "Software"), to deal
7 | in the Software without restriction, including without limitation the rights
8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 | copies of the Software, and to permit persons to whom the Software is
10 | furnished to do so, subject to the following conditions:
11 |
12 | The above copyright notice and this permission notice shall be included in all
13 | copies or substantial portions of the Software.
14 |
15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21 | SOFTWARE.
22 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # Netlify Optimized Images
2 |
3 | > On Demand image optimization for Netlify using [ipx](https://github.com/unjs/ipx).
4 |
5 | 😺 Online demo: https://netlify-ipx.netlify.app
6 |
7 | ## Usage
8 |
9 | Add `@netlify/ipx` as `devDependency`:
10 |
11 | ```sh
12 | # npm
13 | npm i -D @netlify/ipx
14 |
15 | # yarn
16 | yarn add --dev @netlify/ipx
17 | ```
18 |
19 | Create `netlify/functions/ipx.ts`:
20 |
21 | ```ts
22 | import { createIPXHandler } from "@netlify/ipx";
23 |
24 | export const handler = createIPXHandler({
25 | domains: ["images.unsplash.com"],
26 | });
27 | ```
28 |
29 | Now you can use IPX to optimize both local and remote assets ✨
30 |
31 | Resize `/test.jpg` (in `dist`):
32 |
33 | ```html
34 |
35 | ```
36 |
37 | Resize and change format for a remote url:
38 |
39 | ```html
40 |
43 | ```
44 |
45 | ## Remote Patterns
46 |
47 | Instead of setting an allowlist on `domains`, you may wish to use the option `remotePatterns`. This method allows wildcards in `hostname` and `pathname` segments.
48 |
49 | `remotePatterns` is an array that contains RemotePattern objects:
50 |
51 | ```ts
52 | remotePatterns: [
53 | {
54 | protocol: 'https' // or 'http' - not required
55 | hostname: 'example.com' // required
56 | port: '3000' // not required
57 | pathname: '/blog/**' // not required
58 | }
59 | ]
60 | ```
61 |
62 | To use remote patterns, create `netlify/functions/ipx.ts`:
63 |
64 | ```ts
65 | import { createIPXHandler } from "@netlify/ipx";
66 |
67 | export const handler = createIPXHandler({
68 | remotePatterns: [
69 | {
70 | protocol: "https",
71 | hostname: "images.unsplash.com",
72 | },
73 | ],
74 | });
75 | ```
76 |
77 | `hostname` and `pathname` may contain wildcards:
78 |
79 | ```ts
80 | remotePatterns: [
81 | {
82 | hostname: '*.example.com' // * = match a single path segment or subdomain
83 | pathname: '/blog/**' // ** = match any number of path segments or subdomains
84 | }
85 | ]
86 | ```
87 |
88 | ## Local development
89 |
90 | - Clone repository
91 | - Install dependencies with `yarn install`
92 | - Build the project with `yarn build`
93 | - Run netlify development server with `yarn dev`.
94 | - Open http://localhost:8888
95 |
96 | ## License
97 |
98 | MIT
99 |
--------------------------------------------------------------------------------
/example/netlify/functions/gatsby.ts:
--------------------------------------------------------------------------------
1 | import { createIPXHandler } from '@netlify/ipx'
2 |
3 | export const handler = createIPXHandler({
4 | domains: ['images.unsplash.com'],
5 | propsEncoding: 'base64',
6 | basePath: '/_gatsby/image/'
7 | })
8 |
--------------------------------------------------------------------------------
/example/netlify/functions/ipx.ts:
--------------------------------------------------------------------------------
1 | import { createIPXHandler } from '@netlify/ipx'
2 |
3 | export const handler = createIPXHandler({
4 | remotePatterns: [
5 | {
6 | protocol: 'https',
7 | hostname: '*.unsplash.com'
8 | }
9 | ],
10 | domains: [
11 | 'www.netlify.com'
12 | ],
13 | localPrefix: '/img/',
14 | basePath: '/.netlify/builders/ipx/',
15 | responseHeaders: {
16 | 'Strict-Transport-Security': 'max-age=31536000',
17 | 'X-Test': 'foobar'
18 | }
19 | })
20 |
--------------------------------------------------------------------------------
/example/public/img/test.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/netlify/netlify-ipx/63c7c8d7529ab271de9b12b9f969b6702f7bb6d9/example/public/img/test.jpg
--------------------------------------------------------------------------------
/example/public/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |