feat: ESM/TS single-file plugin support and explicit plugin import API#483
Open
theoephraim wants to merge 3 commits intomainfrom
Open
feat: ESM/TS single-file plugin support and explicit plugin import API#483theoephraim wants to merge 3 commits intomainfrom
theoephraim wants to merge 3 commits intomainfrom
Conversation
Co-authored-by: theoephraim <1158956+theoephraim@users.noreply.github.com> Agent-Logs-Url: https://github.com/dmno-dev/varlock/sessions/77fe1da8-5d52-4c87-9fd8-03b31d55a3f1
…t API - Add plugin-context.ts with proxy-based plugin context (replaces globalThis.plugin) - Support .mjs and .ts single-file plugins via ESM dynamic import - In SEA builds, transform varlock/plugin-lib import to globalThis accessor and execute via data: URL (no temp files, no Bun.plugin() which doesn't work for imports in dynamically loaded modules) - Wrap CJS require to intercept varlock/plugin-lib, enabling explicit import - Remove injected `plugin` global from CJS modules (breaking change) - Update all @varlock/* plugins and smoke test fixtures to use explicit import - Add @types/bun to support Bun.Transpiler type in non-SEA builds Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
🦋 Changeset detectedLatest commit: a269efd The changes in this PR will be included in the next version bump. This PR includes changesets to release 12 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 |
varlock
@varlock/astro-integration
@varlock/nextjs-integration
@varlock/vite-integration
@varlock/1password-plugin
@varlock/aws-secrets-plugin
@varlock/azure-key-vault-plugin
@varlock/bitwarden-plugin
@varlock/google-secret-manager-plugin
@varlock/hashicorp-vault-plugin
@varlock/infisical-plugin
@varlock/pass-plugin
commit: |
philmillman
approved these changes
Mar 25, 2026
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
plugin-context.ts: proxy-based plugin context replaces theglobalThis.plugininjection hack, breaking a circular dependency betweenplugins.tsandplugin-lib.ts.mjsand.tsfiles now supported in addition to.js/.cjs; in SEA binary builds, thevarlock/plugin-libimport is replaced at load time via source text transform +data:URL execution (no temp files)pluginimport: plugin authors now importpluginfromvarlock/plugin-libinstead of relying on an injected global; CJSrequire('varlock/plugin-lib')is intercepted to return live references in all environments including SEA buildspluginglobal is no longer injected into CJS plugin modules — updated all@varlock/*plugins and smoke test fixtures accordinglyValidationError,CoercionError, etc.) are now directly importable fromvarlock/plugin-libPlugin authoring
Test plan
.mjssingle-file plugin.tssingle-file plugin (requires Bun binary)plugin.ERRORSand direct error class imports both work🤖 Generated with Claude Code