API Reference
All exports are available from the cs-mast package root:
import { cs_mast_init, cs_mast_s_exists, /* ... */ } from '@shriyanss/cs-mast';
Core Functions
| Function | Description |
|---|---|
cs_mast_init | Parse source, compute all hashes, build the lookup hashmap |
cs_mast_s_exists | O(1) boolean signature lookup |
cs_mast_init_codebase | Multi-file codebase-level hash |
Signature Utilities
| Function | Description |
|---|---|
parseSignature | PHC string → CsMastSignature | null |
buildSignature | CsMastSignature → PHC string |
buildSignatureFromConfig | Config + hashHex → PHC string |
sanitizePrsr | Apply [a-zA-Z0-9/+.-] charset rule to parser name |
Types
See the Types reference for all exported TypeScript interfaces and type aliases.
Errors
See the Errors reference for ParseError, ConfigError, MutationError.
Guard
See the Guard reference for guardPath, RESTRICTED_METHODS, makeGuard.
Adapter
| Export | Description |
|---|---|
BabelAdapter | Default adapter using @babel/parser + @babel/traverse |
CS_MAST_SIGNATURE_KEY | The string 'cs-mast-s-hash' — property key attached to Babel nodes |
sha256 | SHA-256 wrapper: (input: string) => string (64-char hex) |
computeNodeHash | Low-level: compute hash for one AdapterNode given ResolvedConfig |
computeDefaultHash | Low-level: default Merkle formula for uncategorized nodes |