Registry / web-framework / vite-cpat

vite-cpat

JSON →
library0.1.9jsnpmunverified

Vite plugin for compiling .cpat files (Clarity Pattern files) using clarity-pattern-parser. Current stable version is 0.1.9. The plugin integrates with Vite's build pipeline to parse .cpat files and export patterns as JavaScript modules. Low release cadence, requires TypeScript module augmentation for type safety. Alternative to manual parsing workflows, designed specifically for Vite projects.

npm install vite-cpat
INSTALL
IMPORT
SIG · VITE-CPAT
V
vite-cpat
web-frameworkjavascriptv0.1.9
Install
Import
Disk
Pass rate
0/ 6
Env Coverage0 / 6
glibc
1822
musl
1822
Install & Compatibility
Where this runs
tested against v? · npm install
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
node 18223 runs
build_error
glibc
node 18223 runs
build_error
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

default
import cpat from 'vite-cpat'
const cpat = require('vite-cpat')
ESM-only; CommonJS require will fail
Pattern
import type { Pattern } from 'clarity-pattern-parser'
import { Pattern } from 'vite-cpat'
Pattern type is imported from clarity-pattern-parser, not vite-cpat
.cpat module declaration
declare module '*.cpat' { ... }
declare module '*.cpat' { export default Record<string, Pattern> }
Must include the compileWithParams function export to match the actual module shape

Registers the Vite plugin to handle .cpat files in your project.

import { defineConfig } from 'vite'; import cpat from 'vite-cpat'; export default defineConfig({ plugins: [cpat()], });
Debug
Known issues
gotchaPlugin expects clarity-pattern-parser as a peer dependency; must be installed separately.
fix
Install clarity-pattern-parser: yarn add clarity-pattern-parser
affects: >=0.0.0
gotchaTypeScript projects require a module declaration for '*.cpat' imports; omitted by default.
fix
Add declare module '*.cpat' { ... } as shown in README
affects: >=0.0.0
breakingESM-only; does not support CommonJS require() syntax.
fix
Use import syntax instead of require()
affects: >=0.1.0
Errors
Common errors & fixes
Cannot find module 'vite-cpat' or its corresponding type declarations.
Missing installation or TypeScript not configured for ESM resolution.
fix
Install the package and ensure 'moduleResolution' is set to 'node16' or 'bundler' in tsconfig.json
Module '"*.cpat"' resolves to a non-module entity and cannot be imported using this construct.
Missing module declaration for .cpat files in a TypeScript project.
fix
Add the declare module '*.cpat' block from the README to a global .d.ts file
Upgrade
Version history
0.1.9latest on npm
Audit
Dependencies
clarity-pattern-parserrequiredPeer dependency for parsing .cpat files
Agent activity
4 hits · last 30 days
node
4
Resources
vite-cpat — npm install vite-cpat · libregistry