Skip to content

feat: skip node_modules and add log levels#17

Merged
maastrich merged 1 commit intomainfrom
feat/skip-node-modules-and-log-levels
Apr 24, 2026
Merged

feat: skip node_modules and add log levels#17
maastrich merged 1 commit intomainfrom
feat/skip-node-modules-and-log-levels

Conversation

@maastrich
Copy link
Copy Markdown
Owner

Summary

  • Stop walking into node_modules entirely. Imports that resolve into a node_modules directory are treated as opaque — file never read, imports never walked, zero contribution to the hash. Fixes OOM on large monorepos (bfront).
  • To pin installed versions, add the lockfile to extras. The raw bytes capture every direct/transitive/peer-dep change, no parsers needed.
  • Add logLevel: "silent" | "warn" | "info" | "debug" to HashupOptions, the CLI (--log-level / -l), and hashup.json. Default silent. The previously-unconditional console.warn on hash failures is now opt-in via --log-level warn.

Behavior change

This changes hashes for any project that previously reached into node_modules through a static import. Minor bump, pre-1.0 semantics.

Test plan

  • New tests/skip-node-modules.test.ts — verifies node_modules files are absent from files, hash is stable when a node_modules file is mutated, hash still changes on user-source edits, lockfile-as-extra reintroduces install-tree sensitivity
  • New tests/logger.test.ts — level filtering for silent/warn/info/debug, error stack formatting
  • New isInNodeModules unit tests — POSIX and Windows segments, rejects lookalike paths
  • CLI parse-args tests updated for --log-level / -l
  • vp test — 106/106 passing
  • vp check clean
  • Verified end-to-end on the bfront repo that OOM'd previously: Toaster/index.ts now hashes cleanly with no warnings

Docs

Updated docs/api/hashup.md, docs/api/utilities.md, docs/api/index.md, docs/guide/usage.md, docs/guide/cli.md, docs/guide/how-it-works.md (new "What Is Not Included" entry for node_modules, "Logging" section, "Caveats" note on entry-dependent cycle hashes). schema.json regenerated.

🤖 Generated with Claude Code

- Stop walking into any path under a node_modules directory. The
  dependency is treated as opaque: file never read, its imports never
  walked, contributes nothing to the hash. Fixes OOM on large monorepos.
  Users pin installed versions by adding their lockfile to `extras`.
- Add `logLevel: "silent" | "warn" | "info" | "debug"` to `HashupOptions`,
  the CLI (`--log-level` / `-l`), and the config schema. Default silent;
  previously-unconditional `console.warn` on hash failures is now opt-in.
- Exports: `createLogger`, `isLogLevel`, `isInNodeModules`, `Logger`,
  `LogLevel`. `hashFile` gains an optional `logger` parameter.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@github-actions
Copy link
Copy Markdown
Contributor

📖 Docs preview: https://maastrich.github.io/hashup/branches/pr-17/

@maastrich maastrich merged commit ca24e81 into main Apr 24, 2026
3 checks passed
@maastrich maastrich deleted the feat/skip-node-modules-and-log-levels branch April 24, 2026 09:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant