@cloudflare/kv-asset-handler
Advanced tools
Changelog
0.3.1
This PR removes the tests from the npm package, reducing the size of the package by about half.
These PRs bump dependencies of the project to their latest versions.
This PR fixes the anchor links in the README.
Changelog
0.2.0
Allow changing pathIsEncoded through options - JackPriceBurns, pull/243
When using mapRequestToAsset
, it encodes the URL / key and will never check the KV store for the decoded key.
This adds the ability to set pathIsEncoded
to true, which will decode the URL before getting it from the KV.
Support ES Modules. - threepointone, pull/261
This PR provides a possible solution for getting Workers Sites working with ES Module workers. This approach is not as invasive as other approaches, so isn't as risky either.
Usage:
import manifestJSON from "__STATIC_CONTENT_MANIFEST";
const manifest = JSON.parse(manifestJSON);
export default {
fetch(request, env, ctx) {
return await getAssetFromKV(
{
request,
waitUntil(promise) {
return ctx.waitUntil(promise);
},
},
{
ASSET_NAMESPACE: env.ASSET_NAMESPACE,
ASSET_MANIFEST: manifest,
}
);
// ...
},
};
fix: default ASSET_MANIFEST to empty object - Cherry, pull/254
As per discussion in Discord and the repo at [https://github.com/Erisa-bits/getassetfromkv-undefined-error], allowing ASSET_MANIFEST
to be optional got lost somewhere along the years and errors when attempted to be used without it. This PR restores this functionality by setting it to an empty object (instead of undefined
), which allows fall-through to the standard mapRequestToAsset
function.
chore: bump dependencies - This updates a few dependencies and also pins @types/node
to 15.x
since 16.x
has some incompatible types.
feat: generate more modern code - This removes the unnecessary async/await polyfill added by TypeScript
chore: remove debug logs around response.body.cancel
support - Cherry, pull/249
Fixes issues/248