create-rolldown-plugin

Create Rolldown build plugins using hooks, virtual modules, and graph-aware output emission.

931|91|Updated Aug 13, 2025
One-click install
npx skills add https://github.com/videojs/v10 --skill create-rolldown-plugin
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: create-rolldown-plugin
Source: https://github.com/videojs/v10/tree/main/.agents/skills/create-rolldown-plugin
Command: npx skills add https://github.com/videojs/v10 --skill create-rolldown-plugin

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve?

Writing Rolldown plugins correctly requires navigating hook contracts, module graph timing, virtual module identity, and output ownership rules that are easy to get wrong. This Skill guides the implementation of Rolldown plugins that integrate cleanly with the host build graph instead of fighting it.

Core Features & Use Cases

  • Hook Selection Guidance: Choose between transform, renderChunk, resolveId, load, and other hooks based on whether the edit concerns source modules or final chunks.
  • Virtual Module & Graph Rules: Enforce private \0-prefixed virtual IDs, correct moduleType returns, namespaced module meta, and proper watch-file registration.
  • Output Ownership & Testing: Emit assets and chunks via this.emitFile without destroying unrelated output, and validate through real Rolldown builds plus host-compatibility tests.
  • Use Case: When asked to build a plugin that publishes transformed component metadata as JSON, produce a plugin that loads components through the host graph, retains namespaced metadata, watches discovery inputs, and emits JSON assets with direct Rolldown and Vite compatibility tests.

Quick Start

Create a Rolldown plugin that transforms component source files and emits the collected metadata as a JSON asset in the build output.

Frequently Asked Questions about create-rolldown-plugin

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I create a Rolldown plugin?

Define the host contract first: which modules are selected, what source shape enters and leaves each hook, and what output the plugin owns. Use `transform` for source-module semantics and `renderChunk` only when the edit depends on final generated chunks, then test through real Rolldown builds.

When should I use transform vs renderChunk in Rolldown?

Use `transform` when an edit belongs to one source module, needs its AST or module type, or should participate in module-level caching. Use `renderChunk` when the edit depends on final chunk code, filename, format, or the rendered chunk graph.

Does a Rolldown plugin work with Vite?

Rolldown plugins can be Vite-compatible, but compatibility must be proven by exercising the same contract through both Rolldown and Vite tests rather than relying on structural types alone. Composable filter utilities may be Rolldown-only unless the target Vite version supports them.

How do I handle virtual modules in a Rolldown plugin?

Keep virtual modules private by prefixing internal IDs with `\0`, resolving them explicitly, and returning the correct `moduleType`. Add every non-imported source dependency as a watch file so rebuilds trigger correctly.

Why does my Rolldown plugin lose module metadata between hooks?

Hook results merge `meta` only one level deep, so a later value replaces an earlier value under the same top-level key. Namespace your metadata, such as `meta.vjsc`, and explicitly merge nested fields when several hooks or plugins contribute to it.

When should I not write a Rolldown plugin?

Prefer a Rolldown plugin only when the behavior concerns modules or build output. If the task involves Vite configuration, HTML, the dev server, or HMR, a Rolldown plugin is the wrong tool.