contributor-context
Contributor context for coding agents working in this repository. Human contributors should start with `README.md` and…
<!-- GENERATED from docs/playbooks/integration/rollup.md by scripts/build-agent-skill.mjs. Do not edit. -->
$ npx -y skills add crossbind/crossbind --agent claude-codeHow it fires
How this agent gets triggered: by you, by Claude, or both.
Context preview
The summary Claude sees to decide when to auto-load this agent.
<!-- GENERATED from docs/playbooks/integration/rollup.md by scripts/build-agent-skill.mjs. Do not edit. -->
<!-- GENERATED from docs/playbooks/integration/rollup.md by scripts/build-agent-skill.mjs. Do not edit. -->
> Persona 2 sub-playbook. The user's project uses Rollup directly (not via Vite). Detection: `rollup` in deps, `rollup.config.{js,mjs,ts}` at root, no `vite`/`webpack`/`@rspack/*`.
> **Most users want the Vite playbook**, not this one. Vite wraps Rollup, and `@crossbind/plugin-rollup` is the inner kernel of `@crossbind/plugin-vite`. Use this playbook only when the project authors a JS library/CLI directly with Rollup (not building an app).
Add `@crossbind/plugin-rollup` to a Rollup config so:
| File | Role | |------|------| | `package.json` | + `@crossbind/plugin-rollup` (devDependency), optional `@crossbind/port-<name>` | | `rollup.config.{js,mjs,ts}` | Add `rollupCrossbindPlugin()` to `plugins` | | `crossbind.config.js` *(new at root)* | Project-level crossbind config | | `src/native/` *(only if user wraps own C++)* | `.h` + `.cpp` source |
pnpm add -D @crossbind/plugin-rollup@beta pnpm add @crossbind/port-<name>@beta # optional # Build pnpm rollup -c # Watch pnpm rollup -c -w
import rollupCrossbindPlugin from '@crossbind/plugin-rollup';
export default {
input: 'src/index.js',
output: { file: 'dist/index.js', format: 'esm' },
plugins: [
rollupCrossbindPlugin(),
],
};What the plugin gives you:
Standalone Rollup doesn't have a dev server. If the user needs hot reload, they almost certainly want **Vite** instead. Suggest switching to Vite (which uses Rollup under the hood) for app-style projects:
> If you're building an app (not a library), Vite gives you Rollup + a dev server + COOP/COEP automation — see `docs/playbooks/integration/vite.md`.
If the user picks `runtime: 'mt'` in `crossbind.config.js`, the resulting library still needs COOP/COEP headers wherever it runs. Since Rollup just outputs the bundle, **the consuming app** must serve those headers — same matrix as the Vite playbook.
Import C++ and Rust like JavaScript modules (WebAssembly & React Native)
Contributor context for coding agents working in this repository. Human contributors should start with `README.md` and…
<!-- GENERATED from docs/api/app.md by scripts/build-agent-skill.mjs. Do not edit. -->
<!-- GENERATED from docs/api/build-state.md by scripts/build-agent-skill.mjs. Do not edit. -->
<!-- GENERATED from docs/api/conan.md by scripts/build-agent-skill.mjs. Do not edit. -->
<!-- GENERATED from docs/api/cpp-binding-rules.md by scripts/build-agent-skill.mjs. Do not edit. -->