All notable changes to this project will be documented in this file.
The format is based on Keep a Changelog, and this project adheres to Semantic Versioning.
Delivery
can now be passed ashouldBeCached
function to customize the logic that selects files to receive long-lived cache headers. This function is passed a single parameter — the input file path — and should returntrue
orfalse
..topojson
files will now get the content header ofapplication/json
thanks to a custom type addition tomime
.
- Delivery now uses
mime
instead ofmime-types
. It's smaller and makes it easy to add custom types. - Delivery now does MD5 hashing in-house — no patience for
hasha
's breaking changes in a minor release. maxAgeOverride
is nowcacheControlOverride
and expects you to provide the full string, not just the seconds formax-age=
.- The logic for what gets a long-lived cache header is no longer entirely based on content type and instead decided by whether a file shows signs of being hashed. By default this is a regular expression check looking for an eight-character hexadecimal hash in the filename. Filenames that pass this test will receive a
public, max-age=31536000, immutable
value. Files that match thetext/html
content type will instead get an explicitno-cache
header. Files that do not pass either test get nothing and are at the mercy of upstream decisions.
- Added the ability to pass a
maxAgeOverride
parameter touploadFile
anduploadFiles
. IfshouldCache
istrue
andmaxAgeOverride
is provided, the upload functions will use this value instead to set the cache control header.
- Added flag for using the Accelerate endpoint with S3.
useAccelerateEndpoint
can now be passed when initializing theDelivery
class. It will depend on the S3 bucket already having it active, however.
- Video files (
.mp4
,.webm
) now receive cache headers.
- Font files (
.woff2
,.woff
,.ttf
,.otf
) now receive cache headers.
- JSON files are now cached for one hour.
- Images are now cached for one year.
- Minimum Node.js support is now
v10
. It may still work onv8
, but no promises. - This package is now available on
npm
as@datagraphics/delivery
instead of@datadesk/delivery
, which has been deprecated.
- Initial release!