From 5244faae5094fef7c9e3f5b6cfdd3dfb34c97b3c Mon Sep 17 00:00:00 2001 From: WillTaylorDev Date: Tue, 3 Dec 2024 14:20:00 -0500 Subject: [PATCH] Rename serve_directly to experimental_serve_directly (#7429) --- .changeset/six-coats-rule.md | 2 +- packages/wrangler/src/__tests__/deploy.test.ts | 4 ++-- packages/wrangler/src/assets.ts | 2 +- packages/wrangler/src/config/environment.ts | 2 +- packages/wrangler/src/config/validation.ts | 6 +++--- 5 files changed, 8 insertions(+), 8 deletions(-) diff --git a/.changeset/six-coats-rule.md b/.changeset/six-coats-rule.md index 4112b8521f3c..d11af23a8bff 100644 --- a/.changeset/six-coats-rule.md +++ b/.changeset/six-coats-rule.md @@ -2,6 +2,6 @@ "wrangler": minor --- -feat: add `serve_directly` option to Workers with Assets +feat: add `experimental_serve_directly` option to Workers with Assets Users can now specify whether their assets are served directly against HTTP requests or whether these requests always go to the Worker, which can then respond with asset retrieved by its assets binding. diff --git a/packages/wrangler/src/__tests__/deploy.test.ts b/packages/wrangler/src/__tests__/deploy.test.ts index c99ddd44e334..ce2944c5c0c3 100644 --- a/packages/wrangler/src/__tests__/deploy.test.ts +++ b/packages/wrangler/src/__tests__/deploy.test.ts @@ -4964,7 +4964,7 @@ addEventListener('fetch', event => {});` binding: "ASSETS", html_handling: "none", not_found_handling: "404-page", - serve_directly: false, + experimental_serve_directly: false, }, }); await mockAUSRequest(); @@ -5038,7 +5038,7 @@ addEventListener('fetch', event => {});` binding: "ASSETS", html_handling: "none", not_found_handling: "404-page", - serve_directly: true, + experimental_serve_directly: true, }, }); await mockAUSRequest(); diff --git a/packages/wrangler/src/assets.ts b/packages/wrangler/src/assets.ts index 3e6a943a6157..e8fd43bc3a2b 100644 --- a/packages/wrangler/src/assets.ts +++ b/packages/wrangler/src/assets.ts @@ -347,7 +347,7 @@ export function processAssetsArg( const assetConfig = { html_handling: config.assets?.html_handling, not_found_handling: config.assets?.not_found_handling, - serve_directly: config.assets?.serve_directly, + serve_directly: config.assets?.experimental_serve_directly, }; return { diff --git a/packages/wrangler/src/config/environment.ts b/packages/wrangler/src/config/environment.ts index fe535fefa8bd..a3ac9f58db11 100644 --- a/packages/wrangler/src/config/environment.ts +++ b/packages/wrangler/src/config/environment.ts @@ -948,7 +948,7 @@ export type Assets = { | "drop-trailing-slash" | "none"; not_found_handling?: "single-page-application" | "404-page" | "none"; - serve_directly?: boolean; + experimental_serve_directly?: boolean; }; export interface Observability { diff --git a/packages/wrangler/src/config/validation.ts b/packages/wrangler/src/config/validation.ts index e7a5329208f9..5055b629a823 100644 --- a/packages/wrangler/src/config/validation.ts +++ b/packages/wrangler/src/config/validation.ts @@ -2176,8 +2176,8 @@ const validateAssetsConfig: ValidatorFn = (diagnostics, field, value) => { validateOptionalProperty( diagnostics, field, - "serve_directly", - (value as Assets).serve_directly, + "experimental_serve_directly", + (value as Assets).experimental_serve_directly, "boolean" ) && isValid; @@ -2187,7 +2187,7 @@ const validateAssetsConfig: ValidatorFn = (diagnostics, field, value) => { "binding", "html_handling", "not_found_handling", - "serve_directly", + "experimental_serve_directly", ]) && isValid; return isValid;