Skip to content

fix(utils): keep runtime helpers out of the plugin barrel - #63

Open
shpaw415 wants to merge 2 commits into
mainfrom
fix/utils-worker-safe-helpers
Open

shpaw415 wants to merge 2 commits into
mainfrom
fix/utils-worker-safe-helpers

Conversation

@shpaw415

Copy link
Copy Markdown
Owner

Why

The docs production build succeeds, but the Cloudflare Pages Functions output is not a valid Workers artifact.

frame-master/utils is the public helper API (join, isProd, verboseLog). It imported directiveToolSingleton from ./plugins — the full plugin barrel. That statically pulled:

  • plugin-loader and getConfig
  • virtual-modules module-scope Bun.file proxy
  • Node/process.cwd() config loading

Any plugin that correctly used join / isProd in code that ships to Pages Functions (apply-react layout.tsxThrowNotFound → dynamic SSR pages) dragged the Bun server graph into the worker. Clean functions still compiled to ~17MB and contained Bun.file.

What this changes for plugin DX

  • frame-master/utils is now a Worker/browser-safe helper module. Plugins can import join, isProd, isDev, and verboseLog from it without pulling plugin-loader or Bun APIs.
  • directiveManager lives on frame-master/plugin/utils (alias of directiveToolSingleton), next to the other plugin-author APIs.
  • Docs for the utils API show the split and why it exists.
  • A browser-bundle regression test fails if frame-master/utils grows another plugin/server import.

Migration

// helpers — safe in Workers / browser / functions
import { join, isProd } from "frame-master/utils";

// directive registry — plugin/server only
import { directiveManager } from "frame-master/plugin/utils";

No plugin source changes are required for this fix to take effect once this core release is consumed.

Test plan

  • bun test packages/frame-master/test/utils.test.ts (including new browser-bundle assertion)
  • bun test focused directive + pipeline client-bundle tests
  • bun run typecheck in packages/frame-master

Importing join/isProd from frame-master/utils pulled the full plugin
graph (Bun.file proxy, config loader) into Cloudflare Pages Functions.
Move directiveManager to frame-master/plugin/utils and lock the helper
module with a browser-bundle regression test.
@cloudflare-workers-and-pages

cloudflare-workers-and-pages Bot commented Aug 17, 2026

Copy link
Copy Markdown

Deploying frame-master-docs with  Cloudflare Pages  Cloudflare Pages

Latest commit: c5abddf
Status:🚫  Build failed.

View logs

@coderabbitai

coderabbitai Bot commented Aug 17, 2026

Copy link
Copy Markdown
Contributor

Important

Review available on request

  • 🔍 Trigger review

Reviews should be triggered manually for repositories with fewer than 10 stars. Select Trigger review above or comment @coderabbitai review to review the latest changes. For a full review, comment @coderabbitai full review.

⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: 80f61b2e-9eb3-444f-a4a5-aef2d83a79d2


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

Docs config load failed because apply-react still imported
directiveManager from frame-master/utils. Point the git dep at
deb42cb which uses frame-master/plugin/utils instead.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant