feat: add @varlock/cloudflare-integration package#480
Open
theoephraim wants to merge 5 commits intomainfrom
Open
feat: add @varlock/cloudflare-integration package#480theoephraim wants to merge 5 commits intomainfrom
theoephraim wants to merge 5 commits intomainfrom
Conversation
Deploying with
|
| Status | Name | Latest Commit | Preview URL | Updated (UTC) |
|---|---|---|---|---|
| ✅ Deployment successful! View logs |
varlock-website | 5a87d42 | Commit Preview URL Branch Preview URL |
Mar 25 2026, 05:25 AM |
🦋 Changeset detectedLatest commit: 5a87d42 The changes in this PR will be included in the next version bump. This PR includes changesets to release 2 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
philmillman
approved these changes
Mar 24, 2026
Member
philmillman
left a comment
There was a problem hiding this comment.
lgtm!
one thing we might consider for the docs is calling out explicitly what the upgrade would look like for existing varlock/cloudflare users
|
No dependency changes detected. Learn more about Socket for GitHub. 👍 No dependency changes detected in pull request |
commit: |
New package for Cloudflare Workers that replaces bundling secrets into worker code with Cloudflare's native secrets/vars mechanism. - `varlockCloudflareVitePlugin()` - Vite plugin that reads `__VARLOCK_ENV` from Cloudflare secret bindings at runtime via `cloudflare:workers` - `varlock-wrangler` CLI - drop-in wrangler replacement that uploads non-sensitive values as vars and sensitive values as secrets on deploy, and generates correct types including varlock-managed env vars - `resolvedEnvVars()` helper for injecting vars into miniflare bindings in local dev Refactors the base Vite plugin to remove Cloudflare-specific logic and add generic extension points (ssrEntryCode, ssrEdgeRuntime, ssrEntryModuleIds, ssrInjectModeDev) that platform integrations can use. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
- varlock-wrangler dev: injects env into miniflare via Unix named pipe (FIFO) so secrets never touch disk; watches .env files and restarts wrangler on changes; preserves color output - varlock-wrangler types: passes env keys via --env-file for correct Env type generation - @varlock/cloudflare-integration/init: standalone init module for non-Vite workers (reads __VARLOCK_ENV from CF bindings, patches console/response) - Rewrite docs: show varlock-wrangler approach first, Vite second; move native env access section into Vite section - Fix env file format: use single-quoted dotenv values to avoid escaping issues with JSON in __VARLOCK_ENV Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
3d2a6de to
2c7942e
Compare
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
ba578fa to
8bf8ac9
Compare
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
8bf8ac9 to
5a87d42
Compare
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
@varlock/cloudflare-integrationpackage that replaces bundling secrets into worker code with Cloudflare's native secrets/vars mechanismvarlockCloudflareVitePlugin()reads__VARLOCK_ENVfrom Cloudflare secret bindings at runtime viaimport { env } from 'cloudflare:workers'varlock-wranglerCLI wraps wrangler to automatically upload non-sensitive values as vars and sensitive values as secrets on deployvarlock-wrangler typesgenerates correct CloudflareEnvtypes including varlock-managed env varsresolvedEnvVars()helper for optionally injecting vars into miniflare bindings in local devssrEntryCode,ssrEdgeRuntime,ssrEntryModuleIds,ssrInjectModeDev)Test plan
vite devworks withvarlockCloudflareVitePlugin()— env vars load correctlyvarlock-wrangler deployuploads vars and secrets correctlyvarlock-wrangler typesgeneratesEnvinterface with varlock-managed varsresolvedEnvVars()enables nativeenv.MY_VARaccess in miniflare devvarlockVitePlugin()🤖 Generated with Claude Code