-
Notifications
You must be signed in to change notification settings - Fork 776
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: asset serving config for workers + assets (#6631)
* add asset config behaviour move shared assets code to workers-shared/utils add asset config to wrangler add asset config to miniflare add config binding to asset-worker add asset config behaviour to AW (this is the big one) make UW manually handle 404s update assets-only fixture fix drop-trailing-slash logic html handling tests * pr feedback * fix tests and pr feedback 2 * changesets --------- Co-authored-by: Samuel Macleod <smacleod@cloudflare.com> Co-authored-by: Greg Brimble <gbrimble@cloudflare.com>
- Loading branch information
1 parent
7bbed63
commit 59a0072
Showing
58 changed files
with
2,201 additions
and
400 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--- | ||
"wrangler": patch | ||
--- | ||
|
||
Add config options 'html_handling' and 'not_found_handling' to experimental_asset field in wrangler.toml |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
--- | ||
"@cloudflare/workers-shared": minor | ||
--- | ||
|
||
Add asset config behaviour. | ||
|
||
Add `html_handling` (e.g. /index.html -> /) with options `"auto-trailing-slash" | "force-trailing-slash" | "drop-trailing-slash" | "none"` to Asset Worker. | ||
|
||
Add `not_found_handling` behaviour with options `"404-page" | "single-page-application" | "none"` to Asset Worker. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
# Asset config fixture | ||
|
||
This is testing the asset worker in the workers-shared package. We cannot use the vitest integration directly in that package because it results in circular dependencies. | ||
|
||
Since it runs tests in a workerd context and doesn't depend on the host OS, this fixture only runs test on Linux to reduce wasted time in CI. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
declare module "cloudflare:test" { | ||
// Controls the type of `import("cloudflare:test").env` | ||
interface ProvidedEnv { | ||
CONFIG: Record<string, string>; | ||
ASSETS_MANIFEST: ArrayBuffer; | ||
ASSETS_KV_NAMESPACE: KVNamespace; | ||
} | ||
} |
Oops, something went wrong.