feat: skip node_modules and add log levels#17
Merged
Conversation
- 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>
Contributor
|
📖 Docs preview: https://maastrich.github.io/hashup/branches/pr-17/ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
node_modulesentirely. Imports that resolve into anode_modulesdirectory are treated as opaque — file never read, imports never walked, zero contribution to the hash. Fixes OOM on large monorepos (bfront).extras. The raw bytes capture every direct/transitive/peer-dep change, no parsers needed.logLevel: "silent" | "warn" | "info" | "debug"toHashupOptions, the CLI (--log-level/-l), andhashup.json. Default silent. The previously-unconditionalconsole.warnon hash failures is now opt-in via--log-level warn.Behavior change
This changes hashes for any project that previously reached into
node_modulesthrough a static import. Minor bump, pre-1.0 semantics.Test plan
tests/skip-node-modules.test.ts— verifies node_modules files are absent fromfiles, hash is stable when a node_modules file is mutated, hash still changes on user-source edits, lockfile-as-extra reintroduces install-tree sensitivitytests/logger.test.ts— level filtering for silent/warn/info/debug, error stack formattingisInNodeModulesunit tests — POSIX and Windows segments, rejects lookalike paths--log-level/-lvp test— 106/106 passingvp checkcleanToaster/index.tsnow hashes cleanly with no warningsDocs
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.jsonregenerated.🤖 Generated with Claude Code