[
  {
    "path": ".eslintrc.json",
    "content": "{\r\n    \"env\": {\r\n        \"browser\": true,\r\n        \"commonjs\": true,\r\n        \"es2021\": true\r\n    },\r\n    \"parserOptions\": {\r\n        \"ecmaVersion\": 12\r\n    },\r\n    \"rules\": {\r\n        \"space-before-function-paren\": [\r\n            2,\r\n            {\r\n                \"anonymous\": \"ignore\",\r\n                \"named\": \"never\"\r\n            }\r\n        ]\r\n    }\r\n}\r\n"
  },
  {
    "path": ".github/CONTRIBUTING.md",
    "content": "# Contributing\n\n## Commit messages\n\nCommit messages must follow the [Angular-style](https://github.com/angular/angular.js/blob/master/DEVELOPERS.md#commits) commit format (but excluding the scope).\n\ni.e:\n\n```text\nfix: minified scripts being removed\n\nAlso includes tests\n```\n\nThis will allow for the automatic changelog to generate correctly.\n\n## Code standards\n\nEnsure that your code adheres to the included `.jshintrc` and `.eslintrc.json` configs.\n\n## Sending pull requests\n\n- new command line options are generally discouraged unless there's a *really* good reason\n- add tests for newly added code (and try to mirror directory and file structure if possible)\n- spell check\n- PRs will not be code reviewed unless all tests are passing\n\n*Important:* when fixing a bug, please commit a **failing test** first so that Travis CI (or I can) can show the code failing. Once that commit is in place, then commit the bug fix, so that we can test *before* and *after*.\n\nRemember that you're developing for multiple platforms and versions of node, so if the tests pass on your Mac or Linux or Windows machine, it *may* not pass elsewhere. I personally have Mac and Linux coverage, I need help with Windows tests.\n\n## Issues\n\n- Please include the output from `nodemon --dump` for diagnosis\n- If there's a script that nodemon is having trouble with or is causing nodemon to throw exceptions, please include it in your filed issue to allow me to replicate the issue."
  },
  {
    "path": ".github/FUNDING.yml",
    "content": "github: [remy]\nopen_collective: nodemon\n"
  },
  {
    "path": ".github/ISSUE_TEMPLATE/bug_report.md",
    "content": "---\nname: Bug report\nabout: Create a report to help nodemon improve\ntitle: ''\nlabels: ''\nassignees: ''\n\n---\n\n<!-- \n  when raising an issue please include replies to the following questions, \n  and if you're reporting a bug, please include details on how to replicate\n  and **assume** I have no knowledge of how your systems work - that includes\n  gulp, grunt, webpack, etc. Thank you so much <3\n-->\n\n- Versions: <!-- run this: node -e 'console.log(`node@${process.version}, ${process.platform}@${require(\"os\").release()}`)' -->\n- `nodemon -v`:\n- Operating system/terminal environment (powershell, gitshell, etc): \n- Using Docker? What image: \n- Command you ran:\n\n\n### Expected behaviour\n\n\n### Actual behaviour\n\n\n### Steps to reproduce\n\n\n---\n\nIf applicable, please append the `--dump` flag on your command and include the output here **ensuring to remove any sensitive/personal details or tokens**.\n"
  },
  {
    "path": ".github/ISSUE_TEMPLATE.md",
    "content": "<!-- \n  when raising an issue please include replies to the following questions, \n  and if you're reporting a bug, please include details on how to replicate\n  and **assume** I have no knowledge of how your systems work - that includes\n  gulp, grunt, webpack, etc. Thank you so much <3\n-->\n\n- `nodemon -v`:\n- `node -v`:\n- Operating system/terminal environment: \n- Using Docker? What image: \n- Command you ran:\n\n\n### Expected behaviour\n\n\n### Actual behaviour\n\n\n### Steps to reproduce\n\n\n---\n\nIf applicable, please append the `--dump` flag on your command and include the output here **ensuring to remove any sensitive/personal details or tokens**.\n"
  },
  {
    "path": ".github/no-response.yml",
    "content": "# Configuration for probot-no-response - https://github.com/probot/no-response\n\n# Number of days of inactivity before an Issue is closed for lack of response\ndaysUntilClose: 7\n# Label requiring a response\nresponseRequiredLabel: \"needs more info\"\n# Comment to post when closing an Issue for lack of response. Set to `false` to disable\ncloseComment: >\n  This issue has been automatically closed because there hasn't been a response\n  to my request for more information from the original author. With only the\n  information that is currently in the issue, I don't have enough information\n  to take action, sorry! Please comment on this issue if you have or find the \n  answers we need so that someone can investigate further.\n"
  },
  {
    "path": ".github/oliver.yml",
    "content": "# Number of days the issue was closed in before the bot should reply.\n# If the issue was closed in more days than this, the bot won't reply.\n# Use `daysClosedIn: false` to *always* reply.\ndaysClosedIn: 100\n\n# Labels to look for on issues the bot can reply to\nlabels:\n  - bug\n\n# Comment to post when replying\ncomment: >\n  Thanks for raising this issue, and hopefully you're happy with @remy's fix. If you'd like to support this project, you can do just that through the open collective https://opencollective.com/nodemon/donate or at the very least, starring this project would give me @remy a little smile ❤️\n"
  },
  {
    "path": ".github/workflows/commits.yml",
    "content": "name: Conventional Commit Checker\n\non:\n  pull_request:\n    branches: [main]\n    types: [opened, edited, synchronize]\n\njobs:\n  check-for-cc:\n    runs-on: ubuntu-latest\n    steps:\n      - name: check-for-cc\n        id: check-for-cc\n        uses: agenthunt/conventional-commit-checker-action@v1.0.0\n"
  },
  {
    "path": ".github/workflows/node.js.yml",
    "content": "# This workflow will do a clean install of node dependencies, build the source code and run tests across different versions of node\n# For more information see: https://help.github.com/actions/language-and-framework-guides/using-nodejs-with-github-actions\n\nname: tests\n\non:\n  push:\n    branches: [main]\n  pull_request:\n    branches: [main]\n\njobs:\n  build:\n    runs-on: ubuntu-latest\n\n    strategy:\n      matrix:\n        node-version: [18.x]\n        # See supported Node.js release schedule at https://nodejs.org/en/about/releases/\n\n    steps:\n      - uses: actions/checkout@v2\n      - name: Use Node.js ${{ matrix.node-version }}\n        uses: actions/setup-node@v4\n        with:\n          cache: npm\n          node-version: ${{ matrix.node-version }}\n      - run: npm ci\n      - run: npm run build --if-present\n      - run: npm test\n"
  },
  {
    "path": ".github/workflows/release.yml",
    "content": "name: Release\non:\n  workflow_run:\n    workflows: [\"tests\"]\n    branches: [main]\n    types:\n      - completed\n\njobs:\n  release:\n    name: Release\n    runs-on: ubuntu-latest\n    # This line ensures the release ONLY runs if the 'tests' workflow passed\n    if: ${{ github.event.workflow_run.conclusion == 'success' }}\n    permissions:\n      contents: write\n      id-token: write\n      issues: write\n      pull-requests: write\n    steps:\n      - name: Checkout\n        uses: actions/checkout@v4\n      - name: Setup Node.js\n        uses: actions/setup-node@v4\n        with:\n          cache: npm\n          node-version: 24\n      - name: Install dependencies\n        run: npm ci\n      - name: Release\n        env:\n          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}\n          # will now use the OIDC token automatically\n        run: npx semantic-release\n"
  },
  {
    "path": ".github/workflows/stale.yml",
    "content": "name: Mark stale issues and pull requests\n\non:\n  schedule:\n  - cron: \"0 * * * *\"\n\njobs:\n  stale:\n\n    runs-on: ubuntu-latest\n    permissions:\n      issues: write\n      pull-requests: write\n\n    steps:\n    - uses: actions/stale@v3\n      with:\n        repo-token: ${{ secrets.GITHUB_TOKEN }}\n        days-before-stale: 14\n        days-before-close: 30\n        days-before-pr-close: -1\n        stale-issue-label: 'stale'\n        stale-pr-label: 'stale'\n        stale-issue-message: >\n            This issue has been automatically marked as idle and stale because it hasn't\n            had any recent activity. It will be automtically closed if no further activity\n            occurs. If you think this is wrong, or the problem still persists, just pop\n            a reply in the comments and @remy will (try!) to follow up.\n            \n            Thank you for contributing <3\n        close-issue-message: 'Automatically closing this issue due to lack of activity'\n        exempt-issue-labels: not-stale,security,pinned\n"
  },
  {
    "path": ".github/workflows/website.yml",
    "content": "name: website\n\non:\n  workflow_dispatch:\n\njobs:\n  deploy:\n    runs-on: ubuntu-latest\n    permissions:\n      contents: write\n    env:\n      NETLIFY: ${{ secrets.NETLIFY }}\n    steps:\n      - uses: actions/checkout@v4\n        with:\n          fetch-depth: 0\n      - uses: actions/setup-node@v4\n        with:\n          node-version: 18\n          cache: npm\n      - run: npm ci\n      - run: node website/oc.js\n      - name: Stage changes\n        run: git add README.md website/index.html\n      - name: Commit changes\n        id: commit\n        run: |\n          if git diff --cached --quiet; then\n            echo \"committed=false\" >> \"$GITHUB_OUTPUT\"\n            exit 0\n          fi\n          git config user.name \"${GITHUB_ACTOR}\"\n          git config user.email \"${GITHUB_ACTOR}@users.noreply.github.com\"\n          git commit -m \"chore: website\" -m \"[skip ci]\"\n          echo \"committed=true\" >> \"$GITHUB_OUTPUT\"\n      - name: Push changes\n        if: steps.commit.outputs.committed == 'true'\n        run: git push origin HEAD\n      - name: Trigger Netlify\n        if: env.NETLIFY != ''\n        run: curl -X POST \"$NETLIFY\"\n"
  },
  {
    "path": ".gitignore",
    "content": "lib-cov\n*.seed\n*.log\n*.csv\n*.dat\n*.out\n*.pid\n*.gz\n\n.env\n\n.vscode/\n\npids\nlogs\nresults\n\nnpm-debug.log\nnode_modules\ncoverage\ntmp\nissues/\ntest/fixtures/test*\n\n.idea\n"
  },
  {
    "path": ".jshintrc",
    "content": "{\n  \"browser\": true,\n  \"camelcase\": true,\n  \"curly\": true,\n  \"devel\": true,\n  \"eqeqeq\": true,\n  \"forin\": true,\n  \"indent\": 2,\n  \"noarg\": true,\n  \"node\": true,\n  \"quotmark\": \"single\",\n  \"undef\": true,\n  \"strict\": false,\n  \"unused\": true\n}\n\n"
  },
  {
    "path": ".npmignore",
    "content": "test/\ntmp/\ncoverage/\nissues/\n.github/\nwebsite/\n*.md\nDockerfile\n.eslintrc.json\n.jshintrc\n.releaserc\n.travis.yml\ncommitlint.config.js\n"
  },
  {
    "path": ".npmrc",
    "content": "package-lock=true\n"
  },
  {
    "path": ".prettierrc.json",
    "content": "{\n  \"singleQuote\": true\n}\n"
  },
  {
    "path": ".releaserc",
    "content": "{\n  \"branches\": [\"main\"]\n}\n"
  },
  {
    "path": ".travis.yml",
    "content": "language: node_js\ncache:\n  directories:\n    - ~/.npm\nnotifications:\n  email: false\nnode_js:\n  - '14'\n  - '12'\n  - '10'\nbefore_install:\n  - if [ \"$TRAVIS_PULL_REQUEST_BRANCH\" == \"\" ]; then echo \"//registry.npmjs.org/:_authToken=\\${NPM_TOKEN}\" >> .npmrc; fi\nafter_success:\n  - npm run semantic-release\nbranches:\n  except:\n    - /^v\\d+\\.\\d+\\.\\d+$/\n"
  },
  {
    "path": "CODE_OF_CONDUCT.md",
    "content": "# Contributor Code of Conduct\n\nAs contributors and maintainers of this project, and in the interest of fostering an open and welcoming community, we pledge to respect all people who contribute through reporting issues, posting feature requests, updating documentation, submitting pull requests or patches, and other activities.\n\nWe are committed to making participation in this project a harassment-free experience for everyone, regardless of level of experience, gender, gender identity and expression, sexual orientation, disability, personal appearance, body size, race, ethnicity, age, religion, or nationality.\n\nExamples of unacceptable behavior by participants include:\n\n* The use of sexualized language or imagery\n* Personal attacks\n* Trolling or insulting/derogatory comments\n* Public or private harassment\n* Publishing other's private information, such as physical or electronic addresses, without explicit permission\n* Other unethical or unprofessional conduct.\n\nProject maintainers have the right and responsibility to remove, edit, or reject comments, commits, code, wiki edits, issues, and other contributions that are not aligned to this Code of Conduct. By adopting this Code of Conduct, project maintainers commit themselves to fairly and consistently applying these principles to every aspect of managing this project. Project maintainers who do not follow or enforce the Code of Conduct may be permanently removed from the project team.\n\nThis code of conduct applies both within project spaces and in public spaces when an individual is representing the project or its community.\n\nInstances of abusive, harassing, or otherwise unacceptable behavior may be reported by opening an issue or contacting one or more of the project maintainers.\n\nThis Code of Conduct is adapted from the [Contributor Covenant](http://contributor-covenant.org), version 1.2.0, available at [http://contributor-covenant.org/version/1/2/0/](http://contributor-covenant.org/version/1/2/0/)"
  },
  {
    "path": "Dockerfile",
    "content": "#\n# Ubuntu Node.js Dockerfile\n#\n# https://github.com/dockerfile/ubuntu/blob/master/Dockerfile\n# https://docs.docker.com/examples/nodejs_web_app/\n#\n\n# Pull base image.\nFROM ubuntu:16.04\n\nRUN apt-get update && apt-get install -y curl locales && rm -rf /var/lib/apt/lists/* \\\n    && localedef -i en_US -c -f UTF-8 -A /usr/share/locale/locale.alias en_US.UTF-8\nENV LANG en_US.utf8\n\n# Install Node.js\nRUN curl --silent --location https://deb.nodesource.com/setup_10.x | bash -\nRUN apt-get install --yes nodejs build-essential\n\n# Install app dependencies\nRUN npm install -g npx\n\n# Bundle app source\n# Trouble with COPY http://stackoverflow.com/a/30405787/2926832\n# COPY . /src\n\nWORKDIR /src\n\n\n# Binds to port 8080\n# EXPOSE  8080\n\n#  Defines your runtime(define default command)\n# These commands unlike RUN (they are carried out in the construction of the container) are run when the container\n#CMD [\"node\", \"/src/http.js\"]\n"
  },
  {
    "path": "LICENSE",
    "content": "MIT License\n\nCopyright (c) 2010 - present, Remy Sharp, https://remysharp.com <remy@remysharp.com>\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  <a href=\"https://nodemon.io/\"><img src=\"https://user-images.githubusercontent.com/13700/35731649-652807e8-080e-11e8-88fd-1b2f6d553b2d.png\" alt=\"Nodemon Logo\"></a>\n</p>\n\n# nodemon\n\nnodemon is a tool that helps develop Node.js based applications by automatically restarting the node application when file changes in the directory are detected.\n\nnodemon does **not** require *any* additional changes to your code or method of development. nodemon is a replacement wrapper for `node`. To use `nodemon`, replace the word `node` on the command line when executing your script.\n\n[![NPM version](https://badge.fury.io/js/nodemon.svg)](https://npmjs.org/package/nodemon)\n[![Backers on Open Collective](https://opencollective.com/nodemon/backers/badge.svg)](#backers) [![Sponsors on Open Collective](https://opencollective.com/nodemon/sponsors/badge.svg)](#sponsors)\n\n# Installation\n\nEither through cloning with git or by using [npm](http://npmjs.org) (the recommended way):\n\n```bash\nnpm install -g nodemon # or using yarn: yarn global add nodemon\n```\n\nAnd nodemon will be installed globally to your system path.\n\nYou can also install nodemon as a development dependency:\n\n```bash\nnpm install --save-dev nodemon # or using yarn: yarn add nodemon -D\n```\n\nWith a local installation, nodemon will not be available in your system path or you can't use it directly from the command line. Instead, the local installation of nodemon can be run by calling it from within an npm script (such as `npm start`) or using `npx nodemon`.\n\n# Usage\n\nnodemon wraps your application, so you can pass all the arguments you would normally pass to your app:\n\n```bash\nnodemon [your node app]\n```\n\nFor CLI options, use the `-h` (or `--help`) argument:\n\n```bash\nnodemon -h\n```\n\nUsing nodemon is simple, if my application accepted a host and port as the arguments, I would start it as so:\n\n```bash\nnodemon ./server.js localhost 8080\n```\n\nAny output from this script is prefixed with `[nodemon]`, otherwise all output from your application, errors included, will be echoed out as expected.\n\nYou can also pass the `inspect` flag to node through the command line as you would normally:\n\n```bash\nnodemon --inspect ./server.js 80\n```\n\nIf you have a `package.json` file for your app, you can omit the main script entirely and nodemon will read the `package.json` for the `main` property and use that value as the app ([ref](https://github.com/remy/nodemon/issues/14)).\n\nnodemon will also search for the `scripts.start` property in `package.json` (as of nodemon 1.1.x).\n\nAlso check out the [FAQ](https://github.com/remy/nodemon/blob/master/faq.md) or [issues](https://github.com/remy/nodemon/issues) for nodemon.\n\n## Automatic re-running\n\nnodemon was originally written to restart hanging processes such as web servers, but now supports apps that cleanly exit. If your script exits cleanly, nodemon will continue to monitor the directory (or directories) and restart the script if there are any changes.\n\n## Manual restarting\n\nWhilst nodemon is running, if you need to manually restart your application, instead of stopping and restart nodemon, you can type `rs` with a carriage return, and nodemon will restart your process.\n\n## Config files\n\nnodemon supports local and global configuration files. These are usually named `nodemon.json` and can be located in the current working directory or in your home directory. An alternative local configuration file can be specified with the `--config <file>` option.\n\nThe specificity is as follows, so that a command line argument will always override the config file settings:\n\n- command line arguments\n- local config\n- global config\n\nA config file can take any of the command line arguments as JSON key values, for example:\n\n```json\n{\n  \"verbose\": true,\n  \"ignore\": [\"*.test.js\", \"**/fixtures/**\"],\n  \"execMap\": {\n    \"rb\": \"ruby\",\n    \"pde\": \"processing --sketch={{pwd}} --run\"\n  }\n}\n```\n\nThe above `nodemon.json` file might be my global config so that I have support for ruby files and processing files, and I can run `nodemon demo.pde` and nodemon will automatically know how to run the script even though out of the box support for processing scripts.\n\nA further example of options can be seen in [sample-nodemon.md](https://github.com/remy/nodemon/blob/master/doc/sample-nodemon.md)\n\n### package.json\n\nIf you want to keep all your package configurations in one place, nodemon supports using `package.json` for configuration.\nSpecify the config in the same format as you would for a config file but under `nodemonConfig` in the `package.json` file, for example, take the following `package.json`:\n\n```json\n{\n  \"name\": \"nodemon\",\n  \"homepage\": \"http://nodemon.io\",\n  \"...\": \"... other standard package.json values\",\n  \"nodemonConfig\": {\n    \"ignore\": [\"**/test/**\", \"**/docs/**\"],\n    \"delay\": 2500\n  }\n}\n```\n\nNote that if you specify a `--config` file or provide a local `nodemon.json` any `package.json` config is ignored.\n\n*This section needs better documentation, but for now you can also see `nodemon --help config` ([also here](https://github.com/remy/nodemon/blob/master/doc/cli/config.txt))*.\n\n## Using nodemon as a module\n\nPlease see [doc/requireable.md](doc/requireable.md)\n\n## Using nodemon as child process\n\nPlease see [doc/events.md](doc/events.md#Using_nodemon_as_child_process)\n\n## Running non-node scripts\n\nnodemon can also be used to execute and monitor other programs. nodemon will read the file extension of the script being run and monitor that extension instead of `.js` if there's no `nodemon.json`:\n\n```bash\nnodemon --exec \"python -v\" ./app.py\n```\n\nNow nodemon will run `app.py` with python in verbose mode (note that if you're not passing args to the exec program, you don't need the quotes), and look for new or modified files with the `.py` extension.\n\n### Default executables\n\nUsing the `nodemon.json` config file, you can define your own default executables using the `execMap` property. This is particularly useful if you're working with a language that isn't supported by default by nodemon.\n\nTo add support for nodemon to know about the `.pl` extension (for Perl), the `nodemon.json` file would add:\n\n```json\n{\n  \"execMap\": {\n    \"pl\": \"perl\"\n  }\n}\n```\n\nNow running the following, nodemon will know to use `perl` as the executable:\n\n```bash\nnodemon script.pl\n```\n\nIt's generally recommended to use the global `nodemon.json` to add your own `execMap` options. However, if there's a common default that's missing, this can be merged in to the project so that nodemon supports it by default, by changing [default.js](https://github.com/remy/nodemon/blob/master/lib/config/defaults.js) and sending a pull request.\n\n## Monitoring multiple directories\n\nBy default nodemon monitors the current working directory. If you want to take control of that option, use the `--watch` option to add specific paths:\n\n```bash\nnodemon --watch app --watch libs app/server.js\n```\n\nNow nodemon will only restart if there are changes in the `./app` or `./libs` directory. By default nodemon will traverse sub-directories, so there's no need in explicitly including sub-directories.\n\nNodemon also supports unix globbing, e.g `--watch './lib/*'`. The globbing pattern must be quoted. For advanced globbing, [see `picomatch` documentation](https://github.com/micromatch/picomatch#advanced-globbing), the library that nodemon uses through `chokidar` (which in turn uses it through `anymatch`).\n\n## Specifying extension watch list\n\nBy default, nodemon looks for files with the `.js`, `.mjs`, `.coffee`, `.litcoffee`, and `.json` extensions. If you use the `--exec` option and monitor `app.py` nodemon will monitor files with the extension of `.py`. However, you can specify your own list with the `-e` (or `--ext`) switch like so:\n\n```bash\nnodemon -e js,pug\n```\n\nNow nodemon will restart on any changes to files in the directory (or subdirectories) with the extensions `.js`, `.pug`.\n\n## Ignoring files\n\nBy default, nodemon will only restart when a `.js` JavaScript file changes. In some cases you will want to ignore some specific files, directories or file patterns, to prevent nodemon from prematurely restarting your application.\n\nThis can be done via the command line:\n\n```bash\nnodemon --ignore lib/ --ignore tests/\n```\n\nOr specific files can be ignored:\n\n```bash\nnodemon --ignore lib/app.js\n```\n\nPatterns can also be ignored (but be sure to quote the arguments):\n\n```bash\nnodemon --ignore 'lib/*.js'\n```\n\n**Important** the ignore rules are patterns matched to the full absolute path, and this determines how many files are monitored. If using a wild card glob pattern, it needs to be used as `**` or omitted entirely. For example, `nodemon --ignore '**/test/**'` will work, whereas `--ignore '*/test/*'` will not.\n\nNote that by default, nodemon will ignore the `.git`, `node_modules`, `bower_components`, `.nyc_output`, `coverage` and `.sass-cache` directories and *add* your ignored patterns to the list. If you want to indeed watch a directory like `node_modules`, you need to [override the underlying default ignore rules](https://github.com/remy/nodemon/blob/master/faq.md#overriding-the-underlying-default-ignore-rules).\n\n## Application isn't restarting\n\nIn some networked environments (such as a container running nodemon reading across a mounted drive), you will need to use the `legacyWatch: true` which enables Chokidar's polling.\n\nVia the CLI, use either `--legacy-watch` or `-L` for short:\n\n```bash\nnodemon -L\n```\n\nThough this should be a last resort as it will poll every file it can find.\n\n## Delaying restarting\n\nIn some situations, you may want to wait until a number of files have changed. The timeout before checking for new file changes is 1 second. If you're uploading a number of files and it's taking some number of seconds, this could cause your app to restart multiple times unnecessarily.\n\nTo add an extra throttle, or delay restarting, use the `--delay` command:\n\n```bash\nnodemon --delay 10 server.js\n```\n\nFor more precision, milliseconds can be specified.  Either as a float:\n\n```bash\nnodemon --delay 2.5 server.js\n```\n\nOr using the time specifier (ms):\n\n```bash\nnodemon --delay 2500ms server.js\n```\n\nThe delay figure is number of seconds (or milliseconds, if specified) to delay before restarting. So nodemon will only restart your app the given number of seconds after the *last* file change.\n\nIf you are setting this value in `nodemon.json`, the value will always be interpreted in milliseconds. E.g., the following are equivalent:\n\n```bash\nnodemon --delay 2.5\n\n{\n  \"delay\": 2500\n}\n```\n\n## Gracefully reloading down your script\n\nIt is possible to have nodemon send any signal that you specify to your application.\n\n```bash\nnodemon --signal SIGHUP server.js\n```\n\nYour application can handle the signal as follows.\n\n```js\nprocess.on(\"SIGHUP\", function () {\n  reloadSomeConfiguration();\n  process.kill(process.pid, \"SIGTERM\");\n})\n```\n\nPlease note that nodemon will send this signal to every process in the process tree.\n\nIf you are using `cluster`, then each workers (as well as the master) will receive the signal. If you wish to terminate all workers on receiving a `SIGHUP`, a common pattern is to catch the `SIGHUP` in the master, and forward `SIGTERM` to all workers, while ensuring that all workers ignore `SIGHUP`.\n\n```js\nif (cluster.isMaster) {\n  process.on(\"SIGHUP\", function () {\n    for (const worker of Object.values(cluster.workers)) {\n      worker.process.kill(\"SIGTERM\");\n    }\n  });\n} else {\n  process.on(\"SIGHUP\", function() {})\n}\n```\n\n## Controlling shutdown of your script\n\nnodemon sends a kill signal to your application when it sees a file update. If you need to clean up on shutdown inside your script you can capture the kill signal and handle it yourself.\n\nThe following example will listen once for the `SIGUSR2` signal (used by nodemon to restart), run the clean up process and then kill itself for nodemon to continue control:\n\n```js\n// important to use `on` and not `once` as nodemon can re-send the kill signal\nprocess.on('SIGUSR2', function () {\n  gracefulShutdown(function () {\n    process.kill(process.pid, 'SIGTERM');\n  });\n});\n```\n\nNote that the `process.kill` is *only* called once your shutdown jobs are complete. Hat tip to [Benjie Gillam](http://www.benjiegillam.com/2011/08/node-js-clean-restart-and-faster-development-with-nodemon/) for writing this technique up.\n\n## Triggering events when nodemon state changes\n\nIf you want growl like notifications when nodemon restarts or to trigger an action when an event happens, then you can either `require` nodemon or add event actions to your `nodemon.json` file.\n\nFor example, to trigger a notification on a Mac when nodemon restarts, `nodemon.json` looks like this:\n\n```json\n{\n  \"events\": {\n    \"restart\": \"osascript -e 'display notification \\\"app restarted\\\" with title \\\"nodemon\\\"'\"\n  }\n}\n```\n\nA full list of available events is listed on the [event states wiki](https://github.com/remy/nodemon/wiki/Events#states). Note that you can bind to both states and messages.\n\n## Pipe output to somewhere else\n\n```js\nnodemon({\n  script: ...,\n  stdout: false // important: this tells nodemon not to output to console\n}).on('readable', function() { // the `readable` event indicates that data is ready to pick up\n  this.stdout.pipe(fs.createWriteStream('output.txt'));\n  this.stderr.pipe(fs.createWriteStream('err.txt'));\n});\n```\n\n## Using nodemon in your gulp workflow\n\nCheck out the [gulp-nodemon](https://github.com/JacksonGariety/gulp-nodemon) plugin to integrate nodemon with the rest of your project's gulp workflow.\n\n## Using nodemon in your Grunt workflow\n\nCheck out the [grunt-nodemon](https://github.com/ChrisWren/grunt-nodemon) plugin to integrate nodemon with the rest of your project's grunt workflow.\n\n## Pronunciation\n\n> nodemon, is it pronounced: node-mon, no-demon or node-e-mon (like pokémon)?\n\nWell...I've been asked this many times before. I like that I've been asked this before. There's been bets as to which one it actually is.\n\nThe answer is simple, but possibly frustrating. I'm not saying (how I pronounce it). It's up to you to call it as you like. All answers are correct :)\n\n## Design principles\n\n- Fewer flags is better\n- Works across all platforms\n- Fewer features\n- Let individuals build on top of nodemon\n- Offer all CLI functionality as an API\n- Contributions must have and pass tests\n\nNodemon is not perfect, and CLI arguments has sprawled beyond where I'm completely happy, but perhaps it can be reduced a little one day.\n\n## FAQ\n\nSee the [FAQ](https://github.com/remy/nodemon/blob/master/faq.md) and please add your own questions if you think they would help others.\n\n## Backers\n\nThank you to all [our backers](https://opencollective.com/nodemon#backer)! 🙏\n\n[![nodemon backers](https://opencollective.com/nodemon/backers.svg?width=890)](https://opencollective.com/nodemon#backers)\n\n## Sponsors\n\nSupport this project by becoming a sponsor. Your logo will show up here with a link to your website. [Sponsor this project today ❤️](https://opencollective.com/nodemon#sponsor)\n\n<div style=\"overflow: hidden; margin-bottom: 80px;\"><!--oc--><a title='Netpositive' data-id='162674' data-tier='1' href='https://najlepsibukmacherzy.pl/ranking-legalnych-bukmacherow/'><img alt='Netpositive' src='https://opencollective-production.s3.us-west-1.amazonaws.com/52acecf0-608a-11eb-b17f-5bca7c67fe7b.png' style='object-fit: contain; float: left; margin:12px' height='120' width='120'></a>\n<a title='Best online casinos not on GamStop in the UK' data-id='243140' data-tier='1' href='https://casino-wise.com/'><img alt='Best online casinos not on GamStop in the UK' src='https://opencollective-production.s3.us-west-1.amazonaws.com/account-avatar/f889d209-a931-4c06-a529-fe1f86c411bf/casino-wise-logo.png' style='object-fit: contain; float: left; margin:12px' height='120' width='120'></a>\n<a title='TheCasinoDB' data-id='270835' data-tier='1' href='https://www.thecasinodb.com'><img alt='TheCasinoDB' src='https://opencollective-production.s3.us-west-1.amazonaws.com/account-avatar/7fbc2acb-ba5c-4a5c-99d2-17e205e9a151/8a0f6204-f303-4129-a498-2263fd21e640.png' style='object-fit: contain; float: left; margin:12px' height='120' width='120'></a>\n<a title='Goread.io' data-id='320564' data-tier='1' href='https://goread.io/buy-instagram-followers'><img alt='Goread.io' src='https://opencollective-production.s3.us-west-1.amazonaws.com/7d1302a0-0f33-11ed-a094-3dca78aec7cd.png' style='object-fit: contain; float: left; margin:12px' height='120' width='120'></a>\n<a title='Best Australian online casinos. Reviewed by Correct Casinos.' data-id='322445' data-tier='1' href='https://www.correctcasinos.com/australian-online-casinos/'><img alt='Best Australian online casinos. Reviewed by Correct Casinos.' src='https://opencollective-production.s3.us-west-1.amazonaws.com/fef95200-1551-11ed-ba3f-410c614877c8.png' style='object-fit: contain; float: left; margin:12px' height='120' width='120'></a>\n<a title='nongamstopcasinos.net' data-id='367236' data-tier='1' href='https://www.pieria.co.uk/'><img alt='nongamstopcasinos.net' src='https://opencollective-production.s3.us-west-1.amazonaws.com/fb8b5ba0-3904-11ed-8516-edd7b7687a36.png' style='object-fit: contain; float: left; margin:12px' height='120' width='120'></a>\n<a title='Buy Instagram Likes' data-id='411448' data-tier='1' href='https://poprey.com/'><img alt='Buy Instagram Likes' src='https://opencollective-production.s3.us-west-1.amazonaws.com/fe650970-c21c-11ec-a499-b55e54a794b4.png' style='object-fit: contain; float: left; margin:12px' height='120' width='120'></a>\n<a title='OnlineCasinosSpelen' data-id='423738' data-tier='1' href='https://onlinecasinosspelen.com'><img alt='OnlineCasinosSpelen' src='https://opencollective-production.s3.us-west-1.amazonaws.com/account-avatar/47e87426-6a55-4f69-9fb5-4e5032dc35a8/5d10dd22-320e-47d4-84e6-d144874f1f5f.png' style='object-fit: contain; float: left; margin:12px' height='120' width='120'></a>\n<a title='Beoordelen van nieuwe online casino&apos;s 2023' data-id='424449' data-tier='1' href='https://Nieuwe-Casinos.net'><img alt='Beoordelen van nieuwe online casino&apos;s 2023' src='https://opencollective-production.s3.us-west-1.amazonaws.com/account-avatar/b803f279-c2a2-42da-8f05-d23e73cb8b26/aba64d6d-97e8-468c-b598-db08e0a134c5.png' style='object-fit: contain; float: left; margin:12px' height='120' width='120'></a>\n<a title='Buy real Instagram followers from Twicsy starting at only $2.97. Twicsy has been voted the best site to buy followers from the likes of US Magazine.' data-id='453050' data-tier='1' href='https://twicsy.com/buy-instagram-followers'><img alt='Buy real Instagram followers from Twicsy starting at only $2.97. Twicsy has been voted the best site to buy followers from the likes of US Magazine.' src='https://opencollective-production.s3.us-west-1.amazonaws.com/account-avatar/f07b6f83-d0ed-43c6-91ae-ec8fa90512cd/twicsy-followers.png' style='object-fit: contain; float: left; margin:12px' height='120' width='120'></a>\n<a title='SocialWick offers the best Instagram Followers in the market. If you are looking to boost your organic growth, buy Instagram followers from SocialWick' data-id='462750' data-tier='1' href='https://www.socialwick.com/instagram/followers'><img alt='SocialWick offers the best Instagram Followers in the market. If you are looking to boost your organic growth, buy Instagram followers from SocialWick' src='https://opencollective-production.s3.us-west-1.amazonaws.com/account-avatar/4a977a23-f63a-489a-891b-c0eb8cab1cb4/icon.png' style='object-fit: contain; float: left; margin:12px' height='120' width='120'></a>\n<a title='Buy Telegram Members' data-id='501897' data-tier='1' href='https://buycheapestfollowers.com/buy-telegram-channel-members'><img alt='Buy Telegram Members' src='https://github-production-user-asset-6210df.s3.amazonaws.com/13700/286696172-747dca05-a1e8-4d93-a9e9-95054d1566df.png' style='object-fit: contain; float: left; margin:12px' height='120' width='120'></a>\n<a title='We review the entire iGaming industry from A to Z' data-id='504258' data-tier='1' href='https://casinolandia.com'><img alt='We review the entire iGaming industry from A to Z' src='https://opencollective-production.s3.us-west-1.amazonaws.com/account-avatar/5f858add-77f1-47a2-b577-39eecb299c8c/Logo264.jpg' style='object-fit: contain; float: left; margin:12px' height='120' width='120'></a>\n<a title='CryptoCasinos.online' data-id='525119' data-tier='1' href='https://cryptocasinos.online/'><img alt='CryptoCasinos.online' src='https://opencollective-production.s3.us-west-1.amazonaws.com/account-avatar/97712948-3b1b-4026-a109-257d879baa23/CryptoCasinos.Online-FBcover18.jpg' style='object-fit: contain; float: left; margin:12px' height='120' width='120'></a>\n<a title='No deposit casino promo Codes 2024 - The best online Casinos websites. No deposit bonus codes, Free Spins and Promo Codes. Stake, Roobet, Jackpotcity and more.' data-id='540890' data-tier='1' href='https://www.ownedcore.com/casino'><img alt='No deposit casino promo Codes 2024 - The best online Casinos websites. No deposit bonus codes, Free Spins and Promo Codes. Stake, Roobet, Jackpotcity and more.' src='https://opencollective-production.s3.us-west-1.amazonaws.com/account-avatar/8bd4b78c-95e2-4c41-b4f4-d7fd6c0e12cd/logo4-e6140c27.webp' style='object-fit: contain; float: left; margin:12px' height='120' width='120'></a>\n<a title='Online casino.' data-id='541128' data-tier='1' href='https://www.fruityking.co.nz'><img alt='Online casino.' src='https://opencollective-production.s3.us-west-1.amazonaws.com/account-avatar/7cde3c6f-052c-41bb-93f0-8be187682791/10e42029-c513-4edd-ac24-a8e41d697a96.png' style='object-fit: contain; float: left; margin:12px' height='120' width='120'></a>\n<a title='Boost your social media presence effortlessly with top-quality Instagram and TikTok followers and likes.' data-id='579911' data-tier='1' href='https://leofame.com/buy-instagram-followers'><img alt='Boost your social media presence effortlessly with top-quality Instagram and TikTok followers and likes.' src='https://opencollective-production.s3.us-west-1.amazonaws.com/account-avatar/186c0e19-b195-4228-901a-ab1b70d63ee5/WhatsApp%20Image%202024-06-21%20at%203.50.43%20AM.jpg' style='object-fit: contain; float: left; margin:12px' height='120' width='120'></a>\n<a title='Social Media Management and all kinds of followers' data-id='587050' data-tier='1' href='https://www.socialfollowers.uk/buy-tiktok-followers/'><img alt='Social Media Management and all kinds of followers' src='https://opencollective-production.s3.us-west-1.amazonaws.com/account-avatar/8941f043-5d00-4e33-a1fd-f2d27ca54963/Social%20Followers%20Uk%20logo%20black.png' style='object-fit: contain; float: left; margin:12px' height='120' width='120'></a>\n<a title='Betwinner is an online bookmaker offering sports betting, casino games, and more.' data-id='594768' data-tier='1' href='https://guidebook.betwinner.com/'><img alt='Betwinner is an online bookmaker offering sports betting, casino games, and more.' src='https://opencollective-production.s3.us-west-1.amazonaws.com/account-avatar/82cab29a-7002-4924-83bf-2eecb03d07c4/0x0.png' style='object-fit: contain; float: left; margin:12px' height='120' width='120'></a>\n<a title='At Buzzoid, you can buy Instagram followers quickly, safely, and easily with just a few clicks. Rated world&apos;s #1 IG service since 2012.' data-id='602382' data-tier='1' href='https://buzzoid.com/buy-instagram-followers/'><img alt='At Buzzoid, you can buy Instagram followers quickly, safely, and easily with just a few clicks. Rated world&apos;s #1 IG service since 2012.' src='https://opencollective-production.s3.us-west-1.amazonaws.com/account-avatar/f77464f7-0457-451a-b29d-8e3b161ce83f/285fbc9f-6461-4393-8942-da62d1bed968.png' style='object-fit: contain; float: left; margin:12px' height='120' width='120'></a>\n<a title='Zamsino.com' data-id='608094' data-tier='1' href='https://zamsino.com/'><img alt='Zamsino.com' src='https://opencollective-production.s3.us-west-1.amazonaws.com/account-avatar/e3e99af5-a024-4d85-8594-8fd22e506bc9/Zamsino.com%20Logo.png' style='object-fit: contain; float: left; margin:12px' height='120' width='120'></a>\n<a title='Reviewing and comparing online casinos available to Finnish players. In addition, we publish relevant news and blog posts about the world of iGaming.' data-id='620398' data-tier='1' href='https://uusimmatkasinot.com/'><img alt='Reviewing and comparing online casinos available to Finnish players. In addition, we publish relevant news and blog posts about the world of iGaming.' src='https://opencollective-production.s3.us-west-1.amazonaws.com/account-avatar/d5326d0f-3cde-41f4-b480-78ef8a2fb015/Uusimmatkasinot_head_siteicon.png' style='object-fit: contain; float: left; margin:12px' height='120' width='120'></a>\n<a title='Buzzvoice is your one-stop shop for all your social media marketing needs. With Buzzvoice, you can buy followers, comments, likes, video views and more!' data-id='646075' data-tier='1' href='https://buzzvoice.com/'><img alt='Buzzvoice is your one-stop shop for all your social media marketing needs. With Buzzvoice, you can buy followers, comments, likes, video views and more!' src='https://opencollective-production.s3.us-west-1.amazonaws.com/acd68da0-e71e-11ec-a84e-fd82f80383c1.jpg' style='object-fit: contain; float: left; margin:12px' height='120' width='120'></a>\n<a title='' data-id='648524' data-tier='1' href='https://www.c19.cl/'><img alt='' src='https://opencollective-production.s3.us-west-1.amazonaws.com/account-avatar/01b96d4c-4852-4499-8c70-e3ec57d0c58c/2024-05-09_17-27%20(1).png' style='object-fit: contain; float: left; margin:12px' height='120' width='120'></a>\n<a title='SocialBoosting: Buy Instagram &amp; TikTok Followers, Likes, Views' data-id='653711' data-tier='1' href='https://www.socialboosting.com/'><img alt='SocialBoosting: Buy Instagram &amp; TikTok Followers, Likes, Views' src='https://opencollective-production.s3.us-west-1.amazonaws.com/account-avatar/80a54dfd-8952-4851-8cab-dcfa4a8a0a87/favicon.gif' style='object-fit: contain; float: left; margin:12px' height='120' width='120'></a>\n<a title='Ігрові автомати онлайн' data-id='655295' data-tier='1' href='https://casino.ua/casino/slots/'><img alt='Ігрові автомати онлайн' src='https://opencollective-production.s3.us-west-1.amazonaws.com/account-avatar/3c8fa725-e203-4c57-933c-0a884527fd5b/images.jpg' style='object-fit: contain; float: left; margin:12px' height='120' width='120'></a>\n<a title='Kasinohai.com' data-id='673849' data-tier='1' href='https://www.kasinohai.com/nettikasinot'><img alt='Kasinohai.com' src='https://opencollective-production.s3.us-west-1.amazonaws.com/account-avatar/ad75f68f-cb97-46f8-8981-bbe81ad6ffc9/51bafb1d-ed66-482f-8a8e-9b7b07d55f96.png' style='object-fit: contain; float: left; margin:12px' height='120' width='120'></a>\n<a title='Casino Online Chile' data-id='678929' data-tier='1' href='https://www.acee.cl/'><img alt='Casino Online Chile' src='https://opencollective-production.s3.us-west-1.amazonaws.com/account-avatar/292c66d6-0c5c-40e8-96f0-900dcdeaaf47/acee-casino-chile.png' style='object-fit: contain; float: left; margin:12px' height='120' width='120'></a>\n<a title='casino online chile' data-id='709152' data-tier='1' href='https://chilecasinoonline.cl/'><img alt='casino online chile' src='https://opencollective-production.s3.us-west-1.amazonaws.com/account-avatar/7f3780b2-b7a7-47aa-9837-c01099585495/casino-online-chile-logo.png' style='object-fit: contain; float: left; margin:12px' height='120' width='120'></a>\n<a title='Vanguard Media évalue les casinos en ligne pour joueurs français, testant les sites en France. Nos classements stricts garantissent des casinos fiables et sûrs.' data-id='723517' data-tier='1' href='https://www.vanguardngr.com/casino/fr/'><img alt='Vanguard Media évalue les casinos en ligne pour joueurs français, testant les sites en France. Nos classements stricts garantissent des casinos fiables et sûrs.' src='https://opencollective-production.s3.us-west-1.amazonaws.com/account-avatar/38065879-ef15-4e67-80a1-bdbb30ecb485/101895f1-ca10-49e3-a297-23a915fb9524.png' style='object-fit: contain; float: left; margin:12px' height='120' width='120'></a>\n<a title='Bei Releaf erhalten Sie schnell und diskret Ihr Cannabis Rezept online. Unsere Ärzte prüfen Ihre Angaben und stellen bei Eignung das Rezept aus. Anschließend können Sie legal und sicher medizinisches Cannabis über unsere Partnerapotheken kaufen.' data-id='727109' data-tier='1' href='https://releaf.com/de'><img alt='Bei Releaf erhalten Sie schnell und diskret Ihr Cannabis Rezept online. Unsere Ärzte prüfen Ihre Angaben und stellen bei Eignung das Rezept aus. Anschließend können Sie legal und sicher medizinisches Cannabis über unsere Partnerapotheken kaufen.' src='https://opencollective-production.s3.us-west-1.amazonaws.com/account-avatar/b686d646-5029-4b4c-8cab-9645ab2679de/9da596d1-f48a-41ec-947d-a64dd8e7529c.png' style='object-fit: contain; float: left; margin:12px' height='120' width='120'></a>\n<a title='Download multithreaded HEIC to JPG converter software for Windows 10/11' data-id='751387' data-tier='1' href='https://www.softorbits.net/convert-heic-to-jpeg/'><img alt='Download multithreaded HEIC to JPG converter software for Windows 10/11' src='https://opencollective-production.s3.us-west-1.amazonaws.com/account-avatar/34c7f097-4c59-4be6-a59c-55af13b0bd10/logo-final-square512.png' style='object-fit: contain; float: left; margin:12px' height='120' width='120'></a>\n<a title='We specialize in the online gambling industry, helping players access reliable and verified information about the best online casinos and pokies in Australia. Our team tests casinos and games, collects user reviews from Trustpilot, and organizes them in o' data-id='753333' data-tier='1' href='https://au.trustpilot.com/review/bestpayidpokies.net'><img alt='We specialize in the online gambling industry, helping players access reliable and verified information about the best online casinos and pokies in Australia. Our team tests casinos and games, collects user reviews from Trustpilot, and organizes them in o' src='https://opencollective-production.s3.us-west-1.amazonaws.com/account-avatar/985a0ae7-54c3-4680-8816-bc8d656f7562/payidpokies.png' style='object-fit: contain; float: left; margin:12px' height='120' width='120'></a>\n<a title='Wolf Winner Casino' data-id='754359' data-tier='1' href='https://www.wolfwinner.fun/en'><img alt='Wolf Winner Casino' src='https://opencollective-production.s3.us-west-1.amazonaws.com/account-avatar/556e09fb-d232-4c99-9644-9d28e1cfe27b/wolf-winner-casino-logo.png' style='object-fit: contain; float: left; margin:12px' height='120' width='120'></a>\n<a title='AUCrazyVegas' data-id='756605' data-tier='1' href='https://au.crazyvegas.com/'><img alt='AUCrazyVegas' src='https://opencollective-production.s3.us-west-1.amazonaws.com/account-avatar/be59e9fa-a83d-4244-9e74-f54b7f454e14/au.png' style='object-fit: contain; float: left; margin:12px' height='120' width='120'></a>\n<a title='iDealeCasinos' data-id='757116' data-tier='1' href='https://idealecasinos.com/'><img alt='iDealeCasinos' src='https://opencollective-production.s3.us-west-1.amazonaws.com/account-avatar/907841d3-435e-44b4-9684-c33fd8635ece/ideale-casinos-square-white-logo-300.png' style='object-fit: contain; float: left; margin:12px' height='120' width='120'></a>\n<a title='' data-id='757154' data-tier='1' href='https://nl.trustpilot.com/review/buitenlandsecasino.vip'><img alt='' src='https://opencollective-production.s3.us-west-1.amazonaws.com/account-avatar/9465308a-8e44-4606-af5d-5a81a3c6567b/ChatGPT%20Image%20Nov%2015%2C%202025%2C%2002_53_25%20PM.png' style='object-fit: contain; float: left; margin:12px' height='120' width='120'></a>\n<a title='BetPokies.co.nz is your New Zealand guide in the world of online gambling. Our site was created by gamblers for gamblers.' data-id='760968' data-tier='1' href='https://nz.trustpilot.com/review/betpokies.co.nz'><img alt='BetPokies.co.nz is your New Zealand guide in the world of online gambling. Our site was created by gamblers for gamblers.' src='https://opencollective-production.s3.us-west-1.amazonaws.com/117c78d0-973e-11ed-b663-5b4207ae3c06.png' style='object-fit: contain; float: left; margin:12px' height='120' width='120'></a>\n<a title='one x bet - Arabic betting site' data-id='765806' data-tier='1' href='https://xn----ymcbek6cvgvaq.com/'><img alt='one x bet - Arabic betting site' src='https://opencollective-production.s3.us-west-1.amazonaws.com/account-avatar/529647a4-6230-4013-bcc5-b5855158c022/ChatGPT%20Image%20Sep%2030%2C%202025%2C%2001_29_18%20PM.jpg' style='object-fit: contain; float: left; margin:12px' height='120' width='120'></a>\n<a title='Online Casino Zonder Registratie' data-id='766416' data-tier='1' href='https://nl.trustpilot.com/review/zonderregistratiecasinos.com'><img alt='Online Casino Zonder Registratie' src='https://opencollective-production.s3.us-west-1.amazonaws.com/account-avatar/cf382ddc-627b-4bd9-8870-43ee28d2a628/casino-zonder-registratie.png' style='object-fit: contain; float: left; margin:12px' height='120' width='120'></a>\n<a title='We test dozens of casinos every month and select the coolest ones for Australian players. ' data-id='767300' data-tier='1' href='https://au.trustpilot.com/review/payid-casino.net'><img alt='We test dozens of casinos every month and select the coolest ones for Australian players. ' src='https://opencollective-production.s3.us-west-1.amazonaws.com/account-avatar/ecd8a5f4-fd86-4903-a512-cbfaff35e7ef/payidpokiessites.png' style='object-fit: contain; float: left; margin:12px' height='120' width='120'></a>\n<a title='Pokies Reviews' data-id='771618' data-tier='1' href='https://au.trustpilot.com/review/pokiesgambler.com'><img alt='Pokies Reviews' src='https://opencollective-production.s3.us-west-1.amazonaws.com/account-avatar/a04c9ed0-b1d5-4dbe-a5fd-4cec00567916/pokiesgambler.png' style='object-fit: contain; float: left; margin:12px' height='120' width='120'></a>\n<a title='Buy TikTok Comments' data-id='772992' data-tier='1' href='https://buylikesservices.com/buy-tiktok-custom-comments/'><img alt='Buy TikTok Comments' src='https://opencollective-production.s3.us-west-1.amazonaws.com/account-avatar/1125514e-fc5e-4e1f-a186-a478fa7c3189/6bf0e4e1-f6aa-4d00-a141-f5b2c2642d65.png' style='object-fit: contain; float: left; margin:12px' height='120' width='120'></a>\n<a title='Mi misión es la educación y transparencia en el mundo de los casinos online' data-id='780847' data-tier='1' href='https://www.educatransparencia.cl/'><img alt='Mi misión es la educación y transparencia en el mundo de los casinos online' src='https://opencollective-production.s3.us-west-1.amazonaws.com/account-avatar/c034fdcb-1d17-4c83-8105-f3cfa4f874d6/educalogocito.png' style='object-fit: contain; float: left; margin:12px' height='120' width='120'></a>\n<a title='Spreading knowledge about $ETH' data-id='783771' data-tier='1' href='https://theethereum.wiki'><img alt='Spreading knowledge about $ETH' src='https://opencollective-production.s3.us-west-1.amazonaws.com/account-avatar/bfce6f44-affd-4acd-94c2-bf33797f1cb2/Screenshot%202026-01-28%20at%2014.19.23.png' style='object-fit: contain; float: left; margin:12px' height='120' width='120'></a>\n<a title='' data-id='783792' data-tier='1' href='https://time.now/'><img alt='' src='https://opencollective-production.s3.us-west-1.amazonaws.com/account-avatar/4cca6170-acb2-4b1a-b85b-7715416237cf/time-now-logo3.png' style='object-fit: contain; float: left; margin:12px' height='120' width='120'></a>\n<a title='Best online sports betting and casino company.' data-id='784673' data-tier='1' href='https://global.fun88.com/'><img alt='Best online sports betting and casino company.' src='https://opencollective-production.s3.us-west-1.amazonaws.com/account-avatar/1688ebca-4984-4b9b-a24d-8fdd1233892f/fun88-logo.png' style='object-fit: contain; float: left; margin:12px' height='120' width='120'></a>\n<a title='bestecasinozondercruks' data-id='785087' data-tier='1' href='https://nl.trustpilot.com/review/bestecasinozondercruks.online'><img alt='bestecasinozondercruks' src='https://opencollective-production.s3.us-west-1.amazonaws.com/account-avatar/4948eca9-abd5-49ea-bb70-1ea6053f8663/ChatGPT%20Image%20Dec%2027%2C%202025%2C%2010_22_47%20PM-min.png' style='object-fit: contain; float: left; margin:12px' height='120' width='120'></a>\n<a title='Best online sports betting company in Thailand.' data-id='787477' data-tier='1' href='https://www.fun88thh.com/th/'><img alt='Best online sports betting company in Thailand.' src='https://opencollective-production.s3.us-west-1.amazonaws.com/account-avatar/bbf7174c-fc01-4ce6-86b5-f621e350969d/fun88-logo.png' style='object-fit: contain; float: left; margin:12px' height='120' width='120'></a>\n<a title='Best online sports betting company in Vietnam.' data-id='787478' data-tier='1' href='https://www.fun88vnu.com/vn/'><img alt='Best online sports betting company in Vietnam.' src='https://opencollective-production.s3.us-west-1.amazonaws.com/account-avatar/ed704e1d-3894-48bb-83e3-6094b2c68a5c/fun88-logo.png' style='object-fit: contain; float: left; margin:12px' height='120' width='120'></a>\n<a title='We testen elke maand tientallen casino’s en kiezen de beste uit voor Nederlandse spelers.' data-id='787870' data-tier='1' href='https://nl.trustpilot.com/review/scandicasinos.com'><img alt='We testen elke maand tientallen casino’s en kiezen de beste uit voor Nederlandse spelers.' src='https://opencollective-production.s3.us-west-1.amazonaws.com/account-avatar/115ec975-5575-436a-9406-9ef439dd28c0/scandicasinos.png' style='object-fit: contain; float: left; margin:12px' height='120' width='120'></a>\n<a title='ThePokies Net' data-id='787930' data-tier='1' href='https://au.trustpilot.com/review/thepokies-au.com'><img alt='ThePokies Net' src='https://opencollective-production.s3.us-west-1.amazonaws.com/account-avatar/7981d14b-e79a-45a6-91b5-6040b0077e28/pokiesnet-casino.jpg' style='object-fit: contain; float: left; margin:12px' height='120' width='120'></a>\n<a title='Aviator Game Online' data-id='789860' data-tier='1' href='https://www.trustpilot.com/review/aviatorplay.top'><img alt='Aviator Game Online' src='https://opencollective-production.s3.us-west-1.amazonaws.com/account-avatar/b3cf9a31-607e-4d3f-8b86-0726f4323dae/aviatorr.png' style='object-fit: contain; float: left; margin:12px' height='120' width='120'></a>\n<a title='Plinko Game' data-id='789874' data-tier='1' href='https://www.trustpilot.com/review/plinkoplay.top'><img alt='Plinko Game' src='https://opencollective-production.s3.us-west-1.amazonaws.com/account-avatar/5e953df9-1876-45b6-9ffc-f2009804935b/plinkoo.png' style='object-fit: contain; float: left; margin:12px' height='120' width='120'></a>\n<a title='iDEAL Casinos' data-id='791586' data-tier='1' href='https://nl.trustpilot.com/review/idealcasinos.co.com'><img alt='iDEAL Casinos' src='https://opencollective-production.s3.us-west-1.amazonaws.com/account-avatar/974ae057-b821-4404-b0b7-c85c075996a4/Screen-Shot-2023-03-17-at-10.17.00.png' style='object-fit: contain; float: left; margin:12px' height='120' width='120'></a>\n<a title='POLi Pay Casinos' data-id='796704' data-tier='1' href='https://nz.trustpilot.com/review/surfpokies.com'><img alt='POLi Pay Casinos' src='https://opencollective-production.s3.us-west-1.amazonaws.com/account-avatar/cd762491-d631-4fa3-a49e-bd373e6a338b/polii.png' style='object-fit: contain; float: left; margin:12px' height='120' width='120'></a><!--oc-->\n</div>\n\nPlease note that links to the sponsors above are not direct endorsements nor affiliated with any of contributors of the nodemon project.\n\n# License\n\nMIT [http://rem.mit-license.org](http://rem.mit-license.org)\n"
  },
  {
    "path": "TODO.md",
    "content": "# TODO\n\nA rough outline of things I'd like to do with nodemon after 13 years of supporting the software:\n\n- Upgrade mocha (I tried Jest once, but it can't fork and monitor the outputs, which is how most of the tests run)\n- Switch to prettier from jshint (and commit formatted code)\n- Sweep code for unused or overly complicated code(!)\n"
  },
  {
    "path": "bin/nodemon.js",
    "content": "#!/usr/bin/env node\n\nconst cli = require('../lib/cli');\nconst nodemon = require('../lib/');\nconst options = cli.parse(process.argv);\n\nnodemon(options);\n\nconst fs = require('fs');\n\n// checks for available update and returns an instance\nconst pkg = JSON.parse(fs.readFileSync(__dirname + '/../package.json'));\n\nif (pkg.version.indexOf('0.0.0') !== 0 && options.noUpdateNotifier !== true) {\n  require('simple-update-notifier')({ pkg });\n}\n"
  },
  {
    "path": "commitlint.config.js",
    "content": "module.exports = {\n  extends: ['@commitlint/config-conventional'],\n};\n"
  },
  {
    "path": "doc/arch.md",
    "content": "# nodemon code arch\n\n```\nCLI -> parser -> nodemon options -> rules\n\nrules -> configure -> watch -> start process\n```\n\n## CLI examples\n\nWatch src but only *.js and *.coffee\n\n    nodemon --watch src/ -e js,coffee app.js\n\nParsed to:\n\n    {\n      watch: ['src/'],\n      ignore: [],\n      script: 'app.js'\n      options: {\n        extensions: ['js', 'coffee'],\n        exec: 'node'\n      }\n    }\n\nWatch with no args:\n\n    nodemon\n\nParsed to (assuming a package.json or index.js is found):\n\n    {\n      watch: [], // meaning all subdirectories\n      ignore: [],\n      script: 'index.js',\n      options: {\n        extensions: ['js'],\n        exec: 'node'\n      }\n    }"
  },
  {
    "path": "doc/cli/authors.txt",
    "content": "\n Remy Sharp - author and maintainer\n    https://github.com/remy\n    https://twitter.com/rem\n\n Contributors: https://github.com/remy/nodemon/graphs/contributors ❤︎\n\n Please help make nodemon better: https://github.com/remy/nodemon/\n"
  },
  {
    "path": "doc/cli/config.txt",
    "content": "\n  Typically the options to control nodemon are passed in via the CLI and are\n  listed under: nodemon --help options\n\n  nodemon can also be configured via a local and global config file:\n\n  * $HOME/nodemon.json\n  * $PWD/nodemon.json OR --config <file>\n  * nodemonConfig in package.json\n\n  All config options in the .json file map 1-to-1 with the CLI options, so a\n  config could read as:\n\n    {\n      \"ext\": \"*.pde\",\n      \"verbose\": true,\n      \"exec\": \"processing --sketch=game --run\"\n    }\n\n  There are a limited number of variables available in the config (since you\n  could use backticks on the CLI to use a variable, backticks won't work in\n  the .json config).\n\n  * {{pwd}} - the current directory\n  * {{filename}} - the filename you pass to nodemon\n\n  For example:\n\n    {\n      \"ext\": \"*.pde\",\n      \"verbose\": true,\n      \"exec\": \"processing --sketch={{pwd}} --run\"\n    }\n\n  The global config file is useful for setting up default executables\n  instead of repeating the same option in each of your local configs:\n\n    {\n      \"verbose\": true,\n      \"execMap\": {\n        \"rb\": \"ruby\",\n        \"pde\": \"processing --sketch={{pwd}} --run\"\n      }\n    }\n"
  },
  {
    "path": "doc/cli/help.txt",
    "content": "  Usage: nodemon [options] [script.js] [args]\n\n  Options:\n\n  --config file ............ alternate nodemon.json config file to use\n  -e, --ext ................ extensions to look for, ie. js,pug,hbs.\n  -x, --exec app ........... execute script with \"app\", ie. -x \"python -v\".\n  -w, --watch path ......... watch directory \"path\" or files. use once for\n                             each directory or file to watch.\n  -i, --ignore ............. ignore specific files or directories.\n  -V, --verbose ............ show detail on what is causing restarts.\n  -- <your args> ........... to tell nodemon stop slurping arguments.\n\n  Note: if the script is omitted, nodemon will try to read \"main\" from\n  package.json and without a nodemon.json, nodemon will monitor .js, .mjs, .coffee,\n  .litcoffee, and .json by default.\n\n  For advanced nodemon configuration use nodemon.json: nodemon --help config\n  See also the sample: https://github.com/remy/nodemon/wiki/Sample-nodemon.json\n\n  Examples:\n\n  $ nodemon server.js\n  $ nodemon -w ../foo server.js apparg1 apparg2\n  $ nodemon --exec python app.py\n  $ nodemon --exec \"make build\" -e \"styl hbs\"\n  $ nodemon app.js -- --config # pass config to app.js\n\n  \\x1B[1mAll options are documented under: \\x1B[4mnodemon --help options\\x1B[0m\n"
  },
  {
    "path": "doc/cli/logo.txt",
    "content": "    ;                                 ;\n    kO.                              x0\n    KMX,          .:x0kc.          'KMN\n    0MMM0:     'oKMMMMMMMXd,     ;OMMMX\n    oMMMMMWKOONMMMMMMMMMMMMMWOOKWMMMMMx\n     OMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMK.\n    .oWMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMd.\n    KMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMN\n    KMMMMMMMMMMMMMMW0k0WMMMMMMMMMMMMMMW\n    KMMMMMMMMMMMNk:.    :xNMMMMMMMMMMMW\n    KMMMMMMMMMMK           OMMMMMMMMMMW\n    KMMMMMMMMMMO           xMMMMMMMMMMN\n    KMMMMMMMMMMO           xMMMMMMMMMMN\n    KMMMMMMMMMMO           xMMMMMMMMMMN\n    KMMMMMMMMMMO           xMMMMMMMMMMN\n    KMMMMMMMMMMO           xMMMMMMMMMMN\n    KMMMMMMMMMNc           ;NMMMMMMMMMN\n    KMMMMMW0o'               .lOWMMMMMN\n    KMMKd;                       ,oKMMN\n    kX:                             ,K0"
  },
  {
    "path": "doc/cli/options.txt",
    "content": "\nConfiguration\n  --config <file> .......... alternate nodemon.json config file to use\n  --exitcrash .............. exit on crash, allows nodemon to work with other watchers\n  -i, --ignore ............. ignore specific files or directories\n  --no-colors .............. disable color output\n  --signal <signal> ........ use specified kill signal instead of default (ex. SIGTERM)\n  -w, --watch path ......... watch directory \"dir\" or files. use once for each\n                             directory or file to watch\n  --no-update-notifier ..... opt-out of update version check\n\nExecution\n  -C, --on-change-only ..... execute script on change only, not startup\n  --cwd <dir> .............. change into <dir> before running the script\n  -e, --ext ................ extensions to look for, ie. \"js,pug,hbs\"\n  -I, --no-stdin ........... nodemon passes stdin directly to child process\n  --spawn .................. force nodemon to use spawn (over fork) [node only]\n  -x, --exec app ........... execute script with \"app\", ie. -x \"python -v\"\n  -- <your args> ........... to tell nodemon stop slurping arguments\n\nWatching\n  -d, --delay n ............ debounce restart for \"n\" seconds\n  -L, --legacy-watch ....... use polling to watch for changes (typically needed\n                             when watching over a network/Docker)\n  -P, --polling-interval ... combined with -L, milliseconds to poll for (default 100)\n\nInformation\n  --dump ................... print full debug configuration\n  -h, --help ............... default help\n  --help <topic> ........... help on a specific feature. Try \"--help topics\"\n  -q, --quiet .............. minimise nodemon messages to start/stop only\n  -v, --version ............ current nodemon version\n  -V, --verbose ............ show detail on what is causing restarts\n\n\n> Note that any unrecognised arguments are passed to the executing command.\n"
  },
  {
    "path": "doc/cli/topics.txt",
    "content": "\n  options .................. show all available nodemon options\n  config ................... default config options using nodemon.json\n  authors .................. contributors to this project\n  logo ..................... <3\n  whoami ................... I, AM, NODEMON \\o/\n\n  Please support https://github.com/remy/nodemon/\n"
  },
  {
    "path": "doc/cli/usage.txt",
    "content": "  Usage: nodemon [nodemon options] [script.js] [args]\n\n  See \"nodemon --help\" for more.\n"
  },
  {
    "path": "doc/cli/whoami.txt",
    "content": "__/\\\\\\\\\\_____/\\\\\\_______/\\\\\\\\\\_______/\\\\\\\\\\\\\\\\\\\\\\\\_____/\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\__/\\\\\\\\____________/\\\\\\\\_______/\\\\\\\\\\_______/\\\\\\\\\\_____/\\\\\\_\n _\\/\\\\\\\\\\\\___\\/\\\\\\_____/\\\\\\///\\\\\\____\\/\\\\\\////////\\\\\\__\\/\\\\\\///////////__\\/\\\\\\\\\\\\________/\\\\\\\\\\\\_____/\\\\\\///\\\\\\____\\/\\\\\\\\\\\\___\\/\\\\\\_\n  _\\/\\\\\\/\\\\\\__\\/\\\\\\___/\\\\\\/__\\///\\\\\\__\\/\\\\\\______\\//\\\\\\_\\/\\\\\\_____________\\/\\\\\\//\\\\\\____/\\\\\\//\\\\\\___/\\\\\\/__\\///\\\\\\__\\/\\\\\\/\\\\\\__\\/\\\\\\_\n   _\\/\\\\\\//\\\\\\_\\/\\\\\\__/\\\\\\______\\//\\\\\\_\\/\\\\\\_______\\/\\\\\\_\\/\\\\\\\\\\\\\\\\\\\\\\_____\\/\\\\\\\\///\\\\\\/\\\\\\/_\\/\\\\\\__/\\\\\\______\\//\\\\\\_\\/\\\\\\//\\\\\\_\\/\\\\\\_\n    _\\/\\\\\\\\//\\\\\\\\/\\\\\\_\\/\\\\\\_______\\/\\\\\\_\\/\\\\\\_______\\/\\\\\\_\\/\\\\\\///////______\\/\\\\\\__\\///\\\\\\/___\\/\\\\\\_\\/\\\\\\_______\\/\\\\\\_\\/\\\\\\\\//\\\\\\\\/\\\\\\_\n     _\\/\\\\\\_\\//\\\\\\/\\\\\\_\\//\\\\\\______/\\\\\\__\\/\\\\\\_______\\/\\\\\\_\\/\\\\\\_____________\\/\\\\\\____\\///_____\\/\\\\\\_\\//\\\\\\______/\\\\\\__\\/\\\\\\_\\//\\\\\\/\\\\\\_\n      _\\/\\\\\\__\\//\\\\\\\\\\\\__\\///\\\\\\__/\\\\\\____\\/\\\\\\_______/\\\\\\__\\/\\\\\\_____________\\/\\\\\\_____________\\/\\\\\\__\\///\\\\\\__/\\\\\\____\\/\\\\\\__\\//\\\\\\\\\\\\_\n       _\\/\\\\\\___\\//\\\\\\\\\\____\\///\\\\\\\\\\/_____\\/\\\\\\\\\\\\\\\\\\\\\\\\/___\\/\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\_\\/\\\\\\_____________\\/\\\\\\____\\///\\\\\\\\\\/_____\\/\\\\\\___\\//\\\\\\\\\\_\n        _\\///_____\\/////_______\\/////_______\\////////////_____\\///////////////__\\///______________\\///_______\\/////_______\\///_____\\/////__"
  },
  {
    "path": "doc/events.md",
    "content": "# Events\n\nnodemon will emit events based on the child process.\n\n## Commands\n\n- restart\n- config:update\n- quit\n\n## States\n\n- start - child process has started\n- crash - child process has crashed (nodemon will not emit exit)\n- exit - child process has cleanly exited (ie. no crash)\n- restart([ array of files triggering the restart ]) - child process has restarted\n- config:update - nodemon's config has changed\n\n## Messages\n\n- log({ type, message (plain text log), colour (colour coded log) }) - logging from nodemon (not the child process)\n- stdout - the stdout stream from the child process\n- stderr - the stderr stream from the child process\n- readable - stdout and stderr streams are ready ([example](https://github.com/remy/nodemon#pipe-output-to-somewhere-else))\n\nNote that if you want to supress the normal stdout & stderr of the child, in favour\nof processing the stream manually using the stdout/stderr nodemon events, pass\nnodemon the option of `stdout: false`.\n\n## Using nodemon events\n\nIf nodemon is required, events can be bound and emitted on the nodemon object:\n\n```js\nvar nodemon = require('nodemon');\n\nnodemon({ script: 'app.js' }).on('start', function () {\n  console.log('nodemon started');\n}).on('crash', function () {\n  console.log('script crashed for some reason');\n});\n\n// force a restart\nnodemon.emit('restart');\n\n// force a quit\nnodemon.emit('quit');\n```\n\n## Using nodemon as child process\n\nIf nodemon is a spawned process, then the child (nodemon) will emit message\nevents whereby the event argument contains the event type, and instead of\nemitting events, you `send` the command:\n\n```js\n// using `spawn` as example, can use other functions like `fork`, etc\n// https://nodejs.org/api/child_process.html\nconst { spawn } = require('child_process');\n\nfunction spawnNodemon() {\n  const cp = spawn('nodemon', ['path/to/file.js', '--watch', 'path/to/watch'], {\n    // the important part is the 4th option 'ipc'\n    // this way `process.send` will be available in the child process (nodemon)\n    // so it can communicate back with parent process (through `.on()`, `.send()`)\n    // https://nodejs.org/api/child_process.html#child_process_options_stdio\n    stdio: ['pipe', 'pipe', 'pipe', 'ipc'],\n  });\n\n  return cp;\n}\n\nvar app = spawnNodemon();\n\napp.on('message', function (event) {\n  if (event.type === 'start') {\n    console.log('nodemon started');\n  } else if (event.type === 'crash') {\n    console.log('script crashed for some reason');\n  }\n});\n\n// force a restart\napp.send('restart');\n\n// force a quit\napp.send('quit');\n```\n\nNote that even though the child will still emit a `message` event whose type is\n`exit`, it makes more sense to listen to the actual `exit` event on the child:\n\n```js\napp.on('exit', function () {\n  console.log('nodemon quit');\n});\n```\n"
  },
  {
    "path": "doc/option-parsing-logic.md",
    "content": "# Option parsing logic\n\n1. Read all CLI arguments\n2. Load local config\n3. Load global config\n4. Try backup: package.main\n5. Try backup: package.start\n6. Try index.js\n"
  },
  {
    "path": "doc/requireable.md",
    "content": "# Nodemon as a required module\n\nNodemon (as of 1.0.0) also works as a required module. At present, you can only require nodemon in to your project once (as there are static config variables), but you can re-run with new settings for a different application to monitor.\n\nBy requiring nodemon, you can extend it's functionality. Below is a simple example of using nodemon in your project:\n\n```js\nvar nodemon = require('nodemon');\n\nnodemon({\n  script: 'app.js',\n  ext: 'js json'\n});\n\nnodemon.on('start', function () {\n  console.log('App has started');\n}).on('quit', function () {\n  console.log('App has quit');\n  process.exit();\n}).on('restart', function (files) {\n  console.log('App restarted due to: ', files);\n});\n```\n\nNodemon will emit a number of [events](https://github.com/remy/nodemon/blob/master/doc/events.md) by default, and when in verbose mode will also emit a `log` event (which matches what the nodemon cli tool echos).\n\n## Arguments\n\nThe `nodemon` function takes either an object (that matches the [nodemon config](https://github.com/remy/nodemon#config-files)) or can take a string that matches the arguments that would be used on the command line:\n\n```js\nvar nodemon = require('nodemon');\n\nnodemon('-e \"js json\" app.js');\n```\n\n## Methods & Properties\n\nThe `nodemon` object also has a few methods and properties. Some are exposed to help with tests, but have been listed here for completeness:\n\n### Event handling\n\nThis is the event emitter bus that exists inside nodemon exposed at the top level module (ie. it's the `events` api):\n\n- `nodemon.on(event, fn)`\n- `nodemon.addListener(event, fn)`\n- `nodemon.once(event, fn)`\n- `nodemon.emit(event)`\n- `nodemon.removeAllListeners([event])`\n\nNote: there's no `removeListener` (happy to take a pull request if it's needed).\n\n### Test utilities\n\n- `nodemon.reset()` - reverts nodemon's internal state to a clean slate\n- `nodemon.config` - a reference to the internal config nodemon uses\n"
  },
  {
    "path": "doc/rules.md",
    "content": "# Rules\n\nGiven a nodemon.json file that contains:\n\n```json\n{\n  \"ignore\": [\"*.coffee\"],\n  \"watch\": [\"server/*.coffee\", \"test/\"]\n}\n```\n\nThen nodemon detects changes, but what causes nodemon to restart? The ignored files or the watched files? Which wins?\n\n```js\nconst files = ['server/foo.coffee', 'server/app.js'];\n\n// afterIgnore = ['server/app.js'] now since foo.coffee matches *.coffee\nconst afterIgnore = files.filter(applyIgnore);\n\n// watch = ['server/foo.coffee'] as it's under the watch\nconst watched = files.filter(applyWatch);\n```\n\nWhat about:\n\n```js\nconst files = ['test/app.js', 'test/app.coffee'];\n\n// afterIgnore = ['test/app.js'] now since test/app.coffee matches *.coffee\nconst afterIgnore = files.filter(applyIgnore);\n\n// watch.length = 2 as watch implies test/*.*\nconst watched = files.filter(applyWatch);\n```\n"
  },
  {
    "path": "doc/sample-nodemon.md",
    "content": "# Sample nodemon.json\n\nHere is an example (of a contrived) `nodemon.json` file:\n\n```json\n{\n  \"restartable\": \"rs\",\n  \"ignore\": [\n    \".git\",\n    \"node_modules/**/node_modules\"\n  ],\n  \"verbose\": true,\n  \"execMap\": {\n    \"js\": \"node --harmony\"\n  },\n  \"events\": {\n    \"restart\": \"osascript -e 'display notification \\\"App restarted due to:\\n'$FILENAME'\\\" with title \\\"nodemon\\\"'\"\n  },\n  \"watch\": [\n    \"test/fixtures/\",\n    \"test/samples/\"\n  ],\n  \"env\": {\n    \"NODE_ENV\": \"development\"\n  },\n  \"ext\": \"js,json\"\n}\n```\n\nNote that the `ignore` used is nodemon's default ignore rule. The complete defaults can be seen here: [defaults.js](https://github.com/remy/nodemon/blob/master/lib/config/defaults.js).\n"
  },
  {
    "path": "faq.md",
    "content": "# FAQ\n\nThis is being added to as common issues occur on the [issues](http://github.com/remy/nodemon/issues), and where appropriate the answers will be added here.\n\nThis is a working document, and if it makes sense, I'll take pull requests to help make it better.\n\n# How to clear the console on restart\n\nRather than being a(nother) feature in nodemon, and as per the [design principles](https://github.com/remy/nodemon#design-principles) you can clear the console using nodemon's existing architecture.\n\nIn your `nodemon.json` (or in your `package.json`) you can include the follow event handler to always clear the console when nodemon starts:\n\n```json\n{\n  \"events\": {\n    \"start\": \"cls || clear\"\n  }\n}\n```\n\nNote that on Windows, this will clear the scroll buffer too. If you try to use node to clear the screen, you may have a race condition between the boot time of your process and the start event. This method should be the fastest.\n\n# nodemon doesn't restart on .env change\n\nThis is an edge case with how nodemon watches files. This is because nodemon doesn't know if `.env` is a hidden file with no extension or a `*.env` without a filename.\n\nNonetheless, to trigger a change on `.env` (or similar files like `.bash_profile`), you need to explicitly tell nodemon to watch the file.\n\nHowever, now nodemon will *only* watch the `.env` file, so you need to add to what nodemon is watching, i.e. tell nodemon to _also_ watch the current working directory:\n\n```bash\n$ nodemon --watch .env --watch app app/index.js\n```\n\n# nodemon doesn't work with my REPL\n\nCreate an nodemon.json file with the setting:\n\n```js\n{\n  \"restartable\": false\n}\n```\n\nThis will leave the STDIN to your application rather than listening for the `rs` command to restart.\n\n# Strange/failing behaviour starting the (node-based) executable\n\nBy default, nodemon will try to fork your node scripts ([background reading](https://github.com/remy/nodemon/issues/1025)), however, there are some edge cases where that won't suit your needs. Most of the time the default configuration should be fine, but if you want to force nodemon to spawn your node process, use the `--spawn` option.\n\n# My script arguments are being taken by nodemon\n\nUse the `--` switch to tell nodemon to ignore all arguments after this point. So to pass `-L` to your script instead of nodemon, use:\n\n```\n$ nodemon app.js -- -L -opt2 -opt3\n```\n\nnodemon will ignore all script arguments after `--` and pass them to your script.\n\n# Error: \"process failed, unhandled exit code (2)\"\n\nNodemon will look for exit signals from the child process it runs. When the exit code is `2`, nodemon throws an error. Typically this is because the arguments are bad for the executing program, but it can also be due other reasons.\n\nFor example, mocha@3.x will exit with `2` on failing tests. To handle the exit code in a way that nodemon can consume, manually exit the process, i.e.:\n\n```bash\nnodemon -x 'mocha test/bad.test.js || exit 1'\n```\n\n# You want to suppress the request for support message\n\nPerhaps you're [already supporting nodemon](https://opencollective.com/nodemon) or you're using it in CI and it needs to be quietened.\n\nInclude the environment value of `SUPPRESS_SUPPORT=1`.\n\n# Can't install nodemon: permission issue\n\nYou may need to install nodemon using `sudo` (which isn't recommended, but I understand it's unavoidable in some environments). If the install fails with this appearing in the npm error log, then you need the following workaround.\n\n```\ngyp WARN EACCES user \"root\" does not have permission to access the dev dir \"<some-local-dir>\"\n```\n\nTry to re-install adding `--unsafe-perm` to the arguments:\n\n```\nsudo npm install -g nodemon --unsafe-perm\n```\n\nRef [#713](https://github.com/remy/nodemon/issues/713)\n\n# Help! My changes aren't being detected!\n\nnodemon (from 1.4.2 onwards) uses [Chokidar](https://www.npmjs.com/package/chokidar) as its underlying watch system.\n\nIf you find your files aren't being monitored, either nodemon isn't restarting, or it reports that zero files are being watched, then you may need the polling mode.\n\nTo enable polling use the legacy flag either via the terminal:\n\n```shell\n$ nodemon --legacy-watch\n$ nodemon -L # short alias\n```\n\nOr via the `nodemon.json`:\n\n```json\n{\n  \"legacyWatch\": true\n}\n```\n\n## nodemon tries to run two scripts\n\nIf you see nodemon trying to run two scripts, like:\n\n```\n9 Dec 23:52:58 - [nodemon] starting `node ./app.js fixtures/sigint.js`\n```\n\nThis is because the main script argument (`fixtures/sigint.js` in this case) wasn't found, and a `package.json`'s main file _was_ found. ie. to solve, double check the path to your script is correct.\n\n## What has precedence, ignore or watch?\n\nEverything under the ignore rule has the final word. So if you ignore the `node_modules` directory, but watch `node_modules/*.js`, then all changed files will be ignored, because any changed .js file in the `node_modules` are ignored.\n\nHowever, there are defaults in the ignore rules that your rules will be merged with, and not override. To override the ignore rules see [overriding the underlying default ignore rules](#overriding-the-underlying-default-ignore-rules).\n\n## Overriding the underlying default ignore rules\n\nThe way the ignore rules work is that your rules are merged with the `ignoreRoot` rules, which contain `['.git', 'node_modules', ...]`. So if you ignore `public`, the ignore rule results in `['.git', 'node_modules', ..., 'public']`.\n\nSay you did want to watch the `node_modules` directory. You have to override the `ignoreRoot`. If you wanted this on a per project basis, add the config to you local `nodemon.json`. If you want it for all projects, add it to `$HOME/nodemon.json`:\n\n```json\n{\n  \"ignoreRoot\": [\".git\"]\n}\n```\n\nNow when ignoring `public`, the ignore rule results in `['.git', 'public']`, and nodemon will restart on `node_modules` changes.\n\n## nodemon doesn't work with fedora\n\nFedora is looking for `nodejs` rather than `node` which is the binary that nodemon kicks off.\n\nA workaround is to make sure that `node` binary exists in the `PATH`:\n\n```bash\nsudo ln -s /usr/bin/nodejs /usr/local/bin/node\n```\n\nAlternatively the `--exec nodejs` option can be used.\n\nFedora and Ubuntu package node as nodejs, because node.dpkg is\n\n> Description-en: Amateur Packet Radio Node program\n> The node program accepts TCP/IP and packet radio network connections and\n> presents users with an interface that allows them to make gateway connections\n> to remote hosts using a variety of amateur radio protocols.\n> They make the binary is nodejs, rather than node. So long as you're not using that Packet Radio Node Program mentioned above the workaround will work.\n\nThank you [@EvanCarroll](https://github.com/remy/nodemon/issues/68#issuecomment-13672509)\n\n## Using nodemon with forever\n\nIf you're using nodemon with [forever](https://github.com/foreverjs/forever) (perhaps in a production environment), you can combine the two together. This way if the script crashes, forever restarts the script, and if there are file changes, nodemon restarts your script. For more detail, see [issue 30](https://github.com/remy/nodemon/issues/30).\n\nTo achieve this you need to add the following on the call to `forever`:\n\n* Use forever's `-c nodemon` option to tell forever to run `nodemon` instead of `node`.\n* Include the nodemon `--exitcrash` flag to ensure nodemon exits if the script crashes (or exits unexpectedly).\n* Tell forever to use `SIGTERM` instead of `SIGKILL` when requesting nodemon to stop. This ensures that nodemon can stop the watched node process cleanly.\n* Optionally add the `--uid` parameter, adding a unique name for your process. In the example, the uid is set to `foo`.\n\n```bash\nforever start --uid foo --killSignal=SIGTERM -c 'nodemon --exitcrash' server.js\n```\n\nTo test this, you can kill the server.js process and forever will restart it. If you `touch server.js` nodemon will restart it.\n\nTo stop the process monitored by forever and nodemon, call the following, using the `uid` we assigned above (`foo`):\n\n```bash\nforever stop foo\n```\n\nThis will stop both nodemon and the node process it was monitoring.\n\nNote that I _would not_ recommend using nodemon in a production environment - but that's because I wouldn't want it restart without my explicit instruction.\n\n## What does \"verbose\" give me?\n\nThe `--verbose` (or `-V`) puts nodemon in verbose mode which adds some detail to starting and restarting.\n\nAdditional restart information:\n\n* Which nodemon configs are loaded (local and global if found)\n* Which ignore rules are being applied\n* Which file extensions are being watch\n* The process ID of your application (the `child pid`)\n* The process ID of nodemon to manually trigger restarts via kill signals\n\nFor example:\n\n```text\n14 Apr 15:24:58 - [nodemon] v1.0.17\n14 Apr 15:24:58 - [nodemon] reading config /Users/remy/Sites/jsbin-private/nodemon.json\n14 Apr 15:24:58 - [nodemon] to restart at any time, enter `rs`\n14 Apr 15:24:58 - [nodemon] or send SIGHUP to 58118 to restart\n14 Apr 15:24:58 - [nodemon] ignoring: /Users/remy/Sites/jsbin-private/.git/**/* node_modules/**/node_modules\n14 Apr 15:24:58 - [nodemon] watching: /Users/remy/Sites/jsbin/views/**/* /Users/remy/Sites/jsbin/lib/**/* ../json/*.json config.dev.json\n14 Apr 15:24:58 - [nodemon] watching extensions: json,js,html\n14 Apr 15:24:58 - [nodemon] starting `node run.js`\n14 Apr 15:24:58 - [nodemon] child pid: 9292\n```\n\nWhen nodemon detects a change, the following addition information is shown:\n\n* Which file(s) triggered the check\n* Which (if any) rules the file matched to cause a subsequent restart\n* How many rules were matched and out of those rules, how many cause a restart\n* A list of all the files that _successfully_ caused a restart\n\nFor example, on `lib/app.js` being changed:\n\n```text\n14 Apr 15:25:56 - [nodemon] files triggering change check: ../jsbin/lib/app.js\n14 Apr 15:25:56 - [nodemon] matched rule: **/Users/remy/Sites/jsbin/lib/**/*\n14 Apr 15:25:56 - [nodemon] changes after filters (before/after): 1/1\n14 Apr 15:25:56 - [nodemon] restarting due to changes...\n14 Apr 15:25:56 - [nodemon] ../jsbin/lib/app.js\n\n14 Apr 15:25:56 - [nodemon] starting `node run.js`\n14 Apr 15:25:56 - [nodemon] child pid: 9556\n```\n\n## My .nodemonignore is being ignored\n\n_The legacy `.nodemonignore` was dropped in nodemon@3_\n\nThe new `nodemon.json` supersedes the `.nodemonignore` file, so if you have both, the `.nodemonignore` is not used at all.\n\nNote that if you have a `nodemon.json` in your `$HOME` path, then this will also supersede the old ignore file (and the _legacy_ format config is ignored).\n\n## nodemon does nothing\n\nOn Ubuntu globally installed node applications have been found to have no output when they're run. This _seems_ to be an issue with node not being correctly installed (possibly linked to the binary having to be called `nodejs`).\n\nThe solution (that's worked in the past) is to install [nvm](https://github.com/creationix/nvm) first and using it to install node, _rather_ than using `apt-get` (or similar tools) to install node directly.\n\n## If nodemon is facing the watch errors (Mac & Linux)\n\nTry the following command on terminal:\n\n```bash\necho fs.inotify.max_user_watches=582222 | sudo tee -a /etc/sysctl.conf && sudo sysctl -p\n```\n\n## \"Port in use\" with --inspect flag and docker\n\nThe workaround is to use [kill-port](https://github.com/tiaanduplessis/kill-port) to close off the debugger port, used similarly to:\n\n```bash\nnodemon --delay 80ms --exec 'kill-port -k 9228/tcp; node --inspect=0.0.0.0:9228 ./app/http.js'\n```\n\n[Original suggestion here](https://github.com/remy/nodemon/issues/1050#issuecomment-323680697) and [addition information here](https://github.com/remy/nodemon/issues/1346#issuecomment-401218386).\n\n## Windows: nodemon keeps restarting without changes\n\nThis _might_ be related to a Microsoft Windows release pertaining to the OS and breaking `fsevents` module (which is used by [chokidar](https://github.com/paulmillr/chokidar) - the underlying watch package).\n\nThe workaround is to run the following command:\n\n```bash\nfsutil behavior set disablelastaccess 1\n```\n\n[Futher reading thread](https://github.com/remy/nodemon/issues/1354)\n\n## Error: Cannot find module 'internal/util/types'\n\nIf you see the error `Cannot find module 'internal/util/types'`, the error is solved with a clean npm cache and trying to reinstall the dependency you're working with.\n\nA start is to use the following commands:\n\n```\nsudo npm cache clean --force\nsudo npm i -g npm\n```\n\nOtherwise see [issue #1124](https://github.com/remy/nodemon/issues/1124) for further suggestions.\n\n## No automatic restart when using Docker volumes [issue #419](https://github.com/remy/nodemon/issues/419#issuecomment-391244911)\n\nSome Node.js Docker images do not seem to have the full suite of filesystem process utilities that allow `nodemon` to restart automatically when the code in a mounted volume changes. To handle this, and enable automatic restarts without using legacy mode, you can install the [procps](http://procps.sourceforge.net) package.\n\nHere's an example snippet of a Dockerfile:\n\n```\nFROM node:8.9.4-wheezy\nRUN apt-get update && apt-get install -y procps\n```\n\n## \"scripts is disabled on this system\" on Windows\n\nBased on [this issue](https://github.com/remy/nodemon/issues/1619), if you see the following on Windows:\n\n```\nPS> nodemon app.js\nnodemon : File C:\\…\\nodemon.ps1 cannot be loaded because running scripts is disabled on this system. For more\ninformation, see about_Execution_Policies at https:/go.microsoft.com/fwlink/?LinkID=135170.\nAt line:1 char:1\n\nCategoryInfo : SecurityError: (:) [], PSSecurityException\nFullyQualifiedErrorId : UnauthorizedAccess\n```\n\nThe solution is as follows by [Felipe Jacob](https://github.com/adelbs):\n\nIt's a security restriction of the Windows PowerShell.\n\n1. Open up a powershell command window (open it as administrator)\n2. To check out current restrictions type \"Get-ExecutionPolicy\"\n3. Enable powershell by typing \"Set-ExecutionPolicy remotesigned\"\n\n## How can I watch all file types in a folder?\n\nTo watch all file types, use `'*'`:\n\n```bash\nnodemon --ext '*' --watch public --exec 'python -m SimpleHTTPServer'\n```\n\n## Workaround for when --inspect flag is passed and the old process doesn't finish before starting a new process\n\nBased on [this issue](https://github.com/remy/nodemon/issues/2056).\n\nSometimes when using the `--inspect` flag, nodemon will try to start the a process before the old process is finished.\n\nThis will cause an error trying to up the new process because of the debugger service:\n\n```\n[0] [nodemon] restarting due to changes...\n[0] [nodemon] starting `node --inspect ./main/index.js`\n[0] Starting inspector on 127.0.0.1:9229 failed: address already in use\n```\n\nYour application will likely be running the old version code if you see that message, and you will need to stop the app and manually start it again to run the app with the newer code version.\n\nA common cause for this is when graceful shutdowns are doing async tasks, i.e:\n\n```\n// ensure this is `on` and not `once`\nprocess.on('SIGUSR2', async () => {\n  await db.disconnect()\n  process.kill(process.pid, 'SIGTERM');\n})\n```\n\nSimply removing the `await` keyword would likely fix the issue.\n\nIf even after that you still running into that problem, there's a workaround to force kill the debugger whenever nodemon triggers a restart.\n\nYou can create a `nodemon.json` file at the project root and add the following config:\n\n```\n{\n  \"events\": {\n    \"restart\": \"sh -c 'lsof -i :${PORT:-9229} -t | xargs kill'\"\n  }\n}\n```\n\nThis will run a shell command to kill the process running on the PORT 9229 (default node debug port) whenever nodemon triggers a restart.\n\nIt may fail sometimes, but it makes the hot reload works partially.\n"
  },
  {
    "path": "index.d.ts",
    "content": "import type { WatchOptions } from 'chokidar';\n\nexport type NodemonEventHandler =\n  | 'start'\n  | 'crash'\n  | 'exit'\n  | 'quit'\n  | 'restart'\n  | 'config:update'\n  | 'log'\n  | 'readable'\n  | 'stdout'\n  | 'stderr';\n\nexport type NodemonEventListener = {\n  on(event: 'start' | 'crash' | 'readable', listener: () => void): Nodemon;\n  on(event: 'log', listener: (e: NodemonEventLog) => void): Nodemon;\n  on(event: 'stdout' | 'stderr', listener: (e: string) => void): Nodemon;\n  on(event: 'restart', listener: (files?: string[]) => void): Nodemon;\n  on(event: 'quit', listener: (e?: NodemonEventQuit) => void): Nodemon;\n  on(event: 'exit', listener: (e?: number) => void): Nodemon;\n  on(\n    event: 'config:update',\n    listener: (e?: NodemonEventConfig) => void,\n  ): Nodemon;\n};\n\nexport type NodemonEventLog = {\n  /**\n    - detail: what you get with nodemon --verbose.\n    - status: subprocess starting, restarting.\n    - fail: is the subprocess crashing.\n    - error: is a nodemon system error.\n  */\n  type: 'detail' | 'log' | 'status' | 'error' | 'fail';\n  /** the plain text message */\n  message: string;\n  /** contains the terminal escape codes to add colour, plus the \"[nodemon]\" prefix */\n  colour: string;\n};\n\nexport type NodemonEventQuit = 143 | 130;\n\nexport type NodemonEventConfig = {\n  run: boolean;\n  system: {\n    cwd: string;\n  };\n  required: boolean;\n  dirs: string[];\n  timeout: number;\n  options: NodemonConfig;\n  lastStarted: number;\n  loaded: string[];\n  load: (\n    settings: NodemonSettings,\n    ready: (config: NodemonEventConfig) => void,\n  ) => void;\n  reset: () => void;\n};\n\nexport interface NodemonExecOptions {\n  script: string;\n  scriptPosition?: number;\n  args?: string[];\n  ext?: string; // \"js,mjs\" etc (should really support an array of strings, but I don't think it does right now)\n  exec?: string; // node, python, etc\n  execArgs?: string[]; // args passed to node, etc,\n  nodeArgs?: string[]; // args passed to node, etc,\n}\n\nexport interface NodemonConfig {\n  /** restartable defaults to \"rs\" as a string the user enters */\n  restartable?: false | string;\n  colours?: boolean;\n  execMap?: { [key: string]: string };\n  ignoreRoot?: string[];\n  watch?: string[];\n  ignore?: string[];\n  stdin?: boolean;\n  runOnChangeOnly?: boolean;\n  verbose?: boolean;\n  signal?: string;\n  stdout?: boolean;\n  watchOptions?: WatchOptions;\n  help?: string;\n  version?: boolean;\n  cwd?: string;\n  dump?: boolean;\n  delay?: number;\n  monitor?: string[];\n  spawn?: boolean;\n  noUpdateNotifier?: boolean;\n  legacyWatch?: boolean;\n  pollingInterval?: number;\n  /** @deprecated as this is \"on\" by default */\n  js?: boolean;\n  quiet?: boolean;\n  configFile?: string;\n  exitCrash?: boolean;\n  execOptions?: NodemonExecOptions;\n}\n\nexport interface NodemonSettings extends NodemonConfig, NodemonExecOptions {\n  events?: Record<string, string>;\n  env?: Record<string, string>;\n}\n\nexport type Nodemon = {\n  (settings: NodemonSettings): Nodemon;\n  removeAllListeners(event: NodemonEventHandler): Nodemon;\n  emit(type: NodemonEventHandler, event?: any): Nodemon;\n  reset(callback: Function): Nodemon;\n  restart(): Nodemon;\n  config: NodemonSettings;\n} & NodemonEventListener & {\n    [K in keyof NodemonEventListener as 'addListener']: NodemonEventListener[K];\n  } & {\n    [K in keyof NodemonEventListener as 'once']: NodemonEventListener[K];\n  };\n\ndeclare const nodemon: Nodemon;\n\nexport = nodemon;\n"
  },
  {
    "path": "jsconfig.json",
    "content": "{\n  \"compilerOptions\": {\n    \"typeRoots\": [\"./index.d.ts\", \"./node_modules/@types\"],\n    \"checkJs\": true\n  },\n  \"exclude\": [\"node_modules\"]\n}\n"
  },
  {
    "path": "lib/cli/index.js",
    "content": "var parse = require('./parse');\n\n/**\n * Converts a string to command line args, in particular\n * groups together quoted values.\n * This is a utility function to allow calling nodemon as a required\n * library, but with the CLI args passed in (instead of an object).\n *\n * @param  {String} string\n * @return {Array}\n */\nfunction stringToArgs(string) {\n  var args = [];\n\n  var parts = string.split(' ');\n  var length = parts.length;\n  var i = 0;\n  var open = false;\n  var grouped = '';\n  var lead = '';\n\n  for (; i < length; i++) {\n    lead = parts[i].substring(0, 1);\n    if (lead === '\"' || lead === '\\'') {\n      open = lead;\n      grouped = parts[i].substring(1);\n    } else if (open && parts[i].slice(-1) === open) {\n      open = false;\n      grouped += ' ' + parts[i].slice(0, -1);\n      args.push(grouped);\n    } else if (open) {\n      grouped += ' ' + parts[i];\n    } else {\n      args.push(parts[i]);\n    }\n  }\n\n  return args;\n}\n\nmodule.exports = {\n  parse: function (argv) {\n    if (typeof argv === 'string') {\n      argv = stringToArgs(argv);\n    }\n\n    return parse(argv);\n  },\n};"
  },
  {
    "path": "lib/cli/parse.js",
    "content": "/*\n\nnodemon is a utility for node, and replaces the use of the executable\nnode. So the user calls `nodemon foo.js` instead.\n\nnodemon can be run in a number of ways:\n\n`nodemon` - tries to use package.json#main property to run\n`nodemon` - if no package, looks for index.js\n`nodemon app.js` - runs app.js\n`nodemon --arg app.js --apparg` - eats arg1, and runs app.js with apparg\n`nodemon --apparg` - as above, but passes apparg to package.json#main (or\n  index.js)\n`nodemon --debug app.js\n\n*/\n\nvar fs = require('fs');\nvar path = require('path');\nvar existsSync = fs.existsSync || path.existsSync;\n\nmodule.exports = parse;\n\n/**\n * Parses the command line arguments `process.argv` and returns the\n * nodemon options, the user script and the executable script.\n *\n * @param  {Array<string> | string} argv full process arguments, including `node` leading arg\n * @return {Object} { options, script, args }\n */\nfunction parse(argv) {\n  if (typeof argv === 'string') {\n    argv = argv.split(' ');\n  }\n\n  var eat = function (i, args) {\n    if (i <= args.length) {\n      return args.splice(i + 1, 1).pop();\n    }\n  };\n\n  var args = argv.slice(2);\n  var script = null;\n  var nodemonOptions = { scriptPosition: null };\n\n  var nodemonOpt = nodemonOption.bind(null, nodemonOptions);\n  var lookForArgs = true;\n\n  // move forward through the arguments\n  for (var i = 0; i < args.length; i++) {\n    // if the argument looks like a file, then stop eating\n    if (!script) {\n      if (args[i] === '.' || existsSync(args[i])) {\n        script = args.splice(i, 1).pop();\n\n        // we capture the position of the script because we'll reinsert it in\n        // the right place in run.js:command (though I'm not sure we should even\n        // take it out of the array in the first place, but this solves passing\n        // arguments to the exec process for now).\n        nodemonOptions.scriptPosition = i;\n        i--;\n        continue;\n      }\n    }\n\n    if (lookForArgs) {\n      // respect the standard way of saying: hereafter belongs to my script\n      if (args[i] === '--') {\n        args.splice(i, 1);\n        nodemonOptions.scriptPosition = i;\n        // cycle back one argument, as we just ate this one up\n        i--;\n\n        // ignore all further nodemon arguments\n        lookForArgs = false;\n\n        // move to the next iteration\n        continue;\n      }\n\n      if (nodemonOpt(args[i], eat.bind(null, i, args)) !== false) {\n        args.splice(i, 1);\n        // cycle back one argument, as we just ate this one up\n        i--;\n      }\n    }\n  }\n\n  nodemonOptions.script = script;\n  nodemonOptions.args = args;\n\n  return nodemonOptions;\n}\n\n\n/**\n * Given an argument (ie. from process.argv), sets nodemon\n * options and can eat up the argument value\n *\n * @param {import('../..').NodemonSettings} options object that will be updated\n * @param {String} arg current argument from argv\n * @param {Function} eatNext the callback to eat up the next argument in argv\n * @return {Boolean} false if argument was not a nodemon arg\n */\nfunction nodemonOption(options, arg, eatNext) {\n  // line separation on purpose to help legibility\n  if (arg === '--help' || arg === '-h' || arg === '-?') {\n    var help = eatNext();\n    options.help = help ? help : true;\n  } else\n\n  if (arg === '--version' || arg === '-v') {\n    options.version = true;\n  } else\n\n  if (arg === '--no-update-notifier') {\n    options.noUpdateNotifier = true;\n  } else\n\n  if (arg === '--spawn') {\n    options.spawn = true;\n  } else\n\n  if (arg === '--dump') {\n    options.dump = true;\n  } else\n\n  if (arg === '--verbose' || arg === '-V') {\n    options.verbose = true;\n  } else\n\n  if (arg === '--legacy-watch' || arg === '-L') {\n    options.legacyWatch = true;\n  } else\n\n  if (arg === '--polling-interval' || arg === '-P') {\n    options.pollingInterval = parseInt(eatNext(), 10);\n  } else\n\n  // Depricated as this is \"on\" by default\n  if (arg === '--js') {\n    options.js = true;\n  } else\n\n  if (arg === '--quiet' || arg === '-q') {\n    options.quiet = true;\n  } else\n\n  if (arg === '--config') {\n    options.configFile = eatNext();\n  } else\n\n  if (arg === '--watch' || arg === '-w') {\n    if (!options.watch) { options.watch = []; }\n    options.watch.push(eatNext());\n  } else\n\n  if (arg === '--ignore' || arg === '-i') {\n    if (!options.ignore) { options.ignore = []; }\n    options.ignore.push(eatNext());\n  } else\n\n  if (arg === '--exitcrash') {\n    options.exitCrash = true;\n  } else\n\n  if (arg === '--delay' || arg === '-d') {\n    options.delay = parseDelay(eatNext());\n  } else\n\n  if (arg === '--exec' || arg === '-x') {\n    options.exec = eatNext();\n  } else\n\n  if (arg === '--no-stdin' || arg === '-I') {\n    options.stdin = false;\n  } else\n\n  if (arg === '--on-change-only' || arg === '-C') {\n    options.runOnChangeOnly = true;\n  } else\n\n  if (arg === '--ext' || arg === '-e') {\n    options.ext = eatNext();\n  } else\n\n  if (arg === '--no-colours' || arg === '--no-colors') {\n    options.colours = false;\n  } else\n\n  if (arg === '--signal' || arg === '-s') {\n    options.signal = eatNext();\n  } else\n\n  if (arg === '--cwd') {\n    options.cwd = eatNext();\n\n    // go ahead and change directory. This is primarily for nodemon tools like\n    // grunt-nodemon - we're doing this early because it will affect where the\n    // user script is searched for.\n    process.chdir(path.resolve(options.cwd));\n  } else {\n\n    // this means we didn't match\n    return false;\n  }\n}\n\n/**\n * Given an argument (ie. from nodemonOption()), will parse and return the\n * equivalent millisecond value or 0 if the argument cannot be parsed\n *\n * @param {String} value argument value given to the --delay option\n * @return {Number} millisecond equivalent of the argument\n */\nfunction parseDelay(value) {\n  var millisPerSecond = 1000;\n  var millis = 0;\n\n  if (value.match(/^\\d*ms$/)) {\n    // Explicitly parse for milliseconds when using ms time specifier\n    millis = parseInt(value, 10);\n  } else {\n    // Otherwise, parse for seconds, with or without time specifier then convert\n    millis = parseFloat(value) * millisPerSecond;\n  }\n\n  return isNaN(millis) ? 0 : millis;\n}\n\n"
  },
  {
    "path": "lib/config/command.js",
    "content": "module.exports = command;\n\n/**\n * command constructs the executable command to run in a shell including the\n * user script, the command arguments.\n *\n * @param  {Object} settings Object as:\n *                           { execOptions: {\n *                               exec: String,\n *                               [script: String],\n *                               [scriptPosition: Number],\n *                               [execArgs: Array<string>]\n *                             }\n *                           }\n * @return {Object}          an object with the node executable and the\n *                           arguments to the command\n */\nfunction command(settings) {\n  var options = settings.execOptions;\n  var executable = options.exec;\n  var args = [];\n\n  // after \"executable\" go the exec args (like --debug, etc)\n  if (options.execArgs) {\n    [].push.apply(args, options.execArgs);\n  }\n\n  // then goes the user's script arguments\n  if (options.args) {\n    [].push.apply(args, options.args);\n  }\n\n  // after the \"executable\" goes the user's script\n  if (options.script) {\n    args.splice((options.scriptPosition || 0) +\n      options.execArgs.length, 0, options.script);\n  }\n\n  return {\n    executable: executable,\n    args: args,\n  };\n}\n"
  },
  {
    "path": "lib/config/defaults.js",
    "content": "var ignoreRoot = require('ignore-by-default').directories();\n\n// default options for config.options\nconst defaults = {\n  restartable: 'rs',\n  colours: true,\n  execMap: {\n    py: 'python',\n    rb: 'ruby',\n    ts: 'ts-node',\n    // more can be added here such as ls: lsc - but please ensure it's cross\n    // compatible with linux, mac and windows, or make the default.js\n    // dynamically append the `.cmd` for node based utilities\n  },\n  ignoreRoot: ignoreRoot.map((_) => `**/${_}/**`),\n  watch: ['*.*'],\n  stdin: true,\n  runOnChangeOnly: false,\n  verbose: false,\n  signal: 'SIGUSR2',\n  // 'stdout' refers to the default behaviour of a required nodemon's child,\n  // but also includes stderr. If this is false, data is still dispatched via\n  // nodemon.on('stdout/stderr')\n  stdout: true,\n  watchOptions: {},\n};\n\nconst nodeOptions = process.env.NODE_OPTIONS || ''; // ?\n\nif (/--(loader|import)\\b/.test(nodeOptions)) {\n  delete defaults.execMap.ts;\n}\n\nmodule.exports = defaults;\n"
  },
  {
    "path": "lib/config/exec.js",
    "content": "const path = require('path');\nconst fs = require('fs');\nconst existsSync = fs.existsSync;\nconst utils = require('../utils');\n\nmodule.exports = exec;\nmodule.exports.expandScript = expandScript;\n\n/**\n * Reads the cwd/package.json file and looks to see if it can load a script\n * and possibly an exec first from package.main, then package.start.\n *\n * @return {Object} exec & script if found\n */\nfunction execFromPackage() {\n  // doing a try/catch because we can't use the path.exist callback pattern\n  // or we could, but the code would get messy, so this will do exactly\n  // what we're after - if the file doesn't exist, it'll throw.\n  try {\n    // note: this isn't nodemon's package, it's the user's cwd package\n    var pkg = require(path.join(process.cwd(), 'package.json'));\n    if (pkg.main !== undefined) {\n      // no app found to run - so give them a tip and get the feck out\n      return { exec: null, script: pkg.main };\n    }\n\n    if (pkg.scripts && pkg.scripts.start) {\n      const parts = pkg.scripts.start.split(' ');\n\n      // fixes a loop issue where the script repeats over and over #2258\n      if (parts.includes('nodemon')) {\n        return null;\n      }\n      return { exec: pkg.scripts.start };\n    }\n  } catch (e) {}\n\n  return null;\n}\n\nfunction replace(map, str) {\n  var re = new RegExp('{{(' + Object.keys(map).join('|') + ')}}', 'g');\n  return str.replace(re, function (all, m) {\n    return map[m] || all || '';\n  });\n}\n\nfunction expandScript(script, ext) {\n  if (!ext) {\n    ext = '.js';\n  }\n  if (script.indexOf(ext) !== -1) {\n    return script;\n  }\n\n  if (existsSync(path.resolve(script))) {\n    return script;\n  }\n\n  if (existsSync(path.resolve(script + ext))) {\n    return script + ext;\n  }\n\n  return script;\n}\n\n/**\n * Discovers all the options required to run the script\n * and if a custom exec has been passed in, then it will\n * also try to work out what extensions to monitor and\n * whether there's a special way of running that script.\n *\n * @param  {Object} nodemonOptions\n * @param  {Object} execMap\n * @return {Object} new and updated version of nodemonOptions\n */\nfunction exec(nodemonOptions, execMap) {\n  if (!execMap) {\n    execMap = {};\n  }\n\n  var options = utils.clone(nodemonOptions || {});\n  var script;\n\n  // if there's no script passed, try to get it from the first argument\n  if (!options.script && (options.args || []).length) {\n    script = expandScript(\n      options.args[0],\n      options.ext && '.' + (options.ext || 'js').split(',')[0]\n    );\n\n    // if the script was found, shift it off our args\n    if (script !== options.args[0]) {\n      options.script = script;\n      options.args.shift();\n    }\n  }\n\n  // if there's no exec found yet, then try to read it from the local\n  // package.json this logic used to sit in the cli/parse, but actually the cli\n  // should be parsed first, then the user options (via nodemon.json) then\n  // finally default down to pot shots at the directory via package.json\n  if (!options.exec && !options.script) {\n    var found = execFromPackage();\n    if (found !== null) {\n      if (found.exec) {\n        options.exec = found.exec;\n      }\n      if (!options.script) {\n        options.script = found.script;\n      }\n      if (Array.isArray(options.args) && options.scriptPosition === null) {\n        options.scriptPosition = options.args.length;\n      }\n    }\n  }\n\n  // var options = utils.clone(nodemonOptions || {});\n  script = path.basename(options.script || '');\n\n  var scriptExt = path.extname(script).slice(1);\n\n  var extension = options.ext;\n  if (extension === undefined) {\n    var isJS = scriptExt === 'js' || scriptExt === 'mjs' || scriptExt === 'cjs';\n    extension = isJS || !scriptExt ? 'js,mjs,cjs' : scriptExt;\n    extension += ',json'; // Always watch JSON files\n  }\n\n  var execDefined = !!options.exec;\n\n  // allows the user to simplify cli usage:\n  // https://github.com/remy/nodemon/issues/195\n  // but always give preference to the user defined argument\n  if (!options.exec && execMap[scriptExt] !== undefined) {\n    options.exec = execMap[scriptExt];\n    execDefined = true;\n  }\n\n  options.execArgs = nodemonOptions.execArgs || [];\n\n  if (Array.isArray(options.exec)) {\n    options.execArgs = options.exec;\n    options.exec = options.execArgs.shift();\n  }\n\n  if (options.exec === undefined) {\n    options.exec = 'node';\n  } else {\n    // allow variable substitution for {{filename}} and {{pwd}}\n    var substitution = replace.bind(null, {\n      filename: options.script,\n      pwd: process.cwd(),\n    });\n\n    var newExec = substitution(options.exec);\n    if (\n      newExec !== options.exec &&\n      options.exec.indexOf('{{filename}}') !== -1\n    ) {\n      options.script = null;\n    }\n    options.exec = newExec;\n\n    var newExecArgs = options.execArgs.map(substitution);\n    if (newExecArgs.join('') !== options.execArgs.join('')) {\n      options.execArgs = newExecArgs;\n      delete options.script;\n    }\n  }\n\n  if (options.exec === 'node' && options.nodeArgs && options.nodeArgs.length) {\n    options.execArgs = options.execArgs.concat(options.nodeArgs);\n  }\n\n  // note: indexOf('coffee') handles both .coffee and .litcoffee\n  if (\n    !execDefined &&\n    options.exec === 'node' &&\n    scriptExt.indexOf('coffee') !== -1\n  ) {\n    options.exec = 'coffee';\n\n    // we need to get execArgs set before the script\n    // for example, in `nodemon --debug my-script.coffee --my-flag`, debug is an\n    // execArg, while my-flag is a script arg\n    var leadingArgs = (options.args || []).splice(0, options.scriptPosition);\n    options.execArgs = options.execArgs.concat(leadingArgs);\n    options.scriptPosition = 0;\n\n    if (options.execArgs.length > 0) {\n      // because this is the coffee executable, we need to combine the exec args\n      // into a single argument after the nodejs flag\n      options.execArgs = ['--nodejs', options.execArgs.join(' ')];\n    }\n  }\n\n  if (options.exec === 'coffee') {\n    // don't override user specified extension tracking\n    if (options.ext === undefined) {\n      if (extension) {\n        extension += ',';\n      }\n      extension += 'coffee,litcoffee';\n    }\n\n    // because windows can't find 'coffee', it needs the real file 'coffee.cmd'\n    if (utils.isWindows) {\n      options.exec += '.cmd';\n    }\n  }\n\n  // allow users to make a mistake on the extension to monitor\n  // converts .js, pug => js,pug\n  // BIG NOTE: user can't do this: nodemon -e *.js\n  // because the terminal will automatically expand the glob against\n  // the file system :(\n  extension = (extension.match(/[^,*\\s]+/g) || [])\n    .map((ext) => ext.replace(/^\\./, ''))\n    .join(',');\n\n  options.ext = extension;\n\n  if (options.script) {\n    options.script = expandScript(\n      options.script,\n      extension && '.' + extension.split(',')[0]\n    );\n  }\n\n  options.env = {};\n  // make sure it's an object (and since we don't have )\n  if ({}.toString.apply(nodemonOptions.env) === '[object Object]') {\n    options.env = utils.clone(nodemonOptions.env);\n  } else if (nodemonOptions.env !== undefined) {\n    throw new Error('nodemon env values must be an object: { PORT: 8000 }');\n  }\n\n  return options;\n}\n"
  },
  {
    "path": "lib/config/index.js",
    "content": "/**\n * Manages the internal config of nodemon, checking for the state of support\n * with fs.watch, how nodemon can watch files (using find or fs methods).\n *\n * This is *not* the user's config.\n */\nvar debug = require('debug')('nodemon');\nvar load = require('./load');\nvar rules = require('../rules');\nvar utils = require('../utils');\nvar pinVersion = require('../version').pin;\nvar command = require('./command');\nvar rulesToMonitor = require('../monitor/match').rulesToMonitor;\nvar bus = utils.bus;\n\nfunction reset() {\n  rules.reset();\n\n  config.dirs = [];\n  config.options = { ignore: [], watch: [], monitor: [] };\n  config.lastStarted = 0;\n  config.loaded = [];\n}\n\nvar config = {\n  run: false,\n  system: {\n    cwd: process.cwd(),\n  },\n  required: false,\n  dirs: [],\n  timeout: 1000,\n  options: {},\n};\n\n/**\n * Take user defined settings, then detect the local machine capability, then\n * look for local and global nodemon.json files and merge together the final\n * settings with the config for nodemon.\n *\n * @param  {Object} settings user defined settings for nodemon (typically on\n *  the cli)\n * @param  {Function} ready callback fired once the config is loaded\n */\nconfig.load = function (settings, ready) {\n  reset();\n  var config = this;\n  load(settings, config.options, config, function (options) {\n    config.options = options;\n\n    if (options.watch.length === 0) {\n      // this is to catch when the watch is left blank\n      options.watch.push('*.*');\n    }\n\n    if (options['watch_interval']) { // jshint ignore:line\n      options.watchInterval = options['watch_interval']; // jshint ignore:line\n    }\n\n    config.watchInterval = options.watchInterval || null;\n    if (options.signal) {\n      config.signal = options.signal;\n    }\n\n    var cmd = command(config.options);\n    config.command = {\n      raw: cmd,\n      string: utils.stringify(cmd.executable, cmd.args),\n    };\n\n    // now run automatic checks on system adding to the config object\n    options.monitor = rulesToMonitor(options.watch, options.ignore, config);\n\n    var cwd = process.cwd();\n    debug('config: dirs', config.dirs);\n    if (config.dirs.length === 0) {\n      config.dirs.unshift(cwd);\n    }\n\n    bus.emit('config:update', config);\n    pinVersion().then(function () {\n      ready(config);\n    }).catch(e => {\n      // this doesn't help testing, but does give exposure on syntax errors\n      console.error(e.stack);\n      setTimeout(() => { throw e; }, 0);\n    });\n  });\n};\n\nconfig.reset = reset;\n\nmodule.exports = config;\n"
  },
  {
    "path": "lib/config/load.js",
    "content": "var debug = require('debug')('nodemon');\nvar fs = require('fs');\nvar path = require('path');\nvar exists = fs.exists || path.exists;\nvar utils = require('../utils');\nvar rules = require('../rules');\nvar parse = require('../rules/parse');\nvar exec = require('./exec');\nvar defaults = require('./defaults');\n\nmodule.exports = load;\nmodule.exports.mutateExecOptions = mutateExecOptions;\n\nvar existsSync = fs.existsSync || path.existsSync;\n\nfunction findAppScript() {\n  // nodemon has been run alone, so try to read the package file\n  // or try to read the index.js file\n\n  var pkg =\n    existsSync(path.join(process.cwd(), 'package.json')) &&\n    require(path.join(process.cwd(), 'package.json'));\n  if ((!pkg || pkg.main == undefined) && existsSync('./index.js')) {\n    return 'index.js';\n  }\n}\n\n/**\n * Load the nodemon config, first reading the global root/nodemon.json, then\n * the local nodemon.json to the exec and then overwriting using any user\n * specified settings (i.e. from the cli)\n *\n * @param {Object} settings user defined settings\n * @param {Object} options global options\n * @param {Object} config the config object to be updated\n * @param {Function} callback that receives complete config\n */\nfunction load(settings, options, config, callback) {\n  config.loaded = [];\n  // first load the root nodemon.json\n  loadFile(options, config, utils.home, function (options) {\n    // then load the user's local configuration file\n    if (settings.configFile) {\n      options.configFile = path.resolve(settings.configFile);\n    }\n    loadFile(options, config, process.cwd(), function (options) {\n      // Then merge over with the user settings (parsed from the cli).\n      // Note that merge protects and favours existing values over new values,\n      // and thus command line arguments get priority\n      options = utils.merge(settings, options);\n\n      // legacy support\n      if (!Array.isArray(options.ignore)) {\n        options.ignore = [options.ignore];\n      }\n\n      if (!options.ignoreRoot) {\n        options.ignoreRoot = defaults.ignoreRoot;\n      }\n\n      // blend the user ignore and the default ignore together\n      if (options.ignoreRoot && options.ignore) {\n        if (!Array.isArray(options.ignoreRoot)) {\n          options.ignoreRoot = [options.ignoreRoot];\n        }\n        options.ignore = options.ignoreRoot.concat(options.ignore);\n      } else {\n        options.ignore = defaults.ignore.concat(options.ignore);\n      }\n\n      // add in any missing defaults\n      options = utils.merge(options, defaults);\n\n      if (!options.script && !options.exec) {\n        var found = findAppScript();\n        if (found) {\n          if (!options.args) {\n            options.args = [];\n          }\n          // if the script is found as a result of not being on the command\n          // line, then we move any of the pre double-dash args in execArgs\n          const n =\n            options.scriptPosition === null\n              ? options.args.length\n              : options.scriptPosition;\n\n          options.execArgs = (options.execArgs || []).concat(\n            options.args.splice(0, n)\n          );\n          options.scriptPosition = null;\n\n          options.script = found;\n        }\n      }\n\n      mutateExecOptions(options);\n\n      if (options.quiet) {\n        utils.quiet();\n      }\n\n      if (options.verbose) {\n        utils.debug = true;\n      }\n\n      // simplify the ready callback to be called after the rules are normalised\n      // from strings to regexp through the rules lib. Note that this gets\n      // created *after* options is overwritten twice in the lines above.\n      var ready = function (options) {\n        normaliseRules(options, callback);\n      };\n\n      ready(options);\n    });\n  });\n}\n\nfunction normaliseRules(options, ready) {\n  // convert ignore and watch options to rules/regexp\n  rules.watch.add(options.watch);\n  rules.ignore.add(options.ignore);\n\n  // normalise the watch and ignore arrays\n  options.watch = options.watch === false ? false : rules.rules.watch;\n  options.ignore = rules.rules.ignore;\n\n  ready(options);\n}\n\n/**\n * Looks for a config in the current working directory, and a config in the\n * user's home directory, merging the two together, giving priority to local\n * config. This can then be overwritten later by command line arguments\n *\n * @param  {Function} ready callback to pass loaded settings to\n */\nfunction loadFile(options, config, dir, ready) {\n  if (!ready) {\n    ready = function () {};\n  }\n\n  var callback = function (settings) {\n    // prefer the local nodemon.json and fill in missing items using\n    // the global options\n    ready(utils.merge(settings, options));\n  };\n\n  if (!dir) {\n    return callback({});\n  }\n\n  var filename = options.configFile || path.join(dir, 'nodemon.json');\n\n  if (config.loaded.indexOf(filename) !== -1) {\n    // don't bother re-parsing the same config file\n    return callback({});\n  }\n\n  fs.readFile(filename, 'utf8', function (err, data) {\n    if (err) {\n      if (err.code === 'ENOENT') {\n        if (!options.configFile && dir !== utils.home) {\n          // if no specified local config file and local nodemon.json\n          // doesn't exist, try the package.json\n          return loadPackageJSON(config, callback);\n        }\n      }\n      return callback({});\n    }\n\n    var settings = {};\n\n    try {\n      settings = JSON.parse(data.toString('utf8').replace(/^\\uFEFF/, ''));\n      if (!filename.endsWith('package.json') || settings.nodemonConfig) {\n        config.loaded.push(filename);\n      }\n    } catch (e) {\n      utils.log.fail('Failed to parse config ' + filename);\n      console.error(e);\n      process.exit(1);\n    }\n\n    // options values will overwrite settings\n    callback(settings);\n  });\n}\n\nfunction loadPackageJSON(config, ready) {\n  if (!ready) {\n    ready = () => {};\n  }\n\n  const dir = process.cwd();\n  const filename = path.join(dir, 'package.json');\n  const packageLoadOptions = { configFile: filename };\n  return loadFile(packageLoadOptions, config, dir, (settings) => {\n    ready(settings.nodemonConfig || {});\n  });\n}\n\nfunction mutateExecOptions(options) {\n  // work out the execOptions based on the final config we have\n  options.execOptions = exec(\n    {\n      script: options.script,\n      exec: options.exec,\n      args: options.args,\n      scriptPosition: options.scriptPosition,\n      nodeArgs: options.nodeArgs,\n      execArgs: options.execArgs,\n      ext: options.ext,\n      env: options.env,\n    },\n    options.execMap\n  );\n\n  // clean up values that we don't need at the top level\n  delete options.scriptPosition;\n  delete options.script;\n  delete options.args;\n  delete options.ext;\n\n  return options;\n}\n"
  },
  {
    "path": "lib/help/index.js",
    "content": "var fs = require('fs');\nvar path = require('path');\nconst supportsColor = require('supports-color');\n\nmodule.exports = help;\n\nconst highlight = supportsColor.stdout ? '\\x1B\\[$1m' : '';\n\nfunction help(item) {\n  if (!item) {\n    item = 'help';\n  } else if (item === true) { // if used with -h or --help and no args\n    item = 'help';\n  }\n\n  // cleanse the filename to only contain letters\n  // aka: /\\W/g but figured this was eaiser to read\n  item = item.replace(/[^a-z]/gi, '');\n\n  try {\n    var dir = path.join(__dirname, '..', '..', 'doc', 'cli', item + '.txt');\n    var body = fs.readFileSync(dir, 'utf8');\n    return body.replace(/\\\\x1B\\[(.)m/g, highlight);\n  } catch (e) {\n    return '\"' + item + '\" help can\\'t be found';\n  }\n}\n"
  },
  {
    "path": "lib/index.js",
    "content": "module.exports = require('./nodemon');"
  },
  {
    "path": "lib/monitor/index.js",
    "content": "module.exports = {\n  run: require('./run'),\n  watch: require('./watch').watch,\n};\n"
  },
  {
    "path": "lib/monitor/match.js",
    "content": "const { minimatch } = require('minimatch');\nconst path = require('path');\nconst fs = require('fs');\nconst debug = require('debug')('nodemon:match');\nconst utils = require('../utils');\n\nmodule.exports = match;\nmodule.exports.rulesToMonitor = rulesToMonitor;\n\nfunction rulesToMonitor(watch, ignore, config) {\n  var monitor = [];\n\n  if (!Array.isArray(ignore)) {\n    if (ignore) {\n      ignore = [ignore];\n    } else {\n      ignore = [];\n    }\n  }\n\n  if (!Array.isArray(watch)) {\n    if (watch) {\n      watch = [watch];\n    } else {\n      watch = [];\n    }\n  }\n\n  if (watch && watch.length) {\n    monitor = utils.clone(watch);\n  }\n\n  if (ignore) {\n    [].push.apply(\n      monitor,\n      (ignore || []).map(function (rule) {\n        return '!' + rule;\n      })\n    );\n  }\n\n  var cwd = process.cwd();\n\n  // next check if the monitored paths are actual directories\n  // or just patterns - and expand the rule to include *.*\n  monitor = monitor.map(function (rule) {\n    var not = rule.slice(0, 1) === '!';\n\n    if (not) {\n      rule = rule.slice(1);\n    }\n\n    if (rule === '.' || rule === '.*') {\n      rule = '*.*';\n    }\n\n    var dir = path.resolve(cwd, rule);\n\n    try {\n      var stat = fs.statSync(dir);\n      if (stat.isDirectory()) {\n        rule = dir;\n        if (rule.slice(-1) !== '/') {\n          rule += '/';\n        }\n        rule += '**/*';\n\n        // `!not` ... sorry.\n        if (!not) {\n          config.dirs.push(dir);\n        }\n      } else {\n        // ensures we end up in the check that tries to get a base directory\n        // and then adds it to the watch list\n        throw new Error();\n      }\n    } catch (e) {\n      var base = tryBaseDir(dir);\n      if (!not && base) {\n        if (config.dirs.indexOf(base) === -1) {\n          config.dirs.push(base);\n        }\n      }\n    }\n\n    if (rule.slice(-1) === '/') {\n      // just slap on a * anyway\n      rule += '*';\n    }\n\n    // if the url ends with * but not **/* and not *.*\n    // then convert to **/* - somehow it was missed :-\\\n    if (\n      rule.slice(-4) !== '**/*' &&\n      rule.slice(-1) === '*' &&\n      rule.indexOf('*.') === -1\n    ) {\n      if (rule.slice(-2) !== '**') {\n        rule += '*/*';\n      }\n    }\n\n    return (not ? '!' : '') + rule;\n  });\n\n  return monitor;\n}\n\nfunction tryBaseDir(dir) {\n  var stat;\n  if (/[?*\\{\\[]+/.test(dir)) {\n    // if this is pattern, then try to find the base\n    try {\n      var base = path.dirname(dir.replace(/([?*\\{\\[]+.*$)/, 'foo'));\n      stat = fs.statSync(base);\n      if (stat.isDirectory()) {\n        return base;\n      }\n    } catch (error) {\n      // console.log(error);\n    }\n  } else {\n    try {\n      stat = fs.statSync(dir);\n      // if this path is actually a single file that exists, then just monitor\n      // that, *specifically*.\n      if (stat.isFile() || stat.isDirectory()) {\n        return dir;\n      }\n    } catch (e) { }\n  }\n\n  return false;\n}\n\nfunction match(files, monitor, ext) {\n  // sort the rules by highest specificity (based on number of slashes)\n  // ignore rules (!) get sorted highest as they take precedent\n  const cwd = process.cwd();\n  var rules = monitor\n    .sort(function (a, b) {\n      var r = b.split(path.sep).length - a.split(path.sep).length;\n      var aIsIgnore = a.slice(0, 1) === '!';\n      var bIsIgnore = b.slice(0, 1) === '!';\n\n      if (aIsIgnore || bIsIgnore) {\n        if (aIsIgnore) {\n          return -1;\n        }\n\n        return 1;\n      }\n\n      if (r === 0) {\n        return b.length - a.length;\n      }\n      return r;\n    })\n    .map(function (s) {\n      var prefix = s.slice(0, 1);\n\n      if (prefix === '!') {\n        if (s.indexOf('!' + cwd) === 0) {\n          return s;\n        }\n\n        // if it starts with a period, then let's get the relative path\n        if (s.indexOf('!.') === 0) {\n          return '!' + path.resolve(cwd, s.substring(1));\n        }\n\n        return '!**' + (prefix !== path.sep ? path.sep : '') + s.slice(1);\n      }\n\n      // if it starts with a period, then let's get the relative path\n      if (s.indexOf('.') === 0) {\n        return path.resolve(cwd, s);\n      }\n\n      if (s.indexOf(cwd) === 0) {\n        return s;\n      }\n\n      return '**' + (prefix !== path.sep ? path.sep : '') + s;\n    });\n\n  debug('rules', rules);\n\n  var good = [];\n  var whitelist = []; // files that we won't check against the extension\n  var ignored = 0;\n  var watched = 0;\n  var usedRules = [];\n  var minimatchOpts = {\n    dot: true,\n  };\n\n  // enable case-insensitivity on Windows\n  if (utils.isWindows) {\n    minimatchOpts.nocase = true;\n    minimatchOpts.windowsPathsNoEscape = true;\n  }\n\n  files.forEach(function (file) {\n    file = path.resolve(cwd, file);\n\n    var matched = false;\n    for (var i = 0; i < rules.length; i++) {\n      if (rules[i].slice(0, 1) === '!') {\n        if (!minimatch(file, rules[i], minimatchOpts)) {\n          debug('ignored', file, 'rule:', rules[i]);\n          ignored++;\n          matched = true;\n          break;\n        }\n      } else {\n        debug('matched', file, 'rule:', rules[i]);\n        if (minimatch(file, rules[i], minimatchOpts)) {\n          watched++;\n\n          // don't repeat the output if a rule is matched\n          if (usedRules.indexOf(rules[i]) === -1) {\n            usedRules.push(rules[i]);\n            utils.log.detail('matched rule: ' + rules[i]);\n          }\n\n          // if the rule doesn't match the WATCH EVERYTHING\n          // but *does* match a rule that ends with *.*, then\n          // white list it - in that we don't run it through\n          // the extension check too.\n          if (\n            rules[i] !== '**' + path.sep + '*.*' &&\n            rules[i].slice(-3) === '*.*'\n          ) {\n            whitelist.push(file);\n          } else if (path.basename(file) === path.basename(rules[i])) {\n            // if the file matches the actual rule, then it's put on whitelist\n            whitelist.push(file);\n          } else {\n            good.push(file);\n          }\n          matched = true;\n        } else {\n          // utils.log.detail('no match: ' + rules[i], file);\n        }\n      }\n    }\n    if (!matched) {\n      ignored++;\n    }\n  });\n\n  // finally check the good files against the extensions that we're monitoring\n  if (ext) {\n    if (ext.indexOf(',') === -1) {\n      ext = '**/*.' + ext;\n    } else {\n      ext = '**/*.{' + ext + '}';\n    }\n\n    good = good.filter(function (file) {\n      // only compare the filename to the extension test\n      return minimatch(path.basename(file), ext, minimatchOpts);\n    });\n    debug('good (filtered by ext)', good);\n  } else {\n    // else assume *.*\n    debug('good', good);\n  }\n\n  if (whitelist.length) debug('whitelist', whitelist);\n\n  var result = good.concat(whitelist);\n\n  if (utils.isWindows) {\n    // fix for windows testing - I *think* this is okay to do\n    result = result.map(function (file) {\n      return file.slice(0, 1).toLowerCase() + file.slice(1);\n    });\n  }\n\n  return {\n    result: result,\n    ignored: ignored,\n    watched: watched,\n    total: files.length,\n  };\n}\n"
  },
  {
    "path": "lib/monitor/run.js",
    "content": "var debug = require('debug')('nodemon:run');\nconst statSync = require('fs').statSync;\nvar utils = require('../utils');\nvar bus = utils.bus;\nvar childProcess = require('child_process');\nvar spawn = childProcess.spawn;\nvar exec = childProcess.exec;\nvar execSync = childProcess.execSync;\nvar fork = childProcess.fork;\nvar watch = require('./watch').watch;\nvar config = require('../config');\nvar child = null; // the actual child process we spawn\nvar killedAfterChange = false;\nvar noop = () => {};\nvar restart = null;\nvar psTree = require('pstree.remy');\nvar path = require('path');\nvar signals = require('./signals');\nconst undefsafe = require('undefsafe');\nconst osRelease = parseInt(require('os').release().split('.')[0], 10);\n\nfunction run(options) {\n  var cmd = config.command.raw;\n  // moved up\n  // we need restart function below in the global scope for run.kill\n  /*jshint validthis:true*/\n  restart = run.bind(this, options);\n  run.restart = restart;\n\n  // binding options with instance of run\n  // so that we can use it in run.kill\n  run.options = options;\n\n  var runCmd = !options.runOnChangeOnly || config.lastStarted !== 0;\n  if (runCmd) {\n    utils.log.status('starting `' + config.command.string + '`');\n  } else {\n    // should just watch file if command is not to be run\n    // had another alternate approach\n    // to stop process being forked/spawned in the below code\n    // but this approach does early exit and makes code cleaner\n    debug('start watch on: %s', config.options.watch);\n    if (config.options.watch !== false) {\n      watch();\n      return;\n    }\n  }\n\n  config.lastStarted = Date.now();\n\n  var stdio = ['pipe', 'pipe', 'pipe'];\n\n  if (config.options.stdout) {\n    stdio = ['pipe', process.stdout, process.stderr];\n  }\n\n  if (config.options.stdin === false) {\n    stdio = [process.stdin, process.stdout, process.stderr];\n  }\n\n  var sh = 'sh';\n  var shFlag = '-c';\n\n  const binPath = process.cwd() + '/node_modules/.bin';\n\n  const spawnOptions = {\n    env: Object.assign({}, options.execOptions.env, process.env, {\n      PATH:\n        binPath +\n        path.delimiter +\n        (undefsafe(options, '.execOptions.env.PATH') || process.env.PATH),\n    }),\n    stdio: stdio,\n  };\n\n  var executable = cmd.executable;\n\n  if (utils.isWindows) {\n    // if the exec includes a forward slash, reverse it for windows compat\n    // but *only* apply to the first command, and none of the arguments.\n    // ref #1251 and #1236\n    if (executable.indexOf('/') !== -1) {\n      executable = executable\n        .split(' ')\n        .map((e, i) => {\n          if (i === 0) {\n            return path.normalize(e);\n          }\n          return e;\n        })\n        .join(' ');\n    }\n    // taken from npm's cli: https://git.io/vNFD4\n    sh = process.env.comspec || 'cmd';\n    shFlag = '/d /s /c';\n    spawnOptions.windowsVerbatimArguments = true;\n    spawnOptions.windowsHide = true;\n  }\n\n  var args = runCmd ? utils.stringify(executable, cmd.args) : ':';\n  var spawnArgs = [sh, [shFlag, args], spawnOptions];\n\n  const firstArg = cmd.args[0] || '';\n\n  var inBinPath = false;\n  try {\n    inBinPath = statSync(`${binPath}/${executable}`).isFile();\n  } catch (e) {}\n\n  // hasStdio allows us to correctly handle stdin piping\n  // see: https://git.io/vNtX3\n  const hasStdio = utils.satisfies('>= 6.4.0 || < 5');\n\n  // forking helps with sub-process handling and tends to clean up better\n  // than spawning, but it should only be used under specific conditions\n  const shouldFork =\n    !config.options.spawn &&\n    !inBinPath &&\n    !(firstArg.indexOf('-') === 0) && // don't fork if there's a node exec arg\n    firstArg !== 'inspect' && // don't fork it's `inspect` debugger\n    executable === 'node' && // only fork if node\n    utils.version.major > 4; // only fork if node version > 4\n\n  if (shouldFork) {\n    // this assumes the first argument is the script and slices it out, since\n    // we're forking\n    var forkArgs = cmd.args.slice(1);\n    var env = utils.merge(options.execOptions.env, process.env);\n    stdio.push('ipc');\n    const forkOptions = {\n      env: env,\n      stdio: stdio,\n      silent: !hasStdio,\n    };\n    if (utils.isWindows) {\n      forkOptions.windowsHide = true;\n    }\n    child = fork(options.execOptions.script, forkArgs, forkOptions);\n    utils.log.detail('forking');\n    debug('fork', sh, shFlag, args);\n  } else {\n    utils.log.detail('spawning');\n    child = spawn.apply(null, spawnArgs);\n    debug('spawn', sh, shFlag, args);\n  }\n\n  if (config.required) {\n    var emit = {\n      stdout: function (data) {\n        bus.emit('stdout', data);\n      },\n      stderr: function (data) {\n        bus.emit('stderr', data);\n      },\n    };\n\n    // now work out what to bind to...\n    if (config.options.stdout) {\n      child.on('stdout', emit.stdout).on('stderr', emit.stderr);\n    } else {\n      child.stdout.on('data', emit.stdout);\n      child.stderr.on('data', emit.stderr);\n\n      bus.stdout = child.stdout;\n      bus.stderr = child.stderr;\n    }\n\n    if (shouldFork) {\n      child.on('message', function (message, sendHandle) {\n        bus.emit('message', message, sendHandle);\n      });\n    }\n  }\n\n  bus.emit('start');\n\n  utils.log.detail('child pid: ' + child.pid);\n\n  child.on('error', function (error) {\n    bus.emit('error', error);\n    if (error.code === 'ENOENT') {\n      utils.log.error('unable to run executable: \"' + cmd.executable + '\"');\n      process.exit(1);\n    } else {\n      utils.log.error('failed to start child process: ' + error.code);\n      throw error;\n    }\n  });\n\n  child.on('exit', function (code, signal) {\n    if (child && child.stdin) {\n      process.stdin.unpipe(child.stdin);\n    }\n\n    if (code === 127) {\n      utils.log.error(\n        'failed to start process, \"' + cmd.executable + '\" exec not found'\n      );\n      bus.emit('error', code);\n      process.exit();\n    }\n\n    // If the command failed with code 2, it may or may not be a syntax error\n    // See: http://git.io/fNOAR\n    // We will only assume a parse error, if the child failed quickly\n    if (code === 2 && Date.now() < config.lastStarted + 500) {\n      utils.log.error('process failed, unhandled exit code (2)');\n      utils.log.error('');\n      utils.log.error('Either the command has a syntax error,');\n      utils.log.error('or it is exiting with reserved code 2.');\n      utils.log.error('');\n      utils.log.error('To keep nodemon running even after a code 2,');\n      utils.log.error('add this to the end of your command: || exit 1');\n      utils.log.error('');\n      utils.log.error('Read more here: https://git.io/fNOAG');\n      utils.log.error('');\n      utils.log.error('nodemon will stop now so that you can fix the command.');\n      utils.log.error('');\n      bus.emit('error', code);\n      process.exit();\n    }\n\n    // In case we killed the app ourselves, set the signal thusly\n    if (killedAfterChange) {\n      killedAfterChange = false;\n      signal = config.signal;\n    }\n    // this is nasty, but it gives it windows support\n    if (utils.isWindows && signal === 'SIGTERM') {\n      signal = config.signal;\n    }\n\n    if (signal === config.signal || code === 0) {\n      // this was a clean exit, so emit exit, rather than crash\n      debug('bus.emit(exit) via ' + config.signal);\n      bus.emit('exit', signal);\n\n      // exit the monitor, but do it gracefully\n      if (signal === config.signal) {\n        return restart();\n      }\n\n      if (code === 0) {\n        // clean exit - wait until file change to restart\n        if (runCmd) {\n          utils.log.status('clean exit - waiting for changes before restart');\n        }\n        child = null;\n      }\n    } else {\n      bus.emit('crash');\n\n      // support the old syntax of `exitcrash` - 2024-12-13\n      if (options.exitcrash) {\n        options.exitCrash = true;\n        delete options.exitcrash;\n      }\n\n      if (options.exitCrash) {\n        utils.log.fail('app crashed');\n        if (!config.required) {\n          process.exit(1);\n        }\n      } else {\n        utils.log.fail(\n          'app crashed - waiting for file changes before' + ' starting...'\n        );\n        child = null;\n      }\n    }\n\n    if (config.options.restartable) {\n      // stdin needs to kick in again to be able to listen to the\n      // restart command\n      process.stdin.resume();\n    }\n  });\n\n  // moved the run.kill outside to handle both the cases\n  // intial start\n  // no start\n\n  // connect stdin to the child process (options.stdin is on by default)\n  if (options.stdin) {\n    process.stdin.resume();\n    // FIXME decide whether or not we need to decide the encoding\n    // process.stdin.setEncoding('utf8');\n\n    // swallow the stdin error if it happens\n    // ref: https://github.com/remy/nodemon/issues/1195\n    if (hasStdio) {\n      child.stdin.on('error', () => {});\n      process.stdin.pipe(child.stdin);\n    } else {\n      if (child.stdout) {\n        child.stdout.pipe(process.stdout);\n      } else {\n        utils.log.error(\n          'running an unsupported version of node ' + process.version\n        );\n        utils.log.error(\n          'nodemon may not work as expected - ' +\n            'please consider upgrading to LTS'\n        );\n      }\n    }\n\n    bus.once('exit', function () {\n      if (child && process.stdin.unpipe) {\n        // node > 0.8\n        process.stdin.unpipe(child.stdin);\n      }\n    });\n  }\n\n  debug('start watch on: %s', config.options.watch);\n  if (config.options.watch !== false) {\n    watch();\n  }\n}\n\nfunction waitForSubProcesses(pid, callback) {\n  debug('checking ps tree for pids of ' + pid);\n  psTree(pid, (err, pids) => {\n    if (!pids.length) {\n      return callback();\n    }\n\n    utils.log.status(\n      `still waiting for ${pids.length} sub-process${\n        pids.length > 2 ? 'es' : ''\n      } to finish...`\n    );\n    setTimeout(() => waitForSubProcesses(pid, callback), 1000);\n  });\n}\n\nfunction kill(child, signal, callback) {\n  if (!callback) {\n    callback = noop;\n  }\n\n  if (utils.isWindows) {\n    const taskKill = () => {\n      try {\n        exec('taskkill /pid ' + child.pid + ' /T /F');\n      } catch (e) {\n        utils.log.error('Could not shutdown sub process cleanly');\n      }\n    };\n\n    // We are handling a 'SIGKILL' , 'SIGUSR2' and 'SIGUSR1' POSIX signal under Windows the\n    // same way it is handled on a UNIX system: We are performing\n    // a hard shutdown without waiting for the process to clean-up.\n    if (\n      signal === 'SIGKILL' ||\n      osRelease < 10 ||\n      signal === 'SIGUSR2' ||\n      signal === 'SIGUSR1'\n    ) {\n      debug('terminating process group by force: %s', child.pid);\n\n      // We are using the taskkill utility to terminate the whole\n      // process group ('/t') of the child ('/pid') by force ('/f').\n      // We need to end all sub processes, because the 'child'\n      // process in this context is actually a cmd.exe wrapper.\n      taskKill();\n      callback();\n      return;\n    }\n\n    try {\n      // We are using the Windows Management Instrumentation Command-line\n      // (wmic.exe) to resolve the sub-child process identifier, because the\n      // 'child' process in this context is actually a cmd.exe wrapper.\n      // We want to send the termination signal directly to the node process.\n      // The '2> nul' silences the no process found error message.\n      const resultBuffer = execSync(\n        `wmic process where (ParentProcessId=${child.pid}) get ProcessId 2> nul`\n      );\n      const result = resultBuffer.toString().match(/^[0-9]+/m);\n\n      // If there is no sub-child process we fall back to the child process.\n      const processId = Array.isArray(result) ? result[0] : child.pid;\n\n      debug('sending kill signal SIGINT to process: %s', processId);\n\n      // We are using the standalone 'windows-kill' executable to send the\n      // standard POSIX signal 'SIGINT' to the node process. This fixes #1720.\n      const windowsKill = path.normalize(\n        `${__dirname}/../../bin/windows-kill.exe`\n      );\n\n      // We have to detach the 'windows-kill' execution completely from this\n      // process group to avoid terminating the nodemon process itself.\n      // See: https://github.com/alirdn/windows-kill#how-it-works--limitations\n      //\n      // Therefore we are using 'start' to create a new cmd.exe context.\n      // The '/min' option hides the new terminal window and the '/wait'\n      // option lets the process wait for the command to finish.\n\n      execSync(\n        `start \"windows-kill\" /min /wait \"${windowsKill}\" -SIGINT ${processId}`\n      );\n    } catch (e) {\n      taskKill();\n    }\n    callback();\n  } else {\n    // we use psTree to kill the full subtree of nodemon, because when\n    // spawning processes like `coffee` under the `--debug` flag, it'll spawn\n    // it's own child, and that can't be killed by nodemon, so psTree gives us\n    // an array of PIDs that have spawned under nodemon, and we send each the\n    // configured signal (default: SIGUSR2) signal, which fixes #335\n    // note that psTree also works if `ps` is missing by looking in /proc\n    let sig = signal.replace('SIG', '');\n\n    psTree(child.pid, function (err, pids) {\n      // if ps isn't native to the OS, then we need to send the numeric value\n      // for the signal during the kill, `signals` is a lookup table for that.\n      if (!psTree.hasPS) {\n        sig = signals[signal];\n      }\n\n      // the sub processes need to be killed from smallest to largest\n      debug('sending kill signal to ' + pids.join(', '));\n\n      child.kill(signal);\n\n      pids.sort().forEach((pid) => exec(`kill -${sig} ${pid}`, noop));\n\n      waitForSubProcesses(child.pid, () => {\n        // finally kill the main user process\n        exec(`kill -${sig} ${child.pid}`, callback);\n      });\n    });\n  }\n}\n\nrun.kill = function (noRestart, callback) {\n  // I hate code like this :(  - Remy (author of said code)\n  if (typeof noRestart === 'function') {\n    callback = noRestart;\n    noRestart = false;\n  }\n\n  if (!callback) {\n    callback = noop;\n  }\n\n  if (child !== null) {\n    // if the stdin piping is on, we need to unpipe, but also close stdin on\n    // the child, otherwise linux can throw EPIPE or ECONNRESET errors.\n    if (run.options.stdin) {\n      process.stdin.unpipe(child.stdin);\n    }\n\n    // For the on('exit', ...) handler above the following looks like a\n    // crash, so we set the killedAfterChange flag if a restart is planned\n    if (!noRestart) {\n      killedAfterChange = true;\n    }\n\n    /* Now kill the entire subtree of processes belonging to nodemon */\n    var oldPid = child.pid;\n    if (child) {\n      kill(child, config.signal, function () {\n        // this seems to fix the 0.11.x issue with the \"rs\" restart command,\n        // though I'm unsure why. it seems like more data is streamed in to\n        // stdin after we close.\n        if (child && run.options.stdin && child.stdin && oldPid === child.pid) {\n          child.stdin.end();\n        }\n        callback();\n      });\n    }\n  } else if (!noRestart) {\n    // if there's no child, then we need to manually start the process\n    // this is because as there was no child, the child.on('exit') event\n    // handler doesn't exist which would normally trigger the restart.\n    bus.once('start', callback);\n    run.restart();\n  } else {\n    callback();\n  }\n};\n\nrun.restart = noop;\n\nbus.on('quit', function onQuit(code) {\n  if (code === undefined) {\n    code = 0;\n  }\n\n  // remove event listener\n  var exitTimer = null;\n  var exit = function () {\n    clearTimeout(exitTimer);\n    exit = noop; // null out in case of race condition\n    child = null;\n    if (!config.required) {\n      // Execute all other quit listeners.\n      bus.listeners('quit').forEach(function (listener) {\n        if (listener !== onQuit) {\n          listener();\n        }\n      });\n      process.exit(code);\n    } else {\n      bus.emit('exit');\n    }\n  };\n\n  // if we're not running already, don't bother with trying to kill\n  if (config.run === false) {\n    return exit();\n  }\n\n  // immediately try to stop any polling\n  config.run = false;\n\n  if (child) {\n    // give up waiting for the kids after 10 seconds\n    exitTimer = setTimeout(exit, 10 * 1000);\n    child.removeAllListeners('exit');\n    child.once('exit', exit);\n\n    kill(child, 'SIGINT');\n  } else {\n    exit();\n  }\n});\n\nbus.on('restart', function () {\n  // run.kill will send a SIGINT to the child process, which will cause it\n  // to terminate, which in turn uses the 'exit' event handler to restart\n  run.kill();\n});\n\n// remove the child file on exit\nprocess.on('exit', function () {\n  utils.log.detail('exiting');\n  if (child) {\n    child.kill();\n  }\n});\n\n// because windows borks when listening for the SIG* events\nif (!utils.isWindows) {\n  bus.once('boot', () => {\n    // usual suspect: ctrl+c exit\n    process.once('SIGINT', () => bus.emit('quit', 130));\n    process.once('SIGTERM', () => {\n      bus.emit('quit', 143);\n      if (child) {\n        child.kill('SIGTERM');\n      }\n    });\n  });\n}\n\nmodule.exports = run;\n"
  },
  {
    "path": "lib/monitor/signals.js",
    "content": "module.exports = {\n  SIGHUP: 1,\n  SIGINT: 2,\n  SIGQUIT: 3,\n  SIGILL: 4,\n  SIGTRAP: 5,\n  SIGABRT: 6,\n  SIGBUS: 7,\n  SIGFPE: 8,\n  SIGKILL: 9,\n  SIGUSR1: 10,\n  SIGSEGV: 11,\n  SIGUSR2: 12,\n  SIGPIPE: 13,\n  SIGALRM: 14,\n  SIGTERM: 15,\n  SIGSTKFLT: 16,\n  SIGCHLD: 17,\n  SIGCONT: 18,\n  SIGSTOP: 19,\n  SIGTSTP: 20,\n  SIGTTIN: 21,\n  SIGTTOU: 22,\n  SIGURG: 23,\n  SIGXCPU: 24,\n  SIGXFSZ: 25,\n  SIGVTALRM: 26,\n  SIGPROF: 27,\n  SIGWINCH: 28,\n  SIGIO: 29,\n  SIGPWR: 30,\n  SIGSYS: 31,\n  SIGRTMIN: 35,\n}\n"
  },
  {
    "path": "lib/monitor/watch.js",
    "content": "module.exports.watch = watch;\nmodule.exports.resetWatchers = resetWatchers;\n\nvar debug = require('debug')('nodemon:watch');\nvar debugRoot = require('debug')('nodemon');\nvar chokidar = require('chokidar');\nvar undefsafe = require('undefsafe');\nvar config = require('../config');\nvar path = require('path');\nvar utils = require('../utils');\nvar bus = utils.bus;\nvar match = require('./match');\nvar watchers = [];\nvar debouncedBus;\n\nbus.on('reset', resetWatchers);\n\nfunction resetWatchers() {\n  debugRoot('resetting watchers');\n  watchers.forEach(function (watcher) {\n    watcher.close();\n  });\n  watchers = [];\n}\n\nfunction watch() {\n  if (watchers.length) {\n    debug('early exit on watch, still watching (%s)', watchers.length);\n    return;\n  }\n\n  var dirs = [].slice.call(config.dirs);\n\n  debugRoot('start watch on: %s', dirs.join(', '));\n  const rootIgnored = config.options.ignore;\n  debugRoot('ignored', rootIgnored);\n\n  var watchedFiles = [];\n\n  const promise = new Promise(function (resolve) {\n    const dotFilePattern = /[/\\\\]\\./;\n    var ignored = match.rulesToMonitor(\n      [], // not needed\n      Array.from(rootIgnored),\n      config\n    ).map(pattern => pattern.slice(1));\n\n    const addDotFile = dirs.filter(dir => dir.match(dotFilePattern));\n\n    // don't ignore dotfiles if explicitly watched.\n    if (addDotFile.length === 0) {\n      ignored.push(dotFilePattern);\n    }\n\n    var watchOptions = {\n      ignorePermissionErrors: true,\n      ignored: ignored,\n      persistent: true,\n      usePolling: config.options.legacyWatch || false,\n      interval: config.options.pollingInterval,\n      // note to future developer: I've gone back and forth on adding `cwd`\n      // to the props and in some cases it fixes bugs but typically it causes\n      // bugs elsewhere (since nodemon is used is so many ways). the final\n      // decision is to *not* use it at all and work around it\n      // cwd: ...\n    };\n\n    if (utils.isWindows) {\n      watchOptions.disableGlobbing = true;\n    }\n\n    if (utils.isIBMi) {\n      watchOptions.usePolling = true;\n    }\n\n    if (process.env.TEST) {\n      watchOptions.useFsEvents = false;\n    }\n\n    var watcher = chokidar.watch(\n      dirs,\n      Object.assign({}, watchOptions, config.options.watchOptions || {})\n    );\n\n    watcher.ready = false;\n\n    var total = 0;\n\n    watcher.on('change', filterAndRestart);\n    watcher.on('unlink', filterAndRestart);\n    watcher.on('add', function (file) {\n      if (watcher.ready) {\n        return filterAndRestart(file);\n      }\n\n      watchedFiles.push(file);\n      bus.emit('watching', file);\n      debug('chokidar watching: %s', file);\n    });\n    watcher.on('ready', function () {\n      watchedFiles = Array.from(new Set(watchedFiles)); // ensure no dupes\n      total = watchedFiles.length;\n      watcher.ready = true;\n      resolve(total);\n      debugRoot('watch is complete');\n    });\n\n    watcher.on('error', function (error) {\n      if (error.code === 'EINVAL') {\n        utils.log.error(\n          'Internal watch failed. Likely cause: too many ' +\n          'files being watched (perhaps from the root of a drive?\\n' +\n          'See https://github.com/paulmillr/chokidar/issues/229 for details'\n        );\n      } else {\n        utils.log.error('Internal watch failed: ' + error.message);\n        process.exit(1);\n      }\n    });\n\n    watchers.push(watcher);\n  });\n\n  return promise.catch(e => {\n    // this is a core error and it should break nodemon - so I have to break\n    // out of a promise using the setTimeout\n    setTimeout(() => {\n      throw e;\n    });\n  }).then(function () {\n    utils.log.detail(`watching ${watchedFiles.length} file${\n      watchedFiles.length === 1 ? '' : 's'}`);\n    return watchedFiles;\n  });\n}\n\nfunction filterAndRestart(files) {\n  if (!Array.isArray(files)) {\n    files = [files];\n  }\n\n  if (files.length) {\n    var cwd = process.cwd();\n    if (this.options && this.options.cwd) {\n      cwd = this.options.cwd;\n    }\n\n    utils.log.detail(\n      'files triggering change check: ' +\n      files\n        .map(file => {\n          const res = path.relative(cwd, file);\n          return res;\n        })\n        .join(', ')\n    );\n\n    // make sure the path is right and drop an empty\n    // filenames (sometimes on windows)\n    files = files.filter(Boolean).map(file => {\n      return path.relative(process.cwd(), path.relative(cwd, file));\n    });\n\n    if (utils.isWindows) {\n      // ensure the drive letter is in uppercase (c:\\foo -> C:\\foo)\n      files = files.map(f => {\n        if (f.indexOf(':') === -1) { return f; }\n        return f[0].toUpperCase() + f.slice(1);\n      });\n    }\n\n\n    debug('filterAndRestart on', files);\n\n    var matched = match(\n      files,\n      config.options.monitor,\n      undefsafe(config, 'options.execOptions.ext')\n    );\n\n    debug('matched?', JSON.stringify(matched));\n\n    // if there's no matches, then test to see if the changed file is the\n    // running script, if so, let's allow a restart\n    if (config.options.execOptions && config.options.execOptions.script) {\n      const script = path.resolve(config.options.execOptions.script);\n      if (matched.result.length === 0 && script) {\n        const length = script.length;\n        files.find(file => {\n          if (file.substr(-length, length) === script) {\n            matched = {\n              result: [file],\n              total: 1,\n            };\n            return true;\n          }\n        });\n      }\n    }\n\n    utils.log.detail(\n      'changes after filters (before/after): ' +\n      [files.length, matched.result.length].join('/')\n    );\n\n    // reset the last check so we're only looking at recently modified files\n    config.lastStarted = Date.now();\n\n    if (matched.result.length) {\n      if (config.options.delay > 0) {\n        utils.log.detail('delaying restart for ' + config.options.delay + 'ms');\n        if (debouncedBus === undefined) {\n          debouncedBus = debounce(restartBus, config.options.delay);\n        }\n        debouncedBus(matched);\n      } else {\n        return restartBus(matched);\n      }\n    }\n  }\n}\n\nfunction restartBus(matched) {\n  utils.log.status('restarting due to changes...');\n  matched.result.map(file => {\n    utils.log.detail(path.relative(process.cwd(), file));\n  });\n\n  if (config.options.verbose) {\n    utils.log._log('');\n  }\n\n  bus.emit('restart', matched.result);\n}\n\nfunction debounce(fn, delay) {\n  var timer = null;\n  return function () {\n    const context = this;\n    const args = arguments;\n    clearTimeout(timer);\n    timer = setTimeout(() =>fn.apply(context, args), delay);\n  };\n}\n"
  },
  {
    "path": "lib/nodemon.js",
    "content": "var debug = require('debug')('nodemon');\nvar path = require('path');\nvar monitor = require('./monitor');\nvar cli = require('./cli');\nvar version = require('./version');\nvar util = require('util');\nvar utils = require('./utils');\nvar bus = utils.bus;\nvar help = require('./help');\n/** @type {import('..').NodemonEventConfig} */\nvar config = require('./config');\nvar spawn = require('./spawn');\nconst defaults = require('./config/defaults')\nvar eventHandlers = {};\n\n// this is fairly dirty, but theoretically sound since it's part of the\n// stable module API\nconfig.required = utils.isRequired;\n\n/**\n * @param {import('..').NodemonSettings | string} settings\n * @returns {import('..').Nodemon}\n */\nfunction nodemon(settings) {\n  bus.emit('boot');\n  nodemon.reset();\n  \n  /** @type {import('..').NodemonSettings} */\n  let options\n\n  // allow the cli string as the argument to nodemon, and allow for\n  // `node nodemon -V app.js` or just `-V app.js`\n  if (typeof settings === 'string') {\n    settings = settings.trim();\n    if (settings.indexOf('node') !== 0) {\n      if (settings.indexOf('nodemon') !== 0) {\n        settings = 'nodemon ' + settings;\n      }\n      settings = 'node ' + settings;\n    }\n    options = cli.parse(settings);\n  } else options = settings;\n\n  // set the debug flag as early as possible to get all the detailed logging\n  if (options.verbose) {\n    utils.debug = true;\n  }\n\n  if (options.help) {\n    if (process.stdout.isTTY) {\n      process.stdout._handle.setBlocking(true); // nodejs/node#6456\n    }\n    console.log(help(options.help));\n    if (!config.required) {\n      process.exit(0);\n    }\n  }\n\n  if (options.version) {\n    version().then(function (v) {\n      console.log(v);\n      if (!config.required) {\n        process.exit(0);\n      }\n    });\n    return;\n  }\n\n  // nodemon tools like grunt-nodemon. This affects where\n  // the script is being run from, and will affect where\n  // nodemon looks for the nodemon.json files\n  if (options.cwd) {\n    // this is protection to make sure we haven't dont the chdir already...\n    // say like in cli/parse.js (which is where we do this once already!)\n    if (process.cwd() !== path.resolve(config.system.cwd, options.cwd)) {\n      process.chdir(options.cwd);\n    }\n  }\n\n  config.load(options, function (config) {\n    if (!config.options.dump && !config.options.execOptions.script &&\n      config.options.execOptions.exec === 'node') {\n      if (!config.required) {\n        console.log(help('usage'));\n        process.exit();\n      }\n      return;\n    }\n\n    // before we print anything, update the colour setting on logging\n    utils.colours = config.options.colours;\n\n    // always echo out the current version\n    utils.log.info(version.pinned);\n\n    const cwd = process.cwd();\n\n    if (config.options.cwd) {\n      utils.log.detail('process root: ' + cwd);\n    }\n\n    config.loaded.map(file => file.replace(cwd, '.')).forEach(file => {\n      utils.log.detail('reading config ' + file);\n    });\n\n    if (config.options.stdin && config.options.restartable) {\n      // allow nodemon to restart when the use types 'rs\\n'\n      process.stdin.resume();\n      process.stdin.setEncoding('utf8');\n      process.stdin.on('data', data => {\n        const str = data.toString().trim().toLowerCase();\n\n        // if the keys entered match the restartable value, then restart!\n        if (str === config.options.restartable) {\n          bus.emit('restart');\n        } else if (data.charCodeAt(0) === 12) { // ctrl+l\n          console.clear();\n        }\n      });\n    } else if (config.options.stdin) {\n      // so let's make sure we don't eat the key presses\n      // but also, since we're wrapping, watch out for\n      // special keys, like ctrl+c x 2 or '.exit' or ctrl+d or ctrl+l\n      var ctrlC = false;\n      var buffer = '';\n\n      process.stdin.on('data', function (data) {\n        data = data.toString();\n        buffer += data;\n        const chr = data.charCodeAt(0);\n\n        // if restartable, echo back\n        if (chr === 3) {\n          if (ctrlC) {\n            process.exit(0);\n          }\n\n          ctrlC = true;\n          return;\n        } else if (buffer === '.exit' || chr === 4) { // ctrl+d\n          process.exit();\n        } else if (chr === 13 || chr === 10) { // enter / carriage return\n          buffer = '';\n        } else if (chr === 12) { // ctrl+l\n          console.clear();\n          buffer = '';\n        }\n        ctrlC = false;\n      });\n      if (process.stdin.setRawMode) {\n        process.stdin.setRawMode(true);\n      }\n    }\n\n    if (config.options.restartable) {\n      utils.log.info('to restart at any time, enter `' +\n        config.options.restartable + '`');\n    }\n\n    if (!config.required) {\n      const restartSignal = config.options.signal === 'SIGUSR2' ? 'SIGHUP' : 'SIGUSR2';\n      process.on(restartSignal, nodemon.restart);\n      utils.bus.on('error', () => {\n        utils.log.fail((new Error().stack));\n      });\n      utils.log.detail((config.options.restartable ? 'or ' : '') + 'send ' +\n        restartSignal + ' to ' + process.pid + ' to restart');\n    }\n\n    const ignoring = config.options.monitor.map(function (rule) {\n      if (rule.slice(0, 1) !== '!') {\n        return false;\n      }\n\n      rule = rule.slice(1);\n\n      // don't notify of default ignores\n      if (defaults.ignoreRoot.indexOf(rule) !== -1) {\n        return false;\n        // return rule.slice(3).slice(0, -3);\n      }\n\n      if (rule.startsWith(cwd)) {\n        return rule.replace(cwd, '.');\n      }\n\n      return rule;\n    }).filter(Boolean).join(' ');\n    if (ignoring) utils.log.detail('ignoring: ' + ignoring);\n\n    utils.log.info('watching path(s): ' + config.options.monitor.map(function (rule) {\n      if (rule.slice(0, 1) !== '!') {\n        try {\n          rule = path.relative(process.cwd(), rule);\n        } catch (e) {}\n\n        return rule;\n      }\n\n      return false;\n    }).filter(Boolean).join(' '));\n\n    utils.log.info('watching extensions: ' + (config.options.execOptions.ext || '(all)'));\n\n    if (config.options.dump) {\n      utils.log._log('log', '--------------');\n      utils.log._log('log', 'node: ' + process.version);\n      utils.log._log('log', 'nodemon: ' + version.pinned);\n      utils.log._log('log', 'command: ' + process.argv.join(' '));\n      utils.log._log('log', 'cwd: ' + cwd);\n      utils.log._log('log', ['OS:', process.platform, process.arch].join(' '));\n      utils.log._log('log', '--------------');\n      utils.log._log('log', util.inspect(config, { depth: null }));\n      utils.log._log('log', '--------------');\n      if (!config.required) {\n        process.exit();\n      }\n\n      return;\n    }\n\n    config.run = true;\n\n    if (config.options.stdout === false) {\n      nodemon.on('start', function () {\n        nodemon.stdout = bus.stdout;\n        nodemon.stderr = bus.stderr;\n\n        bus.emit('readable');\n      });\n    }\n\n    if (config.options.events && Object.keys(config.options.events).length) {\n      Object.keys(config.options.events).forEach(function (key) {\n        utils.log.detail('bind ' + key + ' -> `' +\n          config.options.events[key] + '`');\n        nodemon.on(key, function () {\n          if (config.options && config.options.events) {\n            spawn(config.options.events[key], config,\n              [].slice.apply(arguments));\n          }\n        });\n      });\n    }\n\n    monitor.run(config.options);\n\n  });\n\n  return nodemon;\n}\n\nnodemon.restart = function () {\n  utils.log.status('restarting child process');\n  bus.emit('restart');\n  return nodemon;\n};\n\nnodemon.addListener = nodemon.on = function (event, handler) {\n  if (!eventHandlers[event]) { eventHandlers[event] = []; }\n  eventHandlers[event].push(handler);\n  bus.on(event, handler);\n  return nodemon;\n};\n\nnodemon.once = function (event, handler) {\n  if (!eventHandlers[event]) { eventHandlers[event] = []; }\n  eventHandlers[event].push(handler);\n  bus.once(event, function () {\n    debug('bus.once(%s)', event);\n    eventHandlers[event].splice(eventHandlers[event].indexOf(handler), 1);\n    handler.apply(this, arguments);\n  });\n  return nodemon;\n};\n\nnodemon.emit = function () {\n  bus.emit.apply(bus, [].slice.call(arguments));\n  return nodemon;\n};\n\nnodemon.removeAllListeners = function (event) {\n  // unbind only the `nodemon.on` event handlers\n  Object.keys(eventHandlers).filter(function (e) {\n    return event ? e === event : true;\n  }).forEach(function (event) {\n    eventHandlers[event].forEach(function (handler) {\n      bus.removeListener(event, handler);\n      eventHandlers[event].splice(eventHandlers[event].indexOf(handler), 1);\n    });\n  });\n\n  return nodemon;\n};\n\nnodemon.reset = function (done) {\n  bus.emit('reset', done);\n};\n\nbus.on('reset', function (done) {\n  debug('reset');\n  nodemon.removeAllListeners();\n  monitor.run.kill(true, function () {\n    utils.reset();\n    config.reset();\n    config.run = false;\n    if (done) {\n      done();\n    }\n  });\n});\n\n// expose the full config\nnodemon.config = config;\n\nmodule.exports = nodemon;\n\n"
  },
  {
    "path": "lib/rules/add.js",
    "content": "'use strict';\n\nvar utils = require('../utils');\n\n// internal\nvar reEscComments = /\\\\#/g;\n// note that '^^' is used in place of escaped comments\nvar reUnescapeComments = /\\^\\^/g;\nvar reComments = /#.*$/;\nvar reEscapeChars = /[.|\\-[\\]()\\\\]/g;\nvar reAsterisk = /\\*/g;\n\nmodule.exports = add;\n\n/**\n * Converts file patterns or regular expressions to nodemon\n * compatible RegExp matching rules. Note: the `rules` argument\n * object is modified to include the new rule and new RegExp\n *\n * ### Example:\n *\n *     var rules = { watch: [], ignore: [] };\n *     add(rules, 'watch', '*.js');\n *     add(rules, 'ignore', '/public/');\n *     add(rules, 'watch', ':(\\d)*\\.js'); // note: string based regexp\n *     add(rules, 'watch', /\\d*\\.js/);\n *\n * @param {Object} rules containing `watch` and `ignore`. Also updated during\n *                       execution\n * @param {String} which must be either \"watch\" or \"ignore\"\n * @param {String|RegExp} rule the actual rule.\n */\nfunction add(rules, which, rule) {\n  if (!{ ignore: 1, watch: 1}[which]) {\n    throw new Error('rules/index.js#add requires \"ignore\" or \"watch\" as the ' +\n      'first argument');\n  }\n\n  if (Array.isArray(rule)) {\n    rule.forEach(function (rule) {\n      add(rules, which, rule);\n    });\n    return;\n  }\n\n  // support the rule being a RegExp, but reformat it to\n  // the custom :<regexp> format that we're working with.\n  if (rule instanceof RegExp) {\n    // rule = ':' + rule.toString().replace(/^\\/(.*?)\\/$/g, '$1');\n    utils.log.error('RegExp format no longer supported, but globs are.');\n    return;\n  }\n\n  // remove comments and trim lines\n  // this mess of replace methods is escaping \"\\#\" to allow for emacs temp files\n\n  // first up strip comments and remove blank head or tails\n  rule = (rule || '').replace(reEscComments, '^^')\n             .replace(reComments, '')\n             .replace(reUnescapeComments, '#').trim();\n\n  var regexp = false;\n\n  if (typeof rule === 'string' && rule.substring(0, 1) === ':') {\n    rule = rule.substring(1);\n    utils.log.error('RegExp no longer supported: ' + rule);\n    regexp = true;\n  } else if (rule.length === 0) {\n    // blank line (or it was a comment)\n    return;\n  }\n\n  if (regexp) {\n    // rules[which].push(rule);\n  } else {\n    // rule = rule.replace(reEscapeChars, '\\\\$&')\n    // .replace(reAsterisk, '.*');\n\n    rules[which].push(rule);\n    // compile a regexp of all the rules for this ignore or watch\n    var re = rules[which].map(function (rule) {\n      return rule.replace(reEscapeChars, '\\\\$&')\n                 .replace(reAsterisk, '.*');\n    }).join('|');\n\n    // used for the directory matching\n    rules[which].re = new RegExp(re);\n  }\n}\n"
  },
  {
    "path": "lib/rules/index.js",
    "content": "'use strict';\nvar utils = require('../utils');\nvar add = require('./add');\nvar parse = require('./parse');\n\n// exported\nvar rules = { ignore: [], watch: [] };\n\n/**\n * Loads a nodemon config file and populates the ignore\n * and watch rules with it's contents, and calls callback\n * with the new rules\n *\n * @param  {String} filename\n * @param  {Function} callback\n */\nfunction load(filename, callback) {\n  parse(filename, function (err, result) {\n    if (err) {\n      // we should have bombed already, but\n      utils.log.error(err);\n      callback(err);\n    }\n\n    if (result.raw) {\n      result.raw.forEach(add.bind(null, rules, 'ignore'));\n    } else {\n      result.ignore.forEach(add.bind(null, rules, 'ignore'));\n      result.watch.forEach(add.bind(null, rules, 'watch'));\n    }\n\n    callback(null, rules);\n  });\n}\n\nmodule.exports = {\n  reset: function () { // just used for testing\n    rules.ignore.length = rules.watch.length = 0;\n    delete rules.ignore.re;\n    delete rules.watch.re;\n  },\n  load: load,\n  ignore: {\n    test: add.bind(null, rules, 'ignore'),\n    add: add.bind(null, rules, 'ignore'),\n  },\n  watch: {\n    test: add.bind(null, rules, 'watch'),\n    add: add.bind(null, rules, 'watch'),\n  },\n  add: add.bind(null, rules),\n  rules: rules,\n};"
  },
  {
    "path": "lib/rules/parse.js",
    "content": "'use strict';\nvar fs = require('fs');\n\n/**\n * Parse the nodemon config file, supporting both old style\n * plain text config file, and JSON version of the config\n *\n * @param  {String}   filename\n * @param  {Function} callback\n */\nfunction parse(filename, callback) {\n  var rules = {\n    ignore: [],\n    watch: [],\n  };\n\n  fs.readFile(filename, 'utf8', function (err, content) {\n\n    if (err) {\n      return callback(err);\n    }\n\n    var json = null;\n    try {\n      json = JSON.parse(content);\n    } catch (e) {}\n\n    if (json !== null) {\n      rules = {\n        ignore: json.ignore || [],\n        watch: json.watch || [],\n      };\n\n      return callback(null, rules);\n    }\n\n    // otherwise return the raw file\n    return callback(null, { raw: content.split(/\\n/) });\n  });\n}\n\nmodule.exports = parse;\n\n"
  },
  {
    "path": "lib/spawn.js",
    "content": "const path = require('path');\nconst utils = require('./utils');\nconst merge = utils.merge;\nconst bus = utils.bus;\nconst spawn = require('child_process').spawn;\n\nmodule.exports = function spawnCommand(command, config, eventArgs) {\n  var stdio = ['pipe', 'pipe', 'pipe'];\n\n  if (config.options.stdout) {\n    stdio = ['pipe', process.stdout, process.stderr];\n  }\n\n  const env = merge(process.env, { FILENAME: eventArgs[0] });\n\n  var sh = 'sh';\n  var shFlag = '-c';\n  var spawnOptions = {\n    env: merge(config.options.execOptions.env, env),\n    stdio: stdio,\n  };\n\n  if (!Array.isArray(command)) {\n    command = [command];\n  }\n\n  if (utils.isWindows) {\n    // if the exec includes a forward slash, reverse it for windows compat\n    // but *only* apply to the first command, and none of the arguments.\n    // ref #1251 and #1236\n    command = command.map(executable => {\n      if (executable.indexOf('/') === -1) {\n        return executable;\n      }\n\n      return  executable.split(' ').map((e, i) => {\n        if (i === 0) {\n          return path.normalize(e);\n        }\n        return e;\n      }).join(' ');\n    });\n    // taken from npm's cli: https://git.io/vNFD4\n    sh = process.env.comspec || 'cmd';\n    shFlag = '/d /s /c';\n    spawnOptions.windowsVerbatimArguments = true;\n    spawnOptions.windowsHide = true;\n  }\n\n  const args = command.join(' ');\n  const child = spawn(sh, [shFlag, args], spawnOptions);\n\n  if (config.required) {\n    var emit = {\n      stdout: function (data) {\n        bus.emit('stdout', data);\n      },\n      stderr: function (data) {\n        bus.emit('stderr', data);\n      },\n    };\n\n    // now work out what to bind to...\n    if (config.options.stdout) {\n      child.on('stdout', emit.stdout).on('stderr', emit.stderr);\n    } else {\n      child.stdout.on('data', emit.stdout);\n      child.stderr.on('data', emit.stderr);\n\n      bus.stdout = child.stdout;\n      bus.stderr = child.stderr;\n    }\n  }\n};\n"
  },
  {
    "path": "lib/utils/bus.js",
    "content": "var events = require('events');\nvar debug = require('debug')('nodemon');\nvar util = require('util');\n\nvar Bus = function () {\n  events.EventEmitter.call(this);\n};\n\nutil.inherits(Bus, events.EventEmitter);\n\nvar bus = new Bus();\n\n// /*\nvar collected = {};\nbus.on('newListener', function (event) {\n  debug('bus new listener: %s (%s)', event, bus.listeners(event).length);\n  if (!collected[event]) {\n    collected[event] = true;\n    bus.on(event, function () {\n      debug('bus emit: %s', event);\n    });\n  }\n});\n\n// */\n\n// proxy process messages (if forked) to the bus\nprocess.on('message', function (event) {\n  debug('process.message(%s)', event);\n  bus.emit(event);\n});\n\nvar emit = bus.emit;\n\n// if nodemon was spawned via a fork, allow upstream communication\n// via process.send\nif (process.send) {\n  bus.emit = function (event, data) {\n    process.send({ type: event, data: data });\n    emit.apply(bus, arguments);\n  };\n}\n\nmodule.exports = bus;\n"
  },
  {
    "path": "lib/utils/clone.js",
    "content": "module.exports = clone;\n\n// via http://stackoverflow.com/a/728694/22617\nfunction clone(obj) {\n  // Handle the 3 simple types, and null or undefined\n  if (null === obj || 'object' !== typeof obj) {\n    return obj;\n  }\n\n  var copy;\n\n  // Handle Date\n  if (obj instanceof Date) {\n    copy = new Date();\n    copy.setTime(obj.getTime());\n    return copy;\n  }\n\n  // Handle Array\n  if (obj instanceof Array) {\n    copy = [];\n    for (var i = 0, len = obj.length; i < len; i++) {\n      copy[i] = clone(obj[i]);\n    }\n    return copy;\n  }\n\n  // Handle Object\n  if (obj instanceof Object) {\n    copy = {};\n    for (var attr in obj) {\n      if (obj.hasOwnProperty && obj.hasOwnProperty(attr)) {\n        copy[attr] = clone(obj[attr]);\n      }\n    }\n    return copy;\n  }\n\n  throw new Error('Unable to copy obj! Its type isn\\'t supported.');\n}"
  },
  {
    "path": "lib/utils/colour.js",
    "content": "/**\n * Encodes a string in a colour: red, yellow or green\n * @param  {String} c   colour to highlight in\n * @param  {String} str the string to encode\n * @return {String}     coloured string for terminal printing\n */\nfunction colour(c, str) {\n  return (colour[c] || colour.black) + str + colour.black;\n}\n\nfunction strip(str) {\n  re.lastIndex = 0; // reset position\n  return str.replace(re, '');\n}\n\ncolour.red = '\\x1B[31m';\ncolour.yellow = '\\x1B[33m';\ncolour.green = '\\x1B[32m';\ncolour.black = '\\x1B[39m';\n\nvar reStr = Object.keys(colour).map(key => colour[key]).join('|');\nvar re = new RegExp(('(' + reStr + ')').replace(/\\[/g, '\\\\['), 'g');\n\ncolour.strip = strip;\n\nmodule.exports = colour;\n"
  },
  {
    "path": "lib/utils/index.js",
    "content": "var noop = function () { };\nvar path = require('path');\nconst semver = require('semver');\nvar version = process.versions.node.split('.') || [null, null, null];\n\nvar utils = (module.exports = {\n  semver: semver,\n  satisfies: test => semver.satisfies(process.versions.node, test),\n  version: {\n    major: parseInt(version[0] || 0, 10),\n    minor: parseInt(version[1] || 0, 10),\n    patch: parseInt(version[2] || 0, 10),\n  },\n  clone: require('./clone'),\n  merge: require('./merge'),\n  bus: require('./bus'),\n  isWindows: process.platform === 'win32',\n  isMac: process.platform === 'darwin',\n  isLinux: process.platform === 'linux',\n  isIBMi: require('os').type() === 'OS400',\n  isRequired: (function () {\n    var p = module.parent;\n    while (p) {\n      // in electron.js engine it happens\n      if (!p.filename) {\n        return true;\n      }\n      if (p.filename.indexOf('bin' + path.sep + 'nodemon.js') !== -1) {\n        return false;\n      }\n      p = p.parent;\n    }\n\n    return true;\n  })(),\n  home: process.env.HOME || process.env.HOMEPATH,\n  quiet: function () {\n    // nukes the logging\n    if (!this.debug) {\n      for (var method in utils.log) {\n        if (typeof utils.log[method] === 'function') {\n          utils.log[method] = noop;\n        }\n      }\n    }\n  },\n  reset: function () {\n    if (!this.debug) {\n      for (var method in utils.log) {\n        if (typeof utils.log[method] === 'function') {\n          delete utils.log[method];\n        }\n      }\n    }\n    this.debug = false;\n  },\n  regexpToText: function (t) {\n    return t\n      .replace(/\\.\\*\\\\./g, '*.')\n      .replace(/\\\\{2}/g, '^^')\n      .replace(/\\\\/g, '')\n      .replace(/\\^\\^/g, '\\\\');\n  },\n  stringify: function (exec, args) {\n    // serializes an executable string and array of arguments into a string\n    args = args || [];\n\n    return [exec]\n      .concat(\n      args.map(function (arg) {\n        // if an argument contains a space, we want to show it with quotes\n        // around it to indicate that it is a single argument\n        if (arg.length > 0 && arg.indexOf(' ') === -1) {\n          return arg;\n        }\n        // this should correctly escape nested quotes\n        return JSON.stringify(arg);\n      })\n      )\n      .join(' ')\n      .trim();\n  },\n});\n\nutils.log = require('./log')(utils.isRequired);\n\nObject.defineProperty(utils, 'debug', {\n  set: function (value) {\n    this.log.debug = value;\n  },\n  get: function () {\n    return this.log.debug;\n  },\n});\n\nObject.defineProperty(utils, 'colours', {\n  set: function (value) {\n    this.log.useColours = value;\n  },\n  get: function () {\n    return this.log.useColours;\n  },\n});\n"
  },
  {
    "path": "lib/utils/log.js",
    "content": "var colour = require('./colour');\nvar bus = require('./bus');\nvar required = false;\nvar useColours = true;\n\nvar coding = {\n  log: 'black',\n  info: 'yellow',\n  status: 'green',\n  detail: 'yellow',\n  fail: 'red',\n  error: 'red',\n};\n\nfunction log(type, text) {\n  var msg = '[nodemon] ' + (text || '');\n\n  if (useColours) {\n    msg = colour(coding[type], msg);\n  }\n\n  // always push the message through our bus, using nextTick\n  // to help testing and get _out of_ promises.\n  process.nextTick(() => {\n    bus.emit('log', { type: type, message: text, colour: msg });\n  });\n\n  // but if we're running on the command line, also echo out\n  // question: should we actually just consume our own events?\n  if (!required) {\n    if (type === 'error') {\n      console.error(msg);\n    } else {\n      console.log(msg || '');\n    }\n  }\n}\n\nvar Logger = function (r) {\n  if (!(this instanceof Logger)) {\n    return new Logger(r);\n  }\n  this.required(r);\n  return this;\n};\n\nObject.keys(coding).forEach(function (type) {\n  Logger.prototype[type] = log.bind(null, type);\n});\n\n// detail is for messages that are turned on during debug\nLogger.prototype.detail = function (msg) {\n  if (this.debug) {\n    log('detail', msg);\n  }\n};\n\nLogger.prototype.required = function (val) {\n  required = val;\n};\n\nLogger.prototype.debug = false;\nLogger.prototype._log = function (type, msg) {\n  if (required) {\n    bus.emit('log', { type: type, message: msg || '', colour: msg || '' });\n  } else if (type === 'error') {\n    console.error(msg);\n  } else {\n    console.log(msg || '');\n  }\n};\n\nObject.defineProperty(Logger.prototype, 'useColours', {\n  set: function (val) {\n    useColours = val;\n  },\n  get: function () {\n    return useColours;\n  },\n});\n\nmodule.exports = Logger;\n"
  },
  {
    "path": "lib/utils/merge.js",
    "content": "var clone = require('./clone');\n\nmodule.exports = merge;\n\nfunction typesMatch(a, b) {\n  return (typeof a === typeof b) && (Array.isArray(a) === Array.isArray(b));\n}\n\n/**\n * A deep merge of the source based on the target.\n * @param  {Object} source   [description]\n * @param  {Object} target   [description]\n * @return {Object}          [description]\n */\nfunction merge(source, target, result) {\n  if (result === undefined) {\n    result = clone(source);\n  }\n\n  // merge missing values from the target to the source\n  Object.getOwnPropertyNames(target).forEach(function (key) {\n    if (source[key] === undefined) {\n      result[key] = target[key];\n    }\n  });\n\n  Object.getOwnPropertyNames(source).forEach(function (key) {\n    var value = source[key];\n\n    if (target[key] && typesMatch(value, target[key])) {\n      // merge empty values\n      if (value === '') {\n        result[key] = target[key];\n      }\n\n      if (Array.isArray(value)) {\n        if (value.length === 0 && target[key].length) {\n          result[key] = target[key].slice(0);\n        }\n      } else if (typeof value === 'object') {\n        result[key] = merge(value, target[key]);\n      }\n    }\n  });\n\n  return result;\n}"
  },
  {
    "path": "lib/version.js",
    "content": "module.exports = version;\nmodule.exports.pin = pin;\n\nvar fs = require('fs');\nvar path = require('path');\nvar exec = require('child_process').exec;\nvar root = null;\n\nfunction pin() {\n  return version().then(function (v) {\n    version.pinned = v;\n  });\n}\n\nfunction version(callback) {\n  // first find the package.json as this will be our root\n  var promise = findPackage(path.dirname(module.parent.filename))\n    .then(function (dir) {\n      // now try to load the package\n      var v = require(path.resolve(dir, 'package.json')).version;\n\n      if (v && v !== '0.0.0-development') {\n        return v;\n      }\n\n      root = dir;\n\n      // else we're in development, give the commit out\n      // get the last commit and whether the working dir is dirty\n      var promises = [\n        branch().catch(function () { return 'master'; }),\n        commit().catch(function () { return '<none>'; }),\n        dirty().catch(function () { return 0; }),\n      ];\n\n      // use the cached result as the export\n      return Promise.all(promises).then(function (res) {\n        var branch = res[0];\n        var commit = res[1];\n        var dirtyCount = parseInt(res[2], 10);\n        var curr = branch + ': ' + commit;\n        if (dirtyCount !== 0) {\n          curr += ' (' + dirtyCount + ' dirty files)';\n        }\n\n        return curr;\n      });\n    }).catch(function (error) {\n      console.log(error.stack);\n      throw error;\n    });\n\n  if (callback) {\n    promise.then(function (res) {\n      callback(null, res);\n    }, callback);\n  }\n\n  return promise;\n}\n\nfunction findPackage(dir) {\n  if (dir === '/') {\n    return Promise.reject(new Error('package not found'));\n  }\n  return new Promise(function (resolve) {\n    fs.stat(path.resolve(dir, 'package.json'), function (error, exists) {\n      if (error || !exists) {\n        return resolve(findPackage(path.resolve(dir, '..')));\n      }\n\n      resolve(dir);\n    });\n  });\n}\n\nfunction command(cmd) {\n  return new Promise(function (resolve, reject) {\n    exec(cmd, { cwd: root }, function (err, stdout, stderr) {\n      var error = stderr.trim();\n      if (error) {\n        return reject(new Error(error));\n      }\n      resolve(stdout.split('\\n').join(''));\n    });\n  });\n}\n\nfunction commit() {\n  return command('git rev-parse HEAD');\n}\n\nfunction branch() {\n  return command('git rev-parse --abbrev-ref HEAD');\n}\n\nfunction dirty() {\n  return command('expr $(git status --porcelain 2>/dev/null| ' +\n    'egrep \"^(M| M)\" | wc -l)');\n}\n"
  },
  {
    "path": "package.json",
    "content": "{\n  \"name\": \"nodemon\",\n  \"homepage\": \"https://nodemon.io\",\n  \"author\": {\n    \"name\": \"Remy Sharp\",\n    \"url\": \"https://github.com/remy\"\n  },\n  \"bin\": {\n    \"nodemon\": \"./bin/nodemon.js\"\n  },\n  \"engines\": {\n    \"node\": \">=10\"\n  },\n  \"repository\": {\n    \"type\": \"git\",\n    \"url\": \"https://github.com/remy/nodemon.git\"\n  },\n  \"description\": \"Simple monitor script for use during development of a Node.js app.\",\n  \"keywords\": [\n    \"cli\",\n    \"monitor\",\n    \"monitor\",\n    \"development\",\n    \"restart\",\n    \"autoload\",\n    \"reload\",\n    \"terminal\"\n  ],\n  \"license\": \"MIT\",\n  \"types\": \"./index.d.ts\",\n  \"main\": \"./lib/nodemon\",\n  \"scripts\": {\n    \"commitmsg\": \"commitlint -e\",\n    \"coverage\": \"istanbul cover _mocha -- --timeout 30000 --ui bdd --reporter list test/**/*.test.js\",\n    \"lint\": \"eslint lib/**/*.js\",\n    \"test\": \"npm run lint && npm run spec\",\n    \"spec\": \"for FILE in test/**/*.test.js; do echo $FILE; TEST=1 mocha --exit --timeout 30000 $FILE; if [ $? -ne 0 ]; then exit 1; fi; sleep 1; done\",\n    \"postspec\": \"npm run clean\",\n    \"clean\": \"rm -rf test/fixtures/test*.js test/fixtures/test*.md\",\n    \"web\": \"node web\",\n    \"semantic-release\": \"semantic-release\",\n    \"prepush\": \"npm run lint\",\n    \"killall\": \"ps auxww | grep node | grep -v grep | awk '{ print $2 }' | xargs kill -9\"\n  },\n  \"devDependencies\": {\n    \"@commitlint/cli\": \"^11.0.0\",\n    \"@commitlint/config-conventional\": \"^11.0.0\",\n    \"async\": \"1.4.2\",\n    \"coffee-script\": \"~1.7.1\",\n    \"eslint\": \"^7.32.0\",\n    \"husky\": \"^7.0.4\",\n    \"mocha\": \"^2.5.3\",\n    \"nyc\": \"^15.1.0\",\n    \"proxyquire\": \"^1.8.0\",\n    \"semantic-release\": \"^25.0.0\",\n    \"should\": \"~4.0.0\"\n  },\n  \"dependencies\": {\n    \"chokidar\": \"^3.5.2\",\n    \"debug\": \"^4\",\n    \"ignore-by-default\": \"^1.0.1\",\n    \"minimatch\": \"^10.2.1\",\n    \"pstree.remy\": \"^1.1.8\",\n    \"semver\": \"^7.5.3\",\n    \"simple-update-notifier\": \"^2.0.0\",\n    \"supports-color\": \"^5.5.0\",\n    \"touch\": \"^3.1.0\",\n    \"undefsafe\": \"^2.0.5\"\n  },\n  \"version\": \"0.0.0-development\",\n  \"funding\": {\n    \"type\": \"opencollective\",\n    \"url\": \"https://opencollective.com/nodemon\"\n  },\n  \"publishConfig\": {\n    \"provenance\": true\n  }\n}\n"
  },
  {
    "path": "test/cli/exec.test.js",
    "content": "'use strict';\n/*global describe:true, it: true */\nconst path = require('path');\nconst exec = require('../../lib/config/exec');\nconst expandScript = exec.expandScript;\nconst command = require('../../lib/config/command');\nconst assert = require('assert');\nconst utils = require('../../lib/utils');\n\nfunction toCmd(options) {\n  var cmd = command({\n    script: options.script || 'app.js',\n    execOptions: options,\n  });\n\n  return {\n    cmd: cmd,\n    string: utils.stringify(cmd.executable, cmd.args),\n  };\n}\n\ndescribe('expandScript', () => {\n  var pwd = process.cwd();\n\n  afterEach(function () {\n    process.chdir(pwd);\n  });\n\n  beforeEach(function () {\n    // move to the fixtures directory to allow for config loading\n    process.chdir(path.resolve(pwd, 'test/fixtures'));\n  });\n\n  it('should expand app.js', () => {\n    const script = expandScript('app');\n    assert.equal(script, 'app.js', script);\n  });\n\n  it('should expand hello.py', () => {\n    const script = expandScript('hello', '.py');\n    assert.equal(script, 'hello.py', script);\n  });\n\n  it('should ignore foo.js', () => {\n    const script = expandScript('foo', '.js');\n    assert.equal(script, 'foo', script);\n  });\n});\n\ndescribe('nodemon exec', function () {\n  var pwd = process.cwd();\n\n  afterEach(function () {\n    process.chdir(pwd);\n  });\n\n  beforeEach(function () {\n    // move to the fixtures directory to allow for config loading\n    process.chdir(path.resolve(pwd, 'test/fixtures'));\n  });\n\n  it('should default to node', function () {\n    var options = exec({ script: 'index.js' });\n    var cmd = toCmd(options);\n    assert.equal(options.exec, 'node', 'exec is node');\n    assert.equal(options.ext, 'js,mjs,cjs,json');\n    assert.equal(cmd.string, 'node index.js', cmd.string);\n  });\n\n  it('should support --debug', function () {\n    var options = exec({ script: 'app.js', nodeArgs: ['--debug'] });\n    var cmd = toCmd(options);\n    assert(cmd.string === 'node --debug app.js', cmd.string);\n    assert(options.ext.indexOf('js') !== -1, 'extension watched is .js');\n  });\n\n  it('should support --debug=XXXX', function () {\n    var options = exec({ script: 'app.js', nodeArgs: ['--debug=9999'] });\n    var cmd = toCmd(options);\n    assert(cmd.string === 'node --debug=9999 app.js', cmd.string);\n    assert(options.exec === 'node');\n    assert(options.ext.indexOf('js') !== -1);\n  });\n\n  it('should support multiple extensions', function () {\n    var options = exec({ script: 'app.js', ext: 'js, pug, hbs' });\n    var cmd = toCmd(options);\n    assert(cmd.string === 'node app.js', cmd.string);\n    assert(options.ext.indexOf('pug') !== -1, 'comma separated string');\n\n    options = exec({ script: 'app.js', ext: 'js|pug|hbs' });\n    assert(options.exec === 'node');\n    assert(options.ext.indexOf('pug') !== -1, 'pipe separated string');\n  });\n\n  it('should support watching all extensions', function () {\n    var options = exec({ script: 'app.js', ext: '' });\n    assert.equal(\n      options.ext,\n      '',\n      'does not set default extensions when empty extension requested'\n    );\n\n    options = exec({ script: 'app.js', ext: '.' });\n    assert.equal(options.ext, '', 'treats `.` as wildcard extension');\n\n    options = exec({ script: 'app.js', ext: '*' });\n    assert.equal(options.ext, '', 'treats `*` as wildcard extension');\n\n    options = exec({ script: 'app.coffee', exec: 'coffee', ext: '' });\n    assert.equal(\n      options.ext,\n      '',\n      'does not set default extensions when empty extension requested'\n    );\n  });\n\n  it('should replace {{filename}}', function () {\n    var options = exec({\n      script: 'app.js',\n      exec: 'node {{filename}}.tmp --somethingElse',\n    });\n\n    var cmd = toCmd(options);\n    assert(cmd.string === 'node app.js.tmp --somethingElse', cmd.string);\n  });\n\n  it('should not split on spaces in {{filename}}', function () {\n    var options = exec({\n      script: 'my app.js',\n      exec: 'node {{filename}}.tmp --somethingElse',\n    });\n    var cmd = toCmd(options);\n    // var cmd = command({ execOptions: options });\n\n    assert(cmd.string === 'node my app.js.tmp --somethingElse', cmd.string);\n  });\n\n  it('should support extension maps', function () {\n    var options = exec(\n      { script: 'template.pug' },\n      { pug: 'pug {{filename}} --out /tmp' }\n    );\n    var cmd = toCmd(options);\n    assert(cmd.string === 'pug template.pug --out /tmp', cmd.string);\n  });\n\n  it('should support input from argv#parse', function () {\n    var parse = require('../../lib/cli/parse');\n    parse(\n      'node /usr/local/bin/nodemon.js --debug -e js,pug,hbs app.js'.split(' ')\n    );\n  });\n\n  it('should use coffeescript on .coffee', function () {\n    var options = exec({ script: 'index.coffee' });\n    assert(\n      options.exec.indexOf('coffee') === 0,\n      'using coffeescript to execute'\n    );\n    assert(options.ext.indexOf('coffee') !== -1);\n  });\n\n  it('should support coffeescript in debug mode', function () {\n    var options = exec({ script: 'app.coffee', nodeArgs: ['--debug'] });\n\n    assert(\n      options.exec.indexOf('coffee') === 0,\n      'using coffeescript to execute'\n    );\n    assert(options.execArgs[1].indexOf('--debug') !== -1);\n    assert(options.ext.indexOf('coffee') !== -1);\n  });\n\n  it('should support custom execs', function () {\n    var options = exec({ script: 'app.py', exec: 'python' });\n\n    assert(options.exec === 'python');\n    assert(options.ext.indexOf('py') !== -1);\n  });\n\n  it('should support custom executables with arguments', function () {\n    var options = exec({ script: 'app.py', exec: 'python --debug' });\n    var cmd = toCmd(options);\n\n    assert(cmd.string === 'python --debug app.py', cmd.string);\n    assert(options.ext.indexOf('py') !== -1);\n  });\n\n  it('should support an array of exec arguments', function () {\n    var options = exec({ script: 'app.js', exec: ['/path to node', '-v'] });\n\n    assert(options.exec === '/path to node', options.exec);\n    assert(options.execArgs.length === 1, options.execArgs.length);\n    assert(options.execArgs[0] === '-v', options.execArgs[0]);\n  });\n\n  it('should support non-english filenames', function () {\n    var parse = require('../../lib/cli/parse');\n    var options = parse('node nodemon.js -e ζ ./server.js \"$@\"'.split(' '));\n    var res = exec(options);\n    assert(res.ext === 'ζ', 'exec did not bail');\n  });\n\n  it('should support multi-level file extensions', function () {\n    var options = exec({ ext: '.ts.d,js md' });\n\n    assert(options.ext.indexOf('ts.d') !== -1);\n    assert(options.ext.indexOf('js') !== -1);\n    assert(options.ext.indexOf('md') !== -1);\n  });\n\n  it('should support single-level file extensions', function () {\n    var options = exec({ ext: '.js, pug' });\n\n    assert(options.ext.indexOf('js') !== -1);\n    assert(options.ext.indexOf('pug') !== -1);\n  });\n\n  it('should expand app to app.js', function () {\n    var options = exec({ script: 'app' });\n    var cmd = toCmd(options);\n    assert(cmd.string === 'node app.js', cmd.string);\n\n    options = exec({ script: 'app', ext: '' });\n    cmd = toCmd(options);\n    assert(cmd.string === 'node app.js', cmd.string);\n  });\n\n  it('should expand based on custom extensions to hello.py', function () {\n    var options = exec({ script: 'hello', ext: '.py', exec: 'python' });\n    var cmd = toCmd(options);\n    assert(cmd.string === 'python hello.py', cmd.string);\n  });\n\n  it('should expand based on custom extensions to app.js (js,jsx,mjs)', function () {\n    var options = exec({ script: 'app', ext: 'js,jsx,mjs' });\n    var cmd = toCmd(options);\n    assert(cmd.string === 'node app.js', cmd.string);\n  });\n\n  it('should not expand index to non-existant index.js', function () {\n    var options = exec({ script: 'index' });\n    var cmd = toCmd(options);\n    assert(cmd.string === 'node index', cmd.string);\n  });\n});\n"
  },
  {
    "path": "test/cli/parse.test.js",
    "content": "'use strict';\n/*global describe:true, it: true */\nvar cli = require('../../lib/cli/'),\n  exec = require('../../lib/config/exec'),\n  pkg = require('../../package'),\n  assert = require('assert'),\n  command = require('../../lib/config/command'),\n  utils = require('../../lib/utils');\n\nconst mutateExecOptions = require('../../lib/config/load').mutateExecOptions;\n\nfunction asCLI(cmd) {\n  return ('node nodemon ' + (cmd || '')).trim();\n}\n\nfunction parse(cmd) {\n  var parsed = cli.parse(cmd);\n\n  // mirrored based on /lib/config/load.js:36\n  parsed.execOptions = exec({\n    script: parsed.script,\n    exec: parsed.exec,\n    args: parsed.args,\n    scriptPosition: parsed.scriptPosition,\n    nodeArgs: parsed.nodeArgs,\n    ext: parsed.ext,\n    env: parsed.env\n  });\n\n  return parsed;\n    return mutateExecOptions(cli.parse(cmd));\n}\n\nfunction commandToString(command) {\n  return utils.stringify(command.executable, command.args);\n}\n\ndescribe('nodemon CLI parser', function () {\n  it('should support --debug with script detect via package', function () {\n    var cwd = process.cwd();\n    process.chdir('test/fixtures/packages/express4');\n    var settings = parse(asCLI('--debug'));\n    var cmd = commandToString(command(settings));\n    process.chdir(cwd);\n    assert.equal(cmd, 'NODE_ENV=development node ./bin/www --debug');\n  });\n\n  it('should replace {{filename}}', function () {\n    var settings = parse(asCLI('test/fixtures/app.js --exec \"node {{filename}}.tmp\" --somethingElse'));\n    var cmd = commandToString(command(settings));\n    assert(cmd === 'node test/fixtures/app.js.tmp --somethingElse', cmd);\n  });\n\n  it('should replace {{filename}} multiple times', function () {\n    var settings = parse(asCLI('test/fixtures/app.js --exec \"node {{filename}}.tmp {{filename}}.tmp\" --somethingElse'));\n    var cmd = commandToString(command(settings));\n    assert(cmd === 'node test/fixtures/app.js.tmp test/fixtures/app.js.tmp --somethingElse', cmd);\n  });\n\n  it('should parse the help examples #1', function () {\n    var settings = parse(asCLI('test/fixtures/app.js')),\n      cmd = commandToString(command(settings));\n\n    assert(cmd === 'node test/fixtures/app.js', 'node test/fixtures/app.js: ' + cmd);\n  });\n\n  it('should parse the help examples #2', function () {\n    var settings = parse(asCLI('-w ../lib test/fixtures/app.js apparg1 apparg2')),\n      cmd = commandToString(command(settings));\n\n    assert.deepEqual(settings.watch, ['../lib'], 'watching ../lib: ' + settings.watch);\n    assert.deepEqual(settings.execOptions.args, ['apparg1', 'apparg2'], 'args are corr   ' + settings.execOptions.args);\n    assert(cmd === 'node test/fixtures/app.js apparg1 apparg2', 'command is ' + cmd);\n  });\n\n  it('should parse the help examples #3', function () {\n    var settings = parse(asCLI('--exec python app.py')),\n      cmd = commandToString(command(settings));\n\n    assert(cmd === 'python app.py', 'command is ' + cmd);\n    assert(settings.execOptions.exec === 'python', 'exec is python');\n  });\n\n  it('should parse the help examples #4', function () {\n    var settings = parse(asCLI('--exec \"make build\" -e \"styl hbs\"')),\n      cmd = commandToString(command(settings));\n\n    assert(cmd === 'make build', 'command is ' + cmd);\n    assert.deepEqual(settings.execOptions.ext.split(','), ['styl', 'hbs'], 'correct extensions being watched: ' + settings.execOptions.ext);\n  });\n\n  it('should parse the help examples #5', function () {\n    var settings = parse(asCLI('test/fixtures/app.js -- -L')),\n      cmd = commandToString(command(settings));\n\n    assert(cmd === 'node test/fixtures/app.js -L', 'command is ' + cmd);\n  });\n\n  it('should put the script at the end if found in package.main', function () {\n    var pwd = process.cwd();\n    process.chdir('test/fixtures'); // allows us to load text/fixtures/package.json\n    var settings = parse(asCLI('--harmony')),\n      cmd = commandToString(command(settings));\n    process.chdir(pwd);\n\n    assert(cmd === 'node --harmony app.js', 'command is ' + cmd);\n  });\n\n  it('should support default express4 format', function () {\n    var pwd = process.cwd();\n    process.chdir('test/fixtures/packages/express4'); // allows us to load text/fixtures/package.json\n    var settings = parse(asCLI()),\n      cmd = commandToString(command(settings));\n\n    process.chdir(pwd);\n\n    assert.equal(cmd, 'NODE_ENV=development node ./bin/www', 'command is \"' + cmd + '\"');\n  });\n\n  it('should support spaces', function () {\n    var pwd = process.cwd();\n    process.chdir('test/fixtures/');\n    var settings = parse(asCLI('--exec \\'\"app with spaces.js\" foo\\''));\n    var cmd = commandToString(command(settings));\n\n    process.chdir(pwd);\n\n    assert(cmd === '\"app with spaces.js\" foo', cmd);\n  });\n\n\n  it('should support quotes around arguments', function () {\n    var settings = parse(asCLI('--watch \"foo bar\"'));\n    assert(settings.watch[0] === 'foo bar');\n  });\n\n  it('should keep eating arguments that are for nodemon after the script.js', function () {\n    var settings = parse(asCLI('--watch \"foo bar\" test/fixtures/app.js -V --scriptOpt1 -- -V'));\n    assert.deepEqual(settings.execOptions.args, ['--scriptOpt1', '-V'], 'script args are: ' + settings.execOptions.args.join(' '));\n    assert(settings.verbose === true, 'verbose');\n    assert(settings.watch[0] === 'foo bar', 'watching \"foo bar\" dir');\n  });\n\n  it('should allow -- to appear anywhere, and still find user script', function () {\n    var settings = parse(asCLI('test/fixtures/app.js -- -V'));\n    assert(!settings.verbose, '-V arg was passed to script, not nodemon');\n    assert.deepEqual(settings.execOptions.args, ['-V'], 'script passed -V via --');\n    settings = parse(asCLI('-- test/fixtures/app.js -V'));\n    assert.deepEqual(settings.execOptions.args, ['-V'], 'leading -- finds script');\n    settings = parse(asCLI('test/fixtures/app.js -V --'));\n    assert.deepEqual(settings.execOptions.args, [], '-- is ignored');\n    assert(settings.verbose, '-V was passed to nodemon');\n  });\n\n  it('should support arguments from the cli', function () {\n    var settings = parse(['node', 'nodemon', '--watch', 'foo bar']);\n    assert(settings.watch[0] === 'foo bar');\n  });\n\n  it('should support stand alone `nodemon` command', function () {\n    var settings = parse(asCLI(''));\n    assert(settings.execOptions.script === pkg.main + '.js', `${settings.execOptions.script} === ${pkg.main}`);\n  });\n\n  it('should put --debug in the right place with coffescript', function () {\n    var settings = parse(asCLI('--debug test/fixtures/app.coffee'));\n\n    // using indexOf instead of === because on windows\n    // coffee is coffee.cmd - so we check for a partial match\n    assert(commandToString(command(settings)).indexOf('--nodejs --debug test/fixtures/app.coffee') !== -1);\n    assert(settings.execOptions.exec.indexOf('coffee') === 0, 'executable is CoffeeScript');\n  });\n\n  it('should support period path', function () {\n    var settings = parse(asCLI('.'));\n\n    assert(commandToString(command(settings)) === 'node .');\n  });\n\n  it('should parse `nodemon lib/index.js`', function () {\n    var settings = parse(asCLI('lib/index.js'));\n\n    assert(settings.script === 'lib/index.js');\n  });\n\n  it('should parse `nodemon --config my/.nodemon.json server.js`', function () {\n    var settings = parse(asCLI('--config my/.nodemon.json test/fixtures/app.js'));\n\n    assert(settings.configFile === 'my/.nodemon.json');\n    assert(settings.script === 'test/fixtures/app.js');\n  });\n\n  it('should parse `nodemon test/fixtures/app.coffee`', function () {\n    var settings = parse(asCLI('test/fixtures/app.coffee'));\n\n    assert(settings.script === 'test/fixtures/app.coffee');\n    assert(settings.execOptions.exec.indexOf('coffee') === 0, 'executable is CoffeeScript');\n  });\n\n  it('should parse `nodemon --watch src/ -e js,coffee test/fixtures/app.js`', function () {\n    var settings = parse(asCLI('--watch src/ -e js,coffee test/fixtures/app.js'));\n\n    assert(settings.script === 'test/fixtures/app.js');\n    assert(settings.execOptions.exec === 'node');\n  });\n\n  it('should pass --debug to node', function () {\n    var settings = parse(asCLI('--debug test/fixtures/app.js'));\n\n    assert(settings.script === 'test/fixtures/app.js');\n    assert(settings.execOptions.exec === 'node');\n\n    assert(commandToString(command(settings)).indexOf('--debug') !== -1);\n  });\n\n  it('should pass --harmony to node', function () {\n    var settings = parse(asCLI('--harmony test/fixtures/app.js'));\n\n    assert(settings.script === 'test/fixtures/app.js');\n    assert(settings.execOptions.exec === 'node');\n    assert(commandToString(command(settings)).indexOf('--harmony') !== -1);\n  });\n});\n\ndescribe('nodemon argument parser', function () {\n  it('support strings', function () {\n    var settings = cli.parse('node nodemon -v');\n    assert(settings.version === true, 'version flag');\n  });\n\n  it('should support short versions of flags', function () {\n    var settings = cli.parse('node nodemon -v -x java -I -V -q -w fixtures -i fixtures -d 5 -L -C -e pug -s SIGHUP');\n    assert(settings.version, 'version');\n    assert(settings.verbose, 'verbose');\n    assert(settings.exec === 'java', 'exec');\n    assert(settings.quiet, 'quiet');\n    assert(settings.stdin === false, 'read stdin');\n    assert(settings.watch[0] === 'fixtures', 'watch');\n    assert(settings.ignore[0] === 'fixtures', 'ignore');\n    assert(settings.delay === 5000, 'delay 5 seconds');\n    assert(settings.runOnChangeOnly, 'run on change only');\n    assert(settings.ext === 'pug', 'extension is pug');\n    assert(settings.signal === 'SIGHUP', 'signal is SIGHUP');\n  });\n\n\n  it('should support long versions of flags', function () {\n    var settings = cli.parse('node nodemon --version --exec java --verbose --quiet --watch fixtures --ignore fixtures --no-stdin --delay 5 --legacy-watch --exitcrash --on-change-only --ext pug --config my/.nodemon.json --signal SIGHUP');\n    assert(settings.version, 'version');\n    assert(settings.verbose, 'verbose');\n    assert(settings.exec === 'java', 'exec');\n    assert(settings.quiet, 'quiet');\n    assert(settings.stdin === false, 'read stdin');\n    assert(settings.exitCrash, 'exit if crash');\n    assert(settings.watch[0] === 'fixtures', 'watch');\n    assert(settings.ignore[0] === 'fixtures', 'ignore');\n    assert(settings.delay === 5000, 'delay 5 seconds');\n    assert(settings.runOnChangeOnly, 'run on change only');\n    assert(settings.ext === 'pug', 'extension is pug');\n    assert(settings.configFile === 'my/.nodemon.json', 'custom config file name is my/.nodemon.json');\n    assert(settings.signal === 'SIGHUP', 'signal is SIGHUP');\n  });\n});\n\ndescribe('nodemon respects custom \"ext\" and \"execMap\"', function () {\n  it('should support \"ext\" and \"execMap\" for same extension', function () {\n    var settings = parse(asCLI('-x \"node --harmony\" -e \"js json coffee\" test/fixtures/app.coffee'));\n    assert(settings.execOptions.ext.indexOf('js') === 0, 'js is monitored: ' + settings.execOptions.ext);\n    assert(settings.execOptions.ext.split(',').length === 3, 'all extensions monitored');\n    assert(settings.execOptions.exec.indexOf('node') === 0, 'node is exec: ' + settings.execOptions.exec);\n  });\n});\n\ndescribe('nodemon should support implicit extensions', () => {\n  it('should expand script to script.js', () => {\n    const cwd = process.cwd();\n    process.chdir('test/fixtures/');\n    const settings = parse(asCLI('env'));\n    process.chdir(cwd);\n    var cmd = commandToString(command(settings));\n    assert.equal(cmd, 'node env.js', 'implicit extension added');\n  });\n\n  it('should support non-js', () => {\n    const cwd = process.cwd();\n    process.chdir('test/fixtures/');\n    const settings = parse(asCLI('hello --ext py'));\n    process.chdir(cwd);\n    var cmd = commandToString(command(settings));\n    assert.equal(cmd, 'node hello.py', 'implicit extension added');\n  });\n\n});\n\ndescribe('nodemon should slurp properly', () => {\n  it('should read quotes as a single entity', () => {\n    const settings = parse(asCLI('notindex.js -- -b \"hello - world\"'));\n    assert(settings.execOptions.exec === 'node', 'node is exec');\n    assert(settings.args.length === 3, 'only has 3 arguments to node');\n  });\n\n  it('should pass non-slurped args to script', () => {\n    const settings = parse(asCLI('-- --log'));\n    var cmd = commandToString(command(settings));\n    assert.equal(cmd, 'node ./lib/nodemon.js --log', 'args passed to script');\n  });\n\n  it('should pass non-slurped args to explicit script', () => {\n    const settings = parse(asCLI('./lib/nodemon.js -- --log'));\n    var cmd = commandToString(command(settings));\n    assert.equal(cmd, 'node ./lib/nodemon.js --log', 'args passed to script');\n  });\n\n  it('should pass slurped args to explicit script', () => {\n    const settings = parse(asCLI('./lib/nodemon.js --log'));\n    var cmd = commandToString(command(settings));\n    assert.equal(cmd, 'node ./lib/nodemon.js --log', 'args passed to script');\n  });\n\n  it('should handle a mix of slurps', () => {\n    var cmd;\n    var settings;\n\n    cmd = commandToString(command(parse(asCLI('--inspect -- --log'))));\n    assert.equal(cmd, 'node --inspect ./lib/nodemon.js --log', 'args passed to script');\n\n    cmd = commandToString(command(parse(asCLI('--inspect ./lib/nodemon.js -- --log'))));\n    assert.equal(cmd, 'node --inspect ./lib/nodemon.js --log', 'args passed to script');\n\n    cmd = commandToString(command(parse(asCLI('--inspect --log ./lib/nodemon.js'))));\n    assert.equal(cmd, 'node --inspect --log ./lib/nodemon.js', 'args passed to script');\n  });\n\n});\n\ndescribe('nodemon with CoffeeScript', function () {\n  it('should not add --nodejs by default', function () {\n    var settings = parse(asCLI('test/fixtures/app.coffee'));\n    assert(settings.execOptions.exec.indexOf('coffee') === 0, 'executable is CoffeeScript');\n    assert(settings.execOptions.execArgs.indexOf('--nodejs') === -1, 'is not using --nodejs');\n  });\n\n  it('should not add --nodejs with app arguments', function () {\n    var settings = parse(asCLI('test/fixtures/app.coffee --my-app-arg'));\n    assert(settings.execOptions.exec.indexOf('coffee') === 0, 'executable is CoffeeScript');\n    assert(settings.execOptions.execArgs.indexOf('--nodejs') === -1, 'is not using --nodejs');\n  });\n\n  it('groups exec argument into a single --nodejs argument', function () {\n    var settings = parse(asCLI('--harmony --debug test/fixtures/app.coffee'));\n    assert(settings.execOptions.exec.indexOf('coffee') === 0, 'executable is CoffeeScript');\n    assert(settings.execOptions.execArgs[0] === '--nodejs', 'is using --nodejs');\n    assert(settings.execOptions.execArgs[1] === '--harmony --debug', 'is grouping exec arguments');\n  });\n\n  it('should add --nodejs when used with --debug', function () {\n    var settings = parse(asCLI('--debug test/fixtures/app.coffee'));\n    var cmd = commandToString(command(settings));\n\n    assert(settings.execOptions.exec.indexOf('coffee') === 0, 'executable is CoffeeScript');\n    assert(cmd.indexOf('--nodejs') !== -1, '--nodejs being used');\n    assert(cmd.indexOf('--debug') !== -1, '--debug being used');\n  });\n\n  it('should add --nodejs when used with --debug-brk', function () {\n    var settings = parse(asCLI('--debug-brk test/fixtures/app.coffee'));\n    var cmd = commandToString(command(settings));\n\n    assert(settings.execOptions.exec.indexOf('coffee') === 0, 'executable is CoffeeScript');\n    assert(cmd.indexOf('--nodejs') !== -1, '--nodejs being used');\n    assert(cmd.indexOf('--debug-brk') !== -1, '--debug-brk being used');\n  });\n});\n\ndescribe('nodemon --delay argument', function () {\n  it('should support an integer value', function () {\n    var settings = cli.parse('node nodemon --delay 5');\n    assert(settings.delay === 5000, 'delay 5 seconds');\n  });\n\n  it('should support a float value', function () {\n    var settings = cli.parse('node nodemon --delay 1.2');\n    assert(settings.delay === 1200, 'delay 1.2 seconds');\n  });\n\n  it('should support a value with a time specifier for seconds (s)', function () {\n    var settings = cli.parse('node nodemon --delay 5s');\n    assert(settings.delay === 5000, 'delay 5 seconds');\n  });\n\n  it('should support a value with a time specifier for milliseconds (ms)', function () {\n    var settings = cli.parse('node nodemon --delay 1200ms');\n    assert(settings.delay === 1200, 'delay 1.2 seconds');\n  });\n});\n"
  },
  {
    "path": "test/config/env.test.js",
    "content": "'use strict';\n/*global describe:true, it: true, after: true */\nvar nodemon = require('../../lib/'),\n  path = require('path'),\n  assert = require('assert');\n\ndescribe('when nodemon runs (1)', function () {\n  var tmp = path.resolve('test/fixtures/env.js');\n  after(function (done) {\n    // clean up just in case.\n    nodemon\n      .once('exit', function () {\n        nodemon.reset(done);\n      })\n      .emit('quit');\n  });\n\n  it('should pass through environment values', function (done) {\n    nodemon({ script: tmp, stdout: false, env: { NODEMON_ENV: 'nodemon' } }).on(\n      'stdout',\n      function (data) {\n        assert(\n          data.toString().trim() === 'nodemon',\n          'NODEMON_ENV env value correctly set to \"nodemon\": ' + data.toString()\n        );\n        nodemon\n          .once('exit', function () {\n            nodemon.reset(done);\n          })\n          .emit('quit');\n      }\n    );\n  });\n});\n"
  },
  {
    "path": "test/config/load-logging.test.js",
    "content": "'use strict';\n/*global describe, it, afterEach, beforeEach, after */\nconst load = require('../../lib/config/load');\nconst utils = require('../../lib/utils');\nconst path = require('path');\nconst testUtils = require('../utils');\nconst assert = require('assert');\nconst noop = {};\n\ndescribe('config logging', () => {\n  const pwd = process.cwd();\n  const oldHome = utils.home;\n\n  beforeEach(() => {\n    // move to the fixtures directory to allow for config loading\n    process.chdir(path.resolve(pwd, 'test/fixtures'));\n    utils.home = path.resolve(\n      pwd,\n      ['test', 'fixtures', 'global'].join(path.sep)\n    );\n  });\n\n  afterEach(() => {\n    process.chdir(pwd);\n    utils.home = oldHome;\n  });\n\n  it('should show package is being used', (done) => {\n    process.chdir(\n      path.resolve(pwd, 'test/fixtures/packages/package-json-settings')\n    );\n    const config = {};\n\n    load(noop, noop, config, () => {\n      assert.equal(config.loaded.length, 2, 'global nodemon and local package');\n      done();\n    });\n  });\n\n  it('should not read package if no nodemonConfig', (done) => {\n    utils.home = process.cwd();\n    process.chdir(path.resolve(pwd, 'test/fixtures'));\n    const config = {};\n\n    load(noop, noop, config, () => {\n      const files = config.loaded.map((_) => path.relative(pwd, _));\n      assert.equal(files.length, 1, 'global nodemon');\n      assert.deepEqual(files, ['test/fixtures/nodemon.json'], 'global nodemon');\n      done();\n    });\n  });\n\n  it('should ignore legacy if new format is found', (done) => {\n    utils.home = process.cwd();\n    process.chdir(path.resolve(pwd, 'test/fixtures/legacy'));\n    const config = {};\n\n    load(noop, noop, config, () => {\n      const loaded = config.loaded.map((_) => path.relative(pwd, _));\n      assert.equal(\n        loaded.length,\n        1,\n        'global nodemon is loaded and legacy is ignored'\n      );\n      done();\n    });\n  });\n\n  it('should load nothing if nothing found', (done) => {\n    utils.home = path.resolve(pwd, 'test/fixtures/configs'); // no valid nodemon.json files\n    process.chdir(pwd);\n    const config = {};\n\n    load(noop, noop, config, () => {\n      const loaded = config.loaded.map((_) => path.relative(pwd, _));\n      assert.deepEqual(loaded, [], 'nothing loaded');\n      done();\n    });\n  });\n});\n"
  },
  {
    "path": "test/config/load.test.js",
    "content": "'use strict';\n/*global describe, it, afterEach, beforeEach, after */\nvar load = require('../../lib/config/load');\nvar defaults = require('../../lib/config/defaults');\nvar cli = require('../../lib/cli/');\nvar path = require('path');\nvar testUtils = require('../utils');\nvar utils = require('../../lib/utils');\nvar rules = require('../../lib/rules');\nvar exec = require('../../lib/config/exec');\nvar nodemon = require('../../lib/nodemon');\nvar command = require('../../lib/config/command');\nvar assert = require('assert');\n\nfunction asCLI(cmd) {\n  return ('node nodemon ' + (cmd || '')).trim();\n}\n\nfunction commandToString(command) {\n  return utils.stringify(command.executable, command.args);\n}\n\ndescribe('config load', function () {\n  var pwd = process.cwd(),\n    oldhome = utils.home;\n\n  afterEach(function () {\n    process.chdir(pwd);\n    utils.home = oldhome;\n  });\n\n  after(function (done) {\n    // clean up just in case.\n    nodemon\n      .once('exit', function () {\n        nodemon.reset(done);\n      })\n      .emit('quit');\n  });\n\n  function removeRegExp(options) {\n    delete options.watch.re;\n    delete options.ignore.re;\n  }\n\n  beforeEach(function () {\n    // move to the fixtures directory to allow for config loading\n    process.chdir(path.resolve(pwd, 'test/fixtures'));\n    utils.home = path.resolve(\n      pwd,\n      ['test', 'fixtures', 'global'].join(path.sep)\n    );\n\n    rules.reset();\n    nodemon.config.reset();\n  });\n\n  it.skip('should remove ignore defaults if user provides their own', function (done) {\n    nodemon({\n      script: testUtils.appjs,\n      verbose: true,\n    })\n      .on('log', function (event) {\n        // console.log(event.colour);\n      })\n      .on('start', function () {\n        assert.ok(\n          nodemon.config.options.ignore.indexOf('one') !== -1,\n          'Contains \"one\" path'\n        );\n        assert.ok(\n          nodemon.config.options.ignore.indexOf('three') !== -1,\n          'Contains \"three\" path'\n        );\n        // note: we use the escaped format: \\\\.git\n        assert.ok(\n          nodemon.config.options.ignore.indexOf('\\\\.git') === -1,\n          'nodemon is not ignoring (default) .git'\n        );\n\n        nodemon.on('exit', function () {\n          nodemon.reset(done);\n        });\n\n        setTimeout(function () {\n          nodemon.emit('quit');\n        }, 1000);\n      });\n  });\n\n  it('should read global config', function (done) {\n    var config = {},\n      settings = { quiet: true },\n      options = {};\n    load(settings, options, config, function (config) {\n      assert(config.verbose, 'we are verbose');\n\n      // ensure global mapping works too\n      var options = exec({ script: 'template.pug' }, config.execMap);\n      assert(\n        options.exec === 'bin/pug template.pug --out /tmp',\n        'exec used, should be \"bin/pug\": ' + options.exec\n      );\n\n      done();\n    });\n  });\n\n  it('should read package.json config', function (done) {\n    var dir = path.resolve(pwd, 'test/fixtures/packages/package-json-settings');\n    process.chdir(dir);\n\n    var config = {},\n      settings = { quiet: true },\n      options = {};\n    load(settings, options, config, function (config) {\n      assert.deepEqual(config.exec, 'foo', 'exec is \"foo\": ' + config.exec);\n      done();\n    });\n  });\n\n  it('should give local files preference', function (done) {\n    var config = {},\n      settings = { quiet: true },\n      options = {};\n    load(settings, options, config, function (config) {\n      removeRegExp(config);\n      assert.ok(\n        config.ignore.indexOf('one') !== -1,\n        'ignore contains \"one\": ' + config.ignore\n      );\n      assert.ok(\n        config.ignore.indexOf('three') !== -1,\n        'ignore contains \"three\": ' + config.ignore\n      );\n      assert.deepEqual(\n        config.watch,\n        ['four'],\n        'watch is \"four\": ' + config.watch\n      );\n      done();\n    });\n  });\n\n  it('should give local files preference over package.json config', function (done) {\n    var dir = path.resolve(\n      pwd,\n      'test/fixtures/packages/nodemon-settings-and-package-json-settings'\n    );\n    process.chdir(dir);\n\n    var config = {},\n      settings = { quiet: true },\n      options = {};\n    load(settings, options, config, function (config) {\n      assert.deepEqual(config.exec, 'foo', 'exec is \"foo\": ' + config.exec);\n      done();\n    });\n  });\n\n  it('should give package.json config preference', function (done) {\n    var dir = path.resolve(pwd, 'test/fixtures/packages/package-json-settings');\n    process.chdir(dir);\n\n    var config = {},\n      settings = { quiet: true },\n      options = {};\n    load(settings, options, config, function (config) {\n      removeRegExp(config);\n      assert.deepEqual(config.exec, 'foo', 'exec is \"foo\": ' + config.exec);\n      assert.ok(\n        config.ignore.indexOf('one') !== -1,\n        'ignore contains \"one\": ' + config.ignore\n      );\n      assert.ok(\n        config.ignore.indexOf('three') !== -1,\n        'ignore contains \"three\": ' + config.ignore\n      );\n      assert.deepEqual(\n        config.watch,\n        ['four'],\n        'watch is \"four\": ' + config.watch\n      );\n      done();\n    });\n  });\n\n  it('should give user specified settings preference', function (done) {\n    var config = {},\n      settings = { ignore: ['one'], watch: ['one'], quiet: true },\n      options = {};\n    load(settings, options, config, function (config) {\n      removeRegExp(config);\n      assert(\n        config.ignore.indexOf('one') !== -1,\n        '\"one\" is ignored: ' + config.ignore\n      );\n      assert.deepEqual(\n        config.watch,\n        ['one'],\n        'watch is \"one\": ' + config.watch\n      );\n      done();\n    });\n  });\n\n  it('should give user specified settings preference over package.json config', function (done) {\n    var dir = path.resolve(pwd, 'test/fixtures/packages/package-json-settings');\n    process.chdir(dir);\n\n    var config = {},\n      settings = { exec: 'foo-user', quiet: true },\n      options = {};\n    load(settings, options, config, function (config) {\n      assert.deepEqual(\n        config.exec,\n        'foo-user',\n        'exec is \"foo-user\": ' + config.exec\n      );\n      done();\n    });\n  });\n\n  it('should give user specified exec preference over package.scripts.start', function (done) {\n    var dir = path.resolve(pwd, 'test/fixtures/packages/start-and-settings');\n    process.chdir(dir);\n\n    var config = {},\n      settings = { script: './index.js' },\n      options = {};\n\n    load(settings, options, config, function (config) {\n      assert.deepEqual(config.exec, 'foo', 'exec is \"foo\": ' + config.exec);\n      done();\n    });\n  });\n\n  it('should give package.json specified exec config over package.scripts.start', function (done) {\n    var dir = path.resolve(\n      pwd,\n      'test/fixtures/packages/start-and-package-json-settings'\n    );\n    process.chdir(dir);\n\n    var config = {},\n      settings = {},\n      options = {};\n\n    load(settings, options, config, function (config) {\n      assert.deepEqual(config.exec, 'foo', 'exec is \"foo\": ' + config.exec);\n      done();\n    });\n  });\n\n  // it('should put the script at the end if found in package.scripts.start', function (done) {\n  //   process.chdir(path.resolve(pwd, 'test/fixtures/packages/start')); // allows us to load text/fixtures/package.json\n  //   var settings = cli.parse(asCLI('--harmony'));\n  //   var config = {};\n  //   var options = {};\n\n  //   load(settings, options, config, function (config) {\n  //     var cmd = commandToString(command(config));\n  //     assert.equal(cmd, 'node --harmony app.js', 'command is ' + cmd);\n  //     done();\n  //   });\n\n  // });\n\n  it('should support \"ext\" with \"execMap\"', function (done) {\n    // prevents our test from finding the nodemon.json files\n    process.chdir(path.resolve(pwd, 'test/fixtures/legacy'));\n    utils.home = path.resolve(pwd, 'test/fixtures/legacy');\n\n    var settings = {\n      script: './index.js',\n      verbose: true,\n      ignore: ['*/artic/templates/*'],\n      ext: 'js coffee json',\n      watch: ['*.coffee'],\n      execMap: { js: 'node --harmony', coffee: 'node --harmony' },\n    };\n    var config = {};\n    var options = {};\n\n    load(settings, options, config, function (config) {\n      var cmd = commandToString(command(config));\n      assert(cmd === 'node --harmony ./index.js', 'cmd is: ' + cmd);\n      done();\n    });\n  });\n\n  it('should merge ignore rules', function (done) {\n    load(\n      {\n        ignore: ['*/artic/templates/*', 'views/*'],\n      },\n      {},\n      {},\n      function (config) {\n        assert.equal(config.ignore.length, defaults.ignoreRoot.length + 2);\n        done();\n      }\n    );\n  });\n\n  it('should allow user to override ignoreRoot', function (done) {\n    load(\n      {\n        ignore: ['*/artic/templates/*', 'views/*'],\n        ignoreRoot: ['.git'],\n      },\n      {},\n      {},\n      function (config) {\n        assert.equal(config.ignore.length, 3);\n        done();\n      }\n    );\n  });\n\n  it('should merge ignore rules even when strings', function (done) {\n    load(\n      {\n        ignore: 'public',\n      },\n      {},\n      {},\n      function (config) {\n        assert.equal(config.ignore.length, defaults.ignoreRoot.length + 1);\n        done();\n      }\n    );\n  });\n\n  it('should allow user to override root ignore rules', function (done) {\n    load(\n      {\n        ignore: 'public',\n        ignoreRoot: [],\n      },\n      {},\n      {},\n      function (config) {\n        assert.equal(config.ignore.length, 1);\n        done();\n      }\n    );\n  });\n\n  it('should allow user to set execArgs', (done) => {\n    const execArgs = ['--inspect'];\n    load(\n      {\n        execArgs,\n      },\n      {},\n      {},\n      (config) => {\n        assert.deepEqual(config.execArgs, execArgs);\n        done();\n      }\n    );\n  });\n\n  it('should support pkg.main and keep user args on args', (done) => {\n    process.chdir(path.resolve(pwd, 'test/fixtures/packages/main-and-start'));\n    const settings = {\n      scriptPosition: 0,\n      script: null,\n      args: ['first', 'second'],\n    };\n    const options = { ignore: [], watch: [], monitor: [] };\n    const config = {\n      run: false,\n      system: { cwd: '/Users/remy/dev/nodemon/issues/1758' },\n      required: false,\n      dirs: [],\n      timeout: 1000,\n      options: { ignore: [], watch: [], monitor: [] },\n      lastStarted: 0,\n      loaded: [],\n    };\n\n    load(settings, options, config, (res) => {\n      assert.deepEqual(res.execOptions.args, ['first', 'second']);\n      done();\n    });\n  });\n\n  it('should give package.main preference for script over index.js', function (done) {\n    var dir = path.resolve(pwd, 'test/fixtures/packages/main-and-index');\n    process.chdir(dir);\n\n    var config = {},\n      settings = {},\n      options = {};\n\n    load(settings, options, config, function (config) {\n      assert.deepEqual(config.execOptions.script, 'server.js');\n      done();\n    });\n  });\n});\n"
  },
  {
    "path": "test/docker.sh",
    "content": "docker build -t nodemon-test-env .\ndocker run --mount type=bind,source=/Users/remy/Sites/nodemon,target=/src/nodemon --name nodemon-test-env --rm -it nodemon-test-env bash\n\n# node /nodemon-src/bin/nodemon.js -V http.js\n"
  },
  {
    "path": "test/events/complete.test.js",
    "content": "'use strict';\n/* global describe, it, beforeEach, before, after */\nvar nodemon = require('../../lib/');\nvar debug = require('debug')('nodemon');\nvar assert = require('assert');\nvar path = require('path');\nvar touch = require('touch');\nvar utils = require('../utils');\nvar dir = path.resolve(__dirname, '..', 'fixtures', 'events');\nvar appjs = path.resolve(dir, 'env.js');\nvar asCLI = utils.asCLI;\nvar fork = require('child_process').fork;\n\ndescribe('events should follow normal flow on user triggered change', function () {\n  function conf() {\n    utils.port++;\n    return {\n      script: appjs,\n      verbose: true,\n      stdout: false,\n      noReset: true,\n      ext: 'js',\n      env: {\n        PORT: utils.port,\n        NODEMON_ENV: 'nodemon',\n      },\n    };\n  }\n\n  var cwd = process.cwd();\n\n  beforeEach(function (done) {\n    debug('beforeEach');\n    nodemon\n      .once('exit', function () {\n        nodemon.reset(done);\n      })\n      .emit('quit');\n  });\n\n  before(function () {\n    process.chdir(dir);\n  });\n\n  after(function (done) {\n    debug('after');\n    process.chdir(cwd);\n    nodemon\n      .once('exit', function () {\n        nodemon.reset(function () {\n          setTimeout(done, 1000);\n        });\n      })\n      .emit('quit');\n  });\n\n  it('start', function (done) {\n    debug('start');\n    nodemon(conf()).once('start', function () {\n      assert(true, '\"start\" event');\n      done();\n    });\n  });\n\n  it('config:update', function (done) {\n    nodemon(conf()).on('config:update', function () {\n      assert(true, '\"config:update\" event');\n      done();\n    });\n  });\n\n  it('exit', function (done) {\n    var plan = new utils.Plan(4, function () {\n      nodemon.reset(done);\n    });\n    var run = 0;\n\n    nodemon(conf())\n      .on('exit', function () {\n        plan.assert(true, '\"exit\" event');\n        if (run === 1) {\n          setTimeout(function () {\n            plan.assert(true, 'restarting ' + appjs);\n            touch.sync(appjs);\n          }, 1500);\n        } else if (run === 2) {\n          plan.assert(true, 'finished');\n        } else {\n          plan.assert(false, 'quit too many times: ' + run);\n        }\n      })\n      .on('start', function () {\n        run++;\n      });\n  });\n\n  it('stdout', function (done) {\n    nodemon(conf()).once('stdout', function (data) {\n      assert(true, '\"stdout\" event with: ' + data);\n      done();\n    });\n  });\n\n  it('restart', function (done) {\n    var plan = new utils.Plan(4, function () {\n      nodemon.reset(done);\n    });\n\n    nodemon(conf())\n      .on('restart', function (files) {\n        plan.assert(true, '\"restart\" event with ' + files);\n        plan.assert(\n          files[0] === appjs,\n          'restart due to ' + files.join(' ') + ' changing'\n        );\n      })\n      .once('exit', function () {\n        plan.assert(true, '\"exit\" event');\n        setTimeout(function () {\n          plan.assert(true, 'restarting');\n          touch.sync(appjs);\n        }, 1500);\n      });\n  });\n});\n"
  },
  {
    "path": "test/events/scripts.test.js",
    "content": "'use strict';\n/*global describe:true, it: true, afterEach: true, beforeEach: true, after:true */\nvar cli = require('../../lib/cli/'),\n  path = require('path'),\n  testUtils = require('../utils'),\n  utils = require('../../lib/utils'),\n  exec = require('../../lib/config/exec'),\n  nodemon = require('../../lib/nodemon'),\n  command = require('../../lib/config/command'),\n  appjs = path.resolve(__dirname, '..', 'fixtures', 'env.js'),\n  assert = require('assert');\n\nfunction asCLI(cmd) {\n  return ('node nodemon ' + (cmd || '')).trim();\n}\n\nfunction parse(cmd) {\n  var parsed = cli.parse(cmd);\n  parsed.execOptions = exec(parsed);\n  return parsed;\n}\n\nfunction commandToString(command) {\n  return utils.stringify(command.executable, command.args);\n}\n\ndescribe('nodemon API events', function () {\n  var pwd = process.cwd(),\n    oldhome = utils.home;\n\n  afterEach(function () {\n    process.chdir(pwd);\n    utils.home = oldhome;\n  });\n\n  after(function (done) {\n    // clean up just in case.\n    setTimeout(done, 1000);\n  });\n\n  beforeEach(function (done) {\n    // move to the fixtures directory to allow for config loading\n    process.chdir(path.resolve(pwd, 'test/fixtures'));\n    utils.home = path.resolve(\n      pwd,\n      ['test', 'fixtures', 'events'].join(path.sep)\n    );\n\n    nodemon.reset(done);\n  });\n\n  it('should trigger start event script', function (done) {\n    var plan = new testUtils.Plan(4, done);\n    nodemon({\n      script: appjs,\n      verbose: true,\n      stdout: false,\n      env: { NODEMON_ENV: 'nodemon' },\n    })\n      .on('start', function () {\n        plan.assert(true, 'started');\n      })\n      .on('exit', function () {\n        plan.assert(true, 'exit');\n      })\n      .on('stdout', function (data) {\n        data = data.toString().trim();\n        if (data === 'OK') {\n          plan.assert(true, 'OK found');\n        } else if (data === 'STOPPED') {\n          plan.assert(true, 'STOPPED found');\n        } else if (data === 'nodemon') {\n          // expected output\n        } else {\n          plan.assert(false, data + ' found');\n        }\n      });\n  });\n});\n"
  },
  {
    "path": "test/fixtures/.dotfile",
    "content": ""
  },
  {
    "path": "test/fixtures/.dotfolder/.nested_dotfile.js",
    "content": ""
  },
  {
    "path": "test/fixtures/.dotfolder/second.js",
    "content": ""
  },
  {
    "path": "test/fixtures/.dotfolder/some_file.js",
    "content": ""
  },
  {
    "path": "test/fixtures/1246/app/index.js",
    "content": "require('http').createServer((req, res) => res.end('ok')).listen(8000);\n\n"
  },
  {
    "path": "test/fixtures/1246/watching/index.js",
    "content": "require('http').createServer((req, res) => res.end('ok')).listen(8000);\n\n"
  },
  {
    "path": "test/fixtures/app with spaces.js",
    "content": "#!/usr/bin/env node\nconsole.log(process.argv[2] || 'OK');\nrequire('http').createServer(function (req, res) { console.log('Request in'); res.end('ok'); }).listen(process.env.PORT || 8000);"
  },
  {
    "path": "test/fixtures/app.coffee",
    "content": "http = require 'http'\nserver = http.createServer (req, res) -> res.end 'hi\\n'\nserver.listen process.env.PORT || 8000\n# console.log \"Listening on port 8000\"\n"
  },
  {
    "path": "test/fixtures/app.js",
    "content": "// process.title = 'node (fixtures/app)';\n// console.log('starting up @ ' + (process.env.PORT || 8000));\nrequire('http').createServer(function (req, res) { console.log('Request in'); res.end('ok'); }).listen(process.env.PORT || 8000);\n\nprocess.on('SIGINT', function() { process.exit(130) })\n"
  },
  {
    "path": "test/fixtures/comments",
    "content": "# this is a comment\n\n# this is another comment\n\n# *.js"
  },
  {
    "path": "test/fixtures/configs/public-star.json",
    "content": "{\n  \"ignore\": \"public/*\",\n  \"ext\": \"json,js,html\",\n  \"verbose\": true\n}\n"
  },
  {
    "path": "test/fixtures/configs/top-level.json",
    "content": "{\n  \"verbose\": \"true\",\n  \"watch\": [\n    \"*.js\",\n    \"app/\",\n    \"helpers/\",\n    \"routes/\",\n    \"view/\",\n    \"views/\"\n  ],\n  \"ext\": \"js json html\",\n  \"exec\": \"node --harmony-generators\"\n}"
  },
  {
    "path": "test/fixtures/configs/watch-options.json",
    "content": "{\n  \"ext\": \"json,js,html\",\n  \"watchOptions\": {\n    \"awaitWriteFinish\": true\n  }\n}\n"
  },
  {
    "path": "test/fixtures/configs/watch-relative-filter.json",
    "content": "{\n  \"ext\": \"json,js,html\",\n  \"watch\": [\"../jsbin/views\", \"../jsbin/lib\", \"../jsbin/*.json\", \"config.dev.json\"]\n}"
  },
  {
    "path": "test/fixtures/configs/watch-relative.json",
    "content": "{\n  \"watch\": [\n    \"../../../lib\"\n  ],\n  \"ext\": \"py\"\n}"
  },
  {
    "path": "test/fixtures/default",
    "content": "# this is my ignore file with a nice comment at the top\n\n/vendor/*     # ignore all external submodules\n/public/*     # static files\n./README.md   # a specific file\n*.css         # ignore any CSS files too\n:(\\d)*\\.js    # monitor javascript files with only digits in their name"
  },
  {
    "path": "test/fixtures/default.json",
    "content": "{\n  \"watch\": [\n    \"./\",\n    \"lib\",\n    \"src\",\n    \"plugins\"\n  ],\n  \"ext\": \"js css html\",\n  \"exec\": \"node\",\n  \"delay\": 2,\n  \"ignore\": [\n    \"/vendor/*\",\n    \"/public/*\",\n    \"./README.md\",\n    \"*.css\",\n    \"/vendor/*\",\n    \":(\\\\d)*\\\\.js\"\n  ]\n}"
  },
  {
    "path": "test/fixtures/env.js",
    "content": "console.log(process.env.NODEMON_ENV);\n"
  },
  {
    "path": "test/fixtures/events/env.js",
    "content": "console.log(process.env.USER);"
  },
  {
    "path": "test/fixtures/events/nodemon.json",
    "content": "{\n  \"verbose\": \"true\",\n  \"ext\": \"js\",\n  \"events\": {\n    \"start\": \"echo 'OK'\",\n    \"crash\": \"echo 'CRASHED'\",\n    \"exit\": \"echo 'STOPPED'\",\n    \"quit\": \"echo 'QUIT'\"\n  }\n}\n"
  },
  {
    "path": "test/fixtures/global/nodemon.json",
    "content": "{\n  \"verbose\": true,\n  \"ignore\": [\"one\", \"two\"],\n  \"execMap\": {\n    \"pug\": \"bin/pug {{filename}} --out /tmp\"\n  }\n}\n"
  },
  {
    "path": "test/fixtures/hello.ls",
    "content": "http = require 'http'\nserver = http.createServer (req, res) -> res.end 'hi\\n'\nserver.listen process.env.PORT\nconsole.log \"Listening...\"\n"
  },
  {
    "path": "test/fixtures/hello.py",
    "content": "print(\"Hello, World!\")"
  },
  {
    "path": "test/fixtures/help.txt",
    "content": "This file should not be read."
  },
  {
    "path": "test/fixtures/legacy/.nodemonignore",
    "content": "# this is my ignore file with a nice comment at the top\n\n/vendor/*     # ignore all external submodules\n/public/*     # static files\n./README.md   # a specific file\n*.css         # ignore any CSS files too\n:(\\d)*\\.js    # ignore javascript files with only digits in their name\napp.json      # any app.json file"
  },
  {
    "path": "test/fixtures/log.coffee",
    "content": "console.log \"CoffeeScript!\""
  },
  {
    "path": "test/fixtures/nodemon.json",
    "content": "{\n  \"ignore\": [\"one\", \"three\"],\n  \"watch\": [\"four\"],\n  \"env\": {\n    \"USER\": \"remysharp\"\n  },\n  \"execMap\": {\n    \"js\": \"node --harmony\"\n  }\n}\n"
  },
  {
    "path": "test/fixtures/package.json",
    "content": "{\n  \"main\": \"app.js\"\n}"
  },
  {
    "path": "test/fixtures/packages/browserify/package.json",
    "content": "{\n  \"scripts\": {\n    \"start\": \"browserify -t hbsfy app.js -o bundle.js\"\n  }\n}\n"
  },
  {
    "path": "test/fixtures/packages/express4/package.json",
    "content": "{\n  \"name\": \"express4-gen\",\n  \"version\": \"0.0.1\",\n  \"private\": true,\n  \"scripts\": {\n    \"start\": \"NODE_ENV=development node ./bin/www\"\n  },\n  \"dependencies\": {\n    \"express\": \"~4.2.0\",\n    \"static-favicon\": \"~1.0.0\",\n    \"morgan\": \"~1.0.0\",\n    \"cookie-parser\": \"~1.0.1\",\n    \"body-parser\": \"~1.0.0\",\n    \"debug\": \"~0.7.4\",\n    \"pug\": \"~2.0.4\",\n    \"pug-cli\": \"~1.0.0\"\n  }\n}\n"
  },
  {
    "path": "test/fixtures/packages/main-and-index/index.js",
    "content": ""
  },
  {
    "path": "test/fixtures/packages/main-and-index/package.json",
    "content": "{\n  \"main\": \"server.js\"\n}\n"
  },
  {
    "path": "test/fixtures/packages/main-and-index/server.js",
    "content": ""
  },
  {
    "path": "test/fixtures/packages/main-and-start/index.js",
    "content": ""
  },
  {
    "path": "test/fixtures/packages/main-and-start/package.json",
    "content": "{\n  \"main\": \"./index.js\",\n  \"scripts\": {\n    \"start\": \"node index.js\"\n  }\n}\n"
  },
  {
    "path": "test/fixtures/packages/nodemon-settings-and-package-json-settings/nodemon.json",
    "content": "{\n  \"exec\": \"foo\"\n}\n"
  },
  {
    "path": "test/fixtures/packages/nodemon-settings-and-package-json-settings/package.json",
    "content": "{\n  \"nodemonConfig\": {\n    \"exec\": \"foo-ignored\"\n  }\n}\n"
  },
  {
    "path": "test/fixtures/packages/package-json-settings/package.json",
    "content": "{\n  \"nodemonConfig\": {\n    \"exec\": \"foo\",\n    \"ignore\": [\"one\", \"three\"],\n    \"watch\": [\"four\"]\n  }\n}\n"
  },
  {
    "path": "test/fixtures/packages/start/package.json",
    "content": "{\n  \"scripts\": {\n    \"start\": \"node app.js\"\n  }\n}"
  },
  {
    "path": "test/fixtures/packages/start-and-package-json-settings/package.json",
    "content": "{\n  \"scripts\": {\n    \"start\": \"node app.js\"\n  },\n  \"nodemonConfig\": {\n    \"exec\": \"foo\"\n  }\n}\n"
  },
  {
    "path": "test/fixtures/packages/start-and-settings/nodemon.json",
    "content": "{\n  \"exec\": \"foo\"\n}\n"
  },
  {
    "path": "test/fixtures/packages/start-and-settings/package.json",
    "content": "{\n  \"scripts\": {\n    \"start\": \"node app.js\"\n  }\n}\n"
  },
  {
    "path": "test/fixtures/packages/start-ignored/package.json",
    "content": "{ \"scripts\": { \"start\": \"foo\" } }\n"
  },
  {
    "path": "test/fixtures/regexp",
    "content": ":(\\d)*\\.js    # monitor javascript files with only digits in their name"
  },
  {
    "path": "test/fixtures/repl.js",
    "content": "var repl = require('repl');\n\n// Start Express or something, when it's up, startup the REPL\nvar rpl = repl.start('REPL> ');\n\nrpl.commands['.hello'] = {\n  help: 'Hello world command.',\n  action: function() {\n    console.log('Hello world.');\n  }\n};"
  },
  {
    "path": "test/fixtures/sigint.js",
    "content": "process.on('SIGINT', function() {\n  if (process.argv.length === 3 && process.argv[2] === '--dont-exit') return;\n  process.exit();\n});\n// timer, to keep process running\nsetInterval(function() {\n  // console.log('working');\n}, 1000);\n"
  },
  {
    "path": "test/fixtures/simple",
    "content": "# this is my ignore file with a nice comment at the top\n\n/vendor/*     # ignore all external submodules\n/public/*     # comment\n./README.md   # a specific file\n*.css         # ignore any CSS files too"
  },
  {
    "path": "test/fixtures/simple.json",
    "content": "{\n  \"watch\": [\n    \"*.js\"\n  ],\n  \"ignore\": [\n    \"/public/*\"\n  ]\n}"
  },
  {
    "path": "test/fixtures/super-legacy/nodemon-ignore",
    "content": "# this is my ignore file with a nice comment at the top\n\n/vendor/*     # ignore all external submodules\n/public/*     # static files\n./README.md   # a specific file\n*.css         # ignore any CSS files too\n:(\\d)*\\.js    # monitor javascript files with only digits in their name"
  },
  {
    "path": "test/fixtures/watch-count/index.js",
    "content": "true;"
  },
  {
    "path": "test/fixtures/watch-count/lib/1.js",
    "content": ""
  },
  {
    "path": "test/fixtures/watch-count/lib/2.js",
    "content": ""
  },
  {
    "path": "test/fixtures/watch-count/lib/3.js",
    "content": ""
  },
  {
    "path": "test/fixtures/watch-count/lib/4.js",
    "content": ""
  },
  {
    "path": "test/fixtures/watch-count/lib/5.js",
    "content": ""
  },
  {
    "path": "test/fork/change-detect.test.js",
    "content": "'use strict';\n/*global describe:true, it: true */\nvar utils = require('../utils'),\n  colour = require('../../lib/utils/colour'),\n  assert = require('assert'),\n  touch = require('touch'),\n  appjs = utils.appjs,\n  appcoffee = utils.appcoffee,\n  match = utils.match,\n  cleanup = utils.cleanup,\n  run = utils.run;\n\ndescribe('nodemon fork simply running', function () {\n  it('should start', function (done) {\n    var p = run(appjs, {\n      output: function (data) {\n        if (match(data, appjs)) {\n          assert(true, 'nodemon started');\n          cleanup(p, done);\n        }\n      },\n      error: function (data) {\n        assert(false, 'nodemon failed with ' + data);\n        cleanup(p, done);\n      }\n    });\n  });\n\n});\n\ndescribe('nodemon fork monitor', function () {\n  it('should restart on .js file changes with no arguments', function (done) {\n    var startWatch = false;\n    var p = run(appjs, {\n      output: function (data) {\n        if (match(data, 'files triggering change check: test/fixtures/app.js')) {\n          startWatch = true;\n        }\n        if (startWatch && match(data, 'changes after filters')) {\n          var changes = colour.strip(data.trim());\n          var restartedOn = null;\n          changes.replace(/changes after filters \\(before\\/after\\): \\d+\\/(\\d+)/, (_, m) => {\n            restartedOn = m;\n          });\n\n          // .split('changes after filters').pop().split('/');\n          // var restartedOn = changes.pop().trim();\n          assert.equal(restartedOn, '1', 'nodemon restarted on 1 file: ' + restartedOn + ' / ' + data.toString());\n        }\n      },\n      error: function (data) {\n        utils.cleanup(p, done, new Error(data));\n      }\n    });\n\n    p.on('message', function (event) {\n      if (event.type === 'restart') {\n        utils.cleanup(p, done);\n      } else if (event.type === 'start') {\n        setTimeout(function () {\n          touch.sync(appjs);\n        }, 1000);\n      }\n    });\n  });\n\n  it('should NOT restart on non-.js file changes with no arguments', function (done) {\n    setTimeout(function () {\n      var p = run(appjs, {\n        output: function (data) {\n          if (match(data, 'changes after filters')) {\n            data = colour.strip(data.toString().trim());\n            var changes = data.split('/');\n            var restartedOn = changes.pop();\n\n            assert.equal(restartedOn, '0', 'expects to not have restarted');\n            utils.cleanup(p, done);\n          }\n        },\n        error: function (data) {\n          utils.cleanup(p, done, new Error(data));\n        }\n      });\n\n      p.on('message', function (event) {\n        if (event.type === 'start') {\n          setTimeout(function () {\n            // touch a different file, but in the same directory\n            touch.sync(appcoffee);\n          }, 2500);\n        } else if (event.type === 'restart') {\n          utils.cleanup(p, done, new Error('nodemon restarted'));\n        }\n      });\n    }, 1000);\n  });\n});\n"
  },
  {
    "path": "test/fork/config.test.js",
    "content": "'use strict';\n/*global describe:true, it: true, afterEach:true, beforeEach:true */\nvar assert = require('assert'),\n    utils = require('../utils'),\n    path = require('path'),\n    match = utils.match,\n    cleanup = utils.cleanup,\n    run = utils.run;\n\ndescribe('nodemon full config test', function () {\n  var pwd = process.cwd();\n\n  beforeEach(function () {\n    // move to the fixtures directory to allow for config loading\n    process.chdir(path.resolve(pwd, 'test/fixtures'));\n  });\n\n  afterEach(function () {\n    process.chdir(pwd);\n  });\n\n  it('should allow execMap.js to be overridden', function (done) {\n    var p = run({ exec: '../../bin/nodemon.js',\n                  args: ['-V']\n      }, {\n      error: function (data) {\n        p.send('quit');\n        cleanup(p, done, new Error(data));\n      },\n    });\n\n    p.on('message', function (event) {\n      if (event.type === 'log') {\n        if (match(event.data.message, 'starting `')) {\n          event.data.message.replace(/`(.*)`/, function (all, m) {\n            assert(m === 'node --harmony app.js', 'Arguments in the correct order: ' + m);\n            // p.send('quit');\n            cleanup(p, done);\n          });\n        }\n      }\n    });\n  });\n});"
  },
  {
    "path": "test/fork/run-mac-only.test.js",
    "content": "const fs = require('fs');\nconst assert = require('assert');\nconst utils = require('../utils');\nconst appJS = utils.appjs;\nconst run = utils.run;\n\nconst filenames = [\n  [__dirname + 'some\\\\\\\"file', '#!/usr/bin/env node\\nconsole.log(\"OK\");'],\n  [__dirname + 'some\\ \\\\file', '#!/bin/sh\\necho \"OK\"'],\n];\n\nif (false && !process.env.TRAVIS && process.platform === 'darwin') {\n  describe('nodemon fork (mac only)', () => {\n    before(() => {\n      filenames.map(file => fs.writeFileSync(file[0], file[1], 'utf8'));\n    });\n\n    after(() => {\n      filenames.map(file => fs.unlinkSync(file[0]));\n    });\n\n    it('should start a fork exec with quotes and escaping', done => {\n      var found = false;\n      var p = run({\n        exec: 'bin/nodemon.js',\n        // make nodemon verbose so we can check the filters being applied\n        args: ['-q', '--exec', filenames[0][0]]\n      }, {\n          error: function (data) {\n            p.send('quit');\n            done(new Error(data));\n          },\n          output: function (data) {\n            // process.stdout.write(data);\n            if (data.trim() === 'OK') {\n              found = true;\n            }\n          }\n        });\n\n      p.on('message', function (event) {\n        if (event.type === 'start') {\n          setTimeout(function () {\n            p.send('quit');\n            done();\n            assert(found, '\"OK\" message was found');\n          }, 500);\n        }\n      });\n    });\n\n    it('should start a fork exec with spaces and slashes', done => {\n      var found = false;\n      var p = run({\n        exec: 'bin/nodemon.js',\n        // make nodemon verbose so we can check the filters being applied\n        args: ['-q', '--exec', `\"${filenames[1][0]}`]\n      }, {\n          error: function (data) {\n            p.send('quit');\n            done(new Error(data));\n          },\n          output: function (data) {\n            // process.stdout.write(data);\n            if (data.trim() === 'OK') {\n              found = true;\n            }\n          }\n        });\n\n      p.on('message', function (event) {\n        if (event.type === 'start') {\n          setTimeout(function () {\n            p.send('quit');\n            done();\n            assert(found, '\"OK\" message was found');\n          }, 500);\n        }\n      });\n    });\n  });\n}\n"
  },
  {
    "path": "test/fork/run.test.js",
    "content": "/*global describe:true, it: true */\nvar assert = require('assert'),\n  utils = require('../utils'),\n  appjs = utils.appjs,\n  run = utils.run;\n\ndescribe('nodemon fork', function () {\n  it('should not show user-signal', done => {\n    var p = run({ exec: 'bin/nodemon.js',\n    args: [ '-V', '-x', 'echo running && sleep 20' ] }, {\n      error: function (data) {\n        p.send('quit');\n        if (data.trim().indexOf('signal') !== -1) {\n          return done(new Error('Signal incorrectly shown'));\n        }\n\n        done(new Error(data));\n      },\n      output: function (data) {\n        if (data.trim().indexOf('signal') !== -1) {\n          done(new Error('Signal incorrectly shown'));\n        }\n      }\n    });\n\n    let started = false;\n    p.on('message', function (event) {\n      if (event.type === 'start') {\n        if (!started) {\n          p.send('restart');\n          started = true;\n        } else {\n          p.send('quit');\n          assert(true, 'nodemon started');\n          done();\n        }\n\n      }\n    });\n  });\n\n  it('should start a fork', function (done) {\n    var p = run(appjs, {\n      error: function (data) {\n        p.send('quit');\n        done(new Error(data));\n      }\n    });\n\n    p.on('message', function (event) {\n      if (event.type === 'start') {\n        p.send('quit');\n        assert(true, 'nodemon started');\n        done();\n      }\n    });\n  });\n\n  if (!process.env.TRAVIS) {\n    it('should start a fork exec with a space without args', function (done) {\n      var found = false;\n      var p = run({\n        exec: 'bin/nodemon.js',\n        // make nodemon verbose so we can check the filters being applied\n        args: ['-q', '--exec', 'test/fixtures/app\\\\ with\\\\ spaces.js']\n      }, {\n          error: function (data) {\n            p.send('quit');\n            done(new Error(data));\n          },\n          output: function (data) {\n            // process.stdout.write(data);\n            if (data.trim() === 'OK') {\n              found = true;\n            }\n          }\n        });\n\n      p.on('message', function (event) {\n        if (event.type === 'start') {\n          setTimeout(function () {\n            p.send('quit');\n            done();\n            assert(found, '\"OK\" message was found');\n          }, 500);\n        }\n      });\n    });\n\n    it('should start a fork exec with a space with args', function (done) {\n      var found = false;\n      var p = run({\n        exec: 'bin/nodemon.js',\n        // make nodemon verbose so we can check the filters being applied\n        args: ['-q', '--exec', '\"test/fixtures/app with spaces.js\" foo'],\n      }, {\n          error: function (data) {\n            p.send('quit');\n            done(new Error(data));\n          },\n          output: function (data) {\n            if (data.trim() === 'foo') {\n              found = true;\n            }\n          }\n        });\n\n      p.on('message', function (event) {\n        if (event.type === 'start') {\n          setTimeout(function () {\n            p.send('quit');\n            assert(found, '\"foo\" message found');\n            done();\n          }, 500);\n        }\n      });\n    });\n\n  }\n\n  it('should start a fork exec with a space with args (escaped)', function (done) {\n    var found = false;\n    var p = run({\n      exec: 'bin/nodemon.js',\n      // make nodemon verbose so we can check the filters being applied\n      args: ['-q', '--exec', 'test/fixtures/app\\\\ with\\\\ spaces.js foo']\n    }, {\n        error: function (data) {\n          p.send('quit');\n          done(new Error(data));\n        },\n        output: function (data) {\n          // process.stdout.write(data);\n          if (data.trim() === 'foo') {\n            found = true;\n          }\n        }\n      });\n\n    p.on('message', function (event) {\n      if (event.type === 'start') {\n        setTimeout(function () {\n          p.send('quit');\n          done();\n          assert(found, '\"OK\" message found');\n        }, 500);\n      }\n    });\n  });\n});\n"
  },
  {
    "path": "test/fork/watch-restart.test.js",
    "content": "'use strict';\n/*global describe:true, it: true, after: true */\nvar assert = require('assert'),\n    fs = require('fs'),\n    utils = require('../utils'),\n    colour = require('../../lib/utils/colour'),\n    appjs = utils.appjs,\n    // appcoffee = utils.appcoffee,\n    run = utils.run,\n    cleanup = utils.cleanup,\n    path = require('path'),\n    touch = require('touch'),\n    crypto = require('crypto'),\n    baseFilename = 'test/fixtures/test' + crypto.randomBytes(16).toString('hex');\n\ndescribe('nodemon fork child restart', function () {\n  var tmpjs = path.resolve(baseFilename + '.js'),\n      tmpmd = path.resolve(baseFilename + '.md'),\n      tmpcoffee = path.resolve(baseFilename + '.coffee');\n\n  afterEach(function () {\n    if (fs.existsSync(tmpjs)) {\n      fs.unlinkSync(tmpjs);\n    }\n    if (fs.existsSync(tmpjs)) {\n      fs.unlinkSync(tmpmd);\n    }\n    if (fs.existsSync(tmpjs)) {\n      fs.unlinkSync(tmpcoffee);\n    }\n  });\n\n  /* removed test due to CoffeeScript using depreciate customFds - failing tests */\n  // it('should cleanly kill entire process tree', function (done) {\n  //   fs.writeFileSync(tmpcoffee, 'true');\n\n  //   var listening = 0;\n\n  //   var p = run('--debug ' + appcoffee, {\n  //     error: function (data) {\n  //       if (data.indexOf('ebugger listening') === -1) {\n  //         p.send('quit');\n  //         cleanup(p, done, new Error(data));\n  //       }\n  //     },\n  //     output: function (data) {\n  //       if (utils.match(data, 'Listening on port')) {\n  //         listening++;\n  //         if (listening === 2) {\n  //           assert(true, 'nodemon started child successfully twice');\n  //           cleanup(p, done);\n  //         }\n  //       }\n\n  //     }\n  //   });\n\n  //   var startedOnce = false;\n  //   p.on('message', function (event) {\n  //     if (startedOnce === false && event.type === 'start') {\n  //       startedOnce = true;\n  //       setTimeout(function () {\n  //         touch.sync(tmpcoffee);\n  //       }, 2000);\n  //     } else if (event.type === 'restart') {\n  //       assert(true, 'nodemon restarted');\n  //     }\n  //   });\n\n  // });\n\n  it('should happen when monitoring a single extension', function (done) {\n    fs.writeFileSync(tmpjs, 'true;');\n\n    var p = run('--ext js ' + appjs, {\n      error: function (data) {\n        p.send('quit');\n        cleanup(p, done, new Error(data));\n      }\n    });\n\n    p.on('message', function (event) {\n      if (event.type === 'start') {\n        setTimeout(function () {\n          touch.sync(tmpjs);\n        }, 1000);\n      } else if (event.type === 'restart') {\n        assert(true, 'nodemon restarted');\n        cleanup(p, done);\n      }\n    });\n  });\n\n  it('should happen only once if delay option is set', function (done) {\n    var restartCount = 0;\n    fs.writeFile(tmpjs, 'true;', function () {\n      var p = run('--verbose --ext js --delay 2 ' + tmpjs, {\n        error: function (data) {\n          p.send('quit');\n          cleanup(p, done, new Error(data));\n        }\n      });\n\n      setTimeout(function () {\n        if (restartCount === 1) {\n          assert(true, 'nodemon restarted ' + restartCount + ' times');\n          cleanup(p, done);\n        } else {\n          cleanup(p, done, new Error('nodemon started ' + restartCount + ' times'));\n        }\n      }, 8000);\n\n      p.on('message', function (event) {\n        if (event.type === 'log') {\n          // console.log(event.data.colour);\n        } else {\n          // console.log(event.type, Date.now()/1000|0);\n        }\n\n        // on first start - kick off timeouts to touch the files\n        if (event.type === 'start' && restartCount === 0) {\n          setTimeout(function () {\n            // console.log('touch 1', Date.now()/1000|0);\n            touch.sync(tmpjs);\n          }, 1000);\n          setTimeout(function () {\n            // console.log('touch 2', Date.now()/1000|0);\n            touch.sync(tmpjs);\n          }, 2000);\n          setTimeout(function () {\n            // console.log('touch 3', Date.now()/1000|0);\n            touch.sync(tmpjs);\n          }, 3000);\n          setTimeout(function () {\n            // console.log('touch 4', Date.now()/1000|0);\n            touch.sync(tmpjs);\n          }, 4000);\n        }\n\n        if (event.type === 'restart') {\n          restartCount++;\n        }\n      });\n\n    });\n\n  });\n\n  it('should happen when monitoring multiple extensions', function (done) {\n    fs.writeFileSync(tmpjs, 'true;');\n    fs.writeFileSync(tmpmd, '# true');\n    var monitor = utils.monitorForChange('changes after filters');\n    setTimeout(function () {\n      var p = run('--ext js,md ' + appjs, {\n        error: function (data) {\n          p.send('quit');\n          cleanup(p, done, new Error(data));\n        },\n        output: function (data) {\n          var msg = colour.strip(data.trim());\n          if (utils.match(msg, 'changes after filters (before/after)')) {\n            var changes = msg.split(/\\n/).shift();\n            changes = changes.replace(/\\s*/gm, '').slice(-5).split('/');\n            var restartedOn = changes.pop();\n            assert.equal(restartedOn, '1', 'nodemon restarted on a single file change: ' + restartedOn + ' -- ' + msg);\n            cleanup(p, done);\n          }\n        }\n      });\n\n      p.on('message', function (event) {\n        if (event.type === 'start') {\n          setTimeout(function () {\n            touch.sync(tmpmd);\n          }, 1000);\n        }\n      });\n    }, 2000);\n  });\n});\n"
  },
  {
    "path": "test/help/help.test.js",
    "content": "/*global describe:true, it: true */\nvar help = require('../../lib/help'),\n    assert = require('assert');\n\ndescribe('help', function () {\n  it('should load index by default', function () {\n    var page = help();\n    assert(page.indexOf('Usage: nodemon') !== -1, 'shows default help page');\n  });\n\n  it('should load specific help topic', function () {\n    var page = help('authors');\n    assert(page.indexOf('Remy Sharp') !== -1, 'shows specific topic');\n  });\n\n  it('should not expose files', function () {\n    var page = help('../../test/fixtures/help');\n    assert(page.indexOf('\" help can\\'t be found') !== -1, 'shows help cannot be found');\n  });\n});"
  },
  {
    "path": "test/lib/events.test.js",
    "content": "/*global describe:true, it: true */\nvar nodemon = require('../../lib/'),\n    assert = require('assert');\n\ndescribe('nodemon events', function () {\n  it('should have (shims) events', function () {\n    assert(nodemon.on);\n  });\n\n  it('should allow events to fire', function (done) {\n    nodemon.on('foo', function () {\n      assert(true);\n      done();\n    });\n\n    nodemon.emit('foo');\n  });\n});\n\n\n"
  },
  {
    "path": "test/lib/require-restartable.test.js",
    "content": "'use strict';\n/*global describe:true, it: true, afterEach: true */\nvar nodemon = require('../../lib/'),\n    assert = require('assert'),\n    path = require('path'),\n    touch = require('touch'),\n    utils = require('../utils'),\n    appjs = path.resolve(__dirname, '..', 'fixtures', 'app.js'),\n    envjs = path.resolve(__dirname, '..', 'fixtures', 'env.js');\n\ndescribe('require-able', function () {\n  var pwd = process.cwd(),\n      oldhome = utils.home;\n\n  afterEach(function () {\n    process.chdir(pwd);\n    utils.home = oldhome;\n  });\n\n  beforeEach(function (done) {\n    // move to the fixtures directory to allow for config loading\n    process.chdir(path.resolve(pwd, 'test'));\n    utils.home = path.resolve(pwd, ['test'].join(path.sep));\n\n    nodemon.reset(done);\n  });\n\n\n  it('should restart on file change', function (done) {\n    var restarted = false;\n\n    utils.port++;\n    nodemon({ script: appjs, verbose: true, env: { PORT: utils.port } }).on('start', function () {\n      setTimeout(function () {\n        touch.sync(appjs);\n      }, 1000);\n    }).on('start', function() {\n      if (restarted) {\n        setTimeout(function() { nodemon.emit('quit') });\n      }\n    }).on('restart', function () {\n      restarted = true;\n    }).on('quit', function () {\n      assert(restarted, 'nodemon restarted and quit properly');\n      nodemon.reset(done);\n    }).on('log', function (event) {\n      // console.log(event.message);\n    });\n  });\n\n});\n"
  },
  {
    "path": "test/lib/require.test.js",
    "content": "'use strict';\n/*global describe:true, it: true, afterEach: true */\nvar nodemon = require('../../lib/'),\n  assert = require('assert'),\n  path = require('path'),\n  touch = require('touch'),\n  utils = require('../utils'),\n  appjs = path.resolve(__dirname, '..', 'fixtures', 'app.js'),\n  envjs = path.resolve(__dirname, '..', 'fixtures', 'env.js');\n\ndescribe('require-able', function () {\n  var pwd = process.cwd(),\n    oldhome = utils.home;\n\n  afterEach(function () {\n    process.chdir(pwd);\n    utils.home = oldhome;\n  });\n\n  beforeEach(function (done) {\n    // move to the fixtures directory to allow for config loading\n    process.chdir(path.resolve(pwd, 'test'));\n    utils.home = path.resolve(pwd, ['test'].join(path.sep));\n\n    nodemon.reset(done);\n  });\n\n  it('should prioritise options over package.start', function (done) {\n    process.chdir(path.resolve('fixtures/packages/start-ignored'));\n\n    nodemon({\n      script: envjs,\n      env: { NODEMON_ENV: 'nodemon' },\n      stdout: false,\n    })\n      .on('stdout', function (data) {\n        var out = data.toString().trim();\n        assert(out === 'nodemon', 'expected output: ' + out);\n        done();\n      })\n      .on('error', function (e) {\n        assert(false, 'script did not run: ' + e);\n        done();\n      });\n  });\n\n  it('should know nodemon has been required', function () {\n    assert(nodemon.config.required, 'nodemon has required property');\n  });\n\n  it('should restart on file change with custom signal', function (done) {\n    var restarted = false;\n\n    utils.port++;\n    nodemon({\n      script: appjs,\n      verbose: true,\n      env: { PORT: utils.port },\n      signal: 'SIGINT',\n    })\n      .on('start', function () {\n        setTimeout(function () {\n          touch.sync(appjs);\n        }, 1000);\n      })\n      .on('start', function () {\n        if (restarted) {\n          setTimeout(function () {\n            nodemon.emit('quit');\n          });\n        }\n      })\n      .on('restart', function () {\n        restarted = true;\n      })\n      .on('quit', function () {\n        assert(restarted, 'nodemon restarted and quit properly');\n        nodemon.reset(done);\n      })\n      .on('log', function (event) {\n        // console.log(event.message);\n      });\n  });\n\n  it('should be restartable', function (done) {\n    var restarted = false;\n\n    nodemon(appjs)\n      .on('start', function () {\n        setTimeout(function () {\n          nodemon.restart();\n        }, 1000);\n      })\n      .on('restart', function () {\n        restarted = true;\n        nodemon.emit('quit');\n      })\n      .on('quit', function () {\n        assert(restarted);\n        nodemon.reset(done);\n        // unbind events for testing again\n      });\n  });\n});\n"
  },
  {
    "path": "test/misc/listeners.test.js",
    "content": "/*global describe, it, beforeEach */\n\nvar nodemon = require('../../lib/');\nvar assert = require('assert');\nvar path = require('path');\nvar dir = path.resolve(__dirname, '..', 'fixtures', 'events');\nvar appjs = path.resolve(dir, 'env.js');\nvar async = require('async');\n\ndescribe('listeners clean up', function () {\n  function conf() {\n    return {\n      script: appjs,\n      verbose: true,\n      stdout: false,\n      noReset: true,\n      ext: 'js',\n      env: {\n        PORT: 0,\n        NODEMON_ENV: 'nodemon',\n      },\n    };\n  }\n\n  beforeEach(function (done) {\n    nodemon.reset(done);\n  });\n\n  it(\n    'should be able to re-run in required mode, many times, and not leak' +\n      'listeners',\n    function (done) {\n      function run(n) {\n        return function (done) {\n          nodemon(conf());\n          nodemon.on('start', function () {\n            nodemon.on('exit', function () {\n              nodemon.reset(done);\n            });\n          });\n        };\n      }\n\n      var toRun = '01234567890123456789'.split('').map(run);\n      toRun.push(function () {\n        done();\n      });\n\n      async.series(toRun);\n    }\n  );\n});\n"
  },
  {
    "path": "test/misc/sigint.test.js",
    "content": "'use strict';\n/*global describe:true, it: true */\nvar utils = require('../utils'),\n    assert = require('assert'),\n    path = require('path'),\n    appjs = path.relative(process.cwd(), path.resolve(__dirname, '..', 'fixtures', 'sigint.js')),\n    match = utils.match,\n    cleanup = utils.cleanup,\n    run = utils.run,\n    isRunning = utils.isRunning;\n\nfunction runAndKill(done, cmdline, exitcb)\n{\n  var childPID = null;\n\n  var p = run(cmdline, {\n    output: function (data) {\n      if (match(data, 'pid: ')) {\n        data.replace(/pid: (\\d+)/, function (_, p1) {\n          childPID = p1;\n        });\n      }\n    },\n    error: function (data) {\n      assert(false, 'nodemon failed with ' + data);\n      cleanup(p, done);\n    }\n  });\n\n  p.on('message', function (event) {\n    if (event.type === 'start') {\n      setTimeout(function () {\n       p.kill('SIGINT');\n      }, 1000);\n    }\n  }).on('exit', function () {\n    exitcb(childPID);\n  });\n}\n\ndescribe('terminal signals', function () {\n  it('should kill child with SIGINT', function (done) {\n    runAndKill(done, appjs, function (childPID) {\n      assert(!isRunning(childPID), 'child is still running at ' + childPID);\n      done();\n    });\n  });\n\n  it('should terminate nodemon (after ~10 seconds)', function (done) {\n    runAndKill(done, appjs + ' --dont-exit', function (childPID) {\n      // make sure we don't keep abandoned child\n      process.kill(childPID, 'SIGTERM');\n      done();\n    });\n  });\n});\n"
  },
  {
    "path": "test/mocha.opts",
    "content": "--reporter spec\n--ui bdd\n"
  },
  {
    "path": "test/monitor/count.test.js",
    "content": "'use strict';\n/*global describe:true, it: true, after: true */\nvar nodemon = require('../../lib/');\nvar utils = require('../utils');\nvar path = require('path');\nvar appjs = path.resolve(__dirname, '..', 'fixtures', 'watch-count', 'index.js');\nvar assert = require('assert');\nvar watchRe = /watching ([\\d,]+) files/;\n\ndescribe('watch count', function () {\n  var pwd = process.cwd();\n\n  afterEach(function () {\n    // reset the cwd\n    process.chdir(pwd);\n  });\n\n  after(function (done) {\n    // clean up just in case.\n    nodemon.once('exit', function () {\n      nodemon.reset(done);\n    }).emit('quit');\n  });\n\n  it('should respect ignore rules', function (done) {\n    process.chdir('test/fixtures/watch-count');\n    nodemon({ script: appjs, verbose: true }).on('start', function () {\n      setTimeout(function () {\n        nodemon.once('exit', done).emit('quit');\n      }, 200);\n    }).on('log', function (data) {\n      var match = null;\n      var count = 0;\n      if (match = data.message.match(watchRe)) {\n        count = match[1].replace(',', '') * 1;\n        assert(count === 6, 'Watching ' + count + ' files, expecting 6.');\n      }\n    });\n  });\n\n  it('should not watch directory when given a single file', function (done) {\n    process.chdir('test/fixtures/watch-count/');\n    var watching = 0;\n    nodemon({ script: appjs, verbose: true, watch: appjs }).on('start', function () {\n      setTimeout(function () {\n        assert(watching === 1, `got ${watching} files`);\n        nodemon.once('exit', done).emit('quit');\n      }, 200);\n    }).on('watching', file => {\n      watching++;\n    }).on('log', function (data) {\n      var match = null;\n      var count = 0;\n      if (match = data.message.match(watchRe)) {\n        count = match[1].replace(',', '') * 1;\n        assert(count === 1, `log showing ${count} files`);\n      }\n    });\n  });\n\n\n  it('should ignore node_modules from any dir', function (done) {\n    process.chdir('test/fixtures/watch-count/lib');\n    nodemon({ script: appjs, verbose: true, watch: '..' }).on('start', function () {\n      setTimeout(function () {\n        nodemon.once('exit', done).emit('quit');\n      }, 200);\n    }).on('log', function (data) {\n      var match = null;\n      var count = 0;\n      if (match = data.message.match(watchRe)) {\n        count = match[1].replace(',', '') * 1;\n        assert(count === 6, 'Watching ' + count + ' files, expecting 6.');\n      }\n    });\n  });\n});\n"
  },
  {
    "path": "test/monitor/ignore.test.js",
    "content": "'use strict';\n/*global describe:true, it: true, after: true */\nvar assert = require('assert'),\n  path = require('path'),\n  fs = require('fs'),\n  utils = require('../utils'),\n  appjs = utils.appjs,\n  cleanup = utils.cleanup,\n  run = utils.run,\n  files = [],\n  randomFile = function () {\n    return '_nodemon' + (Math.random() * Date.now() | 0);\n  };\n\nfunction ignore(rule, done, file) {\n  var p = run((rule ? ('-i ' + rule + ' ') : '') + appjs, {\n    output: function (data) {\n      // console.log(data.trim());\n    },\n    error: function (data) {\n      p.send('quit');\n      cleanup(p, done, new Error(data));\n    },\n  });\n\n  p.on('message', function (event) {\n    if (event.type === 'start') {\n      // touch\n      setTimeout(function () {\n        if (!file) {\n          file = path.join(process.cwd(), rule, randomFile());\n        }\n\n        files.push(file);\n        fs.writeFile(file, '', function (err) {\n          if (err) {\n            console.log('error on writing file');\n            cleanup(p, done, new Error(err));\n          }\n        });\n\n        // if this fires, then *nothing* happened, which is good\n        setTimeout(function () {\n          cleanup(p, done);\n        }, 1000);\n      }, 1000);\n    } else if (event.type === 'restart') {\n      assert(false, 'nodemon should not restart');\n      cleanup(p, done);\n    }\n  });\n}\n\ndescribe('nodemon ignore', function () {\n  afterEach(function (done) {\n    files.forEach(function (file) {\n      if (fs.existsSync(file)) {\n        fs.unlinkSync(file);\n      }\n    });\n    done();\n  });\n\n  it('should be controlled via cli', function (done) {\n    ignore('node_modules', done);\n  });\n\n  it('should ignore node_modules by default', function (done) {\n    ignore(null, done, path.join(process.cwd(), 'node_modules', 'mocha', 'node_modules', randomFile()));\n  });\n\n});\n"
  },
  {
    "path": "test/monitor/match.test.js",
    "content": "'use strict';\n/*global describe:true, it: true */\nvar assert = require('assert'),\n  match = require('../../lib/monitor/match'),\n  config = require('../../lib/config'),\n  path = require('path'),\n  fs = require('fs'),\n  nodemonUtils = require('../../lib/utils'),\n  defaults = require('../../lib/config/defaults'),\n  utils = require('../utils'),\n  watch = require('../../lib/monitor/watch'),\n  merge = nodemonUtils.merge;\n\ndescribe('match', function () {\n  var monitor = [\n    '!.git',\n    '!node_modules/*',\n    '!public/*',\n    '!npm-debug.log',\n    '!node_modules/*',\n    'views/server/*',\n    '!*.coffee',\n  ];\n\n  it('should resolve ./ in positive match', () => {\n    const cwd = process.cwd();\n    const res = match(\n      [cwd + '/app.nodemon'],\n      ['./*.nodemon', '!**/dir/*.nodemon'],\n      'js,mjs,json,nodemon'\n    );\n\n    assert.equal(res.result.length, 1, JSON.stringify(res));\n  });\n\n  it('should resolve ./ in positive match (miss test)', () => {\n    const cwd = process.cwd();\n    const res = match(\n      [cwd + '/dir/app.nodemon'],\n      ['./*.nodemon', '!**/dir/*.nodemon'],\n      'js,mjs,json,nodemon'\n    );\n\n    assert.equal(res.result.length, 0, JSON.stringify(res));\n    assert.equal(res.ignored, 1, JSON.stringify(res));\n  });\n\n  it('should resolve ./ in negative match (hit test)', () => {\n    const cwd = process.cwd();\n    const res = match(\n      [cwd + '/app.nodemon'],\n      ['!./*.nodemon', '**/dir/*.nodemon'],\n      'js,mjs,json,nodemon'\n    );\n\n    assert.equal(res.result.length, 0, JSON.stringify(res));\n    assert.equal(res.ignored, 1, JSON.stringify(res));\n  });\n\n  it('should handle lots of **s!', () => {\n    const res = match(\n      ['test/fixtures/app.js'],\n      [\n        '*.*',\n        '!**/.git/**',\n        '!**/.nyc_output/**',\n        '!**/.sass-cache/**',\n        '!**/bower_components/**',\n        '!**/coverage/**',\n      ],\n      'js,mjs,json'\n    );\n\n    assert.equal(res.result.length, 1, JSON.stringify(res));\n  });\n\n  it('should match zero files', function () {\n    var files = [\n      'views/server/remy.coffee',\n      'random.coffee',\n      '/User/remy/app/server/foo.coffee',\n    ];\n\n    var results = match(files, monitor); // ignoring extension support\n    assert(results.result.length === 0, 'matched ' + results.result.length);\n  });\n\n  it('should match one file', function () {\n    var files = [\n      'views/server/remy.js',\n      'random.coffee',\n      '/User/remy/app/server/foo.coffee',\n    ];\n\n    var results = match(files, monitor);\n    assert(results.result.length === 1, 'matched ' + results.result.length);\n  });\n\n  it('should match two files', function () {\n    var files = [\n      'views/server/test.js',\n      'views/server/test2.js',\n      'views/server/test.coffee',\n    ];\n\n    var results = match(files, monitor);\n    assert(results.result.length === 2, 'matched ' + results.result.length);\n  });\n\n  it('should match one file', function () {\n    var files = [\n      'views/server/remy.js',\n      'views/server/ignore.js',\n      'random.coffee',\n      '/User/remy/app/server/foo.coffee',\n    ];\n    monitor.push('!views/server/ignore.js');\n\n    var results = match(files, monitor);\n    assert(results.result.length === 1, 'matched ' + results.result.length);\n  });\n\n  it('should apply *.js to any js file', function () {\n    var files = [utils.appjs];\n\n    var result = match(files, ['*.*'], 'js');\n\n    assert.deepEqual(result.result, files, 'file returned from match, matches');\n    assert(result.ignored === 0, 'no files were ignored');\n    assert(result.watched === files.length, 'a single file was matched');\n  });\n\n  it('should ignore .coffee if watching *.js', function () {\n    var files = [utils.appcoffee];\n\n    var result = match(files, ['*.*'], 'js');\n\n    assert.deepEqual(\n      result.result,\n      [],\n      'no results returned: ' + result.result\n    );\n  });\n\n  it('should match .coffee if watching *.js & *.coffee', function (done) {\n    config.load(\n      {\n        ext: 'js coffee',\n      },\n      function (config) {\n        var files = [utils.appcoffee];\n\n        var result = match(\n          files,\n          config.options.monitor,\n          config.options.execOptions.ext\n        );\n\n        assert.deepEqual(result.result, files, 'coffee file matched');\n        assert(result.ignored === 0, '0 files ignored');\n        done();\n      }\n    );\n  });\n\n  it('should ignore nodemon default rules', function (done) {\n    config.load({ ext: '*.js' }, function (config) {\n      var files = [utils.appjs, path.join(__dirname, '/.git/foo.js')];\n\n      var result = match(\n        files,\n        config.options.monitor,\n        config.options.execOptions.ext\n      );\n\n      assert.deepEqual(result.result, files.slice(0, 1), 'first file matched');\n      assert(result.ignored === 1, '.git file was ignored');\n      assert(result.watched === 1, 'a single file was matched');\n\n      done();\n    });\n  });\n\n  it('should ignore directories', function (done) {\n    config.load(\n      {\n        ext: 'js',\n        ignore: 'test/fixtures',\n      },\n      function (config) {\n        var files = [utils.appjs];\n\n        var result = match(\n          files,\n          config.options.monitor,\n          config.options.execOptions.ext\n        );\n\n        assert.deepEqual(result.result, [], 'should be no files matched');\n        done();\n      }\n    );\n  });\n\n  it('should check all directories by default', function (done) {\n    config.load(\n      {\n        ext: 'js',\n      },\n      function (config) {\n        var files = [utils.appjs];\n        var result = match(\n          files,\n          config.options.monitor,\n          config.options.execOptions.ext\n        );\n        assert.deepEqual(result.result, files, 'results should match');\n        done();\n      }\n    );\n  });\n\n  it('should be specific about directories', function (done) {\n    config.load(\n      {\n        ext: 'js md pug',\n        watch: ['lib'],\n      },\n      function (config) {\n        var files = [utils.appjs];\n        var result = match(\n          files,\n          config.options.monitor,\n          config.options.execOptions.ext\n        );\n\n        assert.deepEqual(result.result, [], 'no results');\n        done();\n      }\n    );\n  });\n\n  it('should not match coffee when monitoring just js', function (done) {\n    config.load(\n      {\n        script: utils.appjs,\n      },\n      function (config) {\n        var result = match(\n          [utils.appcoffee],\n          config.options.monitor,\n          config.options.execOptions.ext\n        );\n\n        assert.deepEqual(result.result, [], 'no results');\n        done();\n      }\n    );\n  });\n\n  it('should ignore case when comparing paths on Windows', function () {\n    if (!nodemonUtils.isWindows) {\n      return;\n    }\n    var results = match(['C:\\\\TEST\\\\fixtures'], ['c:\\\\test\\\\fixtures']);\n    assert(results.result.length === 1, 'matched ' + results.result.length);\n  });\n});\n\ndescribe('validating files that cause restart', function () {\n  it('should allow for relative paths outside of the cwd', function () {\n    var cwd = process.cwd();\n    var dir = cwd + '/test/fixtures/configs';\n    process.chdir(dir);\n    var filename = './watch-relative.json';\n    var config = JSON.parse(fs.readFileSync(filename));\n    var settings = merge(config, defaults);\n    var script = path.resolve('../../../lib/__init__.py');\n\n    settings.monitor = match.rulesToMonitor(settings.watch, settings.ignore, {\n      dirs: [],\n      system: { useFind: true },\n    });\n\n    var matched = match(\n      [script],\n      settings.monitor,\n      settings.ext.replace(' ', ',')\n    );\n    process.chdir(cwd);\n\n    assert(\n      matched.result.length === 1,\n      'relative file matched: ' + matched.results\n    );\n  });\n\n  it('should allow *.js to match at the top level', function () {\n    var filename = path.join('test', 'fixtures', 'configs', 'top-level.json');\n    var config = JSON.parse(fs.readFileSync(filename));\n    var settings = merge(config, defaults);\n    var script = path.resolve('app.js');\n\n    settings.monitor = match.rulesToMonitor(settings.watch, settings.ignore, {\n      dirs: [],\n      system: { useFind: true },\n    });\n\n    var matched = match(\n      [script],\n      settings.monitor,\n      settings.ext.replace(' ', ',')\n    );\n    assert(matched.result.length === 1, 'found match ' + matched.results);\n  });\n\n  it('should allow for simple star rule: public/*', function () {\n    var filename = path.join('test', 'fixtures', 'configs', 'public-star.json');\n    var config = JSON.parse(fs.readFileSync(filename));\n    var settings = merge(config, defaults);\n    var script = 'public/js/chrome.save.js';\n\n    settings.monitor = match.rulesToMonitor(settings.watch, settings.ignore, {\n      dirs: [],\n      system: { useFind: true },\n    });\n\n    var matched = match(\n      [script],\n      settings.monitor,\n      settings.ext.replace(' ', ',')\n    );\n    assert(matched.result.length === 0, 'public/* ignored: ' + matched.results);\n  });\n\n  it('should allow for relative paths with extensions', function () {\n    var cwd = process.cwd();\n    var dir = cwd + '/test/fixtures/configs';\n    process.chdir(dir);\n    var filename = './watch-relative-filter.json';\n    var config = JSON.parse(fs.readFileSync(filename));\n    var settings = merge(config, defaults);\n    var script = path.resolve('../jsbin/scripts.json');\n\n    settings.monitor = match.rulesToMonitor(settings.watch, settings.ignore, {\n      dirs: [],\n      system: { useFind: true },\n    });\n\n    var matched = match(\n      [script],\n      settings.monitor,\n      settings.ext.replace(' ', ',')\n    );\n    process.chdir(cwd);\n\n    assert(\n      matched.result.length === 1,\n      'relative file matched: ' + matched.results\n    );\n  });\n});\n\ndescribe('match rule parser', function () {\n  it('should support \"--watch .\"', function () {\n    var config = { watch: '.' };\n    var settings = merge(config, defaults);\n    var script = 'index.js';\n\n    settings.monitor = match.rulesToMonitor(settings.watch, [], {\n      dirs: [],\n      system: { useFind: true },\n    });\n\n    assert(\n      settings.monitor[0] === '*.*',\n      'path resolved: ' + settings.monitor[0]\n    );\n    var matched = match([script], settings.monitor, 'js');\n    assert(matched.result.length === 1, 'no file matched');\n  });\n\n  it('should support \"--watch .*\"', function () {\n    var config = { watch: '.*' };\n    var settings = merge(config, defaults);\n    var script = 'index.js';\n\n    settings.monitor = match.rulesToMonitor(settings.watch, [], {\n      dirs: [],\n      system: { useFind: true },\n    });\n\n    assert(\n      settings.monitor[0] === '*.*',\n      'path resolved: ' + settings.monitor[0]\n    );\n    var matched = match([script], settings.monitor, 'js');\n    assert(matched.result.length === 1, 'no file matched');\n  });\n\n  it('should support \"--watch <single file>\"', function () {\n    var config = { watch: 'config.json' };\n    var settings = merge(config, defaults);\n\n    settings.monitor = match.rulesToMonitor(settings.watch, [], {\n      dirs: [],\n      system: { useFind: true },\n    });\n\n    var matched = match(['/some/path/to/config.json'], settings.monitor, 'js');\n    assert(matched.result.length === 1, 'no file matched');\n  });\n\n  it('should support \"--watch /some/path/*/config.json\"', function () {\n    var config = { watch: '/*/config.json' };\n    var settings = merge(config, defaults);\n\n    settings.monitor = match.rulesToMonitor(settings.watch, [], {\n      dirs: [],\n      system: { useFind: true },\n    });\n\n    var matched = match(['/some/path/to/config.json'], settings.monitor, 'js');\n    assert(matched.result.length === 1, 'no file matched');\n  });\n\n  it('should support \"--watch *.*\"', function () {\n    var config = { watch: '*.*' };\n    var settings = merge(config, defaults);\n    var script = 'index.js';\n\n    settings.monitor = match.rulesToMonitor(settings.watch, [], {\n      dirs: [],\n      system: { useFind: true },\n    });\n\n    assert(\n      settings.monitor[0] === '*.*',\n      'path resolved: ' + settings.monitor[0]\n    );\n    var matched = match([script], settings.monitor, 'js');\n    assert(matched.result.length === 1, 'no file matched');\n  });\n\n  it('should support \"--watch ..\"', function () {\n    // make sure we're in a deep enough directory\n    var cwd = process.cwd();\n    process.chdir('./test/fixtures/');\n    var pwd = process.cwd();\n    var config = { watch: '..' };\n    var settings = merge(config, defaults);\n    var script = pwd + 'index.js';\n\n    settings.monitor = match.rulesToMonitor(settings.watch, [], {\n      dirs: [],\n      system: { useFind: true },\n    });\n\n    process.chdir(cwd);\n\n    assert(\n      settings.monitor[0] === path.resolve(pwd, '..') + '/**/*',\n      'path resolved: ' + settings.monitor[0]\n    );\n    var matched = match([script], settings.monitor, 'js');\n    assert(matched.result.length === 1, 'no file matched');\n  });\n});\n\ndescribe('watcher', function () {\n  afterEach(function (done) {\n    config.reset();\n    setTimeout(() => {\n      watch.resetWatchers();\n      done();\n    }, 0);\n  });\n\n  it('should not crash if ignoreRoot is an empty array', function (done) {\n    config.load(\n      {\n        watch: ['test/fixtures/app.js'],\n        ignoreRoot: [],\n      },\n      function (config) {\n        return watch\n          .watch()\n          .then(function () {\n            done();\n          })\n          .catch(done);\n      }\n    );\n  });\n\n  it('should not match a dotfile unless explicitly asked to', function (done) {\n    config.load(\n      {\n        watch: ['test/fixtures/*'],\n      },\n      function (config) {\n        return watch\n          .watch()\n          .then(function (files) {\n            var withDotfile = files.filter(function (file) {\n              return /test\\/fixtures\\/\\.dotfile$/.test(file);\n            });\n            assert.deepEqual(\n              withDotfile.length,\n              0,\n              'should not contain .dotfile'\n            );\n            done();\n          })\n          .catch(done);\n      }\n    );\n  });\n\n  it('should match a dotfile if explicitly asked to', function (done) {\n    config.load(\n      {\n        watch: ['test/fixtures/.dotfile'],\n      },\n      function (config) {\n        return watch\n          .watch()\n          .then(function (files) {\n            assert.deepEqual(\n              files.filter((f) => f.endsWith('.dotfile')).length,\n              1,\n              'should contain .dotfile'\n            );\n            done();\n          })\n          .catch(done);\n      }\n    );\n  });\n\n  it('should match a dotfolder if explicitly asked to', function (done) {\n    config.load(\n      {\n        watch: ['test/fixtures/.dotfolder'],\n      },\n      function (config) {\n        return watch\n          .watch()\n          .then(function (files) {\n            assert.deepEqual(\n              files.length,\n              3,\n              'file lists should contain .dotfolder files'\n            );\n            done();\n          })\n          .catch(done);\n      }\n    );\n  });\n\n  it('should watch relative paths', function () {\n    const monitor = match.rulesToMonitor(['./http.js'], [], {\n      dirs: [],\n    });\n\n    var matched = match(['http.js'], monitor, 'js,mjs,json');\n    assert(matched.result.length === 1, 'found match ' + matched.results);\n  });\n\n  it('should ignore relative directories', () => {\n    const monitor = match.rulesToMonitor([], ['node_modules/*', '**/logs/*']);\n\n    var matched = match(['logs/a'], monitor, 'js,mjs,json');\n\n    assert(\n      matched.ignored === 1 && matched.result.length === 0,\n      JSON.stringify(matched)\n    );\n  });\n});\n"
  },
  {
    "path": "test/monitor/run.test.js",
    "content": "'use strict';\n/*global describe:true, it: true, after: true, beforeEach */\nvar nodemon = require('../../lib/');\nvar assert = require('assert');\nvar fs = require('fs');\nvar path = require('path');\nvar touch = require('touch');\nvar crypto = require('crypto');\n\nfunction rnd() {\n  return crypto.randomBytes(16).toString('hex');\n}\n\ndescribe('when nodemon runs (2)', function () {\n  var tmp = path.resolve('test/fixtures/test' + rnd() + '.js');\n  var tmp2 = path.resolve('test/fixtures/test' + rnd() + '-added.js');\n\n  afterEach(function () {\n    if (fs.existsSync(tmp)) {\n      fs.unlinkSync(tmp);\n    }\n    if (fs.existsSync(tmp2)) {\n      fs.unlinkSync(tmp2);\n    }\n  });\n\n  after(function (done) {\n    // clean up just in case.\n    nodemon.once('exit', function () {\n      nodemon.reset(done);\n    }).emit('quit');\n  });\n\n  beforeEach(function (done) {\n    nodemon.reset(done);\n  });\n\n  it('should restart when new files are added', function (done) {\n    fs.writeFileSync(tmp, 'setTimeout(function(){}, 10000)');\n\n    nodemon({\n      script: tmp,\n    }).on('start', function () {\n      setTimeout(function () {\n        fs.writeFileSync(tmp2, 'setTimeout(function(){}, 10000)');\n      }, 500);\n    }).on('restart', function () {\n      assert(fs.existsSync(tmp2), 'restarted after new file was added');\n      nodemon.once('exit', function () {\n        nodemon.reset(done);\n      }).emit('quit');\n    });\n  });\n\n  it('should wait when the script crashes', function (done) {\n    fs.writeFileSync(tmp, 'throw Error(\"forced crash\")');\n\n    nodemon({ script: tmp, stdout: false }).on('crash', function () {\n      assert(true, 'detected crashed state');\n\n      setTimeout(function () {\n        fs.writeFileSync(tmp, 'var n = 10 + 2;');\n      }, 1000);\n    }).on('restart', function () {\n      assert(true, 'nodemon restarted');\n      nodemon.once('exit', function () {\n        nodemon.reset(done);\n      }).emit('quit');\n    });\n  });\n\n  it('should wait when the script cleanly exits', function (done) {\n    fs.writeFileSync(tmp, 'setTimeout(function () { var n = 10; }, 1000)');\n\n    nodemon({ script: tmp }).on('crash', function () {\n      assert(false, 'detected crashed state');\n    }).on('exit', function () {\n      assert(true, 'nodemon is waiting for a change');\n\n      setTimeout(function () {\n        touch.sync(tmp);\n      }, 500);\n    }).on('restart', function () {\n      assert(true, 'nodemon restarted');\n      nodemon.once('exit', function () {\n        nodemon.reset(done);\n      }).emit('quit');\n    });\n  });\n\n  it('should expose readable streams when stdout is false', function (done) {\n    var stdoutTestData = 'outputting some data';\n    var stderrTestData = 'outputting an error';\n\n    var script = 'setTimeout(function () { console.log(\"' + stdoutTestData +\n      '\"); }, 5); setTimeout(function () { console.error(\"' + stderrTestData +\n      '\"); }, 10);';\n\n    fs.writeFileSync(tmp, script);\n\n    var stdoutFileName = 'test/fixtures/stdout.txt';\n    var stderrFileName = 'test/fixtures/stderr.txt';\n\n    var stdoutWritable = fs.createWriteStream(stdoutFileName);\n    var stderrWritable = fs.createWriteStream(stderrFileName);\n\n    nodemon({\n      script: tmp,\n      stdout: false,\n    }).on('crash', function () {\n      assert(false, 'detected crashed state');\n\n    }).on('readable', function () {\n      this.stdout.pipe(stdoutWritable);\n      this.stderr.pipe(stderrWritable);\n\n    }).on('end', function () {\n      this.stdout.unpipe(stdoutWritable);\n      this.stderr.unpipe(stderrWritable);\n      stdoutWritable.end();\n      stderrWritable.end();\n\n      var stdoutWritableResult = fs.readFileSync(stdoutFileName);\n      var stderrWritableResult = fs.readFileSync(stderrFileName);\n\n      assert(stdoutWritableResult === stdoutTestData,\n        'stdout has been piped correctly');\n      assert(stderrWritableResult === stderrTestData,\n        'stderr has been piped correctly');\n\n      this.emit('quit');\n\n    }).once('exit', function () {\n      assert(true, 'nodemon is quitting');\n\n      fs.unlinkSync(stdoutFileName);\n      fs.unlinkSync(stderrFileName);\n\n      nodemon.reset(done);\n    });\n  });\n\n  // Fixed! FIXME this test was previously not working properly\n  // corrected the test case\n  // script should not be run i.e,\n  // file should not be created \n  it('should not run command on startup if runOnChangeOnly is true',\n    function (done) {\n      var script =  \"var touch = require('touch');\\n\"\n                    + \"touch.sync(\" + tmp2 + \");\\n\"\n      fs.writeFileSync(tmp, script);\n\n      nodemon({\n        script: tmp,\n        runOnChangeOnly: true,\n        stdout: false,\n      }).on('start', function () {\n        // file exists check\n      \tassert(!fs.existsSync(tmp2), 'script should not start');\n      }).once('exit', function () {\n        done();\n      });\n\n      setTimeout(function () {\n        nodemon.emit('quit');\n      }, 1500);\n    });\n\n  it('should kill child on SIGINT', function (done) {\n    fs.writeFileSync(tmp, 'setTimeout(function () { var n = 10; }, 10000)');\n\n    nodemon({ script: tmp, verbose: true }).on('start', function () {\n      assert(true, 'nodemon is waiting for a change');\n\n      setTimeout(function () {\n        process.once('SIGINT', function () {\n          // do nothing\n        });\n\n        process.kill(process.pid, 'SIGINT');\n      }, 1000);\n    }).on('crash', function () {\n      assert(false, 'detected crashed state');\n    }).on('exit', function () {\n      assert(true, 'quit correctly');\n      nodemon.reset(done);\n\n      setTimeout(function () {\n        process.kill(process.pid, 'SIGINT');\n      }, 1000);\n    });\n  });\n});\n"
  },
  {
    "path": "test/monitor/watch-restart.test.js",
    "content": "'use strict';\n/*global describe, it, after, afterEach */\nlet debugLogger = {};\nconst nodemon = require('../../lib/');\nvar assert = require('assert');\nvar fs = require('fs');\nvar utils = require('../utils');\nvar path = require('path');\nvar touch = require('touch');\nvar crypto = require('crypto');\nvar baseFilename =\n  'test/fixtures/test' + crypto.randomBytes(16).toString('hex');\n\nvar WAIT_BEFORE_START = 3000;\n\ndescribe('nodemon monitor child restart', function () {\n  var tmpjs = path.resolve(baseFilename + '.js');\n  var tmpmd = path.resolve(baseFilename + '.md');\n\n  function write(both) {\n    fs.writeFileSync(tmpjs, 'true;');\n    if (both) {\n      fs.writeFileSync(tmpmd, '# true');\n    }\n  }\n\n  var pwd = process.cwd();\n  var oldhome = utils.home;\n\n  afterEach(function () {\n    debugLogger = {};\n    process.chdir(pwd);\n    utils.home = oldhome;\n\n    if (fs.existsSync(tmpjs)) {\n      fs.unlinkSync(tmpjs);\n    }\n    if (fs.existsSync(tmpmd)) {\n      fs.unlinkSync(tmpmd);\n    }\n  });\n\n  after(function (done) {\n    nodemon\n      .once('exit', function () {\n        nodemon.reset(done);\n      })\n      .emit('quit');\n  });\n\n  it('should happen when monitoring a single extension', function (done) {\n    write();\n\n    setTimeout(function () {\n      nodemon({ script: tmpjs, verbose: true, ext: 'js' })\n        .on('start', function () {\n          setTimeout(function () {\n            touch.sync(tmpjs);\n          }, 1500);\n        })\n        .on('restart', function (files) {\n          assert(\n            files[0] === tmpjs,\n            'nodemon restarted because of change to our file' + files\n          );\n          nodemon\n            .once('exit', function () {\n              nodemon.reset(done);\n            })\n            .emit('quit');\n        });\n    }, WAIT_BEFORE_START);\n  });\n\n  it('should happen when monitoring multiple extensions', function (done) {\n    write(true);\n    setTimeout(function () {\n      nodemon({\n        script: tmpjs,\n        ext: 'js md',\n        verbose: true,\n      })\n        .on('start', function () {\n          setTimeout(function () {\n            touch.sync(tmpmd);\n          }, 1500);\n        })\n        .on('log', function (event) {\n          var msg = event.message;\n          if (utils.match(msg, 'changes after filters')) {\n            var changes = msg\n              .trim()\n              .slice(-5)\n              .split('/');\n            var restartedOn = changes.pop();\n            assert(\n              restartedOn === '1',\n              'nodemon restarted on a single file change'\n            );\n            nodemon\n              .once('exit', function () {\n                nodemon.reset(done);\n              })\n              .emit('quit');\n          }\n        });\n    }, WAIT_BEFORE_START);\n  });\n\n  if (process.platform === 'darwin') {\n    it('should restart when watching directory (mac only)', function (done) {\n      write(true);\n\n      process.chdir('test/fixtures');\n\n      setTimeout(function () {\n        nodemon({\n          script: tmpjs,\n          verbose: true,\n          ext: 'js',\n          watch: ['*.js', 'global'],\n        })\n          .on('start', function () {\n            setTimeout(function () {\n              touch.sync(tmpjs);\n            }, 1000);\n          })\n          .on('restart', function (files) {\n            assert(\n              files.length === 1,\n              'nodemon restarted when watching directory'\n            );\n            nodemon\n              .once('exit', function () {\n                nodemon.reset(done);\n              })\n              .emit('quit');\n          });\n      }, WAIT_BEFORE_START);\n    });\n  }\n\n  it('should restart when watching directory', function (done) {\n    write(true);\n\n    // process.chdir(process.cwd() + '/test/fixtures');\n\n    setTimeout(function () {\n      nodemon({\n        script: tmpjs,\n        verbose: true,\n        ext: 'js md',\n        watch: ['test/'],\n      })\n        .on('start', function () {\n          setTimeout(function () {\n            touch.sync(tmpmd);\n          }, 1000);\n        })\n        .on('restart', function (files) {\n          assert(\n            files.length === 1,\n            'nodemon restarted when watching directory'\n          );\n          nodemon\n            .once('exit', function () {\n              nodemon.reset(done);\n            })\n            .emit('quit');\n        });\n    }, WAIT_BEFORE_START);\n  });\n\n  it('should ignore relative node_modules', done => {\n    write(true);\n\n    process.chdir(process.cwd() + '/test/fixtures/1246/app');\n\n    nodemon({\n      script: 'index.js',\n      watch: ['../'],\n    })\n      .on('watching', file => {\n        assert(\n          file.indexOf('/node_modules/') === -1,\n          `node_modules found: ${file}`\n        );\n      })\n      .on('start', () => {\n        // gentle timeout to wait for the files to finish reading\n        setTimeout(() => {\n          nodemon\n            .once('exit', function () {\n              nodemon.reset(done);\n            })\n            .emit('quit');\n        }, 1000);\n      });\n  });\n});\n"
  },
  {
    "path": "test/monitor/watch.test.js",
    "content": "'use-strict';\n\nvar assert = require('assert');\nvar chokidar = require('chokidar');\nvar process = require('process');\nvar config = require('../../lib/config');\nvar watch = require('../../lib/monitor/watch');\n\ndescribe('watch', function() {\n  it('should pass watchOptions to the watcher', function(done) {\n    process.chdir(process.cwd() + '/test/fixtures/configs');\n\n    var passedOptions = {};\n    var originalWatch = chokidar.watch;\n    chokidar.watch = function(dirs, options) {\n      passedOptions = options;\n      return originalWatch(dirs, options);\n    };\n\n    config.load({\n      configFile: process.cwd() + '/watch-options.json'\n    }, () => {\n      watch.watch();\n      chokidar.watch = originalWatch;\n      assert(passedOptions.awaitWriteFinish, 'awaitWriteFinish does not have the correct value');\n      done();\n    });\n  });\n})\n"
  },
  {
    "path": "test/rules/index.test.js",
    "content": "'use strict';\n/*global describe:true, it: true, beforeEach: true */\nvar fs = require('fs'),\n    nodemon = require('../../lib/nodemon'),\n    rules = require('../../lib/rules'),\n    assert = require('assert');\n\nfunction loadfixtures(sample) {\n  var path = './test/fixtures/' + sample;\n  return {\n    content: fs.readFileSync(path, 'utf8'),\n    path: path\n  };\n}\n\ndescribe('nodemon rules', function () {\n  var fixtures = {\n    comments: loadfixtures('comments'),\n    regexp: loadfixtures('regexp'),\n    default: loadfixtures('default'),\n    simple: loadfixtures('simple'),\n    simplejson: loadfixtures('simple.json'),\n  };\n\n  beforeEach(function (done) {\n    nodemon.reset(done);\n  });\n\n  it('should be resetable', function (done) {\n    // nodemon.reset();\n    rules.load('./test/fixtures/simple.json', function () {\n      nodemon.reset();\n\n      rules.load('./test/fixtures/comments', function (error, rules) {\n        assert.deepEqual(rules, { watch: [], ignore: [] }, 'rules are empty: ' + JSON.stringify(rules));\n        done();\n      });\n\n    });\n  });\n\n\n  it('should read json', function (done) {\n    rules.load('./test/fixtures/simple.json', function (error, rules) {\n      assert(typeof rules === 'object', 'rules file is parsed');\n      done();\n    });\n  });\n\n  it('should ignore comments files', function (done) {\n    rules.load(fixtures.comments.path, function (error, rules) {\n      assert.equal(rules.ignore.length, 0, 'zero ignore rules');\n      done();\n    });\n  });\n\n  it('should allow comments on lines', function (done) {\n    rules.load(fixtures.simple.path, function (error, rules) {\n      rules.ignore.forEach(function (rule) {\n        assert.equal(rule.indexOf('# comment'), -1, 'no comment found');\n      });\n      done();\n    });\n  });\n\n  it('should ignore regular expressions', function (done) {\n    rules.load(fixtures.regexp.path, function (error, rules) {\n      assert.deepEqual(rules, { 'watch': [], 'ignore': [] }, 'rules are empty');\n      done();\n    });\n  });\n});"
  },
  {
    "path": "test/utils/colour.test.js",
    "content": "/*global describe:true, it: true */\nvar colour = require('../../lib/utils/colour'),\n    assert = require('assert');\n\ndescribe('utils colour', function () {\n  it('should colour strings', function () {\n    var red = colour('red', 'foo');\n    assert(red.indexOf('\\x1B') !== -1);\n  });\n\n  it('should strip colours strings', function () {\n    var red = colour('red', 'foo');\n\n    var plain = colour.strip(red);\n    assert(plain.indexOf('\\x1B') === -1);\n  });\n});"
  },
  {
    "path": "test/utils/log.test.js",
    "content": "'use strict';\n/*global describe:true, it: true */\nvar Logger = require('../../lib/utils/log');\nvar logger = new Logger(true);\nvar bus = require('../../lib/utils/bus');\nvar colour = require('../../lib/utils/colour');\nvar assert = require('assert');\n\ndescribe('logger', function () {\n  var types = {\n    log: 'black',\n    info: 'yellow',\n    status: 'green',\n    detail: 'yellow',\n    fail: 'red',\n    error: 'red'\n  };\n\n  logger.debug = true;\n\n  Object.keys(types).forEach(function (type) {\n    it('should .' + type, function (done) {\n      bus.once('log', function (event) {\n        assert(event.message === type);\n        assert(event.colour.indexOf(colour[types[type]]) !== -1);\n        done();\n      });\n      logger[type](type);\n    });\n  });\n\n  it('should disable colour', function () {\n    var type = 'fail';\n    bus.once('log', function (event) {\n      assert.equal(event.message, type);\n      assert.ok(event.colour.indexOf(colour[types[type]]) !== -1);\n    });\n    logger[type](type);\n\n    logger.useColours = false;\n\n    bus.once('log', function (event) {\n      assert.equal(event.message, type);\n      assert.ok(event.colour.indexOf(colour[types[type]]) === -1);\n    });\n    logger[type](type);\n\n    logger.useColours = true;\n\n    bus.once('log', function (event) {\n      assert.equal(event.message, type);\n      assert.ok(event.colour.indexOf(colour[types[type]]) !== -1);\n    });\n    logger[type](type);\n  });\n\n  // it('should not log detail if debug is off', function (done) {\n  //   logger.debug = false;\n\n  //   function handler() {\n  //     assert(false, 'logged a message when we should not have done');\n  //     bus.removeListener('log', handler);\n  //     done();\n  //   }\n\n  //   bus.addListener('log', handler);\n\n  //   logger.detail('detail');\n\n  //   setTimeout(function () {\n  //     bus.removeListener('log', handler);\n  //     done();\n  //   }, 500);\n  // });\n});"
  },
  {
    "path": "test/utils/merge.test.js",
    "content": "/*global describe:true, it: true */\nvar merge = require('../../lib/utils/merge'),\n    assert = require('assert');\n\nfunction getOriginal() {\n  return {\n    verbose: true,\n    script: './lib/app',\n    args: [],\n    execOptions:\n     { verbose: true,\n       script: './lib/app',\n       args: [],\n       exec: 'node',\n       execArgs: [],\n       ext: ''\n     },\n    restartable: 'rs'\n  };\n}\n\ndescribe('utils merge', function () {\n  var original = {};\n\n  beforeEach(function () {\n    original = getOriginal();\n  });\n\n  it('should be the same with empty targets', function () {\n    var result = merge(original, {});\n    assert.deepEqual(original, result);\n  });\n\n  it('should merge missing properties', function () {\n    var simple = {\n      ignore: []\n    };\n\n    var result = merge(simple, {\n      watch: []\n    });\n\n    assert.deepEqual({\n      ignore: [],\n      watch: []\n    }, result);\n  });\n\n  it('should merge complex missing properties', function () {\n    var target = [{\n          one: 1,\n          two: 2\n        }, {\n          three: 3,\n          four: 4\n        }];\n\n    var result = merge(original, {\n      watch: target\n    });\n\n    original.watch = target;\n\n    assert.deepEqual(original, result);\n  });\n\n  it('should merge deep complex missing properties', function () {\n    var target = {\n      execOptions: { verbose: true,\n         script: './lib/app',\n         args: [],\n         exec: 'node',\n         execArgs: [],\n         ext: ''\n       }\n    };\n\n    var result = merge(original, target);\n\n    original.execOptions = target.execOptions;\n\n    assert.deepEqual(original, result);\n  });\n\n  it('should ignore existing properties', function () {\n    var original = {\n      execOptions: {\n        ext: 'js'\n      }\n    };\n\n    var target = {\n      execOptions: {\n        ext: 'notjs'\n      }\n    };\n\n    var result = merge(original, target);\n    assert.deepEqual(original, result);\n\n    original = { ext: 'js' };\n    target = { ext: 'notjs' };\n\n    result = merge(original, target);\n    assert.deepEqual(original, result);\n  });\n\n  it('should merge in to \"empty\" properties', function () {\n    var target = {\n      execOptions: {\n        ext: 'js'\n      }\n    };\n\n    var original = {\n      execOptions: {\n        ext: ''\n      }\n    };\n\n    var result = merge(original, target);\n\n    original.execOptions = target.execOptions;\n    assert.deepEqual(original, result);\n  });\n\n  it('should merge into empty objects', function () {\n    var original = {\n      foo: 'bar',\n      execOptions: {}\n    };\n\n    var target = {\n      execOptions: {\n        ext: 'js'\n      }\n    };\n\n    var result = merge(original, target);\n    assert.deepEqual({ foo: 'bar', execOptions: { ext: 'js' } }, result);\n  });\n\n  it('should merge into empty arrays', function () {\n    var original = {\n      foo: 'bar',\n      execOptions: []\n    };\n\n    var target = {\n      execOptions: ['js']\n    };\n\n    var result = merge(original, target);\n\n    assert.deepEqual({ foo: 'bar', execOptions: ['js'] }, result)\n  });\n\n  it('should merge into deep empty arrays', function () {\n    // return;\n    var original = {\n      foo: {\n        name: []\n      }\n    };\n\n    var target = {\n      foo: {\n        name: ['remy']\n      }\n    };\n\n    var result = merge(original, target);\n\n    assert.deepEqual({ foo: { name: ['remy'] } }, result)\n  });\n\n});"
  },
  {
    "path": "test/utils/stringify.test.js",
    "content": "'use strict';\n/*global describe:true, it: true */\nvar stringify = require('../../lib/utils').stringify,\n    assert = require('assert');\n\ndescribe('stringify', function () {\n  it('should combine the executable and arguments', function () {\n    var string = stringify('node', ['./app.js', '--flag']);\n    var expected = 'node ./app.js --flag';\n\n    assert(string === expected, \"stringified to \" + string);\n  });\n  it('should not include excess whitespace', function () {\n    var string = stringify('node');\n    var expected = 'node';\n\n    assert(string === expected, \"stringified to \" + string);\n  });\n  it('should quote arguments with spaces', function () {\n    var string = stringify('node', ['./app.js', '--one --two']);\n    var expected = 'node ./app.js \"--one --two\"';\n\n    assert(string === expected, \"stringified to \" + string);\n  });\n  it('should escape quotes', function () {\n    var string = stringify('node', ['./app.js', '--one \"--two --three\"']);\n    var expected = 'node ./app.js \"--one \\\\\"--two --three\\\\\"\"';\n\n    assert(string === expected, \"stringified to \" + string);\n  });\n});\n"
  },
  {
    "path": "test/utils.js",
    "content": "'use strict';\nvar fork = require('child_process').fork,\n    path = require('path'),\n    appjs = path.resolve(__dirname, 'fixtures', 'app.js'),\n    assert = require('assert'),\n    port = 8000,\n    appcoffee = path.resolve(__dirname, 'fixtures', 'app.coffee');\n\nfunction asCLI(cmd) {\n  return {\n    exec: 'bin/nodemon.js',\n    // make nodemon verbose so we can check the filters being applied\n    args: ('-V ' + (cmd || '')).trim().split(' ')\n  };\n}\n\nfunction match(str, key) {\n  return str.indexOf(key) !== -1;\n}\n\nfunction monitorForChange(str) {\n  var watch = false;\n  return function (line) {\n    if (match(line, 'files triggering change check: nodemonCheckFsWatch')) {\n      watch = false;\n    } else if (match(line, 'files triggering change check:')) {\n      watch = true;\n    }\n\n    if (watch) {\n      if (match(line, str)) {\n        return true;\n      }\n    }\n\n    return false;\n  };\n}\n\nfunction run(cmd, callbacks) {\n  var cli = typeof cmd === 'string' ? asCLI(cmd) : cmd;\n  port++;\n  process.env.PORT = port;\n  var proc = fork(cli.exec, cli.args, {\n    env: process.env,\n    cwd: process.cwd(),\n    encoding: 'utf8',\n    silent: true,\n  });\n\n  proc.stderr.setEncoding('utf8');\n  proc.stdout.setEncoding('utf8');\n\n  if (callbacks.output) {\n    proc.stdout.on('data', callbacks.output);\n  }\n  if (callbacks.restart) {\n    proc.stdout.on('data', function (data) {\n      if (match(data, 'restarting due to changes')) {\n        callbacks.restart(null, data);\n      }\n    });\n  }\n  if (callbacks.error) {\n    proc.stderr.on('data', function (error) {\n      error = error.toString().trim();\n\n      if (process.env.TRAVIS && error === 'User defined signal 2') {\n        // swallow the SIGUSR2 - it should never hit the stderr, but for some\n        // reason, travis sees it and causes our tests to fail, so we swallow\n        // if this specific error bubbles out\n      } else {\n        callbacks.error(error);\n      }\n    });\n  }\n\n  return proc;\n}\n\nfunction cleanup(p, done, err) {\n  // as above\n  if (process.env.TRAVIS && err &&\n    err.message.indexOf('User defined signal 2') === 0) {\n    err = null;\n  }\n  if (p) {\n    p.once('exit', function () {\n      p = null;\n      done(err);\n    });\n    p.send('quit');\n  } else {\n    done(err);\n  }\n}\n\nfunction Plan(count, done) {\n  this.done = done;\n  this.count = count;\n}\n\nPlan.prototype.assert = function() {\n  assert.apply(null, arguments);\n  // console.log(arguments[1]);\n\n  if (this.count === 0) {\n    assert(false, 'Too many assertions called via \"' + arguments[1] + '\"');\n  } else {\n    this.count--;\n  }\n\n  if (this.count === 0) {\n    this.done();\n  }\n};\n\nfunction getTriggerCount(msg) {\n  var changes = msg.split(/\\n/).shift();\n  changes = changes.replace(/\\s*/gm, '').slice(-5).split('/');\n  return changes.pop();\n}\n\nfunction isRunning(pid) {\n  try {\n    process.kill(pid, 0)\n    return true\n  } catch (error) {\n    if (error.code && error.code === 'ESRCH') return false\n    throw error\n  }\n}\n\nmodule.exports = {\n  getTriggerCount: getTriggerCount,\n  Plan: Plan,\n  asCLI: asCLI,\n  match: match,\n  run: run,\n  cleanup: cleanup,\n  appjs: appjs,\n  appcoffee: appcoffee,\n  monitorForChange: monitorForChange,\n  port: port,\n  isRunning: isRunning\n};\n"
  },
  {
    "path": "website/index.html",
    "content": "<!DOCTYPE html>\n<html>\n\n  <head>\n    <meta charset=utf-8>\n    <meta name=\"viewport\" content=\"width=device-width\">\n    <title>nodemon</title>\n    <link rel=\"stylesheet\" href=\"style.css\">\n    <link rel=\"icon\" type=\"image/svg+xml\" href=\"/nodemon.svg\">\n  </head>\n\n  <body>\n    <header>\n      <svg version=\"1.1\" id=\"template\" xmlns=\"https://www.w3.org/2000/svg\" xmlns:xlink=\"https://www.w3.org/1999/xlink\"\n        x=\"0px\" y=\"0px\" width=\"160\" height=\"180\" viewBox=\"0 0 160 185\" xml:space=\"preserve\">\n        <path d=\"M158.156,60.461l-5.326-3.066\n                c8.189-12.08,13.084-30.242,6.947-57.395c0,0-13.82,38.733-41.602,37.449L85.645,18.73c-1.227-0.728-2.602-1.103-3.992-1.159\n                c-0.125,0-0.648,0-0.75,0c-1.387,0.057-2.76,0.432-4.004,1.159L44.367,37.449C16.586,38.738,2.762,0,2.762,0\n                c-6.141,27.152-1.238,45.314,6.949,57.395l-5.324,3.066C1.682,62.018,0,64.914,0,68.072l0.16,112.363\n                c0,1.568,0.812,3.021,2.188,3.783c1.344,0.812,3.008,0.812,4.35,0l43.094-24.676c2.727-1.619,4.385-4.477,4.385-7.6V99.449\n                c0-3.129,1.658-6.031,4.373-7.582l18.35-10.568c1.367-0.795,2.863-1.182,4.391-1.182c1.492,0,3.027,0.387,4.356,1.182\n                l18.344,10.568c2.715,1.551,4.379,4.453,4.379,7.582v52.494c0,3.123,1.68,6.002,4.391,7.6l43.082,24.676\n                c1.352,0.812,3.039,0.812,4.379,0c1.336-0.762,2.176-2.215,2.176-3.783l0.141-112.363\n                C162.535,64.914,160.879,62.018,158.156,60.461z\" />\n      </svg>\n      <h1><strong>nodemon</strong> reload, automatically.</h1>\n\n    </header>\n    <main>\n      <p>Nodemon is a utility <strong>depended on by over 3 million projects</strong>, that will monitor for any\n        changes in your source and automatically restart your server.\n        Perfect for development.</p>\n\n      <p>Swap <strong>nodemon</strong> instead of <strong>node</strong> to run your code, and now your process will\n        automatically restart when your code changes. To install, get <a href=\"https://nodejs.org\"\n          target=\"_blank\">Node.js</a>, then from your terminal run:</p>\n\n      <pre><code>npm install -g nodemon</code></pre>\n\n\n      <h2>Features</h2>\n\n      <ul>\n        <li>Automatic restarting of application.</li>\n        <li>Detects default file extension to monitor.</li>\n        <li>Default support for node but easy to run any executable, such as python, ruby, make, etc.\n        </li>\n        <li>Ignoring specific files or directories.</li>\n        <li>Watch specific directories.</li>\n        <li>Works with server applications or one time run utilities and REPLs.</li>\n        <li>Scriptable through node require statements.</li>\n        <li>Open source and available on <a href=\"https://github.com/remy/nodemon/\">github</a>.</li>\n      </ul>\n\n      <p>Read the full <a href=\"https://github.com/remy/nodemon#nodemon\">documentation</a> or visit the <a\n          href=\"https://github.com/remy/nodemon/blob/master/faq.md\">FAQ</a></p>\n\n\n      <div id=\"sponsors\">\n        Support this project by becoming a sponsor. Your logo will show up here with a link to your website. <a\n          href=\"https://opencollective.com/nodemon/contribute\">Sponsor this project today ❤️</a>\n\n        <div\n          style=\"display: flex; flex-wrap: wrap; overflow: hidden; background: white; border-radius: 2px; padding: 20px; margin-top: 40px;\">\n\n          <!--oc--><a data-id='162674' data-tier='1' title='Netpositive' href='https://najlepsibukmacherzy.pl/ranking-legalnych-bukmacherow/'><img alt='Netpositive' src='https://opencollective-production.s3.us-west-1.amazonaws.com/52acecf0-608a-11eb-b17f-5bca7c67fe7b.png' style='object-fit: contain; float: left; margin:12px' height='120' width='120'></a>\n<a data-id='243140' data-tier='1' title='Best online casinos not on GamStop in the UK' href='https://casino-wise.com/'><img alt='Best online casinos not on GamStop in the UK' src='https://opencollective-production.s3.us-west-1.amazonaws.com/account-avatar/f889d209-a931-4c06-a529-fe1f86c411bf/casino-wise-logo.png' style='object-fit: contain; float: left; margin:12px' height='120' width='120'></a>\n<a data-id='270835' data-tier='1' title='TheCasinoDB' href='https://www.thecasinodb.com'><img alt='TheCasinoDB' src='https://opencollective-production.s3.us-west-1.amazonaws.com/account-avatar/7fbc2acb-ba5c-4a5c-99d2-17e205e9a151/8a0f6204-f303-4129-a498-2263fd21e640.png' style='object-fit: contain; float: left; margin:12px' height='120' width='120'></a>\n<a data-id='320564' data-tier='1' title='Goread.io' href='https://goread.io/buy-instagram-followers'><img alt='Goread.io' src='https://opencollective-production.s3.us-west-1.amazonaws.com/7d1302a0-0f33-11ed-a094-3dca78aec7cd.png' style='object-fit: contain; float: left; margin:12px' height='120' width='120'></a>\n<a data-id='322445' data-tier='1' title='Best Australian online casinos. Reviewed by Correct Casinos.' href='https://www.correctcasinos.com/australian-online-casinos/'><img alt='Best Australian online casinos. Reviewed by Correct Casinos.' src='https://opencollective-production.s3.us-west-1.amazonaws.com/fef95200-1551-11ed-ba3f-410c614877c8.png' style='object-fit: contain; float: left; margin:12px' height='120' width='120'></a>\n<a data-id='367236' data-tier='1' title='nongamstopcasinos.net' href='https://www.pieria.co.uk/'><img alt='nongamstopcasinos.net' src='https://opencollective-production.s3.us-west-1.amazonaws.com/fb8b5ba0-3904-11ed-8516-edd7b7687a36.png' style='object-fit: contain; float: left; margin:12px' height='120' width='120'></a>\n<a data-id='411448' data-tier='1' title='Buy Instagram Likes' href='https://poprey.com/'><img alt='Buy Instagram Likes' src='https://opencollective-production.s3.us-west-1.amazonaws.com/fe650970-c21c-11ec-a499-b55e54a794b4.png' style='object-fit: contain; float: left; margin:12px' height='120' width='120'></a>\n<a data-id='423738' data-tier='1' title='OnlineCasinosSpelen' href='https://onlinecasinosspelen.com'><img alt='OnlineCasinosSpelen' src='https://opencollective-production.s3.us-west-1.amazonaws.com/account-avatar/47e87426-6a55-4f69-9fb5-4e5032dc35a8/5d10dd22-320e-47d4-84e6-d144874f1f5f.png' style='object-fit: contain; float: left; margin:12px' height='120' width='120'></a>\n<a data-id='424449' data-tier='1' title='Beoordelen van nieuwe online casino&apos;s 2023' href='https://Nieuwe-Casinos.net'><img alt='Beoordelen van nieuwe online casino&apos;s 2023' src='https://opencollective-production.s3.us-west-1.amazonaws.com/account-avatar/b803f279-c2a2-42da-8f05-d23e73cb8b26/aba64d6d-97e8-468c-b598-db08e0a134c5.png' style='object-fit: contain; float: left; margin:12px' height='120' width='120'></a>\n<a data-id='453050' data-tier='1' title='Buy real Instagram followers from Twicsy starting at only $2.97. Twicsy has been voted the best site to buy followers from the likes of US Magazine.' href='https://twicsy.com/buy-instagram-followers'><img alt='Buy real Instagram followers from Twicsy starting at only $2.97. Twicsy has been voted the best site to buy followers from the likes of US Magazine.' src='https://opencollective-production.s3.us-west-1.amazonaws.com/account-avatar/f07b6f83-d0ed-43c6-91ae-ec8fa90512cd/twicsy-followers.png' style='object-fit: contain; float: left; margin:12px' height='120' width='120'></a>\n<a data-id='462750' data-tier='1' title='SocialWick offers the best Instagram Followers in the market. If you are looking to boost your organic growth, buy Instagram followers from SocialWick' href='https://www.socialwick.com/instagram/followers'><img alt='SocialWick offers the best Instagram Followers in the market. If you are looking to boost your organic growth, buy Instagram followers from SocialWick' src='https://opencollective-production.s3.us-west-1.amazonaws.com/account-avatar/4a977a23-f63a-489a-891b-c0eb8cab1cb4/icon.png' style='object-fit: contain; float: left; margin:12px' height='120' width='120'></a>\n<a data-id='501897' data-tier='1' title='Buy Telegram Members' href='https://buycheapestfollowers.com/buy-telegram-channel-members'><img alt='Buy Telegram Members' src='https://github-production-user-asset-6210df.s3.amazonaws.com/13700/286696172-747dca05-a1e8-4d93-a9e9-95054d1566df.png' style='object-fit: contain; float: left; margin:12px' height='120' width='120'></a>\n<a data-id='504258' data-tier='1' title='We review the entire iGaming industry from A to Z' href='https://casinolandia.com'><img alt='We review the entire iGaming industry from A to Z' src='https://opencollective-production.s3.us-west-1.amazonaws.com/account-avatar/5f858add-77f1-47a2-b577-39eecb299c8c/Logo264.jpg' style='object-fit: contain; float: left; margin:12px' height='120' width='120'></a>\n<a data-id='525119' data-tier='1' title='CryptoCasinos.online' href='https://cryptocasinos.online/'><img alt='CryptoCasinos.online' src='https://opencollective-production.s3.us-west-1.amazonaws.com/account-avatar/97712948-3b1b-4026-a109-257d879baa23/CryptoCasinos.Online-FBcover18.jpg' style='object-fit: contain; float: left; margin:12px' height='120' width='120'></a>\n<a data-id='540890' data-tier='1' title='No deposit casino promo Codes 2024 - The best online Casinos websites. No deposit bonus codes, Free Spins and Promo Codes. Stake, Roobet, Jackpotcity and more.' href='https://www.ownedcore.com/casino'><img alt='No deposit casino promo Codes 2024 - The best online Casinos websites. No deposit bonus codes, Free Spins and Promo Codes. Stake, Roobet, Jackpotcity and more.' src='https://opencollective-production.s3.us-west-1.amazonaws.com/account-avatar/8bd4b78c-95e2-4c41-b4f4-d7fd6c0e12cd/logo4-e6140c27.webp' style='object-fit: contain; float: left; margin:12px' height='120' width='120'></a>\n<a data-id='541128' data-tier='1' title='Online casino.' href='https://www.fruityking.co.nz'><img alt='Online casino.' src='https://opencollective-production.s3.us-west-1.amazonaws.com/account-avatar/7cde3c6f-052c-41bb-93f0-8be187682791/10e42029-c513-4edd-ac24-a8e41d697a96.png' style='object-fit: contain; float: left; margin:12px' height='120' width='120'></a>\n<a data-id='579911' data-tier='1' title='Boost your social media presence effortlessly with top-quality Instagram and TikTok followers and likes.' href='https://leofame.com/buy-instagram-followers'><img alt='Boost your social media presence effortlessly with top-quality Instagram and TikTok followers and likes.' src='https://opencollective-production.s3.us-west-1.amazonaws.com/account-avatar/186c0e19-b195-4228-901a-ab1b70d63ee5/WhatsApp%20Image%202024-06-21%20at%203.50.43%20AM.jpg' style='object-fit: contain; float: left; margin:12px' height='120' width='120'></a>\n<a data-id='587050' data-tier='1' title='Social Media Management and all kinds of followers' href='https://www.socialfollowers.uk/buy-tiktok-followers/'><img alt='Social Media Management and all kinds of followers' src='https://opencollective-production.s3.us-west-1.amazonaws.com/account-avatar/8941f043-5d00-4e33-a1fd-f2d27ca54963/Social%20Followers%20Uk%20logo%20black.png' style='object-fit: contain; float: left; margin:12px' height='120' width='120'></a>\n<a data-id='594768' data-tier='1' title='Betwinner is an online bookmaker offering sports betting, casino games, and more.' href='https://guidebook.betwinner.com/'><img alt='Betwinner is an online bookmaker offering sports betting, casino games, and more.' src='https://opencollective-production.s3.us-west-1.amazonaws.com/account-avatar/82cab29a-7002-4924-83bf-2eecb03d07c4/0x0.png' style='object-fit: contain; float: left; margin:12px' height='120' width='120'></a>\n<a data-id='602382' data-tier='1' title='At Buzzoid, you can buy Instagram followers quickly, safely, and easily with just a few clicks. Rated world&apos;s #1 IG service since 2012.' href='https://buzzoid.com/buy-instagram-followers/'><img alt='At Buzzoid, you can buy Instagram followers quickly, safely, and easily with just a few clicks. Rated world&apos;s #1 IG service since 2012.' src='https://opencollective-production.s3.us-west-1.amazonaws.com/account-avatar/f77464f7-0457-451a-b29d-8e3b161ce83f/285fbc9f-6461-4393-8942-da62d1bed968.png' style='object-fit: contain; float: left; margin:12px' height='120' width='120'></a>\n<a data-id='608094' data-tier='1' title='Zamsino.com' href='https://zamsino.com/'><img alt='Zamsino.com' src='https://opencollective-production.s3.us-west-1.amazonaws.com/account-avatar/e3e99af5-a024-4d85-8594-8fd22e506bc9/Zamsino.com%20Logo.png' style='object-fit: contain; float: left; margin:12px' height='120' width='120'></a>\n<a data-id='620398' data-tier='1' title='Reviewing and comparing online casinos available to Finnish players. In addition, we publish relevant news and blog posts about the world of iGaming.' href='https://uusimmatkasinot.com/'><img alt='Reviewing and comparing online casinos available to Finnish players. In addition, we publish relevant news and blog posts about the world of iGaming.' src='https://opencollective-production.s3.us-west-1.amazonaws.com/account-avatar/d5326d0f-3cde-41f4-b480-78ef8a2fb015/Uusimmatkasinot_head_siteicon.png' style='object-fit: contain; float: left; margin:12px' height='120' width='120'></a>\n<a data-id='646075' data-tier='1' title='Buzzvoice is your one-stop shop for all your social media marketing needs. With Buzzvoice, you can buy followers, comments, likes, video views and more!' href='https://buzzvoice.com/'><img alt='Buzzvoice is your one-stop shop for all your social media marketing needs. With Buzzvoice, you can buy followers, comments, likes, video views and more!' src='https://opencollective-production.s3.us-west-1.amazonaws.com/acd68da0-e71e-11ec-a84e-fd82f80383c1.jpg' style='object-fit: contain; float: left; margin:12px' height='120' width='120'></a>\n<a data-id='648524' data-tier='1' title='' href='https://www.c19.cl/'><img alt='' src='https://opencollective-production.s3.us-west-1.amazonaws.com/account-avatar/01b96d4c-4852-4499-8c70-e3ec57d0c58c/2024-05-09_17-27%20(1).png' style='object-fit: contain; float: left; margin:12px' height='120' width='120'></a>\n<a data-id='653711' data-tier='1' title='SocialBoosting: Buy Instagram &amp; TikTok Followers, Likes, Views' href='https://www.socialboosting.com/'><img alt='SocialBoosting: Buy Instagram &amp; TikTok Followers, Likes, Views' src='https://opencollective-production.s3.us-west-1.amazonaws.com/account-avatar/80a54dfd-8952-4851-8cab-dcfa4a8a0a87/favicon.gif' style='object-fit: contain; float: left; margin:12px' height='120' width='120'></a>\n<a data-id='655295' data-tier='1' title='Ігрові автомати онлайн' href='https://casino.ua/casino/slots/'><img alt='Ігрові автомати онлайн' src='https://opencollective-production.s3.us-west-1.amazonaws.com/account-avatar/3c8fa725-e203-4c57-933c-0a884527fd5b/images.jpg' style='object-fit: contain; float: left; margin:12px' height='120' width='120'></a>\n<a data-id='673849' data-tier='1' title='Kasinohai.com' href='https://www.kasinohai.com/nettikasinot'><img alt='Kasinohai.com' src='https://opencollective-production.s3.us-west-1.amazonaws.com/account-avatar/ad75f68f-cb97-46f8-8981-bbe81ad6ffc9/51bafb1d-ed66-482f-8a8e-9b7b07d55f96.png' style='object-fit: contain; float: left; margin:12px' height='120' width='120'></a>\n<a data-id='678929' data-tier='1' title='Casino Online Chile' href='https://www.acee.cl/'><img alt='Casino Online Chile' src='https://opencollective-production.s3.us-west-1.amazonaws.com/account-avatar/292c66d6-0c5c-40e8-96f0-900dcdeaaf47/acee-casino-chile.png' style='object-fit: contain; float: left; margin:12px' height='120' width='120'></a>\n<a data-id='709152' data-tier='1' title='casino online chile' href='https://chilecasinoonline.cl/'><img alt='casino online chile' src='https://opencollective-production.s3.us-west-1.amazonaws.com/account-avatar/7f3780b2-b7a7-47aa-9837-c01099585495/casino-online-chile-logo.png' style='object-fit: contain; float: left; margin:12px' height='120' width='120'></a>\n<a data-id='723517' data-tier='1' title='Vanguard Media évalue les casinos en ligne pour joueurs français, testant les sites en France. Nos classements stricts garantissent des casinos fiables et sûrs.' href='https://www.vanguardngr.com/casino/fr/'><img alt='Vanguard Media évalue les casinos en ligne pour joueurs français, testant les sites en France. Nos classements stricts garantissent des casinos fiables et sûrs.' src='https://opencollective-production.s3.us-west-1.amazonaws.com/account-avatar/38065879-ef15-4e67-80a1-bdbb30ecb485/101895f1-ca10-49e3-a297-23a915fb9524.png' style='object-fit: contain; float: left; margin:12px' height='120' width='120'></a>\n<a data-id='727109' data-tier='1' title='Bei Releaf erhalten Sie schnell und diskret Ihr Cannabis Rezept online. Unsere Ärzte prüfen Ihre Angaben und stellen bei Eignung das Rezept aus. Anschließend können Sie legal und sicher medizinisches Cannabis über unsere Partnerapotheken kaufen.' href='https://releaf.com/de'><img alt='Bei Releaf erhalten Sie schnell und diskret Ihr Cannabis Rezept online. Unsere Ärzte prüfen Ihre Angaben und stellen bei Eignung das Rezept aus. Anschließend können Sie legal und sicher medizinisches Cannabis über unsere Partnerapotheken kaufen.' src='https://opencollective-production.s3.us-west-1.amazonaws.com/account-avatar/b686d646-5029-4b4c-8cab-9645ab2679de/9da596d1-f48a-41ec-947d-a64dd8e7529c.png' style='object-fit: contain; float: left; margin:12px' height='120' width='120'></a>\n<a data-id='751387' data-tier='1' title='Download multithreaded HEIC to JPG converter software for Windows 10/11' href='https://www.softorbits.net/convert-heic-to-jpeg/'><img alt='Download multithreaded HEIC to JPG converter software for Windows 10/11' src='https://opencollective-production.s3.us-west-1.amazonaws.com/account-avatar/34c7f097-4c59-4be6-a59c-55af13b0bd10/logo-final-square512.png' style='object-fit: contain; float: left; margin:12px' height='120' width='120'></a>\n<a data-id='753333' data-tier='1' title='We specialize in the online gambling industry, helping players access reliable and verified information about the best online casinos and pokies in Australia. Our team tests casinos and games, collects user reviews from Trustpilot, and organizes them in o' href='https://au.trustpilot.com/review/bestpayidpokies.net'><img alt='We specialize in the online gambling industry, helping players access reliable and verified information about the best online casinos and pokies in Australia. Our team tests casinos and games, collects user reviews from Trustpilot, and organizes them in o' src='https://opencollective-production.s3.us-west-1.amazonaws.com/account-avatar/985a0ae7-54c3-4680-8816-bc8d656f7562/payidpokies.png' style='object-fit: contain; float: left; margin:12px' height='120' width='120'></a>\n<a data-id='754359' data-tier='1' title='Wolf Winner Casino' href='https://www.wolfwinner.fun/en'><img alt='Wolf Winner Casino' src='https://opencollective-production.s3.us-west-1.amazonaws.com/account-avatar/556e09fb-d232-4c99-9644-9d28e1cfe27b/wolf-winner-casino-logo.png' style='object-fit: contain; float: left; margin:12px' height='120' width='120'></a>\n<a data-id='756605' data-tier='1' title='AUCrazyVegas' href='https://au.crazyvegas.com/'><img alt='AUCrazyVegas' src='https://opencollective-production.s3.us-west-1.amazonaws.com/account-avatar/be59e9fa-a83d-4244-9e74-f54b7f454e14/au.png' style='object-fit: contain; float: left; margin:12px' height='120' width='120'></a>\n<a data-id='757116' data-tier='1' title='iDealeCasinos' href='https://idealecasinos.com/'><img alt='iDealeCasinos' src='https://opencollective-production.s3.us-west-1.amazonaws.com/account-avatar/907841d3-435e-44b4-9684-c33fd8635ece/ideale-casinos-square-white-logo-300.png' style='object-fit: contain; float: left; margin:12px' height='120' width='120'></a>\n<a data-id='757154' data-tier='1' title='' href='https://nl.trustpilot.com/review/buitenlandsecasino.vip'><img alt='' src='https://opencollective-production.s3.us-west-1.amazonaws.com/account-avatar/9465308a-8e44-4606-af5d-5a81a3c6567b/ChatGPT%20Image%20Nov%2015%2C%202025%2C%2002_53_25%20PM.png' style='object-fit: contain; float: left; margin:12px' height='120' width='120'></a>\n<a data-id='760968' data-tier='1' title='BetPokies.co.nz is your New Zealand guide in the world of online gambling. Our site was created by gamblers for gamblers.' href='https://nz.trustpilot.com/review/betpokies.co.nz'><img alt='BetPokies.co.nz is your New Zealand guide in the world of online gambling. Our site was created by gamblers for gamblers.' src='https://opencollective-production.s3.us-west-1.amazonaws.com/117c78d0-973e-11ed-b663-5b4207ae3c06.png' style='object-fit: contain; float: left; margin:12px' height='120' width='120'></a>\n<a data-id='765806' data-tier='1' title='one x bet - Arabic betting site' href='https://xn----ymcbek6cvgvaq.com/'><img alt='one x bet - Arabic betting site' src='https://opencollective-production.s3.us-west-1.amazonaws.com/account-avatar/529647a4-6230-4013-bcc5-b5855158c022/ChatGPT%20Image%20Sep%2030%2C%202025%2C%2001_29_18%20PM.jpg' style='object-fit: contain; float: left; margin:12px' height='120' width='120'></a>\n<a data-id='766416' data-tier='1' title='Online Casino Zonder Registratie' href='https://nl.trustpilot.com/review/zonderregistratiecasinos.com'><img alt='Online Casino Zonder Registratie' src='https://opencollective-production.s3.us-west-1.amazonaws.com/account-avatar/cf382ddc-627b-4bd9-8870-43ee28d2a628/casino-zonder-registratie.png' style='object-fit: contain; float: left; margin:12px' height='120' width='120'></a>\n<a data-id='767300' data-tier='1' title='We test dozens of casinos every month and select the coolest ones for Australian players. ' href='https://au.trustpilot.com/review/payid-casino.net'><img alt='We test dozens of casinos every month and select the coolest ones for Australian players. ' src='https://opencollective-production.s3.us-west-1.amazonaws.com/account-avatar/ecd8a5f4-fd86-4903-a512-cbfaff35e7ef/payidpokiessites.png' style='object-fit: contain; float: left; margin:12px' height='120' width='120'></a>\n<a data-id='771618' data-tier='1' title='Pokies Reviews' href='https://au.trustpilot.com/review/pokiesgambler.com'><img alt='Pokies Reviews' src='https://opencollective-production.s3.us-west-1.amazonaws.com/account-avatar/a04c9ed0-b1d5-4dbe-a5fd-4cec00567916/pokiesgambler.png' style='object-fit: contain; float: left; margin:12px' height='120' width='120'></a>\n<a data-id='772992' data-tier='1' title='Buy TikTok Comments' href='https://buylikesservices.com/buy-tiktok-custom-comments/'><img alt='Buy TikTok Comments' src='https://opencollective-production.s3.us-west-1.amazonaws.com/account-avatar/1125514e-fc5e-4e1f-a186-a478fa7c3189/6bf0e4e1-f6aa-4d00-a141-f5b2c2642d65.png' style='object-fit: contain; float: left; margin:12px' height='120' width='120'></a>\n<a data-id='780847' data-tier='1' title='Mi misión es la educación y transparencia en el mundo de los casinos online' href='https://www.educatransparencia.cl/'><img alt='Mi misión es la educación y transparencia en el mundo de los casinos online' src='https://opencollective-production.s3.us-west-1.amazonaws.com/account-avatar/c034fdcb-1d17-4c83-8105-f3cfa4f874d6/educalogocito.png' style='object-fit: contain; float: left; margin:12px' height='120' width='120'></a>\n<a data-id='783771' data-tier='1' title='Spreading knowledge about $ETH' href='https://theethereum.wiki'><img alt='Spreading knowledge about $ETH' src='https://opencollective-production.s3.us-west-1.amazonaws.com/account-avatar/bfce6f44-affd-4acd-94c2-bf33797f1cb2/Screenshot%202026-01-28%20at%2014.19.23.png' style='object-fit: contain; float: left; margin:12px' height='120' width='120'></a>\n<a data-id='783792' data-tier='1' title='' href='https://time.now/'><img alt='' src='https://opencollective-production.s3.us-west-1.amazonaws.com/account-avatar/4cca6170-acb2-4b1a-b85b-7715416237cf/time-now-logo3.png' style='object-fit: contain; float: left; margin:12px' height='120' width='120'></a>\n<a data-id='784673' data-tier='1' title='Best online sports betting and casino company.' href='https://global.fun88.com/'><img alt='Best online sports betting and casino company.' src='https://opencollective-production.s3.us-west-1.amazonaws.com/account-avatar/1688ebca-4984-4b9b-a24d-8fdd1233892f/fun88-logo.png' style='object-fit: contain; float: left; margin:12px' height='120' width='120'></a>\n<a data-id='785087' data-tier='1' title='bestecasinozondercruks' href='https://nl.trustpilot.com/review/bestecasinozondercruks.online'><img alt='bestecasinozondercruks' src='https://opencollective-production.s3.us-west-1.amazonaws.com/account-avatar/4948eca9-abd5-49ea-bb70-1ea6053f8663/ChatGPT%20Image%20Dec%2027%2C%202025%2C%2010_22_47%20PM-min.png' style='object-fit: contain; float: left; margin:12px' height='120' width='120'></a>\n<a data-id='787477' data-tier='1' title='Best online sports betting company in Thailand.' href='https://www.fun88thh.com/th/'><img alt='Best online sports betting company in Thailand.' src='https://opencollective-production.s3.us-west-1.amazonaws.com/account-avatar/bbf7174c-fc01-4ce6-86b5-f621e350969d/fun88-logo.png' style='object-fit: contain; float: left; margin:12px' height='120' width='120'></a>\n<a data-id='787478' data-tier='1' title='Best online sports betting company in Vietnam.' href='https://www.fun88vnu.com/vn/'><img alt='Best online sports betting company in Vietnam.' src='https://opencollective-production.s3.us-west-1.amazonaws.com/account-avatar/ed704e1d-3894-48bb-83e3-6094b2c68a5c/fun88-logo.png' style='object-fit: contain; float: left; margin:12px' height='120' width='120'></a>\n<a data-id='787870' data-tier='1' title='We testen elke maand tientallen casino’s en kiezen de beste uit voor Nederlandse spelers.' href='https://nl.trustpilot.com/review/scandicasinos.com'><img alt='We testen elke maand tientallen casino’s en kiezen de beste uit voor Nederlandse spelers.' src='https://opencollective-production.s3.us-west-1.amazonaws.com/account-avatar/115ec975-5575-436a-9406-9ef439dd28c0/scandicasinos.png' style='object-fit: contain; float: left; margin:12px' height='120' width='120'></a>\n<a data-id='787930' data-tier='1' title='ThePokies Net' href='https://au.trustpilot.com/review/thepokies-au.com'><img alt='ThePokies Net' src='https://opencollective-production.s3.us-west-1.amazonaws.com/account-avatar/7981d14b-e79a-45a6-91b5-6040b0077e28/pokiesnet-casino.jpg' style='object-fit: contain; float: left; margin:12px' height='120' width='120'></a>\n<a data-id='789860' data-tier='1' title='Aviator Game Online' href='https://www.trustpilot.com/review/aviatorplay.top'><img alt='Aviator Game Online' src='https://opencollective-production.s3.us-west-1.amazonaws.com/account-avatar/b3cf9a31-607e-4d3f-8b86-0726f4323dae/aviatorr.png' style='object-fit: contain; float: left; margin:12px' height='120' width='120'></a>\n<a data-id='789874' data-tier='1' title='Plinko Game' href='https://www.trustpilot.com/review/plinkoplay.top'><img alt='Plinko Game' src='https://opencollective-production.s3.us-west-1.amazonaws.com/account-avatar/5e953df9-1876-45b6-9ffc-f2009804935b/plinkoo.png' style='object-fit: contain; float: left; margin:12px' height='120' width='120'></a>\n<a data-id='791586' data-tier='1' title='iDEAL Casinos' href='https://nl.trustpilot.com/review/idealcasinos.co.com'><img alt='iDEAL Casinos' src='https://opencollective-production.s3.us-west-1.amazonaws.com/account-avatar/974ae057-b821-4404-b0b7-c85c075996a4/Screen-Shot-2023-03-17-at-10.17.00.png' style='object-fit: contain; float: left; margin:12px' height='120' width='120'></a>\n<a data-id='796704' data-tier='1' title='POLi Pay Casinos' href='https://nz.trustpilot.com/review/surfpokies.com'><img alt='POLi Pay Casinos' src='https://opencollective-production.s3.us-west-1.amazonaws.com/account-avatar/cd762491-d631-4fa3-a49e-bd373e6a338b/polii.png' style='object-fit: contain; float: left; margin:12px' height='120' width='120'></a><!--oc-->\n        </div>\n        <p>Please note that links to the sponsors above are not direct endorsements nor affiliated with any of\n          contributors of the nodemon project.</p>\n      </div>\n    </main>\n    <footer>\n      <p><a href=\"https://github.com/remy/nodemon/issues\">issues</a> &bull; <a\n          href=\"https://github.com/remy/nodemon/\">source code</a> &bull; <a href=\"https://twitter.com/rem\">built by\n          @rem</a></p>\n    </footer>\n  </body>\n\n</html>"
  },
  {
    "path": "website/oc.jq",
    "content": "def getImage:\n\t. as $_ |\n\t{\n      \"206432\": \"https://user-images.githubusercontent.com/13700/127474039-8ba5ac8c-2095-4984-9309-54ff15e95340.png\",\n\t  \"215800\": \"https://user-images.githubusercontent.com/13700/151881982-04677f3d-e2e1-44ee-a168-258b242b1ef4.svg\",\n      \"327241\": \"https://user-images.githubusercontent.com/13700/187039696-e2d8cd59-8b4e-438f-a052-69095212427d.png\",\n      \"348965\": \"https://user-images.githubusercontent.com/13700/199964872-a86bc00b-4273-4251-ae6a-254b0b643d47.jpg\",\n      \"368126\": \"https://user-images.githubusercontent.com/13700/207157616-8b6d3dd2-e7de-4bbf-86b2-d6ad9fb714fb.png\",\n      \"471843\": \"https://github-production-user-asset-6210df.s3.amazonaws.com/13700/277616726-33b554c8-24e0-4570-b8ed-293fb2ab2448.jpg\",\n      \"501897\": \"https://github-production-user-asset-6210df.s3.amazonaws.com/13700/286696172-747dca05-a1e8-4d93-a9e9-95054d1566df.png\",\n      # \"525119\": \"https://github.com/remy/nodemon/assets/13700/820935c0-7844-4ba9-9563-b1c559895c38\",\n      # \"\": \"https://github.com/user-attachments/assets/e25d9ccd-1203-449b-9404-fe7336ac180a\"\n    } | (.[\"\\($_.MemberId)\"] // $_.image)\n;\n\ndef getUrl:\n\t. as $_ | \t{\n      \"327241\": \"https://www.noneedtostudy.com/take-my-online-class/\",\n      \"348965\": \"https://www.testarna.se/casino/utan-svensk-licens/\",\n      \"368126\": \"https://casinofrog.com/ca/online-casino/new/\",\n      \"468969\": \"https://bestnongamstopcasinos.net/\",\n      \"501897\": \"https://buycheapestfollowers.com/buy-telegram-channel-members\",\n      # \"525119\": \"https://finance.yahoo.com/news/30-best-casinos-not-gamstop-091943696.html\",\n      \"532050\": \"https://skweezer.net/buy-instagram-followers\",\n      \"596376\": \"https://buzzoid.com/buy-instagram-followers/\",\n      \"725832\": \"https://www.favbet.ro/ro/casino/pacanele/\",\n      \"751387\": \"https://www.softorbits.net/convert-heic-to-jpeg/\"\n    } | (.[\"\\($_.MemberId)\"] // $_.website)\n;\n\ndef getAlt:\n\t. as $_ | \t{\n      \"319480\": { description: \"casino online stranieri\" },\n      \"321538\": { description: \"bonus benvenuto scommesse\" },\n      \"327241\": { description: \"Do My Online Class - NoNeedToStudy.com\" },\n      \"348965\": { description: \"Testarna\" },\n      \"368126\": { description: \"New casinos 2023\" },\n      \"471843\": { description: \"Aviators\" },\n      \"501897\": { description: \"Buy Telegram Members\" },\n      # \"525119\": { description: \"30 Best Casinos Not on Gamstop in 2024\" },\n      \"532050\": { description: \"buy instagram followers on skweezer.net today\"},\n      \"751387\": { description: \"Download multithreaded HEIC to JPG converter software for Windows 10/11\" },\n    } | (.[\"\\($_.MemberId)\"] // $_) |\n\tif .description then\n\t\t.description\n\telif .name then\n\t\t.name\n\telse\n\t\t\"\"\n\tend | @html\n;\n\ndef tohtml:\n\t\"<a data-id='\\(.MemberId)' data-tier='\\(.tier)' title='\\(getAlt)' href='\\(getUrl)'><img alt='\\(getAlt)' src='\\(getImage)' style='object-fit: contain; float: left; margin:12px' height='120' width='120'></a>\"\n;\n\ndef tomarkdown:\n\"<a title='\\(getAlt)' data-id='\\(.MemberId)' data-tier='\\(.tier)' href='\\(getUrl)'><img alt='\\(getAlt)' src='\\(getImage)' style='object-fit: contain; float: left; margin:12px' height='120' width='120'></a>\";\n\n. + [{\n  # manually added\n  isActive: false,\n  MemberId: \"Online Casinos Australia\",\n  image: true,\n  tier: 1,\n  createdAt: \"2023-09-17 12:00:00\",\n  website: \"https://online-casinosaustralia.com/\",\n  description: \"Online Casinos Australia\",\n  image: \"https://github-production-user-asset-6210df.s3.amazonaws.com/13700/268531585-c2b4e482-0409-4664-9aa2-95a62b0d606d.png\"\n},{\n  isActive: false,\n  tier: 1,\n  MemberId: \"slotozilla\",\n  image: true,\n  createdAt: \"2023-11-29 12:00:00\",\n  website: \"https://www.slotozilla.com/au/free-spins\",\n  description: \"free spins no deposit\",\n  image: \"https://github-production-user-asset-6210df.s3.amazonaws.com/13700/286693953-c68112b6-ebe6-49fd-af6a-5c810a54908d.jpg\"\n}, {\n  isActive: true,\n  tier: 1,\n  MemberId: \"Youraffe\",\n  image: true,\n  createdAt: \"2024-12-13 12:00:00\",\n  website: \"https://zimplerkasinot.net/\",\n  image: \"https://github.com/user-attachments/assets/cbeddc6e-827a-41eb-b669-a0a4575d068a\"\n}, {\n  isActive: true,\n  tier: 1,\n  MemberId: \"Youraffe2\",\n  image: true,\n  createdAt: \"2025-01-13 12:00:00\",\n  website: \"https://verovapaatnettikasinot.net/\",\n  image: \"https://github.com/user-attachments/assets/686bae37-cc29-45e6-b079-ea0bdc101f4e\"\n}\n] |\n\ndef markdown: $markdown;\n\ndef render:\tif markdown then tomarkdown else tohtml end;\n\nsort_by(.tier, .createdAt) | map(select(getImage) | select($date < .lastTransactionAt) | render) | if markdown then .[] else join(\"\\n\") end\n"
  },
  {
    "path": "website/oc.js",
    "content": "const util = require('node:util');\nconst exec = util.promisify(require('node:child_process').exec);\nconst { readFile, writeFile, unlink } = require('fs').promises;\nconst web = require('https');\nconst { resolve } = require('node:path');\nconst { url } = require('node:inspector');\n\nprocess.chdir(resolve(__dirname, '..'));\n\nconst tiers = [26031, 2603];\n\nconst files = {\n  html: './website/index.html',\n  markdown: './README.md',\n  jq: './website/oc.jq',\n};\n\n/**\n * @param {string} out filename to save to\n * @returns Promise<void>\n */\nasync function curl(out) {\n  const res = [];\n  for (const [i, tier] of tiers.entries()) {\n    const url = `https://opencollective.com/nodemon/members/all.json?TierId=${tier}&limit=100&offset=`;\n    let offset = 0;\n    do {\n      let next = await get(url + offset);\n      console.log(url + offset);\n      res.push(...next.map((_) => ({ ..._, tier: i })));\n      offset += next.length;\n      if (next.length === 0) break;\n    } while (offset % 100 === 0);\n  }\n\n  if (res.length === 0) {\n    throw new Error('No results fetched from OpenCollective API');\n  }\n\n  console.log(`Writing ${res.length} members to ${out}`);\n  return writeFile(out, JSON.stringify(res));\n}\n\n/**\n * @param {string} url\n * @returns Promise<any>\n */\nfunction get(url) {\n  return new Promise((resolve, reject) => {\n    web\n      .get(url, (res) => {\n        let contents = '';\n\n        res.on('data', (chunk) => (contents += chunk));\n        res.on('end', () => {\n          try {\n            resolve(JSON.parse(contents));\n          } catch (err) {\n            reject(\n              new Error(`Failed to parse JSON from ${url}: ${err.message}`)\n            );\n          }\n        });\n\n        res.on('error', (err) => {\n          reject(new Error(`Request failed for ${url}: ${err.message}`));\n        });\n      })\n      .on('error', (err) => {\n        reject(new Error(`Connection failed for ${url}: ${err.message}`));\n      });\n  });\n}\n\n/**\n *\n * @param {string} filename\n * @returns Promise<{ markdown: string, html: string >}\n */\nasync function getUpdates(filename) {\n  const date40DaysAgo = new Date(Date.now() - 40 * 24 * 60 * 60 * 1000)\n    .toJSON()\n    .split('T')[0];\n  const { stdout: markdown } = await exec(\n    `cat ${filename} | jq -r --argjson markdown true --arg date \"${date40DaysAgo}\" -f ${files.jq}`\n  );\n  const { stdout: html } = await exec(\n    `cat ${filename} | jq -r --argjson markdown false --arg date \"${date40DaysAgo}\" -f ${files.jq}`\n  );\n\n  return { html: html.trim(), markdown: markdown.trim() };\n}\n\n/**\n * @returns Promise<{ markdown: string, html: string >}\n */\nasync function getContents() {\n  return {\n    html: await readFile(files.html, 'utf-8'),\n    markdown: await readFile(files.markdown, 'utf-8'),\n  };\n}\n\n/**\n * @param {string} insert\n * @param {string} source\n * @param {string} filename\n */\nasync function combine(insert, source, filename) {\n  // `/s` = . matches new line\n\n  // console.log(insert);\n  // console.log('-'.repeat(50));\n\n  const result = source.replace(\n    /<!--oc-->.+<!--oc-->/s,\n    `<!--oc-->${insert}<!--oc-->`\n  );\n  await writeFile(filename, result);\n}\n\n/**\n * @param {string} tmp\n */\nasync function work(tmp) {\n  await curl(tmp);\n\n  const insert = await getUpdates(tmp);\n  const source = await getContents();\n\n  // Use Promise.all to properly await all async operations\n  await Promise.all(\n    ['html', 'markdown'].map(async (type) => {\n      console.log(`Combining ${type} content`);\n      return combine(insert[type], source[type], files[type]);\n    })\n  );\n}\n\nasync function main() {\n  let { stdout: tmp } = await exec('mktemp');\n  tmp = tmp.trim();\n  console.log(`Created temporary file: ${tmp}`);\n\n  try {\n    await work(tmp);\n    console.log('Successfully updated the HTML and Markdown files');\n    // await unlink(tmp);\n    console.log(`Removed temporary file: ${tmp}`);\n  } catch (e) {\n    console.error(`Error during processing: ${e.message}`);\n    console.error(e.stack);\n\n    try {\n      // Attempt to clean up temp file\n      // await unlink(tmp);\n      console.log(`Removed temporary file: ${tmp}`);\n    } catch (unlinkErr) {\n      console.error(\n        `Failed to remove temporary file ${tmp}: ${unlinkErr.message}`\n      );\n    }\n\n    process.exit(1);\n  }\n}\n\nmain().catch((e) => {\n  console.error(`Unhandled error in main: ${e.message}`);\n  console.error(e.stack);\n  process.exit(1);\n});\n"
  },
  {
    "path": "website/style.css",
    "content": "body,\nhtml {\n  margin: 0;\n  min-height: 100%;\n  background: #2b2922;\n  color: #eee;\n  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto,\n    Oxygen-Sans, Ubuntu, Cantarell, 'Helvetica Neue', sans-serif;\n  font-size: 20px;\n  font-weight: 200;\n  line-height: 1.5;\n}\n\nhtml {\n  margin-bottom: 20px;\n}\n\nheader,\nfooter {\n  background: #76d04b;\n  padding: 10px;\n  position: relative;\n  /* background: white; */\n}\n\nfooter p {\n  padding-top: 20px;\n  padding-bottom: 20px;\n}\n\nsvg {\n  width: 200px;\n  height: 200px;\n  margin: 0 auto;\n  padding: 80px 0 0;\n  border: 1px solid #77d04b;\n  display: block;\n  fill: #4f4d3f;\n}\n\nheader,\nfooter a,\nfooter p {\n  color: #4f4d3f;\n}\n\nh1 {\n  padding: 40px 0 0 0;\n  font-weight: 300;\n}\n\nh2 {\n  font-weight: 100;\n}\n\nheader strong {\n  font-weight: 500;\n  font-size: 110%;\n}\n\nheader h1,\nheader h2 {\n  text-align: center;\n}\n\nbody > p,\nh2,\nul {\n  margin: 20px 48px;\n}\n\nmain > ul {\n  padding-left: 60px;\n}\n\ncode {\n  font-weight: 100;\n  font-size: 22px;\n  font-family: 'courier new';\n}\n\npre code {\n  font-family: courier;\n}\n\npre {\n  white-space: pre-wrap;\n  background: #000;\n  border-radius: 4px;\n  padding: 20px 48px;\n}\n\na {\n  color: #fff;\n  font-weight: 400;\n}\n\nfooter {\n  margin-top: 40px;\n  padding: 10px 28px;\n}\n\nfooter p {\n  font-size: 80%;\n  margin-top: 4px;\n  margin-bottom: 4px;\n}\n\nfooter a {\n  padding: 10px;\n}\n\nmain > *,\nfooter > * {\n  max-width: 800px;\n  margin: 20px auto;\n  padding-left: 20px;\n  padding-right: 20px;\n}\n\n@media screen and (max-width: 840px) {\n  pre {\n    border-radius: 0;\n  }\n\n  body > p,\n  h2,\n  ul {\n    margin: 20px 10px;\n  }\n\n  main > ul {\n    margin-left: 0px;\n    padding-left: 48px;\n  }\n\n  footer {\n    padding: 10px 12px;\n  }\n\n  pre,\n  pre code {\n    margin: 10px 0;\n  }\n}\n\n#sponsors {\n  border-top: 1px solid #fff;\n  margin-top: 80px;\n  padding-top: 20px;\n}\n\n#sponsors div {\n  display: flex;\n  flex-direction: row;\n}\n\n#sponsors img {\n  filter: drop-shadow(0px 0px 8px rgba(255, 255, 255, 0.5));\n  margin-right: 20px;\n  border-radius: 2px;\n  height: 120px;\n  object-fit: contain;\n}\n"
  }
]