UNPKG

11.3 kBMarkdownView Raw
1# Changelog
2
3## 0.0.12
4
5- ### Features
6
7 - **Add defaultMimeType option to getAssetFromKV - [mgrahamjo], [pull/121]**
8
9 Some static website owners prefer not to create all of their web routes as directories containing index.html files. Instead, they prefer to create pages as extensionless HTML files. Providing a defaultMimeType option will allow users to set the Content-Type header for extensionless files to text/html, which will enable this use case.
10
11 [mgrahamjo]: https://github.com/mgrahamjo
12 [pull/121]: https://github.com/cloudflare/kv-asset-handler/pull/121
13
14 - **Add defaultMimeType to types - [shagamemnon], [pull/132]**
15
16 Adds the newly added defaultMimeType to the exported types for this package.
17
18 [pull/132]: https://github.com/cloudflare/kv-asset-handler/pull/132
19
20- ### Fixes
21
22 - **Fix text/* charset - [EatonZ], [pull/130]**
23
24 Adds a missing `-` to the `utf-8` charset value in response mime types.
25
26 [EatonZ]: https://github.com/EatonZ
27 [pull/130]: https://github.com/cloudflare/kv-asset-handler/pull/130
28
29 - **Cache handling for HEAD requests - [klittlepage], [pull/141]**
30
31 This PR skips caching for incoming HEAD requests, as they should not be able to be edge cached.
32
33 [klittlepage]: https://github.com/klittlepage
34 [pull/141]: https://github.com/cloudflare/kv-asset-handler/pull/141
35
36- ### Maintenance
37
38 - **Markdown linting/typos - [jbampton], [pull/123], [pull/125], [pull/126], [pull/127], [pull/128], [pull/129], [pull/131], [pull/134]**
39
40 These PRs contain various typo fixes and linting of existing Markdown files in our documentation and CHANGELOG.
41
42 [jbampton]: https://github.com/jbampton
43 [pull/123]: https://github.com/cloudflare/kv-asset-handler/pull/123
44 [pull/125]: https://github.com/cloudflare/kv-asset-handler/pull/125
45 [pull/126]: https://github.com/cloudflare/kv-asset-handler/pull/126
46 [pull/127]: https://github.com/cloudflare/kv-asset-handler/pull/127
47 [pull/128]: https://github.com/cloudflare/kv-asset-handler/pull/128
48 [pull/129]: https://github.com/cloudflare/kv-asset-handler/pull/129
49 [pull/131]: https://github.com/cloudflare/kv-asset-handler/pull/131
50 [pull/134]: https://github.com/cloudflare/kv-asset-handler/pull/134
51
52## 0.0.11
53
54- ### Features
55
56 - **Support cache revalidation using ETags and If-None-Match - [shagamemnon], [issue/62] [pull/94] [pull/113]**
57
58 Previously, cacheable resources were not looked up from the browser cache because `getAssetFromKV` would never return a `304 Not Modified` response.
59
60 Now, `getAssetFromKV` sets an `ETag` header on all cacheable assets before putting them in the Cache API, and therefore will return a `304` response when appropriate.
61
62 [shagamemnon]: https://github.com/shagamemnon
63 [pull/94]: https://github.com/cloudflare/kv-asset-handler/pull/94
64 [pull/113]: https://github.com/cloudflare/kv-asset-handler/issues/113
65 [issue/62]: https://github.com/cloudflare/kv-asset-handler/issues/62
66
67 - **Export TypeScript types - [ispivey], [issue/43] [pull/106]**
68
69 [ispivey]: https://github.com/ispivey
70 [pull/106]: https://github.com/cloudflare/kv-asset-handler/pull/106
71 [issue/43]: https://github.com/cloudflare/kv-asset-handler/issues/43
72
73- ### Fixes
74
75 - **Support non-ASCII characters in paths - [SukkaW], [issue/99] [pull/105]**
76
77 Fixes an issue where non-ASCII paths were not URI-decoded before being looked up, causing non-ASCII paths to 404.
78
79 [SukkaW]: https://github.com/SukkaW
80 [pull/105]: https://github.com/cloudflare/kv-asset-handler/pull/105
81 [issue/99]: https://github.com/cloudflare/kv-asset-handler/issues/99
82
83 - **Support `charset=utf8` in MIME type - [theromis], [issue/92] [pull/97]**
84
85 Fixes an issue where `Content-Type: text/*` was never appended with `; charset=utf8`, meaning clients would not render non-ASCII characters properly.
86
87 [theromis]: https://github.com/theromis
88 [pull/97]: https://github.com/cloudflare/kv-asset-handler/pull/97
89 [issue/92]: https://github.com/cloudflare/kv-asset-handler/issues/92
90
91 - **Fix bugs in README examples - [kentonv] [bradyjoslin], [issue/93] [pull/102] [issue/88] [pull/116]**
92
93 [kentonv]: https://github.com/kentonv
94 [bradyjoslin]: https://github.com/bradyjoslin
95 [pull/102]: https://github.com/cloudflare/kv-asset-handler/pull/102
96 [pull/116]: https://github.com/cloudflare/kv-asset-handler/pull/116
97 [issue/93]: https://github.com/cloudflare/kv-asset-handler/issues/93
98 [issue/88]: https://github.com/cloudflare/kv-asset-handler/issues/88
99
100- ### Maintenance
101
102 - **Make `@cloudflare/workers-types` a dependency and update deps - [ispivey], [pull/107]**
103
104 [ispivey]: https://github.com/ispivey
105 [pull/107]: https://github.com/cloudflare/kv-asset-handler/pull/107
106
107 - **Add Code of Conduct - [EverlastingBugstopper], [pull/101]**
108
109 [EverlastingBugstopper]: https://github.com/EverlastingBugstopper
110 [pull/101]: https://github.com/cloudflare/kv-asset-handler/pull/101
111
112## 0.0.10
113
114- ### Features
115
116 - **Allow extensionless files to be served - [victoriabernard92], [cloudflare/wrangler/issues/980], [pull/73]**
117
118 Prior to this PR, `getAssetFromKv` assumed extensionless requests (e.g. `/some-path`) would be set up to be served as the corresponding HTML file in storage (e.g. `some-path.html`).
119 This fix checks the `ASSET_MANIFEST` for the extensionless file name _before_ appending the HTML extension. If the extensionless file exists (e.g. `some-path` exists as a key in the ASSET_MANIFEST) then we serve that file first. If the extensionless file does not exist, then the behavior does not change (e.g. it still looks for `some-path.html`).
120
121 [victoriabernard92]: https://github.com/victoriabernard92
122 [cloudflare/wrangler/issues/980]: https://github.com/cloudflare/wrangler/issues/980
123 [pull/73]: https://github.com/cloudflare/kv-asset-handler/pull/73
124
125- ### Fixes
126
127 - **Fix URL parsing in serveSinglePageApp - [signalnerve],[sgiacosa], [issue/72], [pull/82]**
128
129 This fixes an issue in `serveSinglePageApp` where the request.url is used as a string to retrieve static content. For example,
130 if a query parameter was set, the URL lookup would break. This fix uses a parsed URL instead of the string and adjusts the README.
131
132 [signalnerve]: https://github.com/signalnerve
133 [sgiacosa]: https://github.com/sgiacosa
134 [issue/72]: https://github.com/cloudflare/kv-asset-handler/issue/72
135 [pull/82]: https://github.com/cloudflare/kv-asset-handler/pull/82
136
137## 0.0.9
138
139- ### Fixes
140
141 - **Building and publishing to npm - [victoriabernard92], [pull/78], [pull/79]**
142
143 Added a `prepack` step that builds JavaScript files from the TypeScript source. This fixes previously broken `npm` publishes.
144
145 [victoriabernard92]: https://github.com/victoriabernard92
146 [issue/78]: https://github.com/cloudflare/kv-asset-handler/issue/78
147 [pull/79]: https://github.com/cloudflare/kv-asset-handler/pull/79
148
149## 0.0.8
150
151- ### Features
152
153 - **Support a variety of errors thrown from `getAssetFromKV` - [victoriabernard92], [issue/59] [pull/64]**
154
155 Previously, `getAssetFromKv` would throw the same error type if anything went wrong. Now it will throw different error types so that clients can catch and differentiate them.
156 For example, a 404 `NotFoundError` error implies nothing went wrong, the asset just didn't exist while
157 a 500 `InternalError` means an expected variable was undefined.
158
159 [victoriabernard92]: https://github.com/victoriabernard92
160 [issue/44]: https://github.com/cloudflare/kv-asset-handler/issues/44
161 [issue/59]: https://github.com/cloudflare/kv-asset-handler/issues/59
162 [pull/47]: https://github.com/cloudflare/kv-asset-handler/pull/47
163
164- ### Fixes
165
166 - **Range Issue with Safari and videos - [victoriabernard92], [issue/60] [pull/66]**
167
168 Previously, if you wanted to serve a video from Workers KV using `kv-asset-handler`, it would be broken on Safari due to its requirement that all videos support the [`Content-Range` header](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Content-Range). Cloudflare already has a feature that will handle these headers automatically, we just needed to take advantage of it by passing in a `Request` object to the [Cache API](https://developers.cloudflare.com/workers/reference/apis/cache/) rather than a URL string.
169 videos from not including the range headers.
170
171 [victoriabernard92]: https://github.com/victoriabernard92
172 [shagamemnon]: https://github.com/shagamemnon
173 [issue/60]: https://github.com/cloudflare/kv-asset-handler/issues/60
174 [issue/63]: https://github.com/cloudflare/kv-asset-handler/issues/63
175 [pull/47]: https://github.com/cloudflare/kv-asset-handler/pull/52
176 [pull/66]: https://github.com/cloudflare/kv-asset-handler/pull/66
177
178 - **Support custom asset namespaces passed into `getAssetFromKV` - [victoriabernard92], [issue/67] [pull/68]**
179
180 This functionality was documented but not properly supported. Tests and implementation fixes applied.
181
182 [victoriabernard92]: https://github.com/victoriabernard92
183 [issue/67]: https://github.com/cloudflare/kv-asset-handler/issues/67
184 [pull/68]: https://github.com/cloudflare/kv-asset-handler/pull/68
185
186## 0.0.7
187
188- ### Features
189
190 - **Add handler for SPAs - [ashleymichal], [issue/46] [pull/47]**
191
192 Some browser applications employ client-side routers that handle navigation in the browser rather than on the server. These applications will work as expected until a non-root URL is requested from the server. This PR adds a special handler, `serveSinglePageApp`, that maps all HTML requests to the root index.html. This is similar to setting a static asset route pattern in an Express.js app.
193
194 [ashleymichal]: https://github.com/ashleymichal
195 [issue/46]: https://github.com/cloudflare/kv-asset-handler/issues/46
196 [pull/47]: https://github.com/cloudflare/kv-asset-handler/pull/47
197
198- ### Documentation
199
200 - **Add function API for `getAssetFromKV` to README.md - [ashleymichal], [issue/48] [pull/52]**
201
202 This function, used to abstract away the implementation for retrieving static assets from a Workers KV namespace, includes a lot of great options for configuring your own, bespoke "Workers Sites" implementation. This PR adds documentation to the README for use by those who would like to tinker with these options.
203
204 [ashleymichal]: https://github.com/ashleymichal
205 [issue/46]: https://github.com/cloudflare/kv-asset-handler/issues/48
206 [pull/47]: https://github.com/cloudflare/kv-asset-handler/pull/52
207
208## 0.0.6
209
210- ### Fixes
211
212 - **Improve caching - [victoriabernard92], [issue/38] [pull/37]**
213
214 - Don't use browser cache by default: Previously, `kv-asset-handler` would set a `Cache-Control` header on the response sent back from the Worker to the client. After this fix, the `Cache-Control` header will only be set if `options.cacheControl.browserTTL` is set by the caller.
215
216 - Set default edge caching to 2 days: Previously the default cache time for static assets was 100 days. This PR sets the default to 2 days. This can be overridden with `options.cacheControl.edgeTTL`.
217
218 [victoriabernard92]: https://github.com/victoriabernard92
219 [issue/38]: https://github.com/cloudflare/kv-asset-handler/issues/38
220 [pull/37]: https://github.com/cloudflare/kv-asset-handler/pull/37