Repository navigation
[vite-plugin] Backport caller-owned Container guidance to v1 #16334
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,7 @@ | ||
| --- | ||
| "@cloudflare/vite-plugin": patch | ||
| --- | ||
|
|
||
| Pass Container command guidance directly to shared helpers | ||
|
|
||
| Keep local development and preview guidance aligned with the CLI and each Worker's configuration file, including legacy Wrangler configurations and the experimental cf delegate. Use the matching Container and deployment helper releases without relying on global command presentation state. | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,3 +1,4 @@ | ||
| import path from "node:path"; | ||
| import { | ||
| configureOpenAPIForContainerPull, | ||
| isCloudflareRegistryImage, | ||
|
|
@@ -15,7 +16,10 @@ import type { | |
| } from "@cloudflare/containers-shared"; | ||
| import type { ComplianceConfig } from "@cloudflare/workers-utils"; | ||
|
|
||
| type ContainerWorkerConfig = ComplianceConfig & { account_id?: string }; | ||
| type ContainerWorkerConfig = ComplianceConfig & { | ||
| account_id?: string; | ||
| configPath?: string; | ||
| }; | ||
|
|
||
| /** | ||
| * Configures the Containers API client used to retrieve image pull credentials. | ||
|
|
@@ -73,13 +77,14 @@ export function normalizeContainerImageUris( | |
| * registry account and compliance settings, including Workers whose images | ||
| * are selected at start time. | ||
| * | ||
| * @param args - Planned images, Docker executable, and Vite logger. | ||
| * @param args - Planned images, Docker executable, Vite logger, and CLI identity. | ||
| * @returns No value. | ||
| */ | ||
| export async function prepareContainerImagesForVite(args: { | ||
| dockerPath: string; | ||
| containerOptionsByWorker: ContainerOptionsByWorker; | ||
| logger: ViteLogger; | ||
| cliDisplayName: string; | ||
| }): Promise<void> { | ||
| for (const [workerConfig, plannedOptions] of args.containerOptionsByWorker) { | ||
| let containerOptions = plannedOptions; | ||
|
|
@@ -119,6 +124,14 @@ export async function prepareContainerImagesForVite(args: { | |
| onContainerImagePreparationEnd: () => {}, | ||
| logger: args.logger, | ||
| complianceConfig: workerConfig, | ||
| configFileName: workerConfig.configPath | ||
| ? path.basename(workerConfig.configPath) | ||
| : "cloudflare.config.ts", | ||
| // TODO: Let cf provide its own command when the delegate supports that contract. | ||
|
Comment on lines
+128
to
+130
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🟡 Container guidance names a nonexistent config For Containers defined through inline Learn moreThe plugin accepts inline Worker configuration without a Wrangler file. In that case, resolveWorkerConfig starts with defaults and applies the inline customizer, leaving the Worker without a config path. Example: A project configures Recommended fix: Distinguish Was this helpful? React with 👍 or 👎 to provide feedback. |
||
| registryConfigureCommand: | ||
| args.cliDisplayName === "cf" | ||
| ? "cf containers registries create" | ||
| : "wrangler containers registries configure", | ||
| }); | ||
| } | ||
| } | ||
|
|
||
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
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.
🟡 Changeset headline describes implementation details
The changeset headline describes passing arguments to helpers rather than the corrected Container guidance users receive. Repository review rules require user-facing changeset language.
Was this helpful? React with 👍 or 👎 to provide feedback.