Documentation Index
Fetch the complete documentation index at: https://mintlify.com/eersnington/sideffect/llms.txt
Use this file to discover all available pages before exploring further.
createSideffectWorkflowsPlugin is the low-level equivalent of withCloudflareWorkflows. It creates only the Sideffect plugin — it does not call Cloudflare’s plugin factory for you. Instead it exposes a cloudflare property on the returned plugin object that contains the fully resolved CloudflarePluginConfig you pass manually to Cloudflare’s factory. This gives you full control over plugin ordering, multiple-Vite-environment setups, and test harnesses where you want to inspect the resolved Cloudflare config before any plugin runs. Import it from sideffect/vite.
Most applications should use
withCloudflareWorkflows() instead. It calls
createSideffectWorkflowsPlugin internally and automatically spreads both plugins. Reach for
createSideffectWorkflowsPlugin only when you need explicit control over how the Cloudflare
plugin is constructed or when you are writing tests that inspect the resolved config.Function signature
Parameters
The same options accepted by
withCloudflareWorkflows(). All fields are optional.
See the withCloudflareWorkflows API reference for full
documentation of each option.Return value
A Vite
Plugin object extended with an additional cloudflare field.The plugin name used by Vite for ordering and error messages.
The plugin runs before standard Vite plugins so it can intercept the virtual entry resolution
before Cloudflare’s plugin processes the Worker entry.
The fully merged
CloudflarePluginConfig object to pass directly to Cloudflare’s Vite plugin
factory: cloudflare(plugin.cloudflare).This config object includes a config hook that Sideffect uses internally to discover workflows,
write sideffect-env.d.ts, and rewrite the main field to the virtual entry. You must pass it
to Cloudflare’s plugin unchanged — do not spread or destructure it before passing.Example
collectWorkflowEntries()
Also exported from sideffect/vite, collectWorkflowEntries performs the static workflow
discovery step in isolation — without creating a Vite plugin or running inside a Vite build. Use it
for programmatic tooling, code generators, or tests that need to inspect discovered workflows
without starting Vite.
Function signature
Parameters
Array of file paths or directory paths to scan. Paths are resolved relative to
baseDirectory.
Sideffect uses TypeScript’s AST parser to find static Workflow.make({ name }).toLayer(...)
exports and follows local barrel re-exports.Base directory used when resolving entries in
patterns. Defaults to process.cwd().Return value
An array of discovered workflow configs. Each entry has the following shape:
Always
"sideffect" for entries returned by this function.The Cloudflare workflow binding config auto-derived from the workflow name:
binding— screaming-snake-case version of the workflow name (e.g."RESIZE_IMAGE").name— the original workflow name fromWorkflow.make({ name }).class_name— PascalCase identifier safe for use as a JavaScript export (e.g."ResizeImage").
Import location of the discovered layer:
modulePath— absolute path to the source file containing the export.exportKind—"named"or"default".exportName— the export identifier name, or"default"for default exports.
Example
collectWorkflowEntries requires TypeScript to be installed in your project — it dynamically
loads the typescript package at runtime for AST parsing. If TypeScript cannot be resolved, it
throws a TypeScriptWorkflowDiscoveryError with installation instructions. Runtime usage of
sideffect and sideffect/cloudflare does not require TypeScript.