Summary
With markdown-magic@4.8.0, passing dry: true to markdownMagic() does not prevent disk writes. Files are still modified, while the return value reports filesChanged: [] — so a "check"-style invocation silently mutates the files it was auditing.
Root cause
src/index.js derives its dry-run state from opts.dry (used for the return value and logging), but the actual write lives in the comment-block-replacer package, which reads opts.dryRun — a key index.js never sets or forwards. The two halves of the pipeline disagree about which option name means "don't write".
Repro
const { markdownMagic } = require("markdown-magic");
// file.md contains any transform block, e.g. <!-- docs TOC -->...<!-- /docs -->
const result = await markdownMagic(["./file.md"], { dry: true });
console.log(result.filesChanged); // [] — claims nothing changed
// ...but ./file.md has been rewritten on disk
Passing both keys works around it:
await markdownMagic(files, { dry: true, dryRun: true });
Expected
dry: true performs the full transform pipeline in-memory and never touches disk (the per-file results[].isChanged / updatedContents are already populated correctly in that mode once dryRun is also set).
Suggested fix
Forward dry into the replacer's dryRun option (or unify the option name across the packages).
Environment: markdown-magic@4.8.0, comment-block-replacer as resolved by its lockfile, Node 25.
Summary
With markdown-magic@4.8.0, passing
dry: truetomarkdownMagic()does not prevent disk writes. Files are still modified, while the return value reportsfilesChanged: []— so a "check"-style invocation silently mutates the files it was auditing.Root cause
src/index.jsderives its dry-run state fromopts.dry(used for the return value and logging), but the actual write lives in thecomment-block-replacerpackage, which readsopts.dryRun— a keyindex.jsnever sets or forwards. The two halves of the pipeline disagree about which option name means "don't write".Repro
Passing both keys works around it:
Expected
dry: trueperforms the full transform pipeline in-memory and never touches disk (the per-fileresults[].isChanged/updatedContentsare already populated correctly in that mode oncedryRunis also set).Suggested fix
Forward
dryinto the replacer'sdryRunoption (or unify the option name across the packages).Environment: markdown-magic@4.8.0, comment-block-replacer as resolved by its lockfile, Node 25.