{"_id":"pack-config-diff","name":"pack-config-diff","dist-tags":{"latest":"0.1.0"},"versions":{"0.1.0":{"name":"pack-config-diff","version":"0.1.0","description":"Semantic configuration differ for webpack and rspack projects","keywords":["webpack","rspack","config","diff","compare","configuration"],"license":"MIT","repository":{"type":"git","url":"git+https://github.com/shakacode/pack-config-diff.git"},"main":"./dist/index.js","types":"./dist/index.d.ts","exports":{".":{"types":"./dist/index.d.ts","require":"./dist/index.js","import":"./dist/index.js"}},"bin":{"pack-config-diff":"bin/pack-config-diff"},"engines":{"node":">=16"},"dependencies":{"js-yaml":"^4.1.0"},"peerDependencies":{"ts-node":">=10"},"peerDependenciesMeta":{"ts-node":{"optional":true}},"devDependencies":{"@eslint/js":"^10.0.1","@types/jest":"^29.0.0","@types/js-yaml":"^4.0.0","eslint":"^10.0.3","eslint-config-prettier":"^10.1.8","jest":"^29.0.0","lefthook":"^2.1.4","prettier":"^3.8.1","ts-jest":"^29.0.0","typescript":"^5.0.0","typescript-eslint":"^8.57.1"},"scripts":{"build":"tsc","prepare":"npm run build","hooks:install":"lefthook install","test":"jest","lint":"eslint . && prettier --check .","lint:fix":"eslint --fix . && prettier --write .","prepublishOnly":"npm run build","release":"bash scripts/release.sh","release:dry-run":"bash scripts/release.sh --dry-run"},"_id":"pack-config-diff@0.1.0","gitHead":"fa09c9f218597347287518ccbc89cc4dfe70472b","bugs":{"url":"https://github.com/shakacode/pack-config-diff/issues"},"homepage":"https://github.com/shakacode/pack-config-diff#readme","_nodeVersion":"24.8.0","_npmVersion":"11.6.0","dist":{"integrity":"sha512-gx60G4pnT4GFQ7WECdf7SCq9vdsvBhodLXXzwisy37/t0zkAZ3hMgLCdOGivudF1l0gcLZhIWVYreS89be15QA==","shasum":"c15025e196ff85009806890cca0841e96aaa6a1b","tarball":"https://registry.npmjs.org/pack-config-diff/-/pack-config-diff-0.1.0.tgz","fileCount":64,"unpackedSize":223612,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEUCID81d0+P5Pymw+NJXnshnZVAHE7SiPXRyj3DZUEZnrDEAiEA+6PHWKSF0WuY6NOsy5F3ANGSL5lk3rIL1W4n2RenQms="}]},"_npmUser":{"name":"shakacode-justin","email":"justin@shakacode.com"},"directories":{},"maintainers":[{"name":"shakacode-justin","email":"justin@shakacode.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/pack-config-diff_0.1.0_1775443598652_0.1156304178746721"},"_hasShrinkwrap":false}},"time":{"created":"2026-04-06T02:46:38.517Z","0.1.0":"2026-04-06T02:46:38.792Z","modified":"2026-04-06T02:46:38.981Z"},"maintainers":[{"name":"shakacode-justin","email":"justin@shakacode.com"}],"description":"Semantic configuration differ for webpack and rspack projects","homepage":"https://github.com/shakacode/pack-config-diff#readme","keywords":["webpack","rspack","config","diff","compare","configuration"],"repository":{"type":"git","url":"git+https://github.com/shakacode/pack-config-diff.git"},"bugs":{"url":"https://github.com/shakacode/pack-config-diff/issues"},"license":"MIT","readme":"# pack-config-diff\n\nSemantic configuration tooling for webpack and rspack projects.\n\n`pack-config-diff` supports both:\n\n- `diff`: compare two webpack/rspack **configuration objects** and explain what changed.\n- `dump`: serialize live webpack/rspack configs to YAML/JSON/inspect for review or diffing.\n\nExtracted from [Shakapacker](https://github.com/shakacode/shakapacker), battle-tested in production workflows.\n\n## Why use this?\n\n- Debug \"works in dev, broken in prod\" by comparing two configs side by side\n- Validate webpack -> rspack migration parity\n- Audit config changes before/after dependency upgrades\n- Compare CI vs local bundler behavior\n- Generate PR-ready markdown diff reports\n\n## Install\n\n```bash\nnpm install pack-config-diff\n```\n\n## Contributor setup\n\n```bash\nnpm install\nnpm run hooks:install\n```\n\nRun `npm run hooks:install` once per clone to wire up lefthook locally.\n\n## Quick start\n\n### Compare two configs (`diff`)\n\nThe tool takes two config files (`--left` and `--right`) and shows what's different between them. Config files can be **JavaScript, TypeScript, JSON, or YAML**.\n\n```bash\npack-config-diff --left=webpack.dev.js --right=webpack.prod.js\n```\n\n```text\n================================================================================\nWebpack/Rspack Configuration Comparison\n================================================================================\n\nComparing: webpack.dev.js\n      vs:  webpack.prod.js\n\nFound 4 difference(s): 0 added, 0 removed, 4 changed\n\n================================================================================\n\n1. [~] mode\n\n   What it does:\n   Defines the environment mode (development, production, or none). Controls built-in optimizations and defaults.\n\n   Affects: Minification, tree-shaking, source maps, and performance optimizations\n\n   Values:\n     dev:  \"development\"\n     prod: \"production\"\n\n   Impact: Enabling production optimizations (minification, tree-shaking)\n\n   Documentation: https://webpack.js.org/configuration/mode/\n\n2. [~] output.filename\n\n   What it does:\n   Filename template for entry chunks. Can include [name], [hash], [contenthash].\n\n   Affects: Output filenames and cache busting strategy\n\n   Values:\n     dev:  \"bundle.js\"\n     prod: \"bundle-[contenthash].js\"\n\n   Impact: Cache busting enabled - better long-term caching\n\n   Documentation: https://webpack.js.org/configuration/output/#outputfilename\n\n...\n\n================================================================================\n\nLegend:\n  [+] = Added in prod\n  [-] = Removed from prod\n  [~] = Changed between configs\n```\n\n### Export a live config snapshot (`dump`)\n\n```bash\npack-config-diff dump webpack.config.js --format=yaml --mode=development --output=webpack-development-client.yml\n```\n\n> Security note: `dump` output without `--clean` may include sensitive plugin/env values. Use `--clean` when sharing snapshots.\n> For trusted internal automation, add `--no-warn-sensitive` to suppress the warning.\n> For build-matrix dumps, add `--no-warn-env-label` to suppress only the `NODE_ENV` fallback environment-label note.\n\n### More examples\n\n```bash\n# Quick summary for CI scripts\npack-config-diff --left=dev.json --right=prod.json --format=summary\n# => 3 changes: +1 -0 ~2\n\n# Markdown table for PR comments\npack-config-diff --left=baseline.json --right=current.json --format=markdown\n\n# Ignore plugin noise when comparing JS configs with class instances\npack-config-diff --left=webpack.dev.js --right=webpack.prod.js --plugin-aware\n\n# Evaluate JS/TS function exports with a specific mode\npack-config-diff --left=webpack.dev.js --right=webpack.prod.js --mode=development\n\n# Ignore rule reorder noise\npack-config-diff --left=before.yaml --right=after.yaml --match-rules-by-test\n\n# Focus on specific areas by ignoring paths\npack-config-diff --left=a.json --right=b.json --ignore-paths=\"plugins.*,devServer\"\n\n# Save report to a file\npack-config-diff --left=a.json --right=b.json --format=json --output=report.json\n\n# Dump a config with inline docs (YAML only)\npack-config-diff dump webpack.config.js --annotate\n\n# Dump as JSON with special value placeholders for functions/RegExp/class instances\npack-config-diff dump webpack.config.js --format=json\n\n# Dump with independent mode + metadata environment labels\npack-config-diff dump webpack.config.js --mode=development --environment=staging\n\n# Dump one named build from a build-matrix config\npack-config-diff dump --build=prod --config-file=config/pack-config-diff-builds.yml --save-dir=./config-exports\n\n# Dump every build in the matrix\npack-config-diff dump --all-builds --config-file=config/pack-config-diff-builds.yml\n\n# Keep sensitive warning but suppress build NODE_ENV label note\npack-config-diff dump --build=dev --config-file=config/pack-config-diff-builds.yml --no-warn-env-label\n```\n\n## What can `--left` and `--right` be?\n\nAny file that contains a webpack/rspack configuration object:\n\n| Format         | Extensions      | Notes                                                                                        |\n| -------------- | --------------- | -------------------------------------------------------------------------------------------- |\n| **JavaScript** | `.js`           | Loaded via `require()`. Supports object exports and function exports `(env, argv) => config` |\n| **TypeScript** | `.ts`           | Same as JS, requires `ts-node` as a peer dependency                                          |\n| **JSON**       | `.json`         | A plain JSON object representing the config                                                  |\n| **YAML**       | `.yaml`, `.yml` | Same structure as JSON, just in YAML syntax                                                  |\n\nYou can mix formats: `--left=config.yaml --right=webpack.config.js` works fine.\n\n**YAML and JSON configs** are snapshots of resolved webpack configuration objects — the same data structure that `webpack.config.js` exports, just serialized to a different format. They're useful when you want to compare configs generated by a framework (like Shakapacker), dump configs from CI builds, or store config snapshots in version control.\n\nSee [Input Formats](./docs/input-formats.md) for full details and examples.\n\n## Programmatic API\n\n```javascript\nconst { DiffEngine, DiffFormatter, loadConfigFile, serializeConfig } = require(\"pack-config-diff\");\n\nconst engine = new DiffEngine({ ignorePaths: [\"plugins.*\"] });\nconst result = engine.compare(leftConfig, rightConfig, {\n  leftFile: \"webpack.dev.js\",\n  rightFile: \"webpack.prod.js\",\n});\n\nconst formatter = new DiffFormatter();\nconsole.log(formatter.formatDetailed(result));\n\nconst config = loadConfigFile(\"webpack.config.js\");\nconst output = serializeConfig(\n  config,\n  {\n    exportedAt: new Date().toISOString(),\n    bundler: \"webpack\",\n    environment: \"development\",\n    configType: \"client\",\n    configCount: 1,\n  },\n  { format: \"yaml\" },\n);\nconsole.log(output);\n```\n\nSee [Programmatic API docs](./docs/programmatic-api.md) for full API reference.\n\n## Documentation\n\n- **[Getting Started](./docs/getting-started.md)** — what this tool does and how to use it\n- **[Input Formats](./docs/input-formats.md)** — JS, TS, JSON, and YAML config files explained\n- **[CLI Reference](./docs/cli-reference.md)** — all options and flags\n- **[Output Formats](./docs/output-formats.md)** — detailed, summary, json, yaml, and markdown\n- **[Comparison Modes](./docs/comparison-modes.md)** — plugin-aware mode, rule matching, path normalization\n- **[Programmatic API](./docs/programmatic-api.md)** — using pack-config-diff from Node.js\n- **[Releasing](./docs/releasing.md)** — how to publish new versions\n\n## Maintainer Automation\n\n- **Update changelog for release prep**: `/update-changelog release` (see [.claude/commands/update-changelog.md](./.claude/commands/update-changelog.md))\n- **Run release dry run**: `npm run release:dry-run`\n- **Publish release**: `npm run release` (script: [scripts/release.sh](./scripts/release.sh))\n- **Address PR reviews (Claude command)**: [.claude/commands/address-review.md](./.claude/commands/address-review.md)\n- **Address PR reviews (command mirror)**: [commands/address-review.md](./commands/address-review.md)\n- **Address PR reviews (portable workflow prompt)**: [.agents/workflows/address-review.md](./.agents/workflows/address-review.md)\n\n## Tests\n\n```bash\nnpm test\n```\n\n## License\n\nMIT\n","readmeFilename":"README.md","_rev":"1-dd1f4591d4c82ce1fcd551854967fd61"}