API Reference
The package exposes one main entry, hashup(), plus a set of lower-level utilities for advanced use cases.
Entry Point
hashup(entry, options?)— resolve an entry file's full import graph and return a deterministic hash.
Utilities
createResolver(options?)— build the enhanced-resolve instance used internally (tsconfig paths on by default).resolveSpecifier()— resolve one import the wayhashup()does: query stripping, tsconfig paths, then Node rules.resolveImport()— resolve a single import specifier with enhanced-resolve only.stripQuery()— drop?query/#fragmentfrom a specifier or path.extractGlobPatterns()/expandGlobImports()— detect and expandimport.meta.glob(...)calls.extractImports()— parse a file and return its static imports.hashFile()— hash a single file and its transitive imports.createContentHash()— SHA-256 a buffer.combineHashes()— fold a list of hashes into a single deterministic digest.createLogger(level?)— build theLoggerused internally. Exportstype LogLevelandtype Logger.isInNodeModules(file)— predicate used by the hasher to decide whether to walk into a resolved path.createHashupCache()— build aHashupCacheto share across multiplehashup()orhashFile()calls.collectReachable(roots, cache)— rebuild a per-call file list from the cache's dependency edges.
Config (subpath export)
The Zod schema and generated JSON schema for hashup.json live on a separate subpath so the main entry stays dep-free:
ts
import { configSchema, configJsonSchema } from "@maastrich/hashup/config";See the CLI guide for the config shape and editor integration.
Main entry
All core functions are exported from the package root:
ts
import {
hashup,
createResolver,
resolveSpecifier,
resolveImport,
stripQuery,
extractGlobPatterns,
expandGlobImports,
extractImports,
hashFile,
createContentHash,
combineHashes,
createLogger,
isLogLevel,
isInNodeModules,
createHashupCache,
collectReachable,
type HashupCache,
type UnresolvedImport,
type CreateResolverOptions,
type Logger,
type LogLevel,
} from "@maastrich/hashup";