Skip to main content

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​

FunctionDescription
cs_mast_initParse source, compute all hashes, build the lookup hashmap
cs_mast_s_existsO(1) boolean signature lookup
cs_mast_init_codebaseMulti-file codebase-level hash

Signature Utilities​

FunctionDescription
parseSignaturePHC string → CsMastSignature | null
buildSignatureCsMastSignature → PHC string
buildSignatureFromConfigConfig + hashHex → PHC string
sanitizePrsrApply [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​

ExportDescription
BabelAdapterDefault adapter using @babel/parser + @babel/traverse
CS_MAST_SIGNATURE_KEYThe string 'cs-mast-s-hash' — property key attached to Babel nodes
sha256SHA-256 wrapper: (input: string) => string (64-char hex)
computeNodeHashLow-level: compute hash for one AdapterNode given ResolvedConfig
computeDefaultHashLow-level: default Merkle formula for uncategorized nodes