unplugin wrapper that runs scriptc build inside bundler pipelines and surfaces scriptc coverage diagnostics. Single package, published as unplugin-scriptc.
src/index.ts, the unplugin factory (scriptcPlugin), hook plumbing, reporter. Public API.src/scriptc.ts, the CLI interface:ScriptcBuildOptionsflag surface,buildArgs/coverageArgsarg builders, process runner, diagnostics envelope types, bin resolution.test/*.test.ts,node --test.e2e.test.tsexercises a real scriptc binary and skips when none resolves.docs/, docmd site (seedocs/docmd.config.json), deployed to unplugin-scriptc.pages.dev.
- One responsibility. The plugin runs the compiler. It never re-implements scriptc's analysis: diagnostics are parsed from the
--print diagnosticsJSON envelope and re-emitted, nothing is inferred locally. If a check requires knowing the compilable subset, it comes from scriptc or nowhere. - Every flag is reachable.
ScriptcBuildOptionsmirrors thescriptc buildoption surface of the pinned release one-to-one;argsis the escape hatch for newer flags. When scriptc adds flags, add the option rather than telling users to passargspermanently. - scriptc is pinned to a minor range.
peerDependencies["scriptc"]is^0.3.0— accepts every 0.3.x release (patch + bug-fix) without a plugin bump, and refuses 0.4.0+. The plugin only relies on thescriptc buildflag surface and the v1 diagnostics JSON envelope, both stable within the 0.3 line. When scriptc ships a new minor, bump the peer range with a commit that re-checks the flag surface and the envelope schema (schemaVersion is the contract). - Reporter contract.
this.warn/this.errorexist only on some bundler hook contexts;makeReporterfalls back toconsole.warn/console.errorwith the[unplugin-scriptc]prefix. Never callthis.warndirectly in a hook that lacks it.
pnpm install # pnpm-workspace.yaml allowBuilds lets scriptc/esbuild/docmd postinstall run
pnpm test
pnpm typecheck && pnpm lint && pnpm fmt:check
pnpm docs:dev # docmd dev serverConventional commits, no AI trailers, author Joaquin Terrasa. main is the release line; publish via the release workflow on tag v*.