-
Notifications
You must be signed in to change notification settings - Fork 233
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[feature] Add support for kv assets. #308
base: main
Are you sure you want to change the base?
Conversation
fa9d320
to
e887ea2
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm unsure if this deserves to be merged into the workers-rs framework itself. Like the existing TypeScript kv-asset-handler this would be better served as a standalone library IMO.
That being said, I'm not totally against adding first party support if there's a good reason as to why it should be in the official crate.
8cf8b7e
to
2f53270
Compare
2f53270
to
aa6aaac
Compare
8c5250c
to
e43237e
Compare
e43237e
to
3812f9d
Compare
3812f9d
to
e52575e
Compare
@zebp From the wrangler/miniflare side I tend to agree. Use of Workers Sites is discouraged in favour of Pages, and the assets story in Wrangler will be revisited as part of Pages/Workers convergence in the near future. As such, adding additional functionality to Workers Sites is generally not something we want to do, and introducing a new API directly to the |
It exposes
env.asset_key
function so filenames can be queried from the "__STATIC_CONTENT" KV namespace.Previously, names were mangled due to an additional hash appended to the names.
Now, inside the worker handler one can access to
favicon.ico
as (simplified):This PR depends on:
A small change to always load a (possibly empty) manifest module.
For running tests.
For running tests.
Once these PRs get merged, CI will pass.
Credits: This code was based on @SeokminHong comment in #54