Skip to content

Commit d2d5c9b

Browse files
authored
feat: add support for Netlify durable cache (#7)
* feat: add support for Netlify durable cache * Add changeset
1 parent 265c64f commit d2d5c9b

File tree

5 files changed

+26
-2
lines changed

5 files changed

+26
-2
lines changed

.changeset/README.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
# Changesets
2+
3+
Hello and welcome! This folder has been automatically generated by `@changesets/cli`, a build tool that works
4+
with multi-package repos, or single-package repos to help you version and publish your code. You can
5+
find the full documentation for it [in our repository](https://github.com/changesets/changesets)
6+
7+
We have a quick list of common questions to get you started engaging with this project in
8+
[our documentation](https://github.com/changesets/changesets/blob/main/docs/common-questions.md)

.changeset/config.json

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
{
2+
"$schema": "https://unpkg.com/@changesets/[email protected]/schema.json",
3+
"changelog": "@changesets/cli/changelog",
4+
"commit": false,
5+
"fixed": [],
6+
"linked": [],
7+
"access": "restricted",
8+
"baseBranch": "main",
9+
"updateInternalDependencies": "patch",
10+
"ignore": []
11+
}

.changeset/mighty-wombats-type.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"cdn-cache-control": minor
3+
---
4+
5+
Adds support for Netlify durable cache

netlify.test.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ describe("Netlify", () => {
1010
const headers = new CacheHeaders().swr();
1111
assert.strictEqual(
1212
headers.get("Netlify-CDN-Cache-Control"),
13-
"public,s-maxage=0,tiered,stale-while-revalidate=604800",
13+
"public,s-maxage=0,durable,stale-while-revalidate=604800",
1414
);
1515
});
1616

src/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ export const ONE_WEEK = 604800;
1616
export const ONE_YEAR = 31536000;
1717

1818
// The tiered directive is used by Netlify to indicate that it should use a tiered cache, with a central cache shared by all edge nodes.
19-
const tieredDirective = "tiered";
19+
const tieredDirective = "durable";
2020

2121
function detectCDN(): CDN | undefined {
2222
if (process.env.NETLIFY || process.env.NETLIFY_LOCAL) {

0 commit comments

Comments
 (0)