[
  {
    "path": ".editorconfig",
    "content": "; http://editorconfig.org\nroot = true\n\n[*]\nindent_style = tab\nend_of_line = lf\ncharset = utf-8\ntrim_trailing_whitespace = true\ninsert_final_newline = true\n\n[{package.json,.travis.yml,.github/**/*.yml}]\nindent_style = space\nindent_size = 2\n"
  },
  {
    "path": ".eslintrc",
    "content": "{\n\t\"extends\": \"@aptoma/eslint-config\",\n\t\"parserOptions\": {\n\t\t\"ecmaVersion\": 9\n\t},\n\t\"env\": {\n\t\t\"node\": true,\n\t\t\"mocha\": true,\n\t\t\"es6\": true\n\t}\n}\n"
  },
  {
    "path": ".github/workflows/nodejs.yml",
    "content": "name: ci\n\non: [pull_request]\n\njobs:\n  build:\n    strategy:\n      matrix:\n        os: [ubuntu-latest]\n        node-version: [18.x, 20.x]\n\n    runs-on: ${{ matrix.os }}\n\n    steps:\n      - uses: actions/checkout@v4\n\n      - name: ${{ matrix.os }} / Node.js ${{ matrix.node-version }}\n        uses: actions/setup-node@v4\n        with:\n          node-version: ${{ matrix.node-version }}\n      - name: npm install, build, and test\n        run: |\n          sudo apt install -y --no-install-recommends graphviz\n          npm i -g npm@9\n          npm ci\n          npm run test\n          npm run debug\n          npm run generate\n"
  },
  {
    "path": ".gitignore",
    "content": "/node_modules\n.DS_Store\n.vscode\n.madgerc\n*.sublime-project\n*.sublime-workspace\n.idea\n"
  },
  {
    "path": ".nvmrc",
    "content": "20\n"
  },
  {
    "path": ".release-it.json",
    "content": "{\n\t\"pkgFiles\": [\"package.json\", \"package-lock.json\"],\n\t\"git\": {\n\t\t\"requireCleanWorkingDir\": false\n\t},\n\t\"hooks\": {\n\t\t\"after:bump\": \"auto-changelog --hide-credit --package\"\n\t}\n}\n"
  },
  {
    "path": "CHANGELOG.md",
    "content": "### Changelog\n\nAll notable changes to this project will be documented in this file. Dates are displayed in UTC.\n\n#### [v8.0.0](https://github.com/pahen/madge/compare/v7.0.0...v8.0.0)\n\n- chore: edit test/output.sh comply with POSIX [`#391`](https://github.com/pahen/madge/pull/391)\n- Update ts-graphviz@2.1.2 and typescript@5.4.4 [`#424`](https://github.com/pahen/madge/pull/424)\n- Remove not required dep on precinct [`#421`](https://github.com/pahen/madge/pull/421)\n- Cleanup README and remove Travis config [`#422`](https://github.com/pahen/madge/pull/422)\n- Correct engine requirements [`#419`](https://github.com/pahen/madge/pull/419)\n- Add tests for Vue [`#418`](https://github.com/pahen/madge/pull/418)\n- Update to dependency-tree@11 [`#417`](https://github.com/pahen/madge/pull/417)\n- Add empty TS config to fix the tests [`0163dc4`](https://github.com/pahen/madge/commit/0163dc469b3a52af423540ea75301d2f6e01b018)\n- Add comment [`3a52fae`](https://github.com/pahen/madge/commit/3a52fae6cf4ad3018c3a8c43be4e361cbf4679ec)\n- Remove integrated npm cache [`e25fa64`](https://github.com/pahen/madge/commit/e25fa6440631af238edafe02706f3a4616862ffa)\n\n### [v7.0.0](https://github.com/pahen/madge/compare/v6.1.0...v7.0.0)\n\n> 8 April 2024\n\n- devDeps: release-it@^15.6.0-&gt;^16.2.1 [`#393`](https://github.com/pahen/madge/pull/393)\n- ci: Run build & test scripts on GitHub Actions [`#394`](https://github.com/pahen/madge/pull/394)\n- chore: bump and align dependencies; dedupe typescript [`#379`](https://github.com/pahen/madge/pull/379)\n- Adding option to not print the circular file count [`#387`](https://github.com/pahen/madge/pull/387)\n- Update README, explaining to how ignore typed imports on .tsx files [`#389`](https://github.com/pahen/madge/pull/389)\n- docs: update README to include ignore dynamic imports FAQ [`#360`](https://github.com/pahen/madge/pull/360)\n- docs: fix donate anchor [`#362`](https://github.com/pahen/madge/pull/362)\n- Release 6.1.0 [`#378`](https://github.com/pahen/madge/pull/378)\n- chore: check in package-lock.json [`2137846`](https://github.com/pahen/madge/commit/2137846544697e3cdad9fb9d3599875f241dcb3d)\n- devDeps: release-it@^16.1.5-&gt;^16.2.1 [`1bcdc12`](https://github.com/pahen/madge/commit/1bcdc12093131b0a92fc9dc76a701cfccdf03867)\n- ci: add build/test workflow for GitHub Actions [`fa34634`](https://github.com/pahen/madge/commit/fa34634e06116572d606e6035f7402a7d276ab6e)\n\n#### [v6.1.0](https://github.com/pahen/madge/compare/v6.0.0...v6.1.0)\n\n> 4 June 2023\n\n- constrain and bump typescript versions [`#376`](https://github.com/pahen/madge/pull/376)\n- Disable spinner when running in CI [`#356`](https://github.com/pahen/madge/pull/356)\n- Remove deploy to NPM from Travis build [`#354`](https://github.com/pahen/madge/pull/354)\n- feat: support for rankdir in CLI [`#311`](https://github.com/pahen/madge/pull/311)\n- Move typescript to peer dependencies [`#350`](https://github.com/pahen/madge/pull/350)\n- Release 6.0.0 [`#352`](https://github.com/pahen/madge/pull/352)\n- Release 6.1.0 [`66bb0c3`](https://github.com/pahen/madge/commit/66bb0c30798b31557d239ca61b2a43ffa6f53fba)\n- install and use ci-info [`c35da47`](https://github.com/pahen/madge/commit/c35da472e7352340209f4537d020b2702f9e67e7)\n- remove ci-info and change isEnabled setting [`a771115`](https://github.com/pahen/madge/commit/a771115ce570c8ea8d4c3ca68300dcfa0b5759ea)\n\n### [v6.0.0](https://github.com/pahen/madge/compare/v5.0.2...v6.0.0)\n\n> 29 January 2023\n\n- Handle collect tsconfig's extends fileds [`#349`](https://github.com/pahen/madge/pull/349)\n- Update packages detective-* to latest [`#348`](https://github.com/pahen/madge/pull/348)\n- chore: bump 'detective-typescript' package to allow newer TS versions [`#321`](https://github.com/pahen/madge/pull/321)\n- Replace to ts-graphviz package [`#341`](https://github.com/pahen/madge/pull/341)\n- chore: bump detective-postcss to v6 [`#319`](https://github.com/pahen/madge/pull/319)\n- Drop support Node.js EOL versions(&lt;14) [`#342`](https://github.com/pahen/madge/pull/342)\n- handle collect tsconfig's extends fileds [`#323`](https://github.com/pahen/madge/issues/323)\n- Changed to depend on the ts-graphviz package [`9b9ae87`](https://github.com/pahen/madge/commit/9b9ae878622be4a58951c5fcb9d46cc0c44e4593)\n- Release 6.0.0 [`2aa75b2`](https://github.com/pahen/madge/commit/2aa75b2aba279d02dd7cf7640a0fcd6236322228)\n- update packages detective-* to latest [`60b6557`](https://github.com/pahen/madge/commit/60b6557efc5a1da04452dfc0f0b1a0281f9c8776)\n\n#### [v5.0.2](https://github.com/pahen/madge/compare/v5.0.1...v5.0.2)\n\n> 27 January 2023\n\n- Add NPM task and docs for creating a release [`#346`](https://github.com/pahen/madge/pull/346)\n- Fix broken link to Travis in README [`#345`](https://github.com/pahen/madge/pull/345)\n- docs: fix subtrees typo in README [`#325`](https://github.com/pahen/madge/pull/325)\n- minor typo in README.md [`#300`](https://github.com/pahen/madge/pull/300)\n- Release 5.0.2 [`614d44d`](https://github.com/pahen/madge/commit/614d44d5f1ab3cc9e9875e67d1e46f4b971d660a)\n- minor typos in README.md [`edc27c8`](https://github.com/pahen/madge/commit/edc27c85c5257df65184fd44c80549ffd0346360)\n- minor type in README.md [`9f5514c`](https://github.com/pahen/madge/commit/9f5514c568aa1d3944a17c459daee93c2948e144)\n\n#### [v5.0.1](https://github.com/pahen/madge/compare/v5.0.0...v5.0.1)\n\n> 23 June 2021\n\n- Fix issue with command line options stopped working [`512c2cb`](https://github.com/pahen/madge/commit/512c2cbfec1db53068e9b805e181ec1b38d30a41)\n- Update README [`8e98136`](https://github.com/pahen/madge/commit/8e98136c5597f87acfa93cdae18c477cbf8a30da)\n\n### [v5.0.0](https://github.com/pahen/madge/compare/v4.0.2...v5.0.0)\n\n> 22 June 2021\n\n- Improve Graphviz support detection [`#274`](https://github.com/pahen/madge/pull/274)\n- Update list of donations [`aa49a0a`](https://github.com/pahen/madge/commit/aa49a0a94fd966be25141c92c75f97d90ad73dc6)\n- Update deps [`820c9b8`](https://github.com/pahen/madge/commit/820c9b827b3ec1c51e454b0ce7ea6f2427f3b6da)\n\n#### [v4.0.2](https://github.com/pahen/madge/compare/v4.0.1...v4.0.2)\n\n> 8 March 2021\n\n- Bump detective-typescript [`e6985d2`](https://github.com/pahen/madge/commit/e6985d25518ea48f816ee007d0bde519ce6a3106)\n\n#### [v4.0.1](https://github.com/pahen/madge/compare/v4.0.0...v4.0.1)\n\n> 5 March 2021\n\n- Fix potential command injection vulnerability [`da5cbc9`](https://github.com/pahen/madge/commit/da5cbc9ab30372d687fa7c324b22af7ffa5c6332)\n\n### [v4.0.0](https://github.com/pahen/madge/compare/v3.12.0...v4.0.0)\n\n> 5 January 2021\n\n- Upgrade dependencies & raise minimum Node.js version [`#269`](https://github.com/pahen/madge/pull/269)\n- Upgrade core dependencies [`fe8a186`](https://github.com/pahen/madge/commit/fe8a186b18a08a6e6f69d49d95f156660f575851)\n- Upgrade commander to version 6 [`5ca410c`](https://github.com/pahen/madge/commit/5ca410c4b4332c67a3104b7e851d0976be78de9e)\n- Require Node.js 10.13 [`eee3dc0`](https://github.com/pahen/madge/commit/eee3dc0540ce3592fbbbada8586cf5b59e5ba33d)\n\n#### [v3.12.0](https://github.com/pahen/madge/compare/v3.11.0...v3.12.0)\n\n> 2 November 2020\n\n- Remove pify again [`#264`](https://github.com/pahen/madge/pull/264)\n- Update ora to version 5 [`#262`](https://github.com/pahen/madge/pull/262)\n- Replace pify with util.promisify [`#263`](https://github.com/pahen/madge/pull/263)\n- Update README [`e4be868`](https://github.com/pahen/madge/commit/e4be868c6c057be3799d8b8fd0c9fa928bbc9b80)\n- Bump dependency-tree to 7.2.2 [`0eaccb7`](https://github.com/pahen/madge/commit/0eaccb728dbdcf36e67850fc89a552361c69a200)\n\n#### [v3.11.0](https://github.com/pahen/madge/compare/v3.10.0...v3.11.0)\n\n> 1 October 2020\n\n- Add support for combining --circular and --dot [`d2ce3f7`](https://github.com/pahen/madge/commit/d2ce3f7ac0dec928eaee37ab8d768d291fa24f84)\n\n#### [v3.10.0](https://github.com/pahen/madge/compare/v3.9.2...v3.10.0)\n\n> 14 September 2020\n\n- Add support for combining --image and --circular [`7a4bd3b`](https://github.com/pahen/madge/commit/7a4bd3be2fbefab3e9468272c912991602360562)\n\n#### [v3.9.2](https://github.com/pahen/madge/compare/v3.9.1...v3.9.2)\n\n> 16 June 2020\n\n- Bump dependencies [`a8e3674`](https://github.com/pahen/madge/commit/a8e367464f5a4bc1586c4a21735691253406ddb4)\n- Downgrade to ESLint 6.8.0 [`bc539af`](https://github.com/pahen/madge/commit/bc539afcda79291b5f694c0b8ab8423356f0d53e)\n\n#### [v3.9.1](https://github.com/pahen/madge/compare/v3.9.0...v3.9.1)\n\n> 8 June 2020\n\n- chore: significant speedup by skipping filing-cabinet ts-config parsing [`#237`](https://github.com/pahen/madge/pull/237)\n- Clarification for mixed projects (with JS and TS) [`#246`](https://github.com/pahen/madge/pull/246)\n\n#### [v3.9.0](https://github.com/pahen/madge/compare/v3.8.0...v3.9.0)\n\n> 7 May 2020\n\n- Remove info about Patreon and Open Collective [`a57eeff`](https://github.com/pahen/madge/commit/a57eeffd27efdf18dbd3d5f941bb23a1aab18f48)\n- Update list of backers [`545be08`](https://github.com/pahen/madge/commit/545be086dec854fd46024cf6a1f6df2c9d710d5e)\n- Update dependencies [`ffa4fdd`](https://github.com/pahen/madge/commit/ffa4fdd64695b22002adaf2add100f1a3da028bc)\n\n#### [v3.8.0](https://github.com/pahen/madge/compare/v3.7.0...v3.8.0)\n\n> 9 March 2020\n\n- Add `leaves` option to show modules that do not have dependencies [`97ed27f`](https://github.com/pahen/madge/commit/97ed27f846f3e53dc127c577e6667f5faf6a814b)\n- Update README [`9c1f7d2`](https://github.com/pahen/madge/commit/9c1f7d2d9a23b42582caebd529cf73753a3226cc)\n- Updated list of donations [`899f15f`](https://github.com/pahen/madge/commit/899f15f1d4b7673d0a7f35b74ae171517eaad5a9)\n\n#### [v3.7.0](https://github.com/pahen/madge/compare/v3.6.0...v3.7.0)\n\n> 30 January 2020\n\n- feat: support package.json config [`#236`](https://github.com/pahen/madge/pull/236)\n- review [`0acebb7`](https://github.com/pahen/madge/commit/0acebb7417ea17a0980630685ee4dfe182fbcdbb)\n- Drop Node.js 8 support [`2cba3e1`](https://github.com/pahen/madge/commit/2cba3e1a93e45b74cf680119e3affffc0feaa695)\n- Drop Node.JS 6 support [`ca3c555`](https://github.com/pahen/madge/commit/ca3c5553e72457d7f96fefa828ef03f6a1cbe0b8)\n\n#### [v3.6.0](https://github.com/pahen/madge/compare/v3.5.1...v3.6.0)\n\n> 11 November 2019\n\n- Add test for TypeScript with mixed import syntax [`50c1c10`](https://github.com/pahen/madge/commit/50c1c10c1e7d369c5e7d1017463451f8d270cdf9)\n- Update deps [`f1125d0`](https://github.com/pahen/madge/commit/f1125d0af5da27510f709a4b8a2e84b45ff5f578)\n\n#### [v3.5.1](https://github.com/pahen/madge/compare/v3.5.0...v3.5.1)\n\n> 7 November 2019\n\n- Add funding to package.json [`8ee9126`](https://github.com/pahen/madge/commit/8ee91265973985eee08b873eff0e5104d48d4f61)\n\n#### [v3.5.0](https://github.com/pahen/madge/compare/v3.4.4...v3.5.0)\n\n> 28 October 2019\n\n- Add an .svg public method to the API [`#171`](https://github.com/pahen/madge/pull/171)\n- Respect graphVizOptions in DOT output [`4edf82a`](https://github.com/pahen/madge/commit/4edf82a3578639972229034aed4ebe1d51ae2bdf)\n- Added credits to README [`9287c3c`](https://github.com/pahen/madge/commit/9287c3c1f1f51ffdb6c27a890c51f32f383b9c5c)\n- Add .svg() in API to export the svg as a Buffer [`d01f6f3`](https://github.com/pahen/madge/commit/d01f6f33a67ecfb7072667b08f6c6550d52a5043)\n\n#### [v3.4.4](https://github.com/pahen/madge/compare/v3.4.3...v3.4.4)\n\n> 12 February 2019\n\n- [Fixes #203] Exclude test folder from npm registry [`#205`](https://github.com/pahen/madge/pull/205)\n- Merge pull request #205 from SethDavenport/chore(exclude-test-folder-from-npm) [`#203`](https://github.com/pahen/madge/issues/203)\n- Add NPM releasing from Travis [`97f060b`](https://github.com/pahen/madge/commit/97f060b1b0f19c6d08b0fc53c24494df7fdd6cdc)\n- Exclude test folder from npm registry [`41f94f2`](https://github.com/pahen/madge/commit/41f94f22f5521bde0523ec7df17fbdf43e587e33)\n\n#### [v3.4.3](https://github.com/pahen/madge/compare/v3.4.2...v3.4.3)\n\n> 17 January 2019\n\n- Add link to my Patreon page in README [`9ee722a`](https://github.com/pahen/madge/commit/9ee722a8d4708f978042c17ffc172409470dfa86)\n- Add info about --orphans to CLI docs [`925c57e`](https://github.com/pahen/madge/commit/925c57efcbe2357f49131e51050107e9ad54eab1)\n- Bump dependency-tree [`c2ce2ac`](https://github.com/pahen/madge/commit/c2ce2ac17888c71aa020ac7da5277535ffaacdac)\n\n#### [v3.4.2](https://github.com/pahen/madge/compare/v3.4.1...v3.4.2)\n\n> 10 January 2019\n\n- Eslint should not be a dev dependency [`3165988`](https://github.com/pahen/madge/commit/316598895e64bbca42654ae263422dba0d365772)\n\n#### [v3.4.1](https://github.com/pahen/madge/compare/v3.4.0...v3.4.1)\n\n> 10 January 2019\n\n- Update eslint (peer dependency for typescript-eslint-parser) [`2e6643a`](https://github.com/pahen/madge/commit/2e6643af90b70cc055e37725942a2177f3e05bdd)\n\n#### [v3.4.0](https://github.com/pahen/madge/compare/v3.3.0...v3.4.0)\n\n> 7 January 2019\n\n- Support .tsx files and specifying a tsconfig [`#193`](https://github.com/pahen/madge/pull/193)\n- README: improve instructions related to Graphviz [`#183`](https://github.com/pahen/madge/pull/183)\n\n#### [v3.3.0](https://github.com/pahen/madge/compare/v3.2.0...v3.3.0)\n\n> 31 October 2018\n\n- Update dependencies & test on Node.js 10 [`#176`](https://github.com/pahen/madge/pull/176)\n- Add --no-spinner option [`b1ad3eb`](https://github.com/pahen/madge/commit/b1ad3eb5d878e31f1f87d99f6b3de713003079c1)\n- Update dependencies [`9b1293e`](https://github.com/pahen/madge/commit/9b1293e4f7c990efd1e58cd9f069bdd3a6b36fb7)\n- Update dev dependencies [`2260b61`](https://github.com/pahen/madge/commit/2260b613ecddb6f623584b82b1a30542b01c90e7)\n\n#### [v3.2.0](https://github.com/pahen/madge/compare/v3.1.1...v3.2.0)\n\n> 26 June 2018\n\n- Plot nodes as boxes [`#165`](https://github.com/pahen/madge/pull/165)\n- Document new graph settings [`c6e742f`](https://github.com/pahen/madge/commit/c6e742f97a065a452445702645ec06c1ea91ea07)\n- aesthetic changes: plot rounded boxes, prefer left to right. [`7a7ed8c`](https://github.com/pahen/madge/commit/7a7ed8c2f9f4f189d0ba1372d30b06fef7e50cc4)\n- fix incorrect hex. 5 -&gt; 6 digits. [`e8e330c`](https://github.com/pahen/madge/commit/e8e330c9f5b70c3d925ec1674c7d62253750196e)\n\n#### [v3.1.1](https://github.com/pahen/madge/compare/v3.1.0...v3.1.1)\n\n> 24 May 2018\n\n#### [v3.1.0](https://github.com/pahen/madge/compare/v3.0.1...v3.1.0)\n\n> 22 May 2018\n\n- Bind all dependencies to latest version [`#161`](https://github.com/pahen/madge/pull/161)\n- Update ora to version 2 [`#155`](https://github.com/pahen/madge/pull/155)\n- Remove mz as a production dependency. Instead use pify for promisifying. [`#154`](https://github.com/pahen/madge/pull/154)\n- Remove package-lock.json [`8fd1859`](https://github.com/pahen/madge/commit/8fd18595a9b8bf28f67c01795b3ed182eb2d4b8d)\n- Bind all dependencies to latest version, It fixes security issue in rc =&gt; deep-extend library. And added .idea project files to gitignore [`147d431`](https://github.com/pahen/madge/commit/147d431e506dac03230fedb2cf12be5a11e79c7d)\n- Use caret ranges for all dependencies [`b0e334a`](https://github.com/pahen/madge/commit/b0e334ac22059edcf3bee059ba075cd1b12da985)\n\n#### [v3.0.1](https://github.com/pahen/madge/compare/v3.0.0...v3.0.1)\n\n> 5 February 2018\n\n- Fix broken link [`#149`](https://github.com/pahen/madge/pull/149)\n- Update deps [`3ba103c`](https://github.com/pahen/madge/commit/3ba103c8afa978b9163e9958d3197b294f9a93ce)\n- Fix issue with short CLI options not working properly [`f73704d`](https://github.com/pahen/madge/commit/f73704dc3bd88fbc6308f1799319825d10251505)\n\n### [v3.0.0](https://github.com/pahen/madge/compare/v2.2.0...v3.0.0)\n\n> 22 January 2018\n\n- chore: upgrade dependency-tree to 6.0.0 to address warning [`#147`](https://github.com/pahen/madge/pull/147)\n- Update dev-dependencies [`#144`](https://github.com/pahen/madge/pull/144)\n- Use caret ranges for all dependencies [`#141`](https://github.com/pahen/madge/pull/141)\n- Update chalk to 2.3.0 [`#140`](https://github.com/pahen/madge/pull/140)\n- Updates dependencies (not dev-dependencies) [`#134`](https://github.com/pahen/madge/pull/134)\n- deps: Update debug to fix security issue [`#130`](https://github.com/pahen/madge/pull/130)\n- Regenerate package-lock.json [`5d26187`](https://github.com/pahen/madge/commit/5d261874f7471cf66898205b83c967401c050fd3)\n- dependency-tree@5.11.1 [`c35174c`](https://github.com/pahen/madge/commit/c35174c39c58ed7a5cf4e9560c1d16407870c4ea)\n- Updat eslint to 4.13.0 and @aptoma/eslint-config to 7.0.1. [`b184021`](https://github.com/pahen/madge/commit/b184021cf758eeffad2eb7f590e218c463e191dc)\n\n#### [v2.2.0](https://github.com/pahen/madge/compare/v2.1.0...v2.2.0)\n\n> 29 August 2017\n\n#### [v2.1.0](https://github.com/pahen/madge/compare/v2.0.0...v2.1.0)\n\n> 26 August 2017\n\n- Support for TypeScript [`#124`](https://github.com/pahen/madge/pull/124)\n- Add tests for TypeScript [`50eb3ca`](https://github.com/pahen/madge/commit/50eb3ca5a884ce7cf23118755b8ed13f2ccf01a1)\n- Center badges in README [`5b981cd`](https://github.com/pahen/madge/commit/5b981cd637787241e119587207ef09a878650136)\n- Create LICENSE [`741cd76`](https://github.com/pahen/madge/commit/741cd761d4d0358022fee20ad3312f5230708603)\n\n### [v2.0.0](https://github.com/pahen/madge/compare/v1.6.0...v2.0.0)\n\n> 15 July 2017\n\n- Add —-orphans to show modules that no one is depending on [`#121`](https://github.com/pahen/madge/pull/121)\n- Fix typo [`#119`](https://github.com/pahen/madge/pull/119)\n- fix typo in `.image()` example [`#113`](https://github.com/pahen/madge/pull/113)\n- Always include file extension [`b6cac48`](https://github.com/pahen/madge/commit/b6cac48c9162736a40e1f6b7aa9dd3a8d225d6da)\n- Fix bug with --extensions not working [`fc4acce`](https://github.com/pahen/madge/commit/fc4acce1517514dc7e34e7a6fb569e83047251b4)\n- Support for Less [`d2d4b96`](https://github.com/pahen/madge/commit/d2d4b96cd160b4bea3d24b8399100a0030158feb)\n\n#### [v1.6.0](https://github.com/pahen/madge/compare/v1.5.0...v1.6.0)\n\n> 8 February 2017\n\n- Show CLI spinner with the currently processed file [`f57480a`](https://github.com/pahen/madge/commit/f57480aaaa4e70e9d9afcab78f425ee0ee6f5754)\n- Add support for dependencyFilter function [`eac8591`](https://github.com/pahen/madge/commit/eac85914a69e8359aca3dd737ff1d6026419f79b)\n- Add script for testing output [`e74df55`](https://github.com/pahen/madge/commit/e74df55c6a5d1f16eda3ef708b1f43bddb7a25d9)\n\n#### [v1.5.0](https://github.com/pahen/madge/compare/v1.4.6...v1.5.0)\n\n> 13 January 2017\n\n- Tweak output colors and error messages [`60d59a6`](https://github.com/pahen/madge/commit/60d59a664dda42d98a4cd7f772afb9acbb38da70)\n- Support running —circular with —-warning [`b8a0371`](https://github.com/pahen/madge/commit/b8a0371c2695dbd4afbade785b87e9be42182ca7)\n- Update changelog [`fa7cc99`](https://github.com/pahen/madge/commit/fa7cc99a09cf4e1af9f9a6664dd57eda1f862fa0)\n\n#### [v1.4.6](https://github.com/pahen/madge/compare/v1.4.5...v1.4.6)\n\n> 9 January 2017\n\n- Update circular dependency check output [`4ec6322`](https://github.com/pahen/madge/commit/4ec6322ec50b5e8bdd16fc0a697fd0f68e803ba7)\n- Update changelog [`d718612`](https://github.com/pahen/madge/commit/d718612b0d00e3bf382a8042ce97aa76fa232de4)\n- Bump dependency-tree [`3bc9689`](https://github.com/pahen/madge/commit/3bc9689c903b2431e0dee3e6796fa23b3bd7886f)\n\n#### [v1.4.5](https://github.com/pahen/madge/compare/v1.4.4...v1.4.5)\n\n> 7 January 2017\n\n- Keep file extension in module paths until we output the graph [`bd980cf`](https://github.com/pahen/madge/commit/bd980cfdbafa1952607df442ca771e68d58a4757)\n- Update changelog [`0492763`](https://github.com/pahen/madge/commit/04927633ce7223980dbbc4818e6e1fbb533737b3)\n\n#### [v1.4.4](https://github.com/pahen/madge/compare/v1.4.3...v1.4.4)\n\n> 4 January 2017\n\n- Add tests for resolving using webpack resolve.root [`8452575`](https://github.com/pahen/madge/commit/8452575bb2ea567593ef1488e6148f96f82acd26)\n- Update changelog [`13648c7`](https://github.com/pahen/madge/commit/13648c709886dfaf8bff1bd4fa24624d12d769ba)\n- Bump dependencies [`c9b1795`](https://github.com/pahen/madge/commit/c9b17951afd7e9caeaa00cd5b61d4ebdd262a937)\n\n#### [v1.4.3](https://github.com/pahen/madge/compare/v1.4.2...v1.4.3)\n\n> 12 October 2016\n\n- Fix bug with CLI —-require-config and --webpack-config not working [`386d710`](https://github.com/pahen/madge/commit/386d71055e263f04cc05779ebd259979c1415b7b)\n- Update changelog [`cc4cb9e`](https://github.com/pahen/madge/commit/cc4cb9ea38f60341b1a57996a52036da1626f9a2)\n- Update changelog [`97ba4c2`](https://github.com/pahen/madge/commit/97ba4c2cb78568766593fabbe89eec738ea4f65d)\n\n#### [v1.4.2](https://github.com/pahen/madge/compare/v1.4.1...v1.4.2)\n\n> 6 October 2016\n\n- Rename —-show-skipped to —-warning [`a2d7c99`](https://github.com/pahen/madge/commit/a2d7c99d9b8e8c04e982a9505e1c95f682f22dc4)\n\n#### [v1.4.1](https://github.com/pahen/madge/compare/v1.4.0...v1.4.1)\n\n> 6 October 2016\n\n- Don’t show warnings about skipped files by default [`2cfa8d7`](https://github.com/pahen/madge/commit/2cfa8d74d7fad3d85225523515a9c36addbe0b3a)\n\n#### [v1.4.0](https://github.com/pahen/madge/compare/v1.3.2...v1.4.0)\n\n> 6 October 2016\n\n- Show skipped files as warnings (disable with —-no-warning) [`#108`](https://github.com/pahen/madge/pull/108)\n- Update changelog [`4cb2c4c`](https://github.com/pahen/madge/commit/4cb2c4c806cfe87db8dabbc32920ac8f539e3dcc)\n\n#### [v1.3.2](https://github.com/pahen/madge/compare/v1.3.1...v1.3.2)\n\n> 3 October 2016\n\n- Bump dependency-tree [`6fb76b2`](https://github.com/pahen/madge/commit/6fb76b2fe29a760b4652edf60724880f10518dda)\n\n#### [v1.3.1](https://github.com/pahen/madge/compare/v1.3.0...v1.3.1)\n\n> 1 October 2016\n\n- Allow to pass options to detectives [`#105`](https://github.com/pahen/madge/pull/105)\n- Bump dependency-tree to 5.7.0 [`d5c5de2`](https://github.com/pahen/madge/commit/d5c5de26c1c12f716d58fb0a780094ea939ed954)\n\n#### [v1.3.0](https://github.com/pahen/madge/compare/v1.2.0...v1.3.0)\n\n> 6 September 2016\n\n- Improve performance on large codebase [`#104`](https://github.com/pahen/madge/pull/104)\n- Cache paths when converting tree for better performance [`fc67d00`](https://github.com/pahen/madge/commit/fc67d0060d3050357f161cf5a86973a53b82910c)\n- Rename commonjs to cjs [`8c56037`](https://github.com/pahen/madge/commit/8c56037570f53ed0c0560fcff391efe05227dc1b)\n- Remove unnecessary mapping of CLI args to config [`93f19da`](https://github.com/pahen/madge/commit/93f19da023ff3ddfd52b89854272555640b3104e)\n\n#### [v1.2.0](https://github.com/pahen/madge/compare/v1.1.0...v1.2.0)\n\n> 1 September 2016\n\n- Add option —-stdin for piping predefined tree [`#103`](https://github.com/pahen/madge/pull/103)\n- Cleanup in tests [`75dce71`](https://github.com/pahen/madge/commit/75dce7194059337163632f284e78c6e4dd795883)\n- Add missing test file [`1ce0c01`](https://github.com/pahen/madge/commit/1ce0c015269b56f32994621226753579ddac2c64)\n\n#### [v1.1.0](https://github.com/pahen/madge/compare/v1.0.0...v1.1.0)\n\n> 23 August 2016\n\n- Fix failing tests on Windows [`#98`](https://github.com/pahen/madge/pull/98)\n- Support for setting custom GraphViz options. Fixes #94 [`#94`](https://github.com/pahen/madge/issues/94)\n- Replace parsers with dependency-tree module [`4be7db2`](https://github.com/pahen/madge/commit/4be7db2f096c6695ac1b8eacfd0095c5fa7ac7fb)\n- Use promises in API [`dbad4b6`](https://github.com/pahen/madge/commit/dbad4b6ba89a05168be8eb702340f9887e1bf46a)\n- Move tree generation to tree.js and add support folders [`07a36ed`](https://github.com/pahen/madge/commit/07a36edb65d84a84096ef3bb7228f4b9448df37d)\n\n### [v1.0.0](https://github.com/pahen/madge/compare/0.6.0...v1.0.0)\n\n> 19 August 2016\n\n- Version 1.0 [`#96`](https://github.com/pahen/madge/pull/96)\n\n#### [0.6.0](https://github.com/pahen/madge/compare/0.5.5...0.6.0)\n\n> 6 July 2016\n\n- Convert classes to ES6. [`8134400`](https://github.com/pahen/madge/commit/8134400915e1e6bef99fc3bceb5c790e7aa2caa7)\n- Convert tests to ES6. [`4a9797e`](https://github.com/pahen/madge/commit/4a9797eac699df69e86d36a12ae92beb28836395)\n- Use ES6 internally. [`6a0e2ca`](https://github.com/pahen/madge/commit/6a0e2ca5838ceb509ba3330fa4031ea1a6f7f7e5)\n\n#### [0.5.5](https://github.com/pahen/madge/compare/0.5.4...0.5.5)\n\n> 3 July 2016\n\n- Fix matching absolute path [`#80`](https://github.com/pahen/madge/pull/80)\n- Support for es6 re-export syntax [`#91`](https://github.com/pahen/madge/pull/91)\n- AMD: Support files with embedded es6 [`#90`](https://github.com/pahen/madge/pull/90)\n- Improve readme circular return object [`#85`](https://github.com/pahen/madge/pull/85)\n- AMD: Support files with embedded es6 (#90) [`#84`](https://github.com/pahen/madge/issues/84)\n- Update code to pass ESLint rules. [`e0866d5`](https://github.com/pahen/madge/commit/e0866d56e6b7dc7112f71616ac22dc7c0d954ea2)\n- Remove react-tools since detective-es6 handles it now. [`b16f946`](https://github.com/pahen/madge/commit/b16f94625846436859ef7a5a5f68545305db509e)\n- Move RequireJS specific code into amd.js [`374d14c`](https://github.com/pahen/madge/commit/374d14c1742a1feba2e6fb7805ab1d510b78d661)\n\n#### [0.5.4](https://github.com/pahen/madge/compare/0.5.3...0.5.4)\n\n> 13 June 2016\n\n- Bump detective-es6 for JSX and ES7 support [`#83`](https://github.com/pahen/madge/pull/83)\n- Don't use sudo to install the package [`#76`](https://github.com/pahen/madge/pull/76)\n- Correct CLI API for mainRequireModule [`#72`](https://github.com/pahen/madge/pull/72)\n- Bump detective-es6 for JSX and ES7 support [`#81`](https://github.com/pahen/madge/issues/81) [`#61`](https://github.com/pahen/madge/issues/61)\n- Update status icons in README. [`61429de`](https://github.com/pahen/madge/commit/61429ded932c32426b20c86552ff5096d715d726)\n- Update releasenotes. [`bf0e987`](https://github.com/pahen/madge/commit/bf0e987b7da6d2d84e142a3cbb5388e7a2e0659c)\n- Bump to version 0.5.4 [`38c40ac`](https://github.com/pahen/madge/commit/38c40ac17d653103187bcc1c5e2512aa3c5b0c4c)\n\n#### [0.5.3](https://github.com/pahen/madge/compare/0.5.2...0.5.3)\n\n> 25 November 2015\n\n- Correct regex on CommonJS parser to detect a core module [`#71`](https://github.com/pahen/madge/pull/71)\n- Update README.md [`#70`](https://github.com/pahen/madge/pull/70)\n- List \"es6\" format in CLI help [`#66`](https://github.com/pahen/madge/pull/66)\n- Update releasenotes. [`153235d`](https://github.com/pahen/madge/commit/153235dba6df0b40b4305c1331fa7856b9a9bd25)\n- Bump to version 0.5.3 [`c00dd70`](https://github.com/pahen/madge/commit/c00dd70f684cb71c651a7e57eeeb89728cb9434c)\n- Correct regex on CJS parser to detect a core module [`67a449a`](https://github.com/pahen/madge/commit/67a449a276d250950dd839ffb37bb2b9bb7a82bd)\n\n#### [0.5.2](https://github.com/pahen/madge/compare/0.5.1...0.5.2)\n\n> 16 October 2015\n\n- Update resolve to latest version. [`21f787c`](https://github.com/pahen/madge/commit/21f787ced85df3002508a1de4fc3b4fe23fbfc06)\n- Bump to version 0.5.2 [`95faed0`](https://github.com/pahen/madge/commit/95faed027d21af80e58697588f061787b2f8592f)\n\n#### [0.5.1](https://github.com/pahen/madge/compare/0.5.0...0.5.1)\n\n> 15 October 2015\n\n- Update modules without any change to the code [`#65`](https://github.com/pahen/madge/pull/65)\n- Update all dependencies that will not break tests [`65dcaf3`](https://github.com/pahen/madge/commit/65dcaf318defa3140222c9774b35d51373bd5aa1)\n- Update shrinkwrap [`08ad266`](https://github.com/pahen/madge/commit/08ad266ea7e922762798b5a5bacc103c7d6b9762)\n- Update releasenotes. [`774f8d8`](https://github.com/pahen/madge/commit/774f8d855bf77da0211df97c97b97dc2d44cab69)\n\n#### [0.5.0](https://github.com/pahen/madge/compare/0.4.1...0.5.0)\n\n> 2 April 2015\n\n- Add 'comma separated' to -p usage for clarity [`#49`](https://github.com/pahen/madge/pull/49)\n- Add ES6 module support [`d5b0b60`](https://github.com/pahen/madge/commit/d5b0b60cff78aa473e60cf81322a9cfc716643a4)\n- Use npm-shrinkwrap instead of “npm shrinkwrap” to get consistent “resolved” fields. [`082abcb`](https://github.com/pahen/madge/commit/082abcb83a34aec2db0edeb728b85cf2e0be2e0b)\n- Cleanup after PL. [`a0d18ff`](https://github.com/pahen/madge/commit/a0d18ffdf8530ca10ebc6ab8e4e86f160b4b524c)\n\n#### [0.4.1](https://github.com/pahen/madge/compare/0.4.0...0.4.1)\n\n> 19 December 2014\n\n- Move method to proper file. [`f17a64a`](https://github.com/pahen/madge/commit/f17a64ae0f1c1e506a99fe739b2bc4a6ef2013cc)\n- Fix bug with absolute paths for module IDs in Windows. [`f64697a`](https://github.com/pahen/madge/commit/f64697a25718ca16e5af5aa21594cfd98bc23701)\n- Fix issues with absolute paths for modules IDs in Windows (all tests should now pass on Windows too). [`9d524e4`](https://github.com/pahen/madge/commit/9d524e4cc044533029ca6a67e1fba1fac1532984)\n\n#### [0.4.0](https://github.com/pahen/madge/compare/0.3.5...0.4.0)\n\n> 19 December 2014\n\n- Update NPM shrinkwrap file. [`a23178c`](https://github.com/pahen/madge/commit/a23178c990c87556e2f126a548005ce2a8f35b37)\n- Resolve the module IDs from the RequireJS paths-config properly. [`41b54e2`](https://github.com/pahen/madge/commit/41b54e2ecde61972ea1f2dfd1a75904ec1029d5a)\n- Add support for JSX (React) and additional module paths. [`858cd72`](https://github.com/pahen/madge/commit/858cd7290d87477ada8b588d85c93f32a6b932e9)\n\n#### [0.3.5](https://github.com/pahen/madge/compare/0.3.3...0.3.5)\n\n> 22 September 2014\n\n- IMPROVED: correctly detect circular dependencies when using path aliases (amd) [`324b12b`](https://github.com/pahen/madge/commit/324b12b7a04c7f3bfd431b057e1487e6cf0e6442)\n- Clear generated graph nodes on each render of a graph. [`4bd4f00`](https://github.com/pahen/madge/commit/4bd4f0035ea2989e7c59249d0ef54be762fbaad5)\n- Update releasenotes. [`d3df3ab`](https://github.com/pahen/madge/commit/d3df3ab7e22234a21a229296811c8171ee3beefb)\n\n#### [0.3.3](https://github.com/pahen/madge/compare/0.3.2...0.3.3)\n\n> 11 July 2014\n\n- Use path.resolve() to resolve relative paths in AMD dependencies instead of substack’s resolve lib since it works as expected (fixes #33). [`#33`](https://github.com/pahen/madge/issues/33)\n- Use amdetective infavor of parse.js for parsing AMD dependencies. [`28e462d`](https://github.com/pahen/madge/commit/28e462d6a016f5b44aa1324392532073d8442005)\n- Bump to version 0.3.3 [`dc35cf4`](https://github.com/pahen/madge/commit/dc35cf45fa7bacc23f31c5cd0cc5888806624ddc)\n\n#### [0.3.2](https://github.com/pahen/madge/compare/0.3.1...0.3.2)\n\n> 25 June 2014\n\n- convert spaces to tabs [`#30`](https://github.com/pahen/madge/pull/30)\n- Code cleanup. [`a235a00`](https://github.com/pahen/madge/commit/a235a0074ba9fb3ca7e6a02aedc6d96c40c8ad5b)\n- Added failing test cases. [`d095e6a`](https://github.com/pahen/madge/commit/d095e6af71093c16ed0ba704a11f8eed05f76912)\n- Added code to pass the tests. [`b2276f5`](https://github.com/pahen/madge/commit/b2276f5fc8a121d87d9d38a94b5a894e5103d7dc)\n\n#### [0.3.1](https://github.com/pahen/madge/compare/0.3.0...0.3.1)\n\n> 3 June 2014\n\n- Apply exclude to RequireJS shim dependencies [`02f3d28`](https://github.com/pahen/madge/commit/02f3d28f26af12d0b0ade3c56df42451161b3882)\n- Update releasenotes. [`8dd4fb2`](https://github.com/pahen/madge/commit/8dd4fb2168c357e9ccdfabe68c5d62b13e654c26)\n- Bump to version 0.3.1 [`c41987b`](https://github.com/pahen/madge/commit/c41987b0ad5c952af9554552bcbbddb87139b2e6)\n\n#### [0.3.0](https://github.com/pahen/madge/compare/0.2.0...0.3.0)\n\n> 26 May 2014\n\n- Lock down dependencies. [`9dcc9b7`](https://github.com/pahen/madge/commit/9dcc9b71348b733aad12e5373f9955158d085509)\n- make pluggbable by adding onParseFile and onAddModule options that hook into these events with returned madge as the bound context [`ee04d41`](https://github.com/pahen/madge/commit/ee04d418a0cfc61cffbf210edd60129ca609be98)\n- Add some documentation about onParseFile and onAddModule options. [`dfa9c2b`](https://github.com/pahen/madge/commit/dfa9c2b4491bd34e6444b0f602bc329eb6c80639)\n\n#### 0.2.0\n\n> 18 April 2014\n\n- Update README.md [`#13`](https://github.com/pahen/madge/pull/13)\n- Using require() to get version number instead of version.js [`#11`](https://github.com/pahen/madge/pull/11)\n- Complete path in circular dependencies is now printed (and marked as red in image graphs). Fixes #4 [`#4`](https://github.com/pahen/madge/issues/4)\n- Fixed Node.js v0.8 issues. Closes #2 [`#2`](https://github.com/pahen/madge/issues/2)\n- first commit [`c730a52`](https://github.com/pahen/madge/commit/c730a52ac6eb49c7a5813146c42ef9861c364aee)\n- Added support for CoffeeScript. Files with extension .coffee will automatically be compiled on-the-fly. [`67fa4ec`](https://github.com/pahen/madge/commit/67fa4ec53d2ae2a85ed0c83ea656dd20364f7f03)\n- Some code cleanup. [`d976942`](https://github.com/pahen/madge/commit/d9769421ad0aa8e5a3109158f33ce80ea926881b)\n"
  },
  {
    "path": "LICENSE",
    "content": "MIT License\n\nCopyright (c) 2017 Patrik Henningsson\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof this software and associated documentation files (the \"Software\"), to deal\nin the Software without restriction, including without limitation the rights\nto use, copy, modify, merge, publish, distribute, sublicense, and/or sell\ncopies of the Software, and to permit persons to whom the Software is\nfurnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in all\ncopies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\nOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\nSOFTWARE.\n"
  },
  {
    "path": "README.md",
    "content": "<p align=\"center\">\n  <img alt=\"madge\" src=\"http://pahen.github.io/madge/logo.svg\" width=\"320\">\n</p>\n\n<p align=\"center\">\n  <img alt=\"Last version\" src=\"https://img.shields.io/github/tag/pahen/madge.svg?style=flat-square\" />\n  <a href=\"https://www.npmjs.org/package/madge\">\n    <img alg=\"NPM Status\" src=\"http://img.shields.io/npm/dm/madge.svg?style=flat-square\" />\n  </a>\n  <a href=\"https://paypal.me/pahen\" target=\"_blank\">\n    <img alt=\"Donate\" src=\"https://img.shields.io/badge/donate-paypal-blue.svg?style=flat-square\" />\n  </a>\n</p>\n\n**Madge** is a developer tool for generating a visual graph of your module dependencies, finding circular dependencies, and giving you other useful info. Joel Kemp's awesome [dependency-tree](https://github.com/mrjoelkemp/node-dependency-tree) is used for extracting the dependency tree.\n\n* Works for JavaScript (AMD, CommonJS, and ES6 modules)\n* Also works for CSS preprocessors (Sass, Stylus, and Less)\n* NPM installed dependencies are excluded by default (can be enabled)\n* All core Node.js modules (assert, path, fs, etc) are excluded\n* Will traverse child dependencies automatically\n\nRead the [changelog](CHANGELOG.md) for latest changes.\n\n> I've worked with Madge on my free time for the last couple of years and it's been a great experience. It started as an experiment but turned out to be a very useful tool for many developers. I have many ideas for the project and it would definitely be easier to dedicate more time to it with some [financial support](#donations-%EF%B8%8F) 🙏\n>\n> Regardless of your contribution, thanks for your support!\n\n## Examples\n\n> Graph generated from madge's own code and dependencies.\n\n<a href=\"http://pahen.github.io/madge/madge.svg\">\n  <img alt=\"graph\" src=\"http://pahen.github.io/madge/madge.svg\" width=\"888\"/>\n</a>\n\n> A graph with circular dependencies. Blue has dependencies, green has no dependencies, and red has circular dependencies.\n\n<a href=\"http://pahen.github.io/madge/simple.svg\">\n  <img alt=\"graph-circular\" src=\"http://pahen.github.io/madge/simple.svg\" width=\"300\"/>\n</a>\n\n## See it in action\n\n<a href=\"https://asciinema.org/a/l9tM7lIraCpmzH0rdWw2KLrMc?autoplay=1\">\n  <img alt=\"in-action\" src=\"https://asciinema.org/a/l9tM7lIraCpmzH0rdWw2KLrMc.png\" width=\"590\"/>\n</a>\n\n# Installation\n\n```sh\nnpm -g install madge\n```\n\n## Graphviz (optional)\n\n> [Graphviz](http://www.graphviz.org/) is only required if you want to generate visual graphs (e.g. in SVG or DOT format).\n\n### Mac OS X\n\n```sh\nbrew install graphviz || port install graphviz\n```\n\n### Ubuntu\n\n```sh\napt-get install graphviz\n```\n\n# API\n\n## madge(path: string|array|object, config: object)\n\n> `path` is a single file or directory, or an array of files/directories to read. A predefined tree can also be passed in as an object.\n\n> `config` is optional and should be the [configuration](#configuration) to use.\n\n> Returns a `Promise` resolved with the Madge instance object.\n\n## Functions\n\n#### .obj()\n\n> Returns an `Object` with all dependencies.\n\n```javascript\nconst madge = require('madge');\n\nmadge('path/to/app.js').then((res) => {\n\tconsole.log(res.obj());\n});\n```\n\n#### .warnings()\n\n> Returns an `Object` of warnings.\n\n```javascript\nconst madge = require('madge');\n\nmadge('path/to/app.js').then((res) => {\n\tconsole.log(res.warnings());\n});\n```\n\n#### .circular()\n\n> Returns an `Array` of all modules that have circular dependencies.\n\n```javascript\nconst madge = require('madge');\n\nmadge('path/to/app.js').then((res) => {\n\tconsole.log(res.circular());\n});\n```\n\n#### .circularGraph()\n\n> Returns an `Object` with only circular dependencies.\n\n```javascript\nconst madge = require('madge');\n\nmadge('path/to/app.js').then((res) => {\n\tconsole.log(res.circularGraph());\n});\n```\n\n#### .depends()\n\n> Returns an `Array` of all modules that depend on a given module.\n\n```javascript\nconst madge = require('madge');\n\nmadge('path/to/app.js').then((res) => {\n\tconsole.log(res.depends('lib/log.js'));\n});\n```\n\n#### .orphans()\n\n> Return an `Array` of all modules that no one is depending on.\n\n```javascript\nconst madge = require('madge');\n\nmadge('path/to/app.js').then((res) => {\n\tconsole.log(res.orphans());\n});\n```\n\n#### .leaves()\n\n> Return an `Array` of all modules that have no dependencies.\n\n```javascript\nconst madge = require('madge');\n\nmadge('path/to/app.js').then((res) => {\n\tconsole.log(res.leaves());\n});\n```\n\n#### .dot([circularOnly: boolean])\n\n> Returns a `Promise` resolved with a DOT representation of the module dependency graph. Set `circularOnly` to only include circular dependencies.\n\n```javascript\nconst madge = require('madge');\n\nmadge('path/to/app.js')\n\t.then((res) => res.dot())\n\t.then((output) => {\n\t\tconsole.log(output);\n\t});\n```\n\n#### .image(imagePath: string, [circularOnly: boolean])\n\n> Write the graph as an image to the given image path. Set `circularOnly` to only include circular dependencies. The [image format](http://www.graphviz.org/content/output-formats) to use is determined from the file extension. Returns a `Promise` resolved with a full path to the written image.\n\n```javascript\nconst madge = require('madge');\n\nmadge('path/to/app.js')\n\t.then((res) => res.image('path/to/image.svg'))\n\t.then((writtenImagePath) => {\n\t\tconsole.log('Image written to ' + writtenImagePath);\n\t});\n```\n\n#### .svg()\n\n> Return a `Promise` resolved with the XML SVG representation of the dependency graph as a `Buffer`.\n\n```javascript\nconst madge = require('madge');\n\nmadge('path/to/app.js')\n\t.then((res) => res.svg())\n\t.then((output) => {\n\t\tconsole.log(output.toString());\n\t});\n```\n\n# Configuration\n\nProperty | Type | Default | Description\n--- | --- | --- | ---\n`baseDir` | String | null | Base directory to use instead of the default\n`includeNpm` | Boolean | false | If shallow NPM modules should be included\n`fileExtensions` | Array | ['js'] | Valid file extensions used to find files in directories\n`excludeRegExp` | Array | false | An array of RegExp for excluding modules\n`requireConfig` | String | null | RequireJS config for resolving aliased modules\n`webpackConfig` | String | null | Webpack config for resolving aliased modules\n`tsConfig` | String\\|Object | null | TypeScript config for resolving aliased modules - Either a path to a tsconfig file or an object containing the config\n`layout` | String | dot | Layout to use in the graph\n`rankdir` | String | LR | Sets the [direction](https://graphviz.gitlab.io/_pages/doc/info/attrs.html#d:rankdir) of the graph layout\n`fontName` | String | Arial | Font name to use in the graph\n`fontSize` | String | 14px | Font size to use in the graph\n`backgroundColor` | String | #000000 | Background color for the graph\n`nodeShape` | String | box | A string specifying the [shape](https://graphviz.gitlab.io/_pages/doc/info/attrs.html#k:shape) of a node in the graph\n`nodeStyle` | String | rounded | A string specifying the [style](https://graphviz.gitlab.io/_pages/doc/info/attrs.html#k:style) of a node in the graph\n`nodeColor` | String | #c6c5fe | Default node color to use in the graph\n`noDependencyColor` | String | #cfffac | Color to use for nodes with no dependencies\n`cyclicNodeColor` | String | #ff6c60 | Color to use for circular dependencies\n`edgeColor` | String | #757575 | Edge color to use in the graph\n`graphVizOptions` | Object | false | Custom Graphviz [options](https://graphviz.gitlab.io/_pages/doc/info/attrs.html)\n`graphVizPath` | String | null | Custom Graphviz path\n`detectiveOptions` | Object | false | Custom `detective` options for [dependency-tree](https://github.com/dependents/node-dependency-tree) and [precinct](https://github.com/dependents/node-precinct#usage)\n`dependencyFilter` | Function | false | Function called with a dependency filepath (exclude subtrees by returning false)\n\nYou can use configuration file either in `.madgerc` in your project or home folder or directly in `package.json`. Look [here](https://github.com/dominictarr/rc#standards) for alternative locations for the file.\n\n> .madgerc\n\n```json\n{\n  \"fontSize\": \"10px\",\n  \"graphVizOptions\": {\n    \"G\": {\n      \"rankdir\": \"LR\"\n    }\n  }\n}\n```\n\n> package.json\n\n```json\n{\n  \"name\": \"foo\",\n  \"version\": \"0.0.1\",\n  ...\n  \"madge\": {\n    \"fontSize\": \"10px\",\n    \"graphVizOptions\": {\n      \"G\": {\n        \"rankdir\": \"LR\"\n      }\n    }\n  }\n}\n```\n\n# CLI\n\n## Examples\n\n> List dependencies from a single file\n\n```sh\nmadge path/src/app.js\n```\n\n> List dependencies from multiple files\n\n```sh\nmadge path/src/foo.js path/src/bar.js\n```\n\n> List dependencies from all *.js files found in a directory\n\n```sh\nmadge path/src\n```\n\n> List dependencies from multiple directories\n\n```sh\nmadge path/src/foo path/src/bar\n```\n\n> List dependencies from all \\*.js and \\*.jsx files found in a directory\n\n```sh\nmadge --extensions js,jsx path/src\n```\n\n> Finding circular dependencies\n\n```sh\nmadge --circular path/src/app.js\n```\n\n> Show modules that depends on a given module\n\n```sh\nmadge --depends wheels.js path/src/app.js\n```\n\n> Show modules that no one is depending on\n\n```sh\nmadge --orphans path/src/\n```\n\n> Show modules that have no dependencies\n\n```sh\nmadge --leaves path/src/\n```\n\n> Excluding modules\n\n```sh\nmadge --exclude '^(foo|bar)\\.js$' path/src/app.js\n```\n\n> Save graph as a SVG image (requires [Graphviz](#graphviz-optional))\n\n```sh\nmadge --image graph.svg path/src/app.js\n```\n\n> Save graph with only circular dependencies\n\n```sh\nmadge --circular --image graph.svg path/src/app.js\n```\n\n> Save graph as a [DOT](http://en.wikipedia.org/wiki/DOT_language) file for further processing (requires [Graphviz](#graphviz-optional))\n\n```sh\nmadge --dot path/src/app.js > graph.gv\n```\n\n> Using pipe to transform tree (this example will uppercase all paths)\n\n```sh\nmadge --json path/src/app.js | tr '[a-z]' '[A-Z]' | madge --stdin\n```\n\n# Debugging\n\n> To enable debugging output if you encounter problems, run madge with the `--debug` option then throw the result in a gist when creating issues on GitHub.\n\n```sh\nmadge --debug path/src/app.js\n```\n\n# Running tests\n\n```sh\nnpm install\nnpm test\n```\n\n# Creating a release\n\n```sh\nnpm run release\n```\n\n# FAQ\n\n## Missing dependencies?\n\nIt could happen that the files you're not seeing have been skipped due to errors or that they can't be resolved. Run madge with the `--warning` option to see skipped files. If you need even more info run with the `--debug` option.\n\n## Using both Javascript and Typescript in your project?\n\nMadge uses [dependency-tree](https://www.npmjs.com/package/dependency-tree) which uses [filing-cabinet](https://www.npmjs.com/package/filing-cabinet) to resolve modules. However it requires configurations for each file type (js/jsx) and (ts/tsx). So provide both `webpackConfig` and `tsConfig` options to madge.\n\n## Using mixed import syntax in the same file?\n\nOnly one syntax is used by default. You can use both though if you're willing to take the degraded performance. Put this in your madge config to enable mixed imports.\n\nFor ES6 + CommonJS:\n\n```json\n{\n  \"detectiveOptions\": {\n    \"es6\": {\n      \"mixedImports\": true\n    }\n  }\n}\n```\n\nFor TypeScript + CommonJS:\n\n```json\n{\n  \"detectiveOptions\": {\n    \"ts\": {\n      \"mixedImports\": true\n    }\n  }\n}\n```\n\n## How to ignore `import type` statements in ES6 + Flow?\n\nPut this in your madge config.\n\n```json\n{\n  \"detectiveOptions\": {\n    \"es6\": {\n      \"skipTypeImports\": true\n    }\n  }\n}\n```\n\n## How to ignore `import` in type annotations in TypeScript?\n\nPut this in your madge config.\n\n```json\n{\n  \"detectiveOptions\": {\n    \"ts\": {\n      \"skipTypeImports\": true\n    }\n  }\n}\n```\n\n## How to ignore dynamic imports in Typescript?\n\nPut this in your madge config.\n\n```json\n{\n  \"detectiveOptions\": {\n    \"ts\": {\n      \"skipAsyncImports\": true\n    },\n    \"tsx\": {\n      \"skipAsyncImports\": true\n    }\n  }\n}\n```\n\nNote: `tsx` is optional, use this when working with JSX.\n\n## Mixing TypesScript and Javascript imports?\n\nEnsure you have this in your `.tsconfig` file.\n\n```json\n{\n  \"compilerOptions\": {\n    \"module\": \"commonjs\",\n    \"allowJs\": true\n  }\n}\n```\n\n## What's the \"Error: write EPIPE\" when exporting graph to image?\n\nEnsure you have [installed Graphviz](#graphviz-optional). If you're running Windows, note that Graphviz is not added to the `PATH` variable during install. You should add the folder of `gvpr.exe` (typically `%Graphviz_folder%/bin`) to the `PATH` variable manually.\n\n## How do I fix the \"Graphviz not built with triangulation library\" error when using sfdp layout?\n\nHomebrew doesn't include GTS by default. Fix this by doing:\n\n```sh\nbrew uninstall graphviz\nbrew install gts\nbrew install graphviz\n```\n\n## The image produced by madge is very hard to read, what's wrong?\n\nTry running madge with a different layout, here's a list of the ones you can try:\n\n* **dot** \"hierarchical\" or layered drawings of directed graphs. This is the default tool to use if edges have directionality.\n\n* **neato** \"spring model'' layouts.  This is the default tool to use if the graph is not too large (about 100 nodes) and you don't know anything else about it. Neato attempts to\nminimize a global energy function, which is equivalent to statistical multi-dimensional scaling.\n\n* **fdp** \"spring model'' layouts similar to those of neato, but does this by reducing forces rather than working with energy.\n\n* **sfdp** multiscale version of fdp for the layout of large graphs.\n\n* **twopi** radial layouts, after Graham Wills 97. Nodes are placed on concentric circles depending their distance from a given root node.\n\n* **circo** circular layout, after Six and Tollis 99, Kauffman and Wiese 02. This is suitable for certain diagrams of multiple cyclic structures, such as certain telecommunications networks.\n\n# Credits\n\n## Contributors\n\nThis project exists thanks to all the people who contribute.\n<a href=\"https://github.com/pahen/madge/graphs/contributors\">\n  <img src=\"https://opencollective.com/madge/contributors.svg?width=890&button=false\" alt=\"Contributors\"/>\n</a>\n\n## Donations ❤️\n\nThanks to the awesome people below for making donations! 🙏[Donate](https://paypal.me/pahen)\n\n<p>\n  <a href=\"https://github.com/BeroBurny\" target=\"_blank\">\n    <div><b>Bernard Stojanović</b> (24 Mars, 2021)</div>\n    <img alt=\"BeroBurny\" src=\"https://github.com/BeroBurny.png\" width=\"64\"/>\n  </a>\n</p>\n\n<p>\n  <a href=\"https://github.com/olejorgenb\" target=\"_blank\">\n    <div><b>Ole Jørgen Brønner</b> (Oct 8, 2020)</div>\n    <img alt=\"olejorgenb\" src=\"https://github.com/olejorgenb.png\" width=\"64\"/>\n  </a>\n</p>\n\n<p>\n  <a href=\"https://github.com/pubkey/rxdb\" target=\"_blank\">\n    <div><b>RxDB</b> (Apr 1, 2020)</div>\n    <img alt=\"RxDB\" src=\"https://cdn.rawgit.com/pubkey/rxdb/ba7c9b80/docs/files/logo/logo_text.svg\" width=\"128\" style=\"margin: -4px -10px\"/>\n  </a>\n</p>\n\n<p>\n  <a href=\"https://github.com/Ziriax\" target=\"_blank\">\n    <div><b>Peter Verswyvelen</b> (Feb 24, 2020)</div>\n    <img alt=\"Ziriax\" src=\"https://github.com/Ziriax.png\" width=\"64\"/>\n  </a>\n</p>\n\n<p>\n  <a href=\"https://github.com/landonalder\" target=\"_blank\">\n    <div><b>Landon Alder</b> (Mar 19, 2019)</div>\n    <img alt=\"landonalder\" src=\"https://github.com/landonalder.png\" width=\"64\"/>\n  </a>\n</p>\n\n# License\n\nMIT License\n"
  },
  {
    "path": "bin/cli.js",
    "content": "#!/usr/bin/env node\n'use strict';\n\nconst path = require('path');\nconst process = require('process');\nconst program = require('commander');\nconst rc = require('rc')('madge');\nconst version = require('../package.json').version;\nconst ora = require('ora');\nconst chalk = require('chalk');\nconst startTime = Date.now();\n\n// Revert https://github.com/tj/commander.js/pull/1409\nprogram.storeOptionsAsProperties();\n\nprogram\n\t.version(version)\n\t.usage('[options] <src...>')\n\t.option('-b, --basedir <path>', 'base directory for resolving paths')\n\t.option('-s, --summary', 'show dependency count summary')\n\t.option('-c, --circular', 'show circular dependencies')\n\t.option('-d, --depends <name>', 'show module dependents')\n\t.option('-x, --exclude <regexp>', 'exclude modules using RegExp')\n\t.option('-j, --json', 'output as JSON')\n\t.option('-i, --image <file>', 'write graph to file as an image')\n\t.option('-l, --layout <name>', 'layout engine to use for graph (dot/neato/fdp/sfdp/twopi/circo)')\n\t.option('--orphans', 'show modules that no one is depending on')\n\t.option('--leaves', 'show modules that have no dependencies')\n\t.option('--dot', 'show graph using the DOT language')\n\t.option('--rankdir <direction>', 'set the direction of the graph layout')\n\t.option('--extensions <list>', 'comma separated string of valid file extensions')\n\t.option('--require-config <file>', 'path to RequireJS config')\n\t.option('--webpack-config <file>', 'path to webpack config')\n\t.option('--ts-config <file>', 'path to typescript config')\n\t.option('--include-npm', 'include shallow NPM modules', false)\n\t.option('--no-color', 'disable color in output and image', false)\n\t.option('--no-spinner', 'disable progress spinner', false)\n\t.option('--no-count', 'disable circular dependencies counting', false)\n\t.option('--stdin', 'read predefined tree from STDIN', false)\n\t.option('--warning', 'show warnings about skipped files', false)\n\t.option('--debug', 'turn on debug output', false)\n\t.parse(process.argv);\n\nif (!program.args.length && !program.stdin) {\n\tconsole.log(program.helpInformation());\n\tprocess.exit(1);\n}\n\nif (program.debug) {\n\tprocess.env.DEBUG = '*';\n}\n\nif (!program.color) {\n\tprocess.env.DEBUG_COLORS = false;\n}\n\nconst log = require('../lib/log');\nconst output = require('../lib/output');\nconst madge = require('../lib/api');\n\nlet packageConfig = {};\ntry {\n\tpackageConfig = require(path.join(process.cwd(), 'package.json')).madge;\n} catch (e) { }\nconst config = Object.assign(rc, packageConfig);\n\nprogram.options.forEach((opt) => {\n\tconst name = opt.name();\n\n\tif (program[name]) {\n\t\tconfig[name] = program[name];\n\t}\n});\n\nconst spinner = ora({\n\ttext: 'Finding files',\n\tcolor: 'white',\n\tinterval: 100000,\n\tisEnabled: program.spinner === 'false' ? false : null\n});\n\nlet exitCode = 0;\n\ndelete config._;\ndelete config.config;\ndelete config.configs;\n\nif (rc.config) {\n\tlog('using runtime config %s', rc.config);\n}\n\nif (program.basedir) {\n\tconfig.baseDir = program.basedir;\n}\n\nif (program.exclude) {\n\tconfig.excludeRegExp = [program.exclude];\n}\n\nif (program.extensions) {\n\tconfig.fileExtensions = program.extensions.split(',').map((s) => s.trim());\n}\n\nif (program.requireConfig) {\n\tconfig.requireConfig = program.requireConfig;\n}\n\nif (program.webpackConfig) {\n\tconfig.webpackConfig = program.webpackConfig;\n}\n\nif (program.tsConfig) {\n\tconfig.tsConfig = program.tsConfig;\n}\n\nif (program.includeNpm) {\n\tconfig.includeNpm = program.includeNpm;\n}\n\nif (!program.color) {\n\tconfig.backgroundColor = '#ffffff';\n\tconfig.nodeColor = '#000000';\n\tconfig.noDependencyColor = '#000000';\n\tconfig.cyclicNodeColor = '#000000';\n\tconfig.edgeColor = '#757575';\n}\n\nif (program.rankdir) {\n\tconfig.rankdir = program.rankdir;\n}\n\nfunction dependencyFilter() {\n\tlet prevFile;\n\n\treturn (dependencyFilePath, traversedFilePath, baseDir) => {\n\t\tif (prevFile !== traversedFilePath) {\n\t\t\tconst relPath = path.relative(baseDir, traversedFilePath);\n\t\t\tconst dir = path.dirname(relPath) + '/';\n\t\t\tconst file = path.basename(relPath);\n\n\t\t\tspinner.text = chalk.grey(dir) + chalk.cyan(file);\n\n\t\t\tprevFile = traversedFilePath;\n\t\t}\n\t};\n}\n\nnew Promise((resolve, reject) => {\n\tif (program.stdin) {\n\t\tlet buffer = '';\n\n\t\tprocess.stdin\n\t\t\t.resume()\n\t\t\t.setEncoding('utf8')\n\t\t\t.on('data', (chunk) => {\n\t\t\t\tbuffer += chunk;\n\t\t\t})\n\t\t\t.on('end', () => {\n\t\t\t\ttry {\n\t\t\t\t\tresolve(JSON.parse(buffer));\n\t\t\t\t} catch (e) {\n\t\t\t\t\treject(e);\n\t\t\t\t}\n\t\t\t});\n\t} else {\n\t\tresolve(program.args);\n\t}\n})\n\t.then((src) => {\n\t\tif (!program.json && !program.dot) {\n\t\t\tspinner.start();\n\t\t\tconfig.dependencyFilter = dependencyFilter();\n\t\t}\n\n\t\treturn madge(src, config);\n\t})\n\t.then((res) => {\n\t\tif (!program.json && !program.dot) {\n\t\t\tspinner.stop();\n\t\t\toutput.getResultSummary(res, startTime);\n\t\t}\n\n\t\tconst result = createOutputFromOptions(program, res);\n\t\tif (result !== undefined) {\n\t\t\treturn result;\n\t\t}\n\n\t\toutput.list(res.obj(), {\n\t\t\tjson: program.json\n\t\t});\n\n\t\treturn res;\n\t})\n\t.then((res) => {\n\t\tif (program.warning && !program.json) {\n\t\t\toutput.warnings(res);\n\t\t}\n\n\t\tif (!program.json && !program.dot) {\n\t\t\tconsole.log('');\n\t\t}\n\n\t\tprocess.exit(exitCode);\n\t})\n\t.catch((err) => {\n\t\tspinner.stop();\n\t\tconsole.log('\\n%s %s\\n', chalk.red('✖'), err.stack);\n\t\tprocess.exit(1);\n\t});\n\nfunction createOutputFromOptions(program, res) {\n\tif (program.summary) {\n\t\toutput.summary(res.obj(), {\n\t\t\tjson: program.json\n\t\t});\n\n\t\treturn res;\n\t}\n\n\tif (program.depends) {\n\t\toutput.modules(res.depends(program.depends), {\n\t\t\tjson: program.json\n\t\t});\n\n\t\treturn res;\n\t}\n\n\tif (program.orphans) {\n\t\toutput.modules(res.orphans(), {\n\t\t\tjson: program.json\n\t\t});\n\n\t\treturn res;\n\t}\n\n\tif (program.leaves) {\n\t\toutput.modules(res.leaves(), {\n\t\t\tjson: program.json\n\t\t});\n\n\t\treturn res;\n\t}\n\n\tif (program.image) {\n\t\treturn res.image(program.image, program.circular).then((imagePath) => {\n\t\t\tspinner.succeed(`${chalk.bold('Image created at')} ${chalk.cyan.bold(imagePath)}`);\n\t\t\treturn res;\n\t\t});\n\t}\n\n\tif (program.dot) {\n\t\treturn res.dot(program.circular).then((output) => {\n\t\t\tprocess.stdout.write(output);\n\t\t\treturn res;\n\t\t});\n\t}\n\n\tif (program.circular) {\n\t\tconst circular = res.circular();\n\n\t\toutput.circular(spinner, res, circular, {\n\t\t\tjson: program.json,\n\t\t\tprintCount: program.count\n\t\t});\n\n\t\tif (circular.length) {\n\t\t\texitCode = 1;\n\t\t}\n\n\t\treturn res;\n\t}\n}\n"
  },
  {
    "path": "lib/api.js",
    "content": "'use strict';\n\nconst path_ = require('path');\nconst tree = require('./tree');\nconst cyclic = require('./cyclic');\nconst graph = require('./graph');\nconst log = require('./log');\n\nconst defaultConfig = {\n\tbaseDir: null,\n\texcludeRegExp: false,\n\tfileExtensions: ['js'],\n\tincludeNpm: false,\n\trequireConfig: null,\n\twebpackConfig: null,\n\ttsConfig: null,\n\trankdir: 'LR',\n\tlayout: 'dot',\n\tfontName: 'Arial',\n\tfontSize: '14px',\n\tbackgroundColor: '#111111',\n\tnodeColor: '#c6c5fe',\n\tnodeShape: 'box',\n\tnodeStyle: 'rounded',\n\tnoDependencyColor: '#cfffac',\n\tcyclicNodeColor: '#ff6c60',\n\tedgeColor: '#757575',\n\tgraphVizOptions: false,\n\tgraphVizPath: false,\n\tdependencyFilter: false\n};\n\nclass Madge {\n\t/**\n\t * Class constructor.\n\t * @constructor\n\t * @api public\n\t * @param {String|Array|Object} path\n\t * @param {Object} config\n\t * @return {Promise}\n\t */\n\tconstructor(path, config) {\n\t\tthis.skipped = [];\n\n\t\tif (!path) {\n\t\t\tthrow new Error('path argument not provided');\n\t\t}\n\n\t\tthis.config = Object.assign({}, defaultConfig, config);\n\t\tif (typeof this.config.tsConfig === 'string') {\n\t\t\tconst ts = require('typescript');\n\t\t\tconst tsParsedConfig = ts.readJsonConfigFile(this.config.tsConfig, ts.sys.readFile);\n\t\t\tconst obj = ts.parseJsonSourceFileConfigFileContent(tsParsedConfig, ts.sys, path_.dirname(config.tsConfig));\n\t\t\tthis.config.tsConfig = {\n\t\t\t\t...obj.raw,\n\t\t\t\tcompilerOptions: obj.options\n\t\t\t};\n\t\t\tlog('using tsconfig %o', this.config.tsConfig);\n\t\t}\n\n\t\tif (typeof path === 'object' && !Array.isArray(path)) {\n\t\t\tthis.tree = path;\n\t\t\tlog('using predefined tree %o', path);\n\t\t\treturn Promise.resolve(this);\n\t\t}\n\n\t\tif (typeof path === 'string') {\n\t\t\tpath = [path];\n\t\t}\n\n\t\treturn tree(path, this.config).then((res) => {\n\t\t\tthis.tree = res.tree;\n\t\t\tthis.skipped = res.skipped;\n\t\t\treturn this;\n\t\t});\n\t}\n\n\t/**\n\t * Return the module dependency graph as an object.\n\t * @api public\n\t * @return {Object}\n\t */\n\tobj() {\n\t\treturn this.tree;\n\t}\n\n\t/**\n\t * Return produced warnings.\n\t * @api public\n\t * @return {Array}\n\t */\n\twarnings() {\n\t\treturn {\n\t\t\tskipped: this.skipped\n\t\t};\n\t}\n\n\t/**\n\t * Return the modules that has circular dependencies.\n\t * @api public\n\t * @return {Array}\n\t */\n\tcircular() {\n\t\treturn cyclic(this.tree);\n\t}\n\n\t/**\n\t * Return circular dependency graph.\n\t * @api public\n\t * @return {Object}\n\t */\n\tcircularGraph() {\n\t\tconst circularDeps = this.circular();\n\n\t\treturn Object.entries(this.obj())\n\t\t\t.filter(([k]) => circularDeps.some((x) => x.includes(k)))\n\t\t\t.reduce((acc, [k, v]) => {\n\t\t\t\tacc[k] = v.filter((x) => circularDeps.some((y) => y.includes(x)));\n\t\t\t\treturn acc;\n\t\t\t}, {});\n\t}\n\n\t/**\n\t * Return a list of modules that depends on the given module.\n\t * @api public\n\t * @param  {String} id\n\t * @return {Array}\n\t */\n\tdepends(id) {\n\t\tconst tree = this.obj();\n\n\t\treturn Object\n\t\t\t.keys(tree)\n\t\t\t.filter((dep) => tree[dep].indexOf(id) >= 0);\n\t}\n\n\t/**\n\t* Return a list of modules that no one is depending on.\n\t* @api public\n\t* @return {Array}\n\t*/\n\torphans() {\n\t\tconst tree = this.obj();\n\t\tconst map = {};\n\n\t\tObject\n\t\t\t.keys(tree)\n\t\t\t.forEach((dep) => {\n\t\t\t\ttree[dep].forEach((id) => {\n\t\t\t\t\tmap[id] = true;\n\t\t\t\t});\n\t\t\t});\n\n\t\treturn Object\n\t\t\t.keys(tree)\n\t\t\t.filter((dep) => !map[dep]);\n\t}\n\n\t/**\n\t* Return a list of modules that have no dependencies.\n\t* @api public\n\t* @return {Array}\n\t*/\n\tleaves() {\n\t\tconst tree = this.obj();\n\t\treturn Object.keys(tree).filter((key) => !tree[key].length);\n\t}\n\n\t/**\n\t * Return the module dependency graph as DOT output.\n\t * @api public\n\t * @param  {Boolean} circularOnly\n\t * @return {Promise}\n\t */\n\tdot(circularOnly) {\n\t\treturn graph.dot(\n\t\t\tcircularOnly ? this.circularGraph() : this.obj(),\n\t\t\tthis.circular(),\n\t\t\tthis.config\n\t\t);\n\t}\n\n\t/**\n\t * Write dependency graph to image.\n\t * @api public\n\t * @param  {String} imagePath\n\t * @param  {Boolean} circularOnly\n\t * @return {Promise}\n\t */\n\timage(imagePath, circularOnly) {\n\t\tif (!imagePath) {\n\t\t\treturn Promise.reject(new Error('imagePath not provided'));\n\t\t}\n\n\t\treturn graph.image(\n\t\t\tcircularOnly ? this.circularGraph() : this.obj(),\n\t\t\tthis.circular(),\n\t\t\timagePath,\n\t\t\tthis.config\n\t\t);\n\t}\n\n\t/**\n\t * Return Buffer with XML SVG representation of the dependency graph.\n\t * @api public\n\t * @return {Promise}\n\t */\n\tsvg() {\n\t\treturn graph.svg(this.obj(), this.circular(), this.config);\n\t}\n}\n\n/**\n * Expose API.\n * @param {String|Array} path\n * @param {Object} config\n * @return {Promise}\n */\nmodule.exports = (path, config) => new Madge(path, config);\n"
  },
  {
    "path": "lib/cyclic.js",
    "content": "'use strict';\n\n/**\n * Get path to the circular dependency.\n * @param  {String} parent\n * @param  {Object} unresolved\n * @return {Array}\n */\nfunction getPath(parent, unresolved) {\n\tlet parentVisited = false;\n\n\treturn Object.keys(unresolved).filter((module) => {\n\t\tif (module === parent) {\n\t\t\tparentVisited = true;\n\t\t}\n\t\treturn parentVisited && unresolved[module];\n\t});\n}\n\n/**\n * A circular dependency is occurring when we see a software package\n * more than once, unless that software package has all its dependencies resolved.\n * @param  {String} id\n * @param  {Object} modules\n * @param  {Object} circular\n * @param  {Object} resolved\n * @param  {Object} unresolved\n */\nfunction resolver(id, modules, circular, resolved, unresolved) {\n\tunresolved[id] = true;\n\n\tif (modules[id]) {\n\t\tmodules[id].forEach((dependency) => {\n\t\t\tif (!resolved[dependency]) {\n\t\t\t\tif (unresolved[dependency]) {\n\t\t\t\t\tcircular.push(getPath(dependency, unresolved));\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t\tresolver(dependency, modules, circular, resolved, unresolved);\n\t\t\t}\n\t\t});\n\t}\n\n\tresolved[id] = true;\n\tunresolved[id] = false;\n}\n\n/**\n * Finds all circular dependencies for the given modules.\n * @param  {Object} modules\n * @return {Array}\n */\nmodule.exports = function (modules) {\n\tconst circular = [];\n\tconst resolved = {};\n\tconst unresolved = {};\n\n\tObject.keys(modules).forEach((id) => {\n\t\tresolver(id, modules, circular, resolved, unresolved);\n\t});\n\n\treturn circular;\n};\n"
  },
  {
    "path": "lib/graph.js",
    "content": "'use strict';\n\nconst path = require('path');\nconst {promisify} = require('util');\nconst gv = require('ts-graphviz');\nconst adapter = require('ts-graphviz/adapter');\nconst toArray = require('stream-to-array');\nconst exec = promisify(require('child_process').execFile);\nconst writeFile = promisify(require('fs').writeFile);\n\n/**\n * Set color on a node.\n * @param  {Object} node\n * @param  {String} color\n */\nfunction setNodeColor(node, color) {\n\tnode.attributes.set('color', color);\n\tnode.attributes.set('fontcolor', color);\n}\n\n/**\n * Check if Graphviz is installed on the system.\n * @param  {Object} config\n * @return {Promise}\n */\nasync function checkGraphvizInstalled(config) {\n\tconst cmd = config.graphVizPath ? path.join(config.graphVizPath, 'gvpr') : 'gvpr';\n\n\ttry {\n\t\tawait exec(cmd, ['-V']);\n\t} catch (err) {\n\t\tif (err.code === 'ENOENT') {\n\t\t\tthrow new Error(`Graphviz could not be found. Ensure that \"gvpr\" is in your $PATH. ${err}`);\n\t\t} else {\n\t\t\tthrow new Error(`Unexpected error when calling Graphviz \"${cmd}\". ${err}`);\n\t\t}\n\t}\n}\n\n/**\n * Return options to use with graphviz digraph.\n * @param  {Object} config\n * @return {Object}\n */\nfunction createGraphvizOptions(config) {\n\tconst graphVizOptions = config.graphVizOptions || {};\n\n\treturn {\n\t\tdotCommand: config.graphVizPath ? config.graphVizPath : null,\n\t\tattributes: {\n\t\t\t// Graph\n\t\t\tgraph: Object.assign({\n\t\t\t\toverlap: false,\n\t\t\t\tpad: 0.3,\n\t\t\t\trankdir: config.rankdir,\n\t\t\t\tlayout: config.layout,\n\t\t\t\tbgcolor: config.backgroundColor\n\t\t\t}, graphVizOptions.G),\n\t\t\t// Edge\n\t\t\tedge: Object.assign({\n\t\t\t\tcolor: config.edgeColor\n\t\t\t}, graphVizOptions.E),\n\t\t\t// Node\n\t\t\tnode: Object.assign({\n\t\t\t\tfontname: config.fontName,\n\t\t\t\tfontsize: config.fontSize,\n\t\t\t\tcolor: config.nodeColor,\n\t\t\t\tshape: config.nodeShape,\n\t\t\t\tstyle: config.nodeStyle,\n\t\t\t\theight: 0,\n\t\t\t\tfontcolor: config.nodeColor\n\t\t\t}, graphVizOptions.N)\n\t\t}\n\t};\n}\n\n/**\n * Creates the graphviz graph.\n * @param  {Object} modules\n * @param  {Array} circular\n * @param  {Object} config\n * @param  {Object} options\n * @return {Promise}\n */\nfunction createGraph(modules, circular, config, options) {\n\tconst g = gv.digraph('G');\n\tconst nodes = {};\n\tconst cyclicModules = circular.reduce((a, b) => a.concat(b), []);\n\n\tObject.keys(modules).forEach((id) => {\n\t\tnodes[id] = nodes[id] || g.createNode(id);\n\n\t\tif (!modules[id].length) {\n\t\t\tsetNodeColor(nodes[id], config.noDependencyColor);\n\t\t} else if (cyclicModules.indexOf(id) >= 0) {\n\t\t\tsetNodeColor(nodes[id], config.cyclicNodeColor);\n\t\t}\n\n\t\tmodules[id].forEach((depId) => {\n\t\t\tnodes[depId] = nodes[depId] || g.createNode(depId);\n\n\t\t\tif (!modules[depId]) {\n\t\t\t\tsetNodeColor(nodes[depId], config.noDependencyColor);\n\t\t\t}\n\n\t\t\tg.createEdge([nodes[id], nodes[depId]]);\n\t\t});\n\t});\n\tconst dot = gv.toDot(g);\n\treturn adapter\n\t\t.toStream(dot, options)\n\t\t.then(toArray)\n\t\t.then(Buffer.concat);\n}\n\n/**\n * Return the module dependency graph XML SVG representation as a Buffer.\n * @param  {Object} modules\n * @param  {Array} circular\n * @param  {Object} config\n * @return {Promise}\n */\nmodule.exports.svg = function (modules, circular, config) {\n\tconst options = createGraphvizOptions(config);\n\n\toptions.format = 'svg';\n\n\treturn checkGraphvizInstalled(config)\n\t\t.then(() => createGraph(modules, circular, config, options));\n};\n\n/**\n * Creates an image from the module dependency graph.\n * @param  {Object} modules\n * @param  {Array} circular\n * @param  {String} imagePath\n * @param  {Object} config\n * @return {Promise}\n */\nmodule.exports.image = function (modules, circular, imagePath, config) {\n\tconst options = createGraphvizOptions(config);\n\n\toptions.format = path.extname(imagePath).replace('.', '') || 'png';\n\n\treturn checkGraphvizInstalled(config)\n\t\t.then(() => {\n\t\t\treturn createGraph(modules, circular, config, options)\n\t\t\t\t.then((image) => writeFile(imagePath, image))\n\t\t\t\t.then(() => path.resolve(imagePath));\n\t\t});\n};\n\n/**\n * Return the module dependency graph as DOT output.\n * @param  {Object} modules\n * @param  {Array} circular\n * @param  {Object} config\n * @return {Promise}\n */\nmodule.exports.dot = function (modules, circular, config) {\n\tconst options = createGraphvizOptions(config);\n\n\toptions.format = 'dot';\n\n\treturn checkGraphvizInstalled(config)\n\t\t.then(() => createGraph(modules, circular, config, options))\n\t\t.then((output) => output.toString('utf8'));\n};\n"
  },
  {
    "path": "lib/log.js",
    "content": "'use strict';\n\nmodule.exports = require('debug')('madge');\n"
  },
  {
    "path": "lib/output.js",
    "content": "'use strict';\n\nconst chalk = require('chalk');\nconst pluralize = require('pluralize');\nconst prettyMs = require('pretty-ms');\n\n/**\n * Print given object as JSON.\n * @param  {Object} obj\n * @return {String}\n */\nfunction printJSON(obj) {\n\treturn console.log(JSON.stringify(obj, null, '  '));\n}\n\n/**\n * Print module dependency graph as indented text (or JSON).\n * @param  {Object} modules\n * @param  {Object} opts\n * @return {undefined}\n */\nmodule.exports.list = function (modules, opts) {\n\topts = opts || {};\n\n\tif (opts.json) {\n\t\treturn printJSON(modules);\n\t}\n\n\tObject.keys(modules).forEach((id) => {\n\t\tconsole.log(chalk.cyan.bold(id));\n\t\tmodules[id].forEach((depId) => {\n\t\t\tconsole.log(chalk.grey(`  ${depId}`));\n\t\t});\n\t});\n};\n\n/**\n * Print a summary of module dependencies.\n * @param  {Object} modules\n * @param  {Object} opts\n * @return {undefined}\n */\nmodule.exports.summary = function (modules, opts) {\n\tconst o = {};\n\n\topts = opts || {};\n\n\tObject.keys(modules).sort((a, b) => {\n\t\treturn modules[b].length - modules[a].length;\n\t}).forEach((id) => {\n\t\tif (opts.json) {\n\t\t\to[id] = modules[id].length;\n\t\t} else {\n\t\t\tconsole.log('%s %s', chalk.cyan.bold(modules[id].length), chalk.grey(id));\n\t\t}\n\t});\n\n\tif (opts.json) {\n\t\treturn printJSON(o);\n\t}\n};\n\n/**\n * Print the result from Madge.circular().\n * @param  {Object} spinner\n * @param  {Object} res\n * @param  {Array} circular\n * @param  {Object} opts\n * @return {undefined}\n */\nmodule.exports.circular = function (spinner, res, circular, opts) {\n\tif (opts.json) {\n\t\treturn printJSON(circular);\n\t}\n\n\tconst cyclicCount = Object.keys(circular).length;\n\n\tif (!circular.length) {\n\t\tspinner.succeed(chalk.bold('No circular dependency found!'));\n\t} else {\n\t\tspinner.fail(chalk.red.bold(`Found ${pluralize('circular dependency', cyclicCount, true)}!\\n`));\n\t\tcircular.forEach((path, idx) => {\n\t\t\tif (opts.printCount) {\n\t\t\t\tprocess.stdout.write(chalk.dim(idx + 1 + ') '));\n\t\t\t}\n\t\t\tpath.forEach((module, idx) => {\n\t\t\t\tif (idx) {\n\t\t\t\t\tprocess.stdout.write(chalk.dim(' > '));\n\t\t\t\t}\n\t\t\t\tprocess.stdout.write(chalk.cyan.bold(module));\n\t\t\t});\n\t\t\tprocess.stdout.write('\\n');\n\t\t});\n\t}\n};\n\n/**\n * Print the given modules.\n * @param  {Array} modules\n * @param  {Object} opts\n * @return {undefined}\n */\nmodule.exports.modules = function (modules, opts) {\n\tif (opts.json) {\n\t\treturn printJSON(modules);\n\t}\n\n\tmodules.forEach((id) => {\n\t\tconsole.log(chalk.cyan.bold(id));\n\t});\n};\n\n/**\n * Print warnings to the console.\n * @param  {Object} res\n * @return {undefined}\n */\nmodule.exports.warnings = function (res) {\n\tconst skipped = res.warnings().skipped;\n\n\tif (skipped.length) {\n\t\tconsole.log(chalk.yellow.bold(`\\n✖ Skipped ${pluralize('file', skipped.length, true)}\\n`));\n\n\t\tskipped.forEach((file) => {\n\t\t\tconsole.log(chalk.yellow(file));\n\t\t});\n\t}\n};\n\n/**\n * Get a summary from the result.\n * @param  {Object} res\n * @param  {Number} startTime\n * @return {undefined}\n */\nmodule.exports.getResultSummary = function (res, startTime) {\n\tconst warningCount = res.warnings().skipped.length;\n\tconst fileCount = Object.keys(res.obj()).length;\n\n\tconsole.log('Processed %s %s %s %s\\n',\n\t\tchalk.bold(fileCount),\n\t\tpluralize('file', fileCount),\n\t\tchalk.dim(`(${prettyMs(Date.now() - startTime)})`),\n\t\twarningCount ? '(' + chalk.yellow.bold(pluralize('warning', warningCount, true)) + ')' : ''\n\t);\n};\n"
  },
  {
    "path": "lib/tree.js",
    "content": "'use strict';\n\nconst os = require('os');\nconst path = require('path');\nconst {promisify} = require('util');\nconst commondir = require('commondir');\nconst walk = require('walkdir');\nconst dependencyTree = require('dependency-tree');\nconst log = require('./log');\n\nconst stat = promisify(require('fs').stat);\n\n/**\n * Check if running on Windows.\n * @type {Boolean}\n */\nconst isWin = (os.platform() === 'win32');\n\nclass Tree {\n\t/**\n\t * Class constructor.\n\t * @constructor\n\t * @api public\n\t * @param {Array} srcPaths\n\t * @param {Object} config\n\t * @return {Promise}\n\t */\n\tconstructor(srcPaths, config) {\n\t\tthis.srcPaths = srcPaths.map((s) => path.resolve(s));\n\t\tlog('using src paths %o', this.srcPaths);\n\n\t\tthis.config = config;\n\t\tlog('using config %o', this.config);\n\n\t\treturn this.getDirs()\n\t\t\t.then(this.setBaseDir.bind(this))\n\t\t\t.then(this.getFiles.bind(this))\n\t\t\t.then(this.generateTree.bind(this));\n\t}\n\n\t/**\n\t * Set the base directory (compute the common one if multiple).\n\t * @param {Array} dirs\n\t */\n\tsetBaseDir(dirs) {\n\t\tif (this.config.baseDir) {\n\t\t\tthis.baseDir = path.resolve(this.config.baseDir);\n\t\t} else {\n\t\t\tthis.baseDir = commondir(dirs);\n\t\t}\n\n\t\tlog('using base directory %s', this.baseDir);\n\t}\n\n\t/**\n\t * Get directories from the source paths\n\t * @return {Promise} resolved with an array of directories\n\t */\n\tgetDirs() {\n\t\treturn Promise\n\t\t\t.all(this.srcPaths.map((srcPath) => {\n\t\t\t\treturn stat(srcPath)\n\t\t\t\t\t.then((stats) => stats.isDirectory() ? srcPath : path.dirname(path.resolve(srcPath)));\n\t\t\t}));\n\t}\n\n\t/**\n\t * Get all files found from the source paths\n\t * @return {Promise} resolved with an array of files\n\t */\n\tgetFiles() {\n\t\tconst files = [];\n\n\t\treturn Promise\n\t\t\t.all(this.srcPaths.map((srcPath) => {\n\t\t\t\treturn stat(srcPath)\n\t\t\t\t\t.then((stats) => {\n\t\t\t\t\t\tif (stats.isFile()) {\n\t\t\t\t\t\t\tif (this.isGitPath(srcPath)) {\n\t\t\t\t\t\t\t\treturn;\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\tfiles.push(path.resolve(srcPath));\n\n\t\t\t\t\t\t\treturn;\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\twalk.sync(srcPath, (filePath, stat) => {\n\t\t\t\t\t\t\tif (this.isGitPath(filePath) || this.isNpmPath(filePath) || !stat.isFile()) {\n\t\t\t\t\t\t\t\treturn;\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\tconst ext = path.extname(filePath).replace('.', '');\n\n\t\t\t\t\t\t\tif (files.indexOf(filePath) < 0 && this.config.fileExtensions.indexOf(ext) >= 0) {\n\t\t\t\t\t\t\t\tfiles.push(filePath);\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t});\n\t\t\t\t\t});\n\t\t\t}))\n\t\t\t.then(() => files);\n\t}\n\n\t/**\n\t * Generate the tree from the given files\n\t * @param  {Array} files\n\t * @return {Object}\n\t */\n\tgenerateTree(files) {\n\t\tconst depTree = {};\n\t\tconst visited = {};\n\t\tconst nonExistent = [];\n\t\tconst npmPaths = {};\n\t\tconst pathCache = {};\n\n\t\tfiles.forEach((file) => {\n\t\t\tif (visited[file]) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tObject.assign(depTree, dependencyTree({\n\t\t\t\tfilename: file,\n\t\t\t\tdirectory: this.baseDir,\n\t\t\t\trequireConfig: this.config.requireConfig,\n\t\t\t\twebpackConfig: this.config.webpackConfig,\n\t\t\t\ttsConfig: this.config.tsConfig,\n\t\t\t\tvisited: visited,\n\t\t\t\tfilter: (dependencyFilePath, traversedFilePath) => {\n\t\t\t\t\tlet dependencyFilterRes = true;\n\t\t\t\t\tconst isNpmPath = this.isNpmPath(dependencyFilePath);\n\n\t\t\t\t\tif (this.isGitPath(dependencyFilePath)) {\n\t\t\t\t\t\treturn false;\n\t\t\t\t\t}\n\n\t\t\t\t\tif (this.config.dependencyFilter) {\n\t\t\t\t\t\tdependencyFilterRes = this.config.dependencyFilter(dependencyFilePath, traversedFilePath, this.baseDir);\n\t\t\t\t\t}\n\n\t\t\t\t\tif (this.config.includeNpm && isNpmPath) {\n\t\t\t\t\t\t(npmPaths[traversedFilePath] = npmPaths[traversedFilePath] || []).push(dependencyFilePath);\n\t\t\t\t\t}\n\n\t\t\t\t\treturn !isNpmPath && (dependencyFilterRes || dependencyFilterRes === undefined);\n\t\t\t\t},\n\t\t\t\tdetective: this.config.detectiveOptions,\n\t\t\t\tnonExistent: nonExistent\n\t\t\t}));\n\t\t});\n\n\t\tlet tree = this.convertTree(depTree, {}, pathCache, npmPaths);\n\n\t\tfor (const npmKey in npmPaths) {\n\t\t\tconst id = this.processPath(npmKey, pathCache);\n\n\t\t\tnpmPaths[npmKey].forEach((npmPath) => {\n\t\t\t\ttree[id].push(this.processPath(npmPath, pathCache));\n\t\t\t});\n\t\t}\n\n\t\tif (this.config.excludeRegExp) {\n\t\t\ttree = this.exclude(tree, this.config.excludeRegExp);\n\t\t}\n\n\t\treturn {\n\t\t\ttree: this.sort(tree),\n\t\t\tskipped: nonExistent\n\t\t};\n\t}\n\n\t/**\n\t * Convert deep tree produced by dependency-tree to a\n\t * shallow (one level deep) tree used by madge.\n\t * @param  {Object} depTree\n\t * @param  {Object} tree\n\t * @param  {Object} pathCache\n\t * @return {Object}\n\t */\n\tconvertTree(depTree, tree, pathCache) {\n\t\tfor (const key in depTree) {\n\t\t\tconst id = this.processPath(key, pathCache);\n\n\t\t\tif (!tree[id]) {\n\t\t\t\ttree[id] = [];\n\n\t\t\t\tfor (const dep in depTree[key]) {\n\t\t\t\t\ttree[id].push(this.processPath(dep, pathCache));\n\t\t\t\t}\n\n\t\t\t\tthis.convertTree(depTree[key], tree, pathCache);\n\t\t\t}\n\t\t}\n\n\t\treturn tree;\n\t}\n\n\t/**\n\t * Process absolute path and return a shorter one.\n\t * @param  {String} absPath\n\t * @param  {Object} cache\n\t * @return {String}\n\t */\n\tprocessPath(absPath, cache) {\n\t\tif (cache[absPath]) {\n\t\t\treturn cache[absPath];\n\t\t}\n\n\t\tlet relPath = path.relative(this.baseDir, absPath);\n\n\t\tif (isWin) {\n\t\t\trelPath = relPath.replace(/\\\\/g, '/');\n\t\t}\n\n\t\tcache[absPath] = relPath;\n\n\t\treturn relPath;\n\t}\n\n\t/**\n\t * Check if path is from NPM folder\n\t * @param  {String} path\n\t * @return {Boolean}\n\t */\n\tisNpmPath(path) {\n\t\treturn path.indexOf('node_modules') >= 0;\n\t}\n\n\t/**\n\t * Check if path is from .git folder\n\t * @param  {String} filePath\n\t * @return {Boolean}\n\t */\n\tisGitPath(filePath) {\n\t\treturn filePath.split(path.sep).indexOf('.git') !== -1;\n\t}\n\n\t/**\n\t * Exclude modules from tree using RegExp.\n\t * @param  {Object} tree\n\t * @param  {Array} excludeRegExp\n\t * @return {Object}\n\t */\n\texclude(tree, excludeRegExp) {\n\t\tconst regExpList = excludeRegExp.map((re) => new RegExp(re));\n\n\t\tfunction regExpFilter(id) {\n\t\t\treturn regExpList.findIndex((regexp) => regexp.test(id)) < 0;\n\t\t}\n\n\t\treturn Object\n\t\t\t.keys(tree)\n\t\t\t.filter(regExpFilter)\n\t\t\t.reduce((acc, id) => {\n\t\t\t\tacc[id] = tree[id].filter(regExpFilter);\n\t\t\t\treturn acc;\n\t\t\t}, {});\n\t}\n\n\t/**\n\t * Sort tree.\n\t * @param  {Object} tree\n\t * @return {Object}\n\t */\n\tsort(tree) {\n\t\treturn Object\n\t\t\t.keys(tree)\n\t\t\t.sort()\n\t\t\t.reduce((acc, id) => {\n\t\t\t\tacc[id] = tree[id].sort();\n\t\t\t\treturn acc;\n\t\t\t}, {});\n\t}\n}\n\n/**\n * Expose API.\n * @param {Array} srcPaths\n * @param {Object} config\n * @return {Promise}\n */\nmodule.exports = (srcPaths, config) => new Tree(srcPaths, config);\n"
  },
  {
    "path": "package.json",
    "content": "{\n  \"name\": \"madge\",\n  \"version\": \"8.0.0\",\n  \"author\": \"Patrik Henningsson <patrik.henningsson@gmail.com>\",\n  \"repository\": \"git://github.com/pahen/madge\",\n  \"homepage\": \"https://github.com/pahen/madge\",\n  \"license\": \"MIT\",\n  \"reveal\": true,\n  \"description\": \"Create graphs from module dependencies.\",\n  \"keywords\": [\n    \"ES6\",\n    \"ES7\",\n    \"AMD\",\n    \"RequireJS\",\n    \"require\",\n    \"module\",\n    \"circular\",\n    \"dependency\",\n    \"dependencies\",\n    \"graphviz\",\n    \"graph\"\n  ],\n  \"engines\": {\n    \"node\": \">=18\"\n  },\n  \"main\": \"./lib/api\",\n  \"bin\": {\n    \"madge\": \"./bin/cli.js\"\n  },\n  \"scripts\": {\n    \"test\": \"npm run lint && npm run mocha\",\n    \"mocha\": \"mocha test/*.js\",\n    \"watch\": \"mocha --watch --growl test/*.js\",\n    \"lint\": \"eslint bin/cli.js lib test/*.js\",\n    \"debug\": \"node bin/cli.js --debug bin lib\",\n    \"generate\": \"npm run generate:small && npm run generate:madge\",\n    \"generate:small\": \"bin/cli.js --image /tmp/simple.svg test/cjs/circular/a.js\",\n    \"generate:madge\": \"bin/cli.js --image /tmp/madge.svg bin lib\",\n    \"test:output\": \"./test/output.sh\",\n    \"release\": \"npm test && release-it\"\n  },\n  \"funding\": {\n    \"type\": \"individual\",\n    \"url\": \"https://www.paypal.me/pahen\"\n  },\n  \"dependencies\": {\n    \"chalk\": \"^4.1.2\",\n    \"commander\": \"^7.2.0\",\n    \"commondir\": \"^1.0.1\",\n    \"debug\": \"^4.3.4\",\n    \"dependency-tree\": \"^11.0.0\",\n    \"ora\": \"^5.4.1\",\n    \"pluralize\": \"^8.0.0\",\n    \"pretty-ms\": \"^7.0.1\",\n    \"rc\": \"^1.2.8\",\n    \"stream-to-array\": \"^2.3.0\",\n    \"ts-graphviz\": \"^2.1.2\",\n    \"walkdir\": \"^0.4.1\"\n  },\n  \"peerDependencies\": {\n    \"typescript\": \"^5.4.4\"\n  },\n  \"peerDependenciesMeta\": {\n    \"typescript\": {\n      \"optional\": true\n    }\n  },\n  \"devDependencies\": {\n    \"@aptoma/eslint-config\": \"^7.0.1\",\n    \"auto-changelog\": \"^2.4.0\",\n    \"eslint\": \"^7.29.0\",\n    \"mocha\": \"^9.0.1\",\n    \"mz\": \"^2.7.0\",\n    \"release-it\": \"^16.2.1\",\n    \"should\": \"^13.2.3\",\n    \"typescript\": \"^5.4.4\"\n  }\n}\n"
  },
  {
    "path": "test/amd/amdes6.js",
    "content": "define([\n  'ok/d'\n], function(a) {\n  'use strict';\n\n  var x = [1, 2, 3, 4]\n\n  for (var i of x) {\n    x++;\n  }\n\n  return x;\n});\n"
  },
  {
    "path": "test/amd/circular/a.js",
    "content": "define(['b', 'c'], function (B, C) {\n\treturn 'A';\n});"
  },
  {
    "path": "test/amd/circular/b.js",
    "content": "define(['d'], function (D) {\n\treturn 'B';\n});"
  },
  {
    "path": "test/amd/circular/c.js",
    "content": "define(['a'], function (A) {\n\treturn 'C';\n});"
  },
  {
    "path": "test/amd/circular/d.js",
    "content": "define(function () {\n\treturn 'D';\n});"
  },
  {
    "path": "test/amd/circular/e.js",
    "content": "define(['f'], function (F) {\n\treturn 'E';\n});"
  },
  {
    "path": "test/amd/circular/f.js",
    "content": "define(['g'], function (G) {\n\treturn 'F';\n});"
  },
  {
    "path": "test/amd/circular/g.js",
    "content": "define(['h'], function (H) {\n\treturn 'G';\n});"
  },
  {
    "path": "test/amd/circular/h.js",
    "content": "define(['f'], function (F) {\n\treturn 'H';\n});"
  },
  {
    "path": "test/amd/circular/main.js",
    "content": "define(['a', 'f'], function () {\n\treturn 'MAIN';\n});"
  },
  {
    "path": "test/amd/circularAlias/config.js",
    "content": "require.config({\n\tpaths: {\n\t\t'cpu':  'x86',\n\t\t'jsdos':'dos'\n\t}\n});\n\n"
  },
  {
    "path": "test/amd/circularAlias/dos.js",
    "content": "define(['cpu'], function(cpu) {\n});\n"
  },
  {
    "path": "test/amd/circularAlias/x86.js",
    "content": "define(['jsdos'], function(dos) {\n});\n"
  },
  {
    "path": "test/amd/circularRelative/a.js",
    "content": "define('a', ['./foo/b'], function () {\n\treturn 'A';\n});"
  },
  {
    "path": "test/amd/circularRelative/foo/b.js",
    "content": "define('foo/b', ['../a'], function () {\n\treturn 'B';\n});"
  },
  {
    "path": "test/amd/nested/a.js",
    "content": "define('a', function () {\n\treturn 'A';\n});\n"
  },
  {
    "path": "test/amd/nested/b.js",
    "content": "define('b', function () {\n\treturn 'b';\n});"
  },
  {
    "path": "test/amd/nested/main.js",
    "content": "define(['require', 'a'], function(require, a) {\n    require(['b'], function (b) {\n\n  \t});\n});"
  },
  {
    "path": "test/amd/ok/a.js",
    "content": "define(['sub/b'], function (B) {\n\treturn 'A';\n});"
  },
  {
    "path": "test/amd/ok/d.js",
    "content": ""
  },
  {
    "path": "test/amd/ok/e.js",
    "content": "define(['sub/c'], function (C) {\n\treturn 'E';\n});"
  },
  {
    "path": "test/amd/ok/sub/b.js",
    "content": "define(['sub/c'], function (C) {\n\treturn 'B';\n});"
  },
  {
    "path": "test/amd/ok/sub/c.js",
    "content": "define(['d'], function (D) {\n\treturn 'C';\n});"
  },
  {
    "path": "test/amd/plugin.js",
    "content": "define(['ok/d', './locale!locales/not/exists'], function (D) {\n\treturn 'p';\n});"
  },
  {
    "path": "test/amd/requirejs/a.js",
    "content": "define(['jquery'], function ($) {\n\treturn 'A';\n});"
  },
  {
    "path": "test/amd/requirejs/config.js",
    "content": "require.config({\n\tpaths: {\n\t\t'jquery': 'vendor/jquery-2.0.3',\n\t\t'jquery.foo': 'vendor/jquery.foo-1.0',\n\t\t'jquery.bar': 'vendor/jquery.bar-1.0',\n\t\t'baz': 'vendor/baz',\n\t\t'quux': 'vendor/quux'\n\t},\n\tshim: {\n\t\t'jquery': { exports: '$' },\n\t\t'jquery.foo': { deps: ['jquery'] },\n\t\t'jquery.bar': { deps: ['jquery'] },\n\t\t'baz': { exports: 'baz', deps: ['quux'] },\n\t\t'quux': { exports: 'quux' }\n\t}\n});"
  },
  {
    "path": "test/amd/requirejs/orphans/a.js",
    "content": "define(['orphans/b'], function () {\n\treturn 'A';\n});\n"
  },
  {
    "path": "test/amd/requirejs/orphans/b.js",
    "content": "define([], function () {\n\treturn 'B';\n});\n"
  },
  {
    "path": "test/amd/requirejs/orphans/c.js",
    "content": "define([], function () {\n\treturn 'C';\n});\n"
  },
  {
    "path": "test/amd/requirejs/vendor/baz.js",
    "content": ""
  },
  {
    "path": "test/amd/requirejs/vendor/jquery-2.0.3.js",
    "content": ""
  },
  {
    "path": "test/amd/requirejs/vendor/jquery.bar-1.0.js",
    "content": ""
  },
  {
    "path": "test/amd/requirejs/vendor/jquery.foo-1.0.js",
    "content": ""
  },
  {
    "path": "test/amd/requirejs/vendor/quux.js",
    "content": ""
  },
  {
    "path": "test/amd.js",
    "content": "/* eslint-env mocha */\n'use strict';\n\nconst madge = require('../lib/api');\nrequire('should');\n\ndescribe('AMD', () => {\n\tconst dir = __dirname + '/amd';\n\n\tit('finds recursive dependencies', (done) => {\n\t\tmadge(dir + '/ok/a.js').then((res) => {\n\t\t\tres.obj().should.eql({\n\t\t\t\t'a.js': ['sub/b.js'],\n\t\t\t\t'sub/b.js': ['sub/c.js'],\n\t\t\t\t'sub/c.js': ['d.js'],\n\t\t\t\t'd.js': []\n\t\t\t});\n\t\t\tdone();\n\t\t}).catch(done);\n\t});\n\n\tit('ignores plugins', (done) => {\n\t\tmadge(dir + '/plugin.js').then((res) => {\n\t\t\tres.obj().should.eql({\n\t\t\t\t'plugin.js': ['ok/d.js'],\n\t\t\t\t'ok/d.js': []\n\t\t\t});\n\t\t\tdone();\n\t\t}).catch(done);\n\t});\n\n\tit('finds nested dependencies', (done) => {\n\t\tmadge(dir + '/nested/main.js').then((res) => {\n\t\t\tres.obj().should.eql({\n\t\t\t\t'a.js': [],\n\t\t\t\t'b.js': [],\n\t\t\t\t'main.js': [\n\t\t\t\t\t'a.js',\n\t\t\t\t\t'b.js'\n\t\t\t\t]\n\t\t\t});\n\t\t\tdone();\n\t\t}).catch(done);\n\t});\n\n\tit('finds circular dependencies', (done) => {\n\t\tmadge(dir + '/circular/main.js').then((res) => {\n\t\t\tres.circular().should.eql([\n\t\t\t\t['a.js', 'c.js'],\n\t\t\t\t['f.js', 'g.js', 'h.js']\n\t\t\t]);\n\t\t\tdone();\n\t\t}).catch(done);\n\t});\n\n\tit('finds circular dependencies with relative paths', (done) => {\n\t\tmadge(dir + '/circularRelative/a.js').then((res) => {\n\t\t\tres.circular().should.eql([['a.js', 'foo/b.js']]);\n\t\t\tdone();\n\t\t}).catch(done);\n\t});\n\n\tit('finds circular dependencies with alias', (done) => {\n\t\tmadge(dir + '/circularAlias/dos.js', {\n\t\t\trequireConfig: dir + '/circularAlias/config.js'\n\t\t}).then((res) => {\n\t\t\tres.circular().should.eql([['dos.js', 'x86.js']]);\n\t\t\tdone();\n\t\t}).catch(done);\n\t});\n\n\tit('works for files with ES6 code inside', (done) => {\n\t\tmadge(dir + '/amdes6.js').then((res) => {\n\t\t\tres.obj().should.eql({\n\t\t\t\t'amdes6.js': ['ok/d.js'],\n\t\t\t\t'ok/d.js': []\n\t\t\t});\n\t\t\tdone();\n\t\t}).catch(done);\n\t});\n\n\tit('uses paths found in RequireJS config', (done) => {\n\t\tmadge(dir + '/requirejs/a.js', {\n\t\t\trequireConfig: dir + '/requirejs/config.js'\n\t\t}).then((res) => {\n\t\t\tres.obj().should.eql({\n\t\t\t\t'a.js': ['vendor/jquery-2.0.3.js'],\n\t\t\t\t'vendor/jquery-2.0.3.js': []\n\t\t\t});\n\t\t\tdone();\n\t\t}).catch(done);\n\t});\n\n\tit('returns modules that no one is depending on', (done) => {\n\t\tmadge(dir + '/requirejs/orphans', {\n\t\t\trequireConfig: dir + '/requirejs/config.js'\n\t\t}).then((res) => {\n\t\t\tres.orphans().should.eql([\n\t\t\t\t'a.js',\n\t\t\t\t'c.js'\n\t\t\t]);\n\t\t\tdone();\n\t\t}).catch(done);\n\t});\n});\n"
  },
  {
    "path": "test/api.js",
    "content": "/* eslint-env mocha */\n'use strict';\n\nconst os = require('os');\nconst path = require('path');\nconst fs = require('mz/fs');\nconst madge = require('../lib/api');\n\nrequire('should');\n\ndescribe('API', () => {\n\tit('throws error on missing path argument', () => {\n\t\t(() => {\n\t\t\tmadge();\n\t\t}).should.throw('path argument not provided');\n\t});\n\n\tit('returns a Promise', () => {\n\t\tmadge(__dirname + '/cjs/a.js').should.be.Promise(); // eslint-disable-line new-cap\n\t});\n\n\tit('throws error if file or directory does not exists', (done) => {\n\t\tmadge(__dirname + '/missing.js').catch((err) => {\n\t\t\terr.message.should.match(/no such file or directory/);\n\t\t\tdone();\n\t\t}).catch(done);\n\t});\n\n\tit('takes single file as path', (done) => {\n\t\tmadge(__dirname + '/cjs/a.js').then((res) => {\n\t\t\tres.obj().should.eql({\n\t\t\t\t'a.js': ['b.js', 'c.js'],\n\t\t\t\t'b.js': ['c.js'],\n\t\t\t\t'c.js': []\n\t\t\t});\n\t\t\tdone();\n\t\t}).catch(done);\n\t});\n\n\tit('takes an array of files as path and combines the result', (done) => {\n\t\tmadge([__dirname + '/cjs/a.js', __dirname + '/cjs/normal/d.js']).then((res) => {\n\t\t\tres.obj().should.eql({\n\t\t\t\t'a.js': ['b.js', 'c.js'],\n\t\t\t\t'b.js': ['c.js'],\n\t\t\t\t'c.js': [],\n\t\t\t\t'normal/d.js': []\n\t\t\t});\n\t\t\tdone();\n\t\t}).catch(done);\n\t});\n\n\tit('take a single directory as path and find files in it', (done) => {\n\t\tmadge(__dirname + '/cjs/normal').then((res) => {\n\t\t\tres.obj().should.eql({\n\t\t\t\t'a.js': ['sub/b.js'],\n\t\t\t\t'd.js': [],\n\t\t\t\t'sub/b.js': ['sub/c.js'],\n\t\t\t\t'sub/c.js': ['d.js']\n\t\t\t});\n\t\t\tdone();\n\t\t}).catch(done);\n\t});\n\n\tit('takes an array of directories as path and compute the basedir correctly', (done) => {\n\t\tmadge([__dirname + '/cjs/multibase/1', __dirname + '/cjs/multibase/2']).then((res) => {\n\t\t\tres.obj().should.eql({\n\t\t\t\t'1/a.js': [],\n\t\t\t\t'2/b.js': []\n\t\t\t});\n\t\t\tdone();\n\t\t}).catch(done);\n\t});\n\n\tit('takes a predefined tree', (done) => {\n\t\tmadge({\n\t\t\ta: ['b', 'c', 'd'],\n\t\t\tb: ['c'],\n\t\t\tc: [],\n\t\t\td: ['a']\n\t\t}).then((res) => {\n\t\t\tres.obj().should.eql({\n\t\t\t\ta: ['b', 'c', 'd'],\n\t\t\t\tb: ['c'],\n\t\t\t\tc: [],\n\t\t\t\td: ['a']\n\t\t\t});\n\t\t\tdone();\n\t\t}).catch(done);\n\t});\n\n\tit('can exclude modules using RegExp', (done) => {\n\t\tmadge(__dirname + '/cjs/a.js', {\n\t\t\texcludeRegExp: ['^b.js$']\n\t\t}).then((res) => {\n\t\t\tres.obj().should.eql({\n\t\t\t\t'a.js': ['c.js'],\n\t\t\t\t'c.js': []\n\t\t\t});\n\t\t\tdone();\n\t\t}).catch(done);\n\t});\n\n\tit('extracts dependencies but excludes .git', (done) => {\n\t\t// eslint-disable-next-line no-sync\n\t\tfs.renameSync(`${__dirname}/git/.git_tmp`, `${__dirname}/git/.git`);\n\n\t\tmadge(__dirname + '/git/a.js', {}).then((res) => {\n\t\t\tres.obj().should.eql({\n\t\t\t\t'a.js': ['b.js', 'c.js'],\n\t\t\t\t'b.js': ['c.js'],\n\t\t\t\t'c.js': []\n\t\t\t});\n\t\t\tdone();\n\t\t}).catch(() => {\n\t\t\tdone();\n\t\t}).finally(() => {\n\t\t\t// eslint-disable-next-line no-sync\n\t\t\tfs.renameSync(`${__dirname}/git/.git`, `${__dirname}/git/.git_tmp`);\n\t\t});\n\t});\n\n\tdescribe('dependencyFilter', () => {\n\t\tit('will stop traversing when returning false', (done) => {\n\t\t\tmadge(__dirname + '/cjs/a.js', {\n\t\t\t\tdependencyFilter: () => {\n\t\t\t\t\treturn false;\n\t\t\t\t}\n\t\t\t}).then((res) => {\n\t\t\t\tres.obj().should.eql({\n\t\t\t\t\t'a.js': []\n\t\t\t\t});\n\t\t\t\tdone();\n\t\t\t}).catch(done);\n\t\t});\n\n\t\tit('will not stop traversing when not returning anything', (done) => {\n\t\t\tmadge(__dirname + '/cjs/a.js', {\n\t\t\t\tdependencyFilter: () => {}\n\t\t\t}).then((res) => {\n\t\t\t\tres.obj().should.eql({\n\t\t\t\t\t'a.js': ['b.js', 'c.js'],\n\t\t\t\t\t'b.js': ['c.js'],\n\t\t\t\t\t'c.js': []\n\t\t\t\t});\n\t\t\t\tdone();\n\t\t\t}).catch(done);\n\t\t});\n\n\t\tit('will pass arguments to the function', (done) => {\n\t\t\tlet counter = 0;\n\n\t\t\tmadge(__dirname + '/cjs/a.js', {\n\t\t\t\tdependencyFilter: (dependencyFilePath, traversedFilePath, baseDir) => {\n\t\t\t\t\tif (counter === 0) {\n\t\t\t\t\t\tdependencyFilePath.should.match(/test\\/cjs\\/b\\.js$/);\n\t\t\t\t\t\ttraversedFilePath.should.match(/test\\/cjs\\/a\\.js$/);\n\t\t\t\t\t\tbaseDir.should.match(/test\\/cjs$/);\n\t\t\t\t\t}\n\n\t\t\t\t\tif (counter === 1) {\n\t\t\t\t\t\tdependencyFilePath.should.match(/test\\/cjs\\/c\\.js$/);\n\t\t\t\t\t\ttraversedFilePath.should.match(/test\\/cjs\\/a\\.js$/);\n\t\t\t\t\t\tbaseDir.should.match(/test\\/cjs$/);\n\t\t\t\t\t}\n\n\t\t\t\t\tif (counter === 2) {\n\t\t\t\t\t\tdependencyFilePath.should.match(/test\\/cjs\\/c\\.js$/);\n\t\t\t\t\t\ttraversedFilePath.should.match(/test\\/cjs\\/b\\.js$/);\n\t\t\t\t\t\tbaseDir.should.match(/test\\/cjs$/);\n\t\t\t\t\t}\n\n\t\t\t\t\tcounter++;\n\t\t\t\t}\n\t\t\t}).then(() => {\n\t\t\t\tdone();\n\t\t\t}).catch(done);\n\t\t});\n\t});\n\n\tdescribe('obj()', () => {\n\t\tit('returns dependency object', (done) => {\n\t\t\tmadge(__dirname + '/cjs/a.js').then((res) => {\n\t\t\t\tres.obj().should.eql({\n\t\t\t\t\t'a.js': ['b.js', 'c.js'],\n\t\t\t\t\t'b.js': ['c.js'],\n\t\t\t\t\t'c.js': []\n\t\t\t\t});\n\t\t\t\tdone();\n\t\t\t}).catch(done);\n\t\t});\n\t});\n\n\tdescribe('circular()', () => {\n\t\tit('returns list of circular dependencies', (done) => {\n\t\t\tmadge(__dirname + '/cjs/circular/a.js').then((res) => {\n\t\t\t\tres.circular().should.eql([\n\t\t\t\t\t['a.js', 'd.js']\n\t\t\t\t]);\n\t\t\t\tdone();\n\t\t\t}).catch(done);\n\t\t});\n\t});\n\n\tdescribe('circularGraph()', () => {\n\t\tit('returns graph with only circular dependencies', (done) => {\n\t\t\tmadge(__dirname + '/cjs/circular/a.js').then((res) => {\n\t\t\t\tres.circularGraph().should.eql({\n\t\t\t\t\t'a.js': ['d.js'],\n\t\t\t\t\t'd.js': ['a.js']\n\t\t\t\t});\n\t\t\t\tdone();\n\t\t\t}).catch(done);\n\t\t});\n\t});\n\n\tdescribe('warnings()', () => {\n\t\tit('returns an array of skipped files', (done) => {\n\t\t\tmadge(__dirname + '/cjs/missing.js').then((res) => {\n\t\t\t\tres.obj().should.eql({\n\t\t\t\t\t'missing.js': ['c.js'],\n\t\t\t\t\t'c.js': []\n\t\t\t\t});\n\t\t\t\tres.warnings().should.eql({\n\t\t\t\t\tskipped: ['./path/non/existing/file']\n\t\t\t\t});\n\t\t\t\tdone();\n\t\t\t}).catch(done);\n\t\t});\n\t});\n\n\tdescribe('dot()', () => {\n\t\tit('returns a promise resolved with graphviz DOT output', async () => {\n\t\t\tconst res = await madge(__dirname + '/cjs/b.js');\n\t\t\tconst output = await res.dot();\n\t\t\toutput.should.match(/digraph G/);\n\t\t\toutput.should.match(/bgcolor=\"#111111\"/);\n\t\t\toutput.should.match(/fontcolor=\"#c6c5fe\"/);\n\t\t\toutput.should.match(/color=\"#757575\"/);\n\t\t\toutput.should.match(/fontcolor=\"#cfffac\"/);\n\t\t});\n\t});\n\n\tdescribe('depends()', () => {\n\t\tit('returns modules that depends on another', (done) => {\n\t\t\tmadge(__dirname + '/cjs/a.js').then((res) => {\n\t\t\t\tres.depends('c.js').should.eql(['a.js', 'b.js']);\n\t\t\t\tdone();\n\t\t\t}).catch(done);\n\t\t});\n\t});\n\n\tdescribe('orphans()', () => {\n\t\tit('returns modules that no one is depending on', (done) => {\n\t\t\tmadge(__dirname + '/cjs/normal').then((res) => {\n\t\t\t\tres.orphans().should.eql(['a.js']);\n\t\t\t\tdone();\n\t\t\t}).catch(done);\n\t\t});\n\t});\n\n\tdescribe('leaves()', () => {\n\t\tit('returns modules that have no dependencies', (done) => {\n\t\t\tmadge(__dirname + '/cjs/normal').then((res) => {\n\t\t\t\tres.leaves().should.eql(['d.js']);\n\t\t\t\tdone();\n\t\t\t}).catch(done);\n\t\t});\n\t});\n\n\tdescribe('svg()', () => {\n\t\tit('returns a promise resolved with XML SVG output in a Buffer', (done) => {\n\t\t\tmadge(__dirname + '/cjs/b.js')\n\t\t\t\t.then((res) => res.svg())\n\t\t\t\t.then((output) => {\n\t\t\t\t\toutput.should.instanceof(Buffer);\n\t\t\t\t\toutput.toString().should.match(/<svg.*/);\n\t\t\t\t\tdone();\n\t\t\t\t})\n\t\t\t\t.catch(done);\n\t\t});\n\t});\n\n\tdescribe('image()', () => {\n\t\tlet imagePath;\n\n\t\tbeforeEach(() => {\n\t\t\timagePath = path.join(os.tmpdir(), 'madge_' + Date.now() + '_image.png');\n\t\t});\n\n\t\tafterEach(() => {\n\t\t\treturn fs.unlink(imagePath).catch(() => {});\n\t\t});\n\n\t\tit('rejects if a filename is not supplied', (done) => {\n\t\t\tmadge(__dirname + '/cjs/a.js')\n\t\t\t\t.then((res) => res.image())\n\t\t\t\t.catch((err) => {\n\t\t\t\t\terr.message.should.eql('imagePath not provided');\n\t\t\t\t\tdone();\n\t\t\t\t});\n\t\t});\n\n\t\tit('rejects on unsupported image format', (done) => {\n\t\t\tmadge(__dirname + '/cjs/a.js')\n\t\t\t\t.then((res) => res.image('image.zyx'))\n\t\t\t\t.catch((err) => {\n\t\t\t\t\terr.message.should.match(/Format: \"zyx\" not recognized/);\n\t\t\t\t\tdone();\n\t\t\t\t});\n\t\t});\n\n\t\tit('rejects if graphviz is not installed', (done) => {\n\t\t\tmadge(__dirname + '/cjs/a.js', {graphVizPath: '/invalid/path'})\n\t\t\t\t.then((res) => res.image('image.png'))\n\t\t\t\t.catch((err) => {\n\t\t\t\t\terr.message.should.eql('Graphviz could not be found. Ensure that \"gvpr\" is in your $PATH. Error: spawn /invalid/path/gvpr ENOENT');\n\t\t\t\t\tdone();\n\t\t\t\t});\n\t\t});\n\n\t\tit('writes image to file', (done) => {\n\t\t\tmadge(__dirname + '/cjs/a.js')\n\t\t\t\t.then((res) => res.image(imagePath))\n\t\t\t\t.then((writtenImagePath) => {\n\t\t\t\t\twrittenImagePath.should.eql(imagePath);\n\n\t\t\t\t\treturn fs\n\t\t\t\t\t\t.exists(imagePath)\n\t\t\t\t\t\t.then((exists) => {\n\t\t\t\t\t\t\tif (!exists) {\n\t\t\t\t\t\t\t\tthrow new Error(imagePath + ' not created');\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tdone();\n\t\t\t\t\t\t});\n\t\t\t\t})\n\t\t\t\t.catch(done);\n\t\t});\n\t});\n});\n"
  },
  {
    "path": "test/cjs/a.js",
    "content": " require('./b');\n require('./c');"
  },
  {
    "path": "test/cjs/b.js",
    "content": "require('./c');"
  },
  {
    "path": "test/cjs/both.js",
    "content": "require('a');\nrequire('b');\nrequire('c'+x);\nvar moo = require('d'+y).moo;\n"
  },
  {
    "path": "test/cjs/c.js",
    "content": ""
  },
  {
    "path": "test/cjs/chained.js",
    "content": "\n\nrequire('c').hello().goodbye()\nrequire('b').hello()\nrequire('a')\n"
  },
  {
    "path": "test/cjs/circular/a.js",
    "content": "var b = require('./b');\nvar c = require('./c');\nvar d = require('./d');"
  },
  {
    "path": "test/cjs/circular/b.js",
    "content": "var c = require('./c');"
  },
  {
    "path": "test/cjs/circular/c.js",
    "content": ""
  },
  {
    "path": "test/cjs/circular/d.js",
    "content": "var a = require('./a');"
  },
  {
    "path": "test/cjs/circular/foo.js",
    "content": "require('./foo.json');"
  },
  {
    "path": "test/cjs/circular/foo.json",
    "content": "{}"
  },
  {
    "path": "test/cjs/core.js",
    "content": "var fs = require('fs');\nvar a = require('a');"
  },
  {
    "path": "test/cjs/error.js",
    "content": "if (x) {\n\treturn;\n}"
  },
  {
    "path": "test/cjs/missing.js",
    "content": "require('./c');\nrequire('./path/non/existing/file');"
  },
  {
    "path": "test/cjs/multibase/1/a.js",
    "content": "module.exports = 'A';"
  },
  {
    "path": "test/cjs/multibase/2/b.js",
    "content": "module.exports = 'B';"
  },
  {
    "path": "test/cjs/nested.js",
    "content": "\nif (true) {\n    (function () {\n        require('a');\n    })();\n}\nif (false) {\n    (function () {\n        var x = 10;\n        switch (x) {\n            case 1 : require('b'); break;\n            default : break;\n        }\n    })()\n}\n\nfunction qqq () {\n    require\n        (\n        \"c\"\n    );\n}\n"
  },
  {
    "path": "test/cjs/normal/a.js",
    "content": "var b = require('./sub/b');\n\nmodule.exports = 'A';"
  },
  {
    "path": "test/cjs/normal/d.js",
    "content": "module.exports = 'D';"
  },
  {
    "path": "test/cjs/normal/sub/b.js",
    "content": "var c = require('./c');\n\nmodule.exports = 'B';"
  },
  {
    "path": "test/cjs/normal/sub/c.js",
    "content": "var d = require('../d');\n\nmodule.exports = 'C';"
  },
  {
    "path": "test/cjs/npm.js",
    "content": "var a = require('a');\nvar d = require('./normal/d');"
  },
  {
    "path": "test/cjs/strings.js",
    "content": "var a = require('a');\nvar b = require('b');\nvar c = require('c');\nvar abc = a.b(c);\n\nvar EventEmitter = require('events').EventEmitter;\n\nvar x = require('doom')(5,6,7);\nx(8,9);\nc.require('notthis');\nvar y = require('y') * 100;\n\nvar EventEmitter2 = require('events2').EventEmitter();"
  },
  {
    "path": "test/cjs/word.js",
    "content": "var a = load('a');\nvar b = load('b');\nvar c = load('c');\nvar abc = a.b(c);\n\nvar EventEmitter = load('events').EventEmitter;\n\nvar x = load('doom')(5,6,7);\nx(8,9);\nc.load('notthis');\nvar y = load('y') * 100;\n\nvar EventEmitter2 = load('events2').EventEmitter();\n"
  },
  {
    "path": "test/cjs.js",
    "content": "/* eslint-env mocha */\n'use strict';\n\nconst madge = require('../lib/api');\nrequire('should');\n\ndescribe('CommonJS', () => {\n\tconst dir = __dirname + '/cjs';\n\n\tit('finds recursive dependencies', (done) => {\n\t\tmadge(dir + '/normal/a.js').then((res) => {\n\t\t\tres.obj().should.eql({\n\t\t\t\t'a.js': ['sub/b.js'],\n\t\t\t\t'd.js': [],\n\t\t\t\t'sub/b.js': ['sub/c.js'],\n\t\t\t\t'sub/c.js': ['d.js']\n\t\t\t});\n\t\t\tdone();\n\t\t}).catch(done);\n\t});\n\n\tit('handles path outside directory', (done) => {\n\t\tmadge(dir + '/normal/sub/c.js').then((res) => {\n\t\t\tres.obj().should.eql({\n\t\t\t\t'../d.js': [],\n\t\t\t\t'c.js': ['../d.js']\n\t\t\t});\n\t\t\tdone();\n\t\t}).catch(done);\n\t});\n\n\tit('finds circular dependencies', (done) => {\n\t\tmadge(dir + '/circular/a.js').then((res) => {\n\t\t\tres.circular().should.eql([\n\t\t\t\t['a.js', 'd.js']\n\t\t\t]);\n\t\t\tdone();\n\t\t}).catch(done);\n\t});\n\n\tit('handle extensions when finding circular dependencies', (done) => {\n\t\tmadge(dir + '/circular/foo.js').then((res) => {\n\t\t\tres.circular().should.eql([]);\n\t\t\tdone();\n\t\t}).catch(done);\n\t});\n\n\tit('excludes core modules by default', (done) => {\n\t\tmadge(dir + '/core.js').then((res) => {\n\t\t\tres.obj().should.eql({\n\t\t\t\t'core.js': []\n\t\t\t});\n\t\t\tdone();\n\t\t}).catch(done);\n\t});\n\n\tit('excludes NPM modules by default', (done) => {\n\t\tmadge(dir + '/npm.js').then((res) => {\n\t\t\tres.obj().should.eql({\n\t\t\t\t'normal/d.js': [],\n\t\t\t\t'npm.js': ['normal/d.js']\n\t\t\t});\n\t\t\tdone();\n\t\t}).catch(done);\n\t});\n\n\tit('can include shallow NPM modules', (done) => {\n\t\tmadge(dir + '/npm.js', {\n\t\t\tincludeNpm: true\n\t\t}).then((res) => {\n\t\t\tres.obj().should.eql({\n\t\t\t\t'normal/d.js': [],\n\t\t\t\t'npm.js': ['node_modules/a.js', 'normal/d.js']\n\t\t\t});\n\t\t\tdone();\n\t\t}).catch(done);\n\t});\n});\n"
  },
  {
    "path": "test/es6/absolute/a.js",
    "content": "import {B} from 'test/es6/absolute/b';\r\n\r\nexport const A = 'A';"
  },
  {
    "path": "test/es6/absolute/b.js",
    "content": "export const B = 'B';"
  },
  {
    "path": "test/es6/absolute.js",
    "content": "import {A} from 'absolute/a';"
  },
  {
    "path": "test/es6/circular/a.js",
    "content": "import * as B from './b';"
  },
  {
    "path": "test/es6/circular/b.js",
    "content": "import * as C from './c';"
  },
  {
    "path": "test/es6/circular/c.js",
    "content": "import * as A from './a';"
  },
  {
    "path": "test/es6/error.js",
    "content": "if (x) {\n\treturn;\n}"
  },
  {
    "path": "test/es6/re-export/a.js",
    "content": "export default 'default export value';\nexport const named = 'named';"
  },
  {
    "path": "test/es6/re-export/b-default.js",
    "content": "export someDefault from './a'"
  },
  {
    "path": "test/es6/re-export/b-named.js",
    "content": "export { named } from './a';"
  },
  {
    "path": "test/es6/re-export/b-star.js",
    "content": "export * from './a'\n"
  },
  {
    "path": "test/es6/re-export/c.js",
    "content": "import { named } from './b-named'\nimport { someDefault } from './b-default'\nimport star from './b-star'\n"
  },
  {
    "path": "test/es6/webpack/src/sub/abs.js",
    "content": ""
  },
  {
    "path": "test/es6/webpack/src/sub/index.js",
    "content": "import rel from './rel.js';"
  },
  {
    "path": "test/es6/webpack/src/sub/rel.js",
    "content": "import abs from 'sub/abs.js';"
  },
  {
    "path": "test/es6/webpack/webpack.config.js",
    "content": "'use strict';\n\nconst path = require('path');\n\nmodule.exports = {\n\tresolve: {\n\t\troot: path.resolve(__dirname, './src')\n\t}\n};\n"
  },
  {
    "path": "test/es6.js",
    "content": "/* eslint-env mocha */\n'use strict';\n\nconst madge = require('../lib/api');\nrequire('should');\n\ndescribe('ES6', () => {\n\tconst dir = __dirname + '/es6';\n\n\tit('extracts dependencies', (done) => {\n\t\tmadge(dir + '/absolute.js').then((res) => {\n\t\t\tres.obj().should.eql({\n\t\t\t\t'absolute.js': ['absolute/a.js'],\n\t\t\t\t'absolute/a.js': []\n\t\t\t});\n\t\t\tdone();\n\t\t}).catch(done);\n\t});\n\n\tit('finds circular dependencies', (done) => {\n\t\tmadge(dir + '/circular/a.js').then((res) => {\n\t\t\tres.circular().should.eql([\n\t\t\t\t['a.js', 'b.js', 'c.js']\n\t\t\t]);\n\t\t\tdone();\n\t\t}).catch(done);\n\t});\n\n\tit('tackles error in files', (done) => {\n\t\tmadge(dir + '/error.js').then((res) => {\n\t\t\tres.obj().should.eql({\n\t\t\t\t'error.js': []\n\t\t\t});\n\t\t\tdone();\n\t\t}).catch(done);\n\t});\n\n\tit('supports export x from \"./file\"', (done) => {\n\t\tmadge(dir + '/re-export/c.js').then((res) => {\n\t\t\tres.obj().should.eql({\n\t\t\t\t'a.js': [],\n\t\t\t\t'b-default.js': ['a.js'],\n\t\t\t\t'b-named.js': ['a.js'],\n\t\t\t\t'b-star.js': ['a.js'],\n\t\t\t\t'c.js': [\n\t\t\t\t\t'b-default.js',\n\t\t\t\t\t'b-named.js',\n\t\t\t\t\t'b-star.js'\n\t\t\t\t]\n\t\t\t});\n\t\t\tdone();\n\t\t}).catch(done);\n\t});\n\n\tit('supports resolve root paths in webpack config', (done) => {\n\t\tmadge(dir + '/webpack/src/sub/index.js', {\n\t\t\twebpackConfig: dir + '/webpack/webpack.config.js'\n\t\t}).then((res) => {\n\t\t\tres.obj().should.eql({\n\t\t\t\t'index.js': ['rel.js'],\n\t\t\t\t'abs.js': [],\n\t\t\t\t'rel.js': ['abs.js']\n\t\t\t});\n\t\t\tdone();\n\t\t}).catch(done);\n\t});\n});\n"
  },
  {
    "path": "test/es7/async.js",
    "content": "import {OTHER} from './other';\nasync function foo() {}\n"
  },
  {
    "path": "test/es7/other.js",
    "content": ""
  },
  {
    "path": "test/es7.js",
    "content": "/* eslint-env mocha */\n'use strict';\n\nconst madge = require('../lib/api');\nrequire('should');\n\ndescribe('ES7', () => {\n\tconst dir = __dirname + '/es7';\n\n\tit('extracts dependencies', (done) => {\n\t\tmadge(dir + '/async.js').then((res) => {\n\t\t\tres.obj().should.eql({\n\t\t\t\t'other.js': [],\n\t\t\t\t'async.js': ['other.js']\n\t\t\t});\n\t\t\tdone();\n\t\t}).catch(done);\n\t});\n});\n"
  },
  {
    "path": "test/flow/cjs/calc.js",
    "content": "// == calc.js == //\n\nimport type { Square } from './geometry.js';\nvar Math = require('./math.js');\n\nvar four: number = Math.add(2, 2);\n"
  },
  {
    "path": "test/flow/cjs/geometry.js",
    "content": "export type Square = {\n  side: number\n};\n"
  },
  {
    "path": "test/flow/cjs/math.js",
    "content": "// == `math.js` == //\n\nfunction add(num1: number, num2: number): number {\n  return num1 + num2;\n};\n// This is how we export the `add()` function in CommonJS\nexports.add = add;\n\nfunction sub(num1, num2) {\n  return num1 - num2;\n}\n\nvar two: number = add(1, 2);\nvar one: number = sub(2, 1);"
  },
  {
    "path": "test/flow/es/calc.js",
    "content": "import {add} from \"./math.js\";\n\nvar four: number = add(2, 2);"
  },
  {
    "path": "test/flow/es/math.js",
    "content": "// == `math.js` == //\n\n// This function is exported, so it's available for other modules to import\nexport function add(num1: number, num2: number): number {\n  return num1 + num2;\n};\n\n// This function isn't exported, so it's only available in the local scope\n// of this module\nfunction sub(num1, num2) {\n  return num1 - num2;\n}\n\n// Note that we can use both exported and non-exported items within this\n// module\nvar two: number = add(1, 2);\nvar one: number = sub(2, 1);"
  },
  {
    "path": "test/flow.js",
    "content": "/* eslint-env mocha */\n'use strict';\n\nconst madge = require('../lib/api');\nrequire('should');\n\ndescribe('Flow', () => {\n\tconst dir = __dirname + '/flow';\n\n\tit('extracts ES module ependencies', (done) => {\n\t\tmadge(dir + '/es/calc.js').then((res) => {\n\t\t\tres.obj().should.eql({\n\t\t\t\t'math.js': [],\n\t\t\t\t'calc.js': ['math.js']\n\t\t\t});\n\t\t\tdone();\n\t\t}).catch(done);\n\t});\n\n\tit('extracts CommonsJS module dependencies', (done) => {\n\t\tmadge(dir + '/cjs/calc.js').then((res) => {\n\t\t\tres.obj().should.eql({\n\t\t\t\t'geometry.js': [],\n\t\t\t\t'calc.js': ['geometry.js']\n\t\t\t});\n\t\t\tdone();\n\t\t}).catch(done);\n\t});\n\n\tit('extracts CommonsJS module dependencies with mixed import syntax', (done) => {\n\t\tmadge(dir + '/cjs/calc.js', {detectiveOptions: {es6: {mixedImports: true}}}).then((res) => {\n\t\t\tres.obj().should.eql({\n\t\t\t\t'geometry.js': [],\n\t\t\t\t'math.js': [],\n\t\t\t\t'calc.js': ['geometry.js', 'math.js']\n\t\t\t});\n\t\t\tdone();\n\t\t}).catch(done);\n\t});\n});\n"
  },
  {
    "path": "test/git/.git_tmp/d.js",
    "content": ""
  },
  {
    "path": "test/git/a.js",
    "content": " require('./b');\n require('./c');\n require('./.git/d');"
  },
  {
    "path": "test/git/b.js",
    "content": "require('./c');"
  },
  {
    "path": "test/git/c.js",
    "content": ""
  },
  {
    "path": "test/jsx/basic.jsx",
    "content": "import React from 'react';\nimport other from './other.jsx';\n\nexport default React.createClass({\n  render: function() {\n    return <div>\n      foo\n      {this.props.children}\n    </div>\n  }\n});\n"
  },
  {
    "path": "test/jsx/other.jsx",
    "content": "export default 'other';"
  },
  {
    "path": "test/jsx.js",
    "content": "/* eslint-env mocha */\n'use strict';\n\nconst madge = require('../lib/api');\nrequire('should');\n\ndescribe('JSX', () => {\n\tconst dir = __dirname + '/jsx';\n\n\tit('finds import in JSX files', (done) => {\n\t\tmadge(dir + '/basic.jsx').then((res) => {\n\t\t\tres.obj().should.eql({\n\t\t\t\t'basic.jsx': ['other.jsx'],\n\t\t\t\t'other.jsx': []\n\t\t\t});\n\t\t\tdone();\n\t\t}).catch(done);\n\t});\n});\n"
  },
  {
    "path": "test/output.sh",
    "content": "#!/bin/bash\n\nmake_title() {\n\tprintf '\\033[01;38;5;022m############### %s ###############\\033[0m\\n' \"$1\"\n}\n\nmake_title \"LIST\"\n./bin/cli.js lib/api.js\n\nmake_title \"SUMMARY\"\n./bin/cli.js lib/api.js -s\n\nmake_title \"DEPENDS\"\n./bin/cli.js lib/api.js -d log.js\n\nmake_title \"CIRCULAR (OK)\"\n./bin/cli.js test/cjs/a.js -c\n\nmake_title \"CIRCULAR (FOUND, NO INDEX COUNTING)\"\n./bin/cli.js test/cjs/circular/a.js -c --no-count\n\nmake_title \"CIRCULAR (FOUND, WITH INDEX COUNT)\"\n./bin/cli.js test/cjs/circular/a.js -c\n\nmake_title \"NPM\"\n./bin/cli.js test/cjs/npm.js --include-npm\n\nmake_title \"STDIN\"\n./bin/cli.js --json lib/api.js | tr '[a-z]' '[A-Z]' | ./bin/cli.js --stdin\n\nmake_title \"IMAGE\"\n./bin/cli.js lib/api.js --image /tmp/test.svg\n\nmake_title \"DOT\"\n./bin/cli.js lib/api.js --dot\n\nmake_title \"JSON\"\n./bin/cli.js lib/api.js --json\n\nmake_title \"NO COLOR\"\n./bin/cli.js lib/api.js --no-color\n\nmake_title \"SHOW EXTENSION\"\n./bin/cli.js lib/api.js --show-extension\n\nmake_title \"WARNINGS (NOTE)\"\n./bin/cli.js test/cjs/missing.js -c\n\nmake_title \"WARNINGS (LIST)\"\n./bin/cli.js test/cjs/missing.js -c --warning\n\nmake_title \"ERROR\"\n./bin/cli.js file/not/found.js\n\nmake_title \"DEBUG\"\n./bin/cli.js lib/log.js --debug\n\nexit 0\n"
  },
  {
    "path": "test/typescript/custom-paths/import.ts",
    "content": "import heading from '@shortcut/require';\nimport fortyTwo from './subfolder';\n\nclass ImportClass {\n    constructor(public greeting: string) { }\n    greet() {\n        return \"<h1>\" + this.greeting + \"</h1>\";\n    }\n};\n"
  },
  {
    "path": "test/typescript/custom-paths/subfolder/index.ts",
    "content": "export default 42;\n"
  },
  {
    "path": "test/typescript/custom-paths/subfolder/require.tsx",
    "content": "import x from '@shortcut2/export';\n\nexport default function(props) {\n    return <h1>{props.children}</h1>\n}\n"
  },
  {
    "path": "test/typescript/custom-paths/subfolder2/export.ts",
    "content": "class ExportClass {\n\tstringLength(s: string) {\n\t\treturn s.length;\n\t}\n}\n\nexport default ExportClass;\n"
  },
  {
    "path": "test/typescript/export-x.tsx",
    "content": "export default function(props) {\n\treturn <span>{props.children}</span>\n}\n"
  },
  {
    "path": "test/typescript/export.ts",
    "content": "class ExportClass {\n\tstringLength(s: string) {\n\t\treturn s.length;\n\t}\n}\n\nexport default ExportClass;\n"
  },
  {
    "path": "test/typescript/import.ts",
    "content": "import B from './require';\nimport heading from './require-x';\n\nclass ImportClass {\n\tconstructor(public greeting: string) { }\n\tgreet() {\n\t\treturn \"<h1>\" + this.greeting + \"</h1>\";\n\t}\n};\n"
  },
  {
    "path": "test/typescript/mixed.ts",
    "content": "require('./export');\nimport './export-x';\n"
  },
  {
    "path": "test/typescript/require-x.tsx",
    "content": "import * as x from './export';\nimport SpanWrapper from './export-x';\n\nexport default function(props) {\n\treturn <h1><SpanWrapper>{props.children}</SpanWrapper></h1>\n}\n"
  },
  {
    "path": "test/typescript/require.ts",
    "content": "import x = require('./export');\n\nexport default class RequireClass  {\n\tstringLength(s: string) {\n\t\treturn s.length;\n\t}\n}\n"
  },
  {
    "path": "test/typescript/with-config/index.ts",
    "content": ""
  },
  {
    "path": "test/typescript/with-config/tsconfig.base.json",
    "content": "{\n    \"compilerOptions\": {\n        \"target\": \"ES5\",\n        \"module\": \"CommonJS\"\n    }\n}"
  },
  {
    "path": "test/typescript/with-config/tsconfig.json",
    "content": "{\n    \"extends\": \"./tsconfig.base.json\",\n    \"compilerOptions\": {\n        \"target\": \"ESNext\",\n        \"allowJs\": true\n    }\n}\n"
  },
  {
    "path": "test/typescript.js",
    "content": "/* eslint-env mocha */\n'use strict';\n\nconst madge = require('../lib/api');\nconst ts = require('typescript');\nrequire('should');\n\ndescribe('TypeScript', () => {\n\tconst dir = __dirname + '/typescript';\n\n\tit('extracts module dependencies', (done) => {\n\t\tmadge(dir + '/import.ts').then((res) => {\n\t\t\tres.obj().should.eql({\n\t\t\t\t'import.ts': ['require-x.tsx', 'require.ts'],\n\t\t\t\t'require.ts': ['export.ts'],\n\t\t\t\t'require-x.tsx': ['export-x.tsx', 'export.ts'],\n\t\t\t\t'export.ts': [],\n\t\t\t\t'export-x.tsx': []\n\t\t\t});\n\t\t\tdone();\n\t\t}).catch(done);\n\t});\n\n\tit('reads paths from a custom tsConfig', (done) => {\n\t\tconst tsConfig = {\n\t\t\tcompilerOptions: {\n\t\t\t\tbaseUrl: dir,\n\t\t\t\tmoduleResolution: 'node',\n\t\t\t\tpaths: {\n\t\t\t\t\t'@shortcut/*': ['custom-paths/subfolder/*'],\n\t\t\t\t\t'@shortcut2/*': ['custom-paths/subfolder2/*']\n\t\t\t\t}\n\t\t\t}\n\t\t};\n\t\tmadge(dir + '/custom-paths/import.ts', {tsConfig: tsConfig}).then((res) => {\n\t\t\tres.obj().should.eql({\n\t\t\t\t'import.ts': ['subfolder/index.ts', 'subfolder/require.tsx'],\n\t\t\t\t'subfolder/index.ts': [],\n\t\t\t\t'subfolder/require.tsx': ['subfolder2/export.ts'],\n\t\t\t\t'subfolder2/export.ts': []\n\t\t\t});\n\t\t\tdone();\n\t\t}).catch(done);\n\t});\n\n\tit('got tsConfig as a string, \"extends\" field is interpreted', (done) => {\n\t\tmadge(dir + '/custom-paths/import.ts', {tsConfig: dir + '/with-config/tsconfig.json'}).then((res) => {\n\t\t\tres.config.tsConfig.should.eql({\n\t\t\t\textends: './tsconfig.base.json',\n\t\t\t\tcompilerOptions: {\n\t\t\t\t\ttarget: ts.ScriptTarget.ESNext,\n\t\t\t\t\tmodule: ts.ModuleKind.CommonJS,\n\t\t\t\t\tallowJs: true,\n\t\t\t\t\tconfigFilePath: undefined\n\t\t\t\t}\n\t\t\t});\n\t\t\tdone();\n\t\t}).catch(done);\n\t});\n\n\tit('supports CJS modules when using mixedImports option', (done) => {\n\t\tmadge(dir + '/mixed.ts', {detectiveOptions: {ts: {mixedImports: true}}}).then((res) => {\n\t\t\tres.obj().should.eql({\n\t\t\t\t'export-x.tsx': [],\n\t\t\t\t'export.ts': [],\n\t\t\t\t'mixed.ts': ['export-x.tsx', 'export.ts']\n\t\t\t});\n\t\t\tdone();\n\t\t}).catch(done);\n\t});\n});\n"
  },
  {
    "path": "test/vue/BasicComponent.vue",
    "content": "<script setup>\nimport OneNested from './OneNested.vue';\nimport TwoNested from './TwoNested.vue';\n</script>\n\n<template>\n\t<OneNested />\n\t<TwoNested />\n</template>\n"
  },
  {
    "path": "test/vue/BasicComponentTs.vue",
    "content": "<script lang=\"ts\" setup>\nimport OneNested from './OneNestedTs.vue';\nimport TwoNested from './TwoNested.vue';\n</script>\n\n<template>\n\t<OneNested />\n\t<TwoNested />\n</template>\n"
  },
  {
    "path": "test/vue/OneNested.vue",
    "content": "<script setup>\nimport { ref } from \"vue\";\nimport ThreeNested from \"./ThreeNested.vue\";\nimport \"./two\";\n\nconst count = ref(0);\n</script>\n\n<template>\n\t<button @click=\"count++\">{{ count }}</button>\n</template>\n"
  },
  {
    "path": "test/vue/OneNestedTs.vue",
    "content": "<script lang=\"ts\" setup>\nimport { ref } from \"vue\";\nimport ThreeNested from \"./ThreeNested.vue\";\nimport \"./one\";\n\nconst count = ref(0);\n</script>\n\n<template>\n\t<button @click=\"count++\">{{ count }}</button>\n</template>\n"
  },
  {
    "path": "test/vue/ThreeNested.vue",
    "content": "<template>Content without deps</template>\n"
  },
  {
    "path": "test/vue/TwoNested.vue",
    "content": "<template>Content without deps</template>\n"
  },
  {
    "path": "test/vue/one.ts",
    "content": "// no content\n"
  },
  {
    "path": "test/vue/two.js",
    "content": "// no content\n"
  },
  {
    "path": "test/vue.js",
    "content": "/* eslint-env mocha */\n'use strict';\n\nconst madge = require('../lib/api');\nrequire('should');\n\ndescribe('Vue', () => {\n\tconst dir = __dirname + '/vue';\n\t// this seems necessary to run the tests successfully\n\tconst emptyTsConfig = {compilerOptions: {}};\n\n\tit('finds import in Vue files using TS', (done) => {\n\t\tmadge(dir + '/BasicComponentTs.vue', {tsConfig: emptyTsConfig}).then((res) => {\n\t\t\tres.obj().should.eql({\n\t\t\t\t'one.ts': [],\n\t\t\t\t'BasicComponentTs.vue': ['OneNestedTs.vue', 'TwoNested.vue'],\n\t\t\t\t'OneNestedTs.vue': ['ThreeNested.vue', 'one.ts'],\n\t\t\t\t'ThreeNested.vue': [],\n\t\t\t\t'TwoNested.vue': []\n\t\t\t});\n\t\t\tdone();\n\t\t}).catch(done);\n\t});\n\n\tit('finds import in Vue files', (done) => {\n\t\tmadge(dir + '/BasicComponent.vue', {tsConfig: emptyTsConfig}).then((res) => {\n\t\t\tres.obj().should.eql({\n\t\t\t\t'two.js': [],\n\t\t\t\t'BasicComponent.vue': ['OneNested.vue', 'TwoNested.vue'],\n\t\t\t\t'OneNested.vue': ['ThreeNested.vue', 'two.js'],\n\t\t\t\t'ThreeNested.vue': [],\n\t\t\t\t'TwoNested.vue': []\n\t\t\t});\n\t\t\tdone();\n\t\t}).catch(done);\n\t});\n});\n"
  }
]