.
This commit is contained in:
3
qwen/nodejs/node_modules/nodemon/.prettierrc.json
generated
vendored
Normal file
3
qwen/nodejs/node_modules/nodemon/.prettierrc.json
generated
vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
{
|
||||
"singleQuote": true
|
||||
}
|
||||
21
qwen/nodejs/node_modules/nodemon/LICENSE
generated
vendored
Normal file
21
qwen/nodejs/node_modules/nodemon/LICENSE
generated
vendored
Normal file
@@ -0,0 +1,21 @@
|
||||
MIT License
|
||||
|
||||
Copyright (c) 2010 - present, Remy Sharp, https://remysharp.com <remy@remysharp.com>
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
||||
441
qwen/nodejs/node_modules/nodemon/README.md
generated
vendored
Normal file
441
qwen/nodejs/node_modules/nodemon/README.md
generated
vendored
Normal file
@@ -0,0 +1,441 @@
|
||||
<p align="center">
|
||||
<a href="https://nodemon.io/"><img src="https://user-images.githubusercontent.com/13700/35731649-652807e8-080e-11e8-88fd-1b2f6d553b2d.png" alt="Nodemon Logo"></a>
|
||||
</p>
|
||||
|
||||
# nodemon
|
||||
|
||||
nodemon is a tool that helps develop Node.js based applications by automatically restarting the node application when file changes in the directory are detected.
|
||||
|
||||
nodemon 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.
|
||||
|
||||
[](https://npmjs.org/package/nodemon)
|
||||
[](#backers) [](#sponsors)
|
||||
|
||||
# Installation
|
||||
|
||||
Either through cloning with git or by using [npm](http://npmjs.org) (the recommended way):
|
||||
|
||||
```bash
|
||||
npm install -g nodemon # or using yarn: yarn global add nodemon
|
||||
```
|
||||
|
||||
And nodemon will be installed globally to your system path.
|
||||
|
||||
You can also install nodemon as a development dependency:
|
||||
|
||||
```bash
|
||||
npm install --save-dev nodemon # or using yarn: yarn add nodemon -D
|
||||
```
|
||||
|
||||
With 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`.
|
||||
|
||||
# Usage
|
||||
|
||||
nodemon wraps your application, so you can pass all the arguments you would normally pass to your app:
|
||||
|
||||
```bash
|
||||
nodemon [your node app]
|
||||
```
|
||||
|
||||
For CLI options, use the `-h` (or `--help`) argument:
|
||||
|
||||
```bash
|
||||
nodemon -h
|
||||
```
|
||||
|
||||
Using nodemon is simple, if my application accepted a host and port as the arguments, I would start it as so:
|
||||
|
||||
```bash
|
||||
nodemon ./server.js localhost 8080
|
||||
```
|
||||
|
||||
Any output from this script is prefixed with `[nodemon]`, otherwise all output from your application, errors included, will be echoed out as expected.
|
||||
|
||||
You can also pass the `inspect` flag to node through the command line as you would normally:
|
||||
|
||||
```bash
|
||||
nodemon --inspect ./server.js 80
|
||||
```
|
||||
|
||||
If 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)).
|
||||
|
||||
nodemon will also search for the `scripts.start` property in `package.json` (as of nodemon 1.1.x).
|
||||
|
||||
Also check out the [FAQ](https://github.com/remy/nodemon/blob/master/faq.md) or [issues](https://github.com/remy/nodemon/issues) for nodemon.
|
||||
|
||||
## Automatic re-running
|
||||
|
||||
nodemon 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.
|
||||
|
||||
## Manual restarting
|
||||
|
||||
Whilst 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.
|
||||
|
||||
## Config files
|
||||
|
||||
nodemon 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.
|
||||
|
||||
The specificity is as follows, so that a command line argument will always override the config file settings:
|
||||
|
||||
- command line arguments
|
||||
- local config
|
||||
- global config
|
||||
|
||||
A config file can take any of the command line arguments as JSON key values, for example:
|
||||
|
||||
```json
|
||||
{
|
||||
"verbose": true,
|
||||
"ignore": ["*.test.js", "**/fixtures/**"],
|
||||
"execMap": {
|
||||
"rb": "ruby",
|
||||
"pde": "processing --sketch={{pwd}} --run"
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
The 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.
|
||||
|
||||
A further example of options can be seen in [sample-nodemon.md](https://github.com/remy/nodemon/blob/master/doc/sample-nodemon.md)
|
||||
|
||||
### package.json
|
||||
|
||||
If you want to keep all your package configurations in one place, nodemon supports using `package.json` for configuration.
|
||||
Specify 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`:
|
||||
|
||||
```json
|
||||
{
|
||||
"name": "nodemon",
|
||||
"homepage": "http://nodemon.io",
|
||||
"...": "... other standard package.json values",
|
||||
"nodemonConfig": {
|
||||
"ignore": ["**/test/**", "**/docs/**"],
|
||||
"delay": 2500
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
Note that if you specify a `--config` file or provide a local `nodemon.json` any `package.json` config is ignored.
|
||||
|
||||
*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))*.
|
||||
|
||||
## Using nodemon as a module
|
||||
|
||||
Please see [doc/requireable.md](doc/requireable.md)
|
||||
|
||||
## Using nodemon as child process
|
||||
|
||||
Please see [doc/events.md](doc/events.md#Using_nodemon_as_child_process)
|
||||
|
||||
## Running non-node scripts
|
||||
|
||||
nodemon 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`:
|
||||
|
||||
```bash
|
||||
nodemon --exec "python -v" ./app.py
|
||||
```
|
||||
|
||||
Now 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.
|
||||
|
||||
### Default executables
|
||||
|
||||
Using 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.
|
||||
|
||||
To add support for nodemon to know about the `.pl` extension (for Perl), the `nodemon.json` file would add:
|
||||
|
||||
```json
|
||||
{
|
||||
"execMap": {
|
||||
"pl": "perl"
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
Now running the following, nodemon will know to use `perl` as the executable:
|
||||
|
||||
```bash
|
||||
nodemon script.pl
|
||||
```
|
||||
|
||||
It'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.
|
||||
|
||||
## Monitoring multiple directories
|
||||
|
||||
By default nodemon monitors the current working directory. If you want to take control of that option, use the `--watch` option to add specific paths:
|
||||
|
||||
```bash
|
||||
nodemon --watch app --watch libs app/server.js
|
||||
```
|
||||
|
||||
Now 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.
|
||||
|
||||
Nodemon 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`).
|
||||
|
||||
## Specifying extension watch list
|
||||
|
||||
By 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:
|
||||
|
||||
```bash
|
||||
nodemon -e js,pug
|
||||
```
|
||||
|
||||
Now nodemon will restart on any changes to files in the directory (or subdirectories) with the extensions `.js`, `.pug`.
|
||||
|
||||
## Ignoring files
|
||||
|
||||
By 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.
|
||||
|
||||
This can be done via the command line:
|
||||
|
||||
```bash
|
||||
nodemon --ignore lib/ --ignore tests/
|
||||
```
|
||||
|
||||
Or specific files can be ignored:
|
||||
|
||||
```bash
|
||||
nodemon --ignore lib/app.js
|
||||
```
|
||||
|
||||
Patterns can also be ignored (but be sure to quote the arguments):
|
||||
|
||||
```bash
|
||||
nodemon --ignore 'lib/*.js'
|
||||
```
|
||||
|
||||
**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.
|
||||
|
||||
Note 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).
|
||||
|
||||
## Application isn't restarting
|
||||
|
||||
In 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.
|
||||
|
||||
Via the CLI, use either `--legacy-watch` or `-L` for short:
|
||||
|
||||
```bash
|
||||
nodemon -L
|
||||
```
|
||||
|
||||
Though this should be a last resort as it will poll every file it can find.
|
||||
|
||||
## Delaying restarting
|
||||
|
||||
In 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.
|
||||
|
||||
To add an extra throttle, or delay restarting, use the `--delay` command:
|
||||
|
||||
```bash
|
||||
nodemon --delay 10 server.js
|
||||
```
|
||||
|
||||
For more precision, milliseconds can be specified. Either as a float:
|
||||
|
||||
```bash
|
||||
nodemon --delay 2.5 server.js
|
||||
```
|
||||
|
||||
Or using the time specifier (ms):
|
||||
|
||||
```bash
|
||||
nodemon --delay 2500ms server.js
|
||||
```
|
||||
|
||||
The 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.
|
||||
|
||||
If you are setting this value in `nodemon.json`, the value will always be interpreted in milliseconds. E.g., the following are equivalent:
|
||||
|
||||
```bash
|
||||
nodemon --delay 2.5
|
||||
|
||||
{
|
||||
"delay": 2500
|
||||
}
|
||||
```
|
||||
|
||||
## Gracefully reloading down your script
|
||||
|
||||
It is possible to have nodemon send any signal that you specify to your application.
|
||||
|
||||
```bash
|
||||
nodemon --signal SIGHUP server.js
|
||||
```
|
||||
|
||||
Your application can handle the signal as follows.
|
||||
|
||||
```js
|
||||
process.on("SIGHUP", function () {
|
||||
reloadSomeConfiguration();
|
||||
process.kill(process.pid, "SIGTERM");
|
||||
})
|
||||
```
|
||||
|
||||
Please note that nodemon will send this signal to every process in the process tree.
|
||||
|
||||
If 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`.
|
||||
|
||||
```js
|
||||
if (cluster.isMaster) {
|
||||
process.on("SIGHUP", function () {
|
||||
for (const worker of Object.values(cluster.workers)) {
|
||||
worker.process.kill("SIGTERM");
|
||||
}
|
||||
});
|
||||
} else {
|
||||
process.on("SIGHUP", function() {})
|
||||
}
|
||||
```
|
||||
|
||||
## Controlling shutdown of your script
|
||||
|
||||
nodemon 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.
|
||||
|
||||
The 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:
|
||||
|
||||
```js
|
||||
// important to use `on` and not `once` as nodemon can re-send the kill signal
|
||||
process.on('SIGUSR2', function () {
|
||||
gracefulShutdown(function () {
|
||||
process.kill(process.pid, 'SIGTERM');
|
||||
});
|
||||
});
|
||||
```
|
||||
|
||||
Note 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.
|
||||
|
||||
## Triggering events when nodemon state changes
|
||||
|
||||
If 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.
|
||||
|
||||
For example, to trigger a notification on a Mac when nodemon restarts, `nodemon.json` looks like this:
|
||||
|
||||
```json
|
||||
{
|
||||
"events": {
|
||||
"restart": "osascript -e 'display notification \"app restarted\" with title \"nodemon\"'"
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
A 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.
|
||||
|
||||
## Pipe output to somewhere else
|
||||
|
||||
```js
|
||||
nodemon({
|
||||
script: ...,
|
||||
stdout: false // important: this tells nodemon not to output to console
|
||||
}).on('readable', function() { // the `readable` event indicates that data is ready to pick up
|
||||
this.stdout.pipe(fs.createWriteStream('output.txt'));
|
||||
this.stderr.pipe(fs.createWriteStream('err.txt'));
|
||||
});
|
||||
```
|
||||
|
||||
## Using nodemon in your gulp workflow
|
||||
|
||||
Check out the [gulp-nodemon](https://github.com/JacksonGariety/gulp-nodemon) plugin to integrate nodemon with the rest of your project's gulp workflow.
|
||||
|
||||
## Using nodemon in your Grunt workflow
|
||||
|
||||
Check out the [grunt-nodemon](https://github.com/ChrisWren/grunt-nodemon) plugin to integrate nodemon with the rest of your project's grunt workflow.
|
||||
|
||||
## Pronunciation
|
||||
|
||||
> nodemon, is it pronounced: node-mon, no-demon or node-e-mon (like pokémon)?
|
||||
|
||||
Well...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.
|
||||
|
||||
The 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 :)
|
||||
|
||||
## Design principles
|
||||
|
||||
- Fewer flags is better
|
||||
- Works across all platforms
|
||||
- Fewer features
|
||||
- Let individuals build on top of nodemon
|
||||
- Offer all CLI functionality as an API
|
||||
- Contributions must have and pass tests
|
||||
|
||||
Nodemon is not perfect, and CLI arguments has sprawled beyond where I'm completely happy, but perhaps it can be reduced a little one day.
|
||||
|
||||
## FAQ
|
||||
|
||||
See the [FAQ](https://github.com/remy/nodemon/blob/master/faq.md) and please add your own questions if you think they would help others.
|
||||
|
||||
## Backers
|
||||
|
||||
Thank you to all [our backers](https://opencollective.com/nodemon#backer)! 🙏
|
||||
|
||||
[](https://opencollective.com/nodemon#backers)
|
||||
|
||||
## Sponsors
|
||||
|
||||
Support 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)
|
||||
|
||||
<div style="overflow: hidden; margin-bottom: 80px;"><!--oc--><a title='buy instagram followers on skweezer.net today' data-id='532050' data-tier='0' href='https://skweezer.net/buy-instagram-followers'><img alt='buy instagram followers on skweezer.net today' src='https://opencollective-production.s3.us-west-1.amazonaws.com/account-avatar/b0ddcb1b-9054-4220-8d72-05131b28a2bb/logo-skweezer-icon.png' style='object-fit: contain; float: left; margin:12px' height='120' width='120'></a>
|
||||
<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>
|
||||
<a title='KasynoHEX' data-id='177376' data-tier='1' href='https://pl.polskiekasynohex.org/'><img alt='KasynoHEX' src='https://opencollective-production.s3.us-west-1.amazonaws.com/2bb0d6e0-99c8-11ea-9349-199aa0d5d24a.png' style='object-fit: contain; float: left; margin:12px' height='120' width='120'></a>
|
||||
<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>
|
||||
<a title='TheCasinoDB' data-id='270835' data-tier='1' href='https://www.thecasinodb.com'><img alt='TheCasinoDB' src='https://logo.clearbit.com/thecasinodb.com' style='object-fit: contain; float: left; margin:12px' height='120' width='120'></a>
|
||||
<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>
|
||||
<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>
|
||||
<a title='Slotmachineweb.com' data-id='329195' data-tier='1' href='https://www.slotmachineweb.com/'><img alt='Slotmachineweb.com' src='https://opencollective-production.s3.us-west-1.amazonaws.com/172f9eb0-22c2-11ed-a0b5-97427086b4aa.jpg' style='object-fit: contain; float: left; margin:12px' height='120' width='120'></a>
|
||||
<a title='Website dedicated to finding the best and safest licensed online casinos in India' data-id='342390' data-tier='1' href='https://www.ghotala.com/'><img alt='Website dedicated to finding the best and safest licensed online casinos in India' src='https://opencollective-production.s3.us-west-1.amazonaws.com/75afa9e0-4ac6-11ed-8d6a-fdcc8c0d0736.jpg' style='object-fit: contain; float: left; margin:12px' height='120' width='120'></a>
|
||||
<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>
|
||||
<a title='Scommesse777' data-id='370216' data-tier='1' href='https://www.scommesse777.com/'><img alt='Scommesse777' src='https://opencollective-production.s3.us-west-1.amazonaws.com/c0346cb0-7ad4-11ed-a9cf-49dc3536976e.jpg' style='object-fit: contain; float: left; margin:12px' height='120' width='120'></a>
|
||||
<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>
|
||||
<a title='OnlineCasinosSpelen' data-id='423738' data-tier='1' href='https://onlinecasinosspelen.com'><img alt='OnlineCasinosSpelen' src='https://logo.clearbit.com/onlinecasinosspelen.com' style='object-fit: contain; float: left; margin:12px' height='120' width='120'></a>
|
||||
<a title='Beoordelen van nieuwe online casino's 2023' data-id='424449' data-tier='1' href='https://Nieuwe-Casinos.net'><img alt='Beoordelen van nieuwe online casino's 2023' src='https://logo.clearbit.com/Nieuwe-Casinos.net' style='object-fit: contain; float: left; margin:12px' height='120' width='120'></a>
|
||||
<a title='CasinoZonderRegistratie.net - Nederlandse Top Casino's' data-id='424450' data-tier='1' href='https://casinoZonderregistratie.net/'><img alt='CasinoZonderRegistratie.net - Nederlandse Top Casino's' src='https://opencollective-production.s3.us-west-1.amazonaws.com/aeb624c0-7ae7-11ed-8d0e-bda59436695a.png' style='object-fit: contain; float: left; margin:12px' height='120' width='120'></a>
|
||||
<a title='Famoid is a digital marketing agency that specializes in social media services and tools.' data-id='434604' data-tier='1' href='https://famoid.com/'><img alt='Famoid is a digital marketing agency that specializes in social media services and tools.' src='https://logo.clearbit.com/famoid.com' style='object-fit: contain; float: left; margin:12px' height='120' width='120'></a>
|
||||
<a title='ігрові автомати беткінг' data-id='443264' data-tier='1' href='https://betking.com.ua/games/all-slots/'><img alt='ігрові автомати беткінг' src='https://opencollective-production.s3.us-west-1.amazonaws.com/account-avatar/94601d07-3205-4c60-9c2d-9b8194dbefb7/skg-blue.png' style='object-fit: contain; float: left; margin:12px' height='120' width='120'></a>
|
||||
<a title='We are the leading Nearshore Technology Solutions company. We architect and engineer scalable and high-performing software solutions.' data-id='452424' data-tier='1' href='https://www.bairesdev.com/sponsoring-open-source-projects/'><img alt='We are the leading Nearshore Technology Solutions company. We architect and engineer scalable and high-performing software solutions.' src='https://opencollective-production.s3.us-west-1.amazonaws.com/account-avatar/dc38bc3b-7430-4cf7-9b77-36467eb92915/logo8.png' style='object-fit: contain; float: left; margin:12px' height='120' width='120'></a>
|
||||
<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>
|
||||
<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://logo.clearbit.com/socialwick.com' style='object-fit: contain; float: left; margin:12px' height='120' width='120'></a>
|
||||
<a title='Online United States Casinos' data-id='466446' data-tier='1' href='https://www.onlineunitedstatescasinos.com/'><img alt='Online United States Casinos' src='https://logo.clearbit.com/onlineunitedstatescasinos.com' style='object-fit: contain; float: left; margin:12px' height='120' width='120'></a>
|
||||
<a title='Online iGaming platform with reliable and trusted reviews.' data-id='473786' data-tier='1' href='https://onlinecasinohex.ph/'><img alt='Online iGaming platform with reliable and trusted reviews.' src='https://opencollective-production.s3.us-west-1.amazonaws.com/b19cbf10-3a5e-11ed-9713-c7c7fc5beda8.svg' style='object-fit: contain; float: left; margin:12px' height='120' width='120'></a>
|
||||
<a title='Looking to boost your YouTube channel? Buy YouTube subscribers with Views4You and watch your audience grow!' data-id='493616' data-tier='1' href='https://views4you.com/buy-youtube-subscribers/'><img alt='Looking to boost your YouTube channel? Buy YouTube subscribers with Views4You and watch your audience grow!' src='https://logo.clearbit.com/views4you.com' style='object-fit: contain; float: left; margin:12px' height='120' width='120'></a>
|
||||
<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>
|
||||
<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>
|
||||
<a title='UpGrow is the Best Instagram Growth Service in 2024. Get more real Instagram followers with our AI-powered growth engine to get 10x faster results. ' data-id='519002' data-tier='1' href='https://www.upgrow.com/'><img alt='UpGrow is the Best Instagram Growth Service in 2024. Get more real Instagram followers with our AI-powered growth engine to get 10x faster results. ' src='https://opencollective-production.s3.us-west-1.amazonaws.com/account-avatar/63ab7268-5ce4-4e61-b9f1-93a1bd89cd3e/ms-icon-310x310.png' style='object-fit: contain; float: left; margin:12px' height='120' width='120'></a>
|
||||
<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>
|
||||
<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>
|
||||
<a title='Online casino.' data-id='541128' data-tier='1' href='https://www.fruityking.co.nz'><img alt='Online casino.' src='https://logo.clearbit.com/fruityking.co.nz' style='object-fit: contain; float: left; margin:12px' height='120' width='120'></a>
|
||||
<a title='SidesMedia' data-id='558019' data-tier='1' href='https://sidesmedia.com'><img alt='SidesMedia' src='https://logo.clearbit.com/sidesmedia.com' style='object-fit: contain; float: left; margin:12px' height='120' width='120'></a>
|
||||
<a title='Find the social proof you need to reach your audience! Boost conversions. Quickly buy Twitter Followers & more with no sign-up. Taking you to the next' data-id='568449' data-tier='1' href='https://Bulkoid.com/buy-twitter-followers'><img alt='Find the social proof you need to reach your audience! Boost conversions. Quickly buy Twitter Followers & more with no sign-up. Taking you to the next' src='https://logo.clearbit.com/Bulkoid.com' style='object-fit: contain; float: left; margin:12px' height='120' width='120'></a>
|
||||
<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>
|
||||
<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>
|
||||
<a title='Trusted last mile route planning and route optimization' data-id='590147' data-tier='1' href='https://route4me.com/'><img alt='Trusted last mile route planning and route optimization' src='https://opencollective-production.s3.us-west-1.amazonaws.com/account-avatar/237386c3-48a2-47c6-97ac-5f888cdb4cda/Route4MeIconLogo.png' style='object-fit: contain; float: left; margin:12px' height='120' width='120'></a>
|
||||
<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>
|
||||
<a title='Help users to find best and cheapest site to buy Instagram Followers' data-id='598908' data-tier='1' href='https://www.reddit.com/r/TikTokExpert/comments/1dpyujh/whats_the_best_site_to_buy_instagram_likes_views/'><img alt='Help users to find best and cheapest site to buy Instagram Followers' src='https://opencollective-production.s3.us-west-1.amazonaws.com/account-avatar/263abc3a-0841-4694-b24a-788460391613/communityIcon_66mltiw57b4d1.jpg' style='object-fit: contain; float: left; margin:12px' height='120' width='120'></a>
|
||||
<a title='At Buzzoid, you can buy Instagram followers quickly, safely, and easily with just a few clicks. Rated world'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's #1 IG service since 2012.' src='https://logo.clearbit.com/buzzoid.com' style='object-fit: contain; float: left; margin:12px' height='120' width='120'></a>
|
||||
<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>
|
||||
<a title='Feedthebot is an informative resource with free seo tools designed to help webmasters, SEO specialists, marketers, and entrepreneurs navigate and bett' data-id='612702' data-tier='1' href='https://www.feedthebot.org/'><img alt='Feedthebot is an informative resource with free seo tools designed to help webmasters, SEO specialists, marketers, and entrepreneurs navigate and bett' src='https://opencollective-production.s3.us-west-1.amazonaws.com/account-avatar/613fd973-b367-41bb-b253-34d2ebf877e8/logo-feedthebot(2).png' style='object-fit: contain; float: left; margin:12px' height='120' width='120'></a>
|
||||
<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>
|
||||
<a title='Jabka Skin' data-id='634777' data-tier='1' href='https://jabka.skin/'><img alt='Jabka Skin' src='https://opencollective-production.s3.us-west-1.amazonaws.com/account-avatar/4c272505-2e0b-4e93-9693-c7d5c07ea0c6/IMG_0161.png' style='object-fit: contain; float: left; margin:12px' height='120' width='120'></a>
|
||||
<a title='Онлайн казино та БК (ставки на спорт) в Україні' data-id='638974' data-tier='1' href='https://betking.com.ua/'><img alt='Онлайн казино та БК (ставки на спорт) в Україні' src='https://opencollective-production.s3.us-west-1.amazonaws.com/account-avatar/08587758-582c-4136-aba5-2519230960d3/betking.jpg' style='object-fit: contain; float: left; margin:12px' height='120' width='120'></a>
|
||||
<a title='Buy Youtube Views' data-id='641611' data-tier='1' href='https://ssmarket.net/buy-youtube-views'><img alt='Buy Youtube Views' src='https://opencollective-production.s3.us-west-1.amazonaws.com/account-avatar/bbc20da5-6350-4f69-a5a5-33b8d438fe72/favicon_kare.png' style='object-fit: contain; float: left; margin:12px' height='120' width='120'></a>
|
||||
<a title='Prank Caller - #1 Prank Calling App' data-id='642864' data-tier='1' href='https://prankcaller.io'><img alt='Prank Caller - #1 Prank Calling App' src='https://logo.clearbit.com/prankcaller.io' style='object-fit: contain; float: left; margin:12px' height='120' width='120'></a>
|
||||
<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>
|
||||
<a title='At Famety, you can grow your social media following quickly, safely, and easily with just a few clicks. Rated the world’s #1 social media service since 2013.' data-id='646341' data-tier='1' href='https://www.famety.com/'><img alt='At Famety, you can grow your social media following quickly, safely, and easily with just a few clicks. Rated the world’s #1 social media service since 2013.' src='https://opencollective-production.s3.us-west-1.amazonaws.com/account-avatar/cfb851d7-3d7e-451b-b872-b653b28c976f/favicon_001.png' style='object-fit: contain; float: left; margin:12px' height='120' width='120'></a>
|
||||
<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>
|
||||
<a title='non GamStop sites' data-id='649825' data-tier='1' href='https://www.stjamestheatre.co.uk/'><img alt='non GamStop sites' src='https://opencollective-production.s3.us-west-1.amazonaws.com/account-avatar/07eb5953-01b2-41cf-8e33-77b9b6df1477/%D0%97%D0%BD%D1%96%D0%BC%D0%BE%D0%BA%20%D0%B5%D0%BA%D1%80%D0%B0%D0%BD%D0%B0%202025-01-10%20%D0%BE%2015.29.42%20(1)%20(1).jpg' style='object-fit: contain; float: left; margin:12px' height='120' width='120'></a>
|
||||
<a title='Buy Twitter Followers Visit TweSocial' data-id='651653' data-tier='1' href='https://twesocial.com'><img alt='Buy Twitter Followers Visit TweSocial' src='https://logo.clearbit.com/twesocial.com' style='object-fit: contain; float: left; margin:12px' height='120' width='120'></a>
|
||||
<a title='Useful guides about PayID pokies and casino sites for Australians' data-id='653496' data-tier='1' href='https://payid-pokies-sites.com/'><img alt='Useful guides about PayID pokies and casino sites for Australians' src='https://opencollective-production.s3.us-west-1.amazonaws.com/account-avatar/3542b01b-6b66-488b-a641-e35720fd5453/images.png' style='object-fit: contain; float: left; margin:12px' height='120' width='120'></a>
|
||||
<a title='Buy Instagram and TikTok followers on SocialBoosting!' data-id='653711' data-tier='1' href='https://www.socialboosting.com/buy-tiktok-followers'><img alt='Buy Instagram and TikTok followers on SocialBoosting!' src='https://logo.clearbit.com/socialboosting.com' style='object-fit: contain; float: left; margin:12px' height='120' width='120'></a>
|
||||
<a title='Buy Youtube Subscribers from the #1 rated company. Our exclusive high quality Youtube subscribers come with a lifetime guarantee!' data-id='654211' data-tier='1' href='https://mysocialfollowing.com/youtube/subscribers.php'><img alt='Buy Youtube Subscribers from the #1 rated company. Our exclusive high quality Youtube subscribers come with a lifetime guarantee!' src='https://opencollective-production.s3.us-west-1.amazonaws.com/account-avatar/eb5da272-eba5-49b7-b26e-d0271809edac/logo.png' style='object-fit: contain; float: left; margin:12px' height='120' width='120'></a>
|
||||
<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>
|
||||
<a title='Best Casinos not on Gamstop in the UK 2025 – Safe & Trusted' data-id='658676' data-tier='1' href='https://www.vso.org.uk/'><img alt='Best Casinos not on Gamstop in the UK 2025 – Safe & Trusted' src='https://opencollective-production.s3.us-west-1.amazonaws.com/account-avatar/e8cda2e8-2516-491a-8a7f-0fa5fe94ed49/125%D1%85125%20(1).jpg' style='object-fit: contain; float: left; margin:12px' height='120' width='120'></a>
|
||||
<a title='MagicUGC is the Best AI UGC Video Generator. Trained on billions of views, MagicUGC creates TikTok & IG-ready videos with 500+ AI actors and proven viral hooks. Generate AI videos in 35+ languages, auto-test unlimited variations, and scale UGC marketing.' data-id='661239' data-tier='1' href='https://www.magicugc.com/'><img alt='MagicUGC is the Best AI UGC Video Generator. Trained on billions of views, MagicUGC creates TikTok & IG-ready videos with 500+ AI actors and proven viral hooks. Generate AI videos in 35+ languages, auto-test unlimited variations, and scale UGC marketing.' src='https://opencollective-production.s3.us-west-1.amazonaws.com/account-avatar/853ae26b-75ac-49bd-8676-0060212f42cb/MagicUGC-logo-rounded%20(1).png' style='object-fit: contain; float: left; margin:12px' height='120' width='120'></a>
|
||||
<a title='Buy Instagram Followers at UseViral' data-id='661787' data-tier='1' href='https://useviral.com/buy-instagram-followers'><img alt='Buy Instagram Followers at UseViral' src='https://logo.clearbit.com/useviral.com' style='object-fit: contain; float: left; margin:12px' height='120' width='120'></a>
|
||||
<a title='We help improve visibility in social networks. ' data-id='663482' data-tier='1' href='https://socialboss.org/'><img alt='We help improve visibility in social networks. ' src='https://opencollective-production.s3.us-west-1.amazonaws.com/account-avatar/48fef73d-509e-47d4-a790-0f6d371338f1/socialboss%20logo.png' style='object-fit: contain; float: left; margin:12px' height='120' width='120'></a>
|
||||
<a title='We are a Software Company that delivers App Development, AI/ML integrations, and Data analytics, by adding the best Engineering teams' data-id='669750' data-tier='1' href='https://www.clickittech.com/'><img alt='We are a Software Company that delivers App Development, AI/ML integrations, and Data analytics, by adding the best Engineering teams' src='https://opencollective-production.s3.us-west-1.amazonaws.com/account-avatar/b01bfc96-cb20-4f49-b3b2-55088f3f9efd/image%20(2).png' style='object-fit: contain; float: left; margin:12px' height='120' width='120'></a>
|
||||
<a title='Kasinohai.com' data-id='673849' data-tier='1' href='https://www.kasinohai.com/nettikasinot'><img alt='Kasinohai.com' src='https://logo.clearbit.com/kasinohai.com' style='object-fit: contain; float: left; margin:12px' height='120' width='120'></a>
|
||||
<a title='Casino Online Chile 2025' data-id='678929' data-tier='1' href='https://www.acee.cl/'><img alt='Casino Online Chile 2025' 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><!--oc-->
|
||||
</div>
|
||||
|
||||
Please note that links to the sponsors above are not direct endorsements nor affiliated with any of contributors of the nodemon project.
|
||||
|
||||
# License
|
||||
|
||||
MIT [http://rem.mit-license.org](http://rem.mit-license.org)
|
||||
16
qwen/nodejs/node_modules/nodemon/bin/nodemon.js
generated
vendored
Executable file
16
qwen/nodejs/node_modules/nodemon/bin/nodemon.js
generated
vendored
Executable file
@@ -0,0 +1,16 @@
|
||||
#!/usr/bin/env node
|
||||
|
||||
const cli = require('../lib/cli');
|
||||
const nodemon = require('../lib/');
|
||||
const options = cli.parse(process.argv);
|
||||
|
||||
nodemon(options);
|
||||
|
||||
const fs = require('fs');
|
||||
|
||||
// checks for available update and returns an instance
|
||||
const pkg = JSON.parse(fs.readFileSync(__dirname + '/../package.json'));
|
||||
|
||||
if (pkg.version.indexOf('0.0.0') !== 0 && options.noUpdateNotifier !== true) {
|
||||
require('simple-update-notifier')({ pkg });
|
||||
}
|
||||
BIN
qwen/nodejs/node_modules/nodemon/bin/windows-kill.exe
generated
vendored
Normal file
BIN
qwen/nodejs/node_modules/nodemon/bin/windows-kill.exe
generated
vendored
Normal file
Binary file not shown.
8
qwen/nodejs/node_modules/nodemon/doc/cli/authors.txt
generated
vendored
Normal file
8
qwen/nodejs/node_modules/nodemon/doc/cli/authors.txt
generated
vendored
Normal file
@@ -0,0 +1,8 @@
|
||||
|
||||
Remy Sharp - author and maintainer
|
||||
https://github.com/remy
|
||||
https://twitter.com/rem
|
||||
|
||||
Contributors: https://github.com/remy/nodemon/graphs/contributors ❤︎
|
||||
|
||||
Please help make nodemon better: https://github.com/remy/nodemon/
|
||||
44
qwen/nodejs/node_modules/nodemon/doc/cli/config.txt
generated
vendored
Normal file
44
qwen/nodejs/node_modules/nodemon/doc/cli/config.txt
generated
vendored
Normal file
@@ -0,0 +1,44 @@
|
||||
|
||||
Typically the options to control nodemon are passed in via the CLI and are
|
||||
listed under: nodemon --help options
|
||||
|
||||
nodemon can also be configured via a local and global config file:
|
||||
|
||||
* $HOME/nodemon.json
|
||||
* $PWD/nodemon.json OR --config <file>
|
||||
* nodemonConfig in package.json
|
||||
|
||||
All config options in the .json file map 1-to-1 with the CLI options, so a
|
||||
config could read as:
|
||||
|
||||
{
|
||||
"ext": "*.pde",
|
||||
"verbose": true,
|
||||
"exec": "processing --sketch=game --run"
|
||||
}
|
||||
|
||||
There are a limited number of variables available in the config (since you
|
||||
could use backticks on the CLI to use a variable, backticks won't work in
|
||||
the .json config).
|
||||
|
||||
* {{pwd}} - the current directory
|
||||
* {{filename}} - the filename you pass to nodemon
|
||||
|
||||
For example:
|
||||
|
||||
{
|
||||
"ext": "*.pde",
|
||||
"verbose": true,
|
||||
"exec": "processing --sketch={{pwd}} --run"
|
||||
}
|
||||
|
||||
The global config file is useful for setting up default executables
|
||||
instead of repeating the same option in each of your local configs:
|
||||
|
||||
{
|
||||
"verbose": true,
|
||||
"execMap": {
|
||||
"rb": "ruby",
|
||||
"pde": "processing --sketch={{pwd}} --run"
|
||||
}
|
||||
}
|
||||
29
qwen/nodejs/node_modules/nodemon/doc/cli/help.txt
generated
vendored
Normal file
29
qwen/nodejs/node_modules/nodemon/doc/cli/help.txt
generated
vendored
Normal file
@@ -0,0 +1,29 @@
|
||||
Usage: nodemon [options] [script.js] [args]
|
||||
|
||||
Options:
|
||||
|
||||
--config file ............ alternate nodemon.json config file to use
|
||||
-e, --ext ................ extensions to look for, ie. js,pug,hbs.
|
||||
-x, --exec app ........... execute script with "app", ie. -x "python -v".
|
||||
-w, --watch path ......... watch directory "path" or files. use once for
|
||||
each directory or file to watch.
|
||||
-i, --ignore ............. ignore specific files or directories.
|
||||
-V, --verbose ............ show detail on what is causing restarts.
|
||||
-- <your args> ........... to tell nodemon stop slurping arguments.
|
||||
|
||||
Note: if the script is omitted, nodemon will try to read "main" from
|
||||
package.json and without a nodemon.json, nodemon will monitor .js, .mjs, .coffee,
|
||||
.litcoffee, and .json by default.
|
||||
|
||||
For advanced nodemon configuration use nodemon.json: nodemon --help config
|
||||
See also the sample: https://github.com/remy/nodemon/wiki/Sample-nodemon.json
|
||||
|
||||
Examples:
|
||||
|
||||
$ nodemon server.js
|
||||
$ nodemon -w ../foo server.js apparg1 apparg2
|
||||
$ nodemon --exec python app.py
|
||||
$ nodemon --exec "make build" -e "styl hbs"
|
||||
$ nodemon app.js -- --config # pass config to app.js
|
||||
|
||||
\x1B[1mAll options are documented under: \x1B[4mnodemon --help options\x1B[0m
|
||||
20
qwen/nodejs/node_modules/nodemon/doc/cli/logo.txt
generated
vendored
Normal file
20
qwen/nodejs/node_modules/nodemon/doc/cli/logo.txt
generated
vendored
Normal file
@@ -0,0 +1,20 @@
|
||||
; ;
|
||||
kO. x0
|
||||
KMX, .:x0kc. 'KMN
|
||||
0MMM0: 'oKMMMMMMMXd, ;OMMMX
|
||||
oMMMMMWKOONMMMMMMMMMMMMMWOOKWMMMMMx
|
||||
OMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMK.
|
||||
.oWMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMd.
|
||||
KMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMN
|
||||
KMMMMMMMMMMMMMMW0k0WMMMMMMMMMMMMMMW
|
||||
KMMMMMMMMMMMNk:. :xNMMMMMMMMMMMW
|
||||
KMMMMMMMMMMK OMMMMMMMMMMW
|
||||
KMMMMMMMMMMO xMMMMMMMMMMN
|
||||
KMMMMMMMMMMO xMMMMMMMMMMN
|
||||
KMMMMMMMMMMO xMMMMMMMMMMN
|
||||
KMMMMMMMMMMO xMMMMMMMMMMN
|
||||
KMMMMMMMMMMO xMMMMMMMMMMN
|
||||
KMMMMMMMMMNc ;NMMMMMMMMMN
|
||||
KMMMMMW0o' .lOWMMMMMN
|
||||
KMMKd; ,oKMMN
|
||||
kX: ,K0
|
||||
36
qwen/nodejs/node_modules/nodemon/doc/cli/options.txt
generated
vendored
Normal file
36
qwen/nodejs/node_modules/nodemon/doc/cli/options.txt
generated
vendored
Normal file
@@ -0,0 +1,36 @@
|
||||
|
||||
Configuration
|
||||
--config <file> .......... alternate nodemon.json config file to use
|
||||
--exitcrash .............. exit on crash, allows nodemon to work with other watchers
|
||||
-i, --ignore ............. ignore specific files or directories
|
||||
--no-colors .............. disable color output
|
||||
--signal <signal> ........ use specified kill signal instead of default (ex. SIGTERM)
|
||||
-w, --watch path ......... watch directory "dir" or files. use once for each
|
||||
directory or file to watch
|
||||
--no-update-notifier ..... opt-out of update version check
|
||||
|
||||
Execution
|
||||
-C, --on-change-only ..... execute script on change only, not startup
|
||||
--cwd <dir> .............. change into <dir> before running the script
|
||||
-e, --ext ................ extensions to look for, ie. "js,pug,hbs"
|
||||
-I, --no-stdin ........... nodemon passes stdin directly to child process
|
||||
--spawn .................. force nodemon to use spawn (over fork) [node only]
|
||||
-x, --exec app ........... execute script with "app", ie. -x "python -v"
|
||||
-- <your args> ........... to tell nodemon stop slurping arguments
|
||||
|
||||
Watching
|
||||
-d, --delay n ............ debounce restart for "n" seconds
|
||||
-L, --legacy-watch ....... use polling to watch for changes (typically needed
|
||||
when watching over a network/Docker)
|
||||
-P, --polling-interval ... combined with -L, milliseconds to poll for (default 100)
|
||||
|
||||
Information
|
||||
--dump ................... print full debug configuration
|
||||
-h, --help ............... default help
|
||||
--help <topic> ........... help on a specific feature. Try "--help topics"
|
||||
-q, --quiet .............. minimise nodemon messages to start/stop only
|
||||
-v, --version ............ current nodemon version
|
||||
-V, --verbose ............ show detail on what is causing restarts
|
||||
|
||||
|
||||
> Note that any unrecognised arguments are passed to the executing command.
|
||||
8
qwen/nodejs/node_modules/nodemon/doc/cli/topics.txt
generated
vendored
Normal file
8
qwen/nodejs/node_modules/nodemon/doc/cli/topics.txt
generated
vendored
Normal file
@@ -0,0 +1,8 @@
|
||||
|
||||
options .................. show all available nodemon options
|
||||
config ................... default config options using nodemon.json
|
||||
authors .................. contributors to this project
|
||||
logo ..................... <3
|
||||
whoami ................... I, AM, NODEMON \o/
|
||||
|
||||
Please support https://github.com/remy/nodemon/
|
||||
3
qwen/nodejs/node_modules/nodemon/doc/cli/usage.txt
generated
vendored
Normal file
3
qwen/nodejs/node_modules/nodemon/doc/cli/usage.txt
generated
vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
Usage: nodemon [nodemon options] [script.js] [args]
|
||||
|
||||
See "nodemon --help" for more.
|
||||
9
qwen/nodejs/node_modules/nodemon/doc/cli/whoami.txt
generated
vendored
Normal file
9
qwen/nodejs/node_modules/nodemon/doc/cli/whoami.txt
generated
vendored
Normal file
@@ -0,0 +1,9 @@
|
||||
__/\\\\\_____/\\\_______/\\\\\_______/\\\\\\\\\\\\_____/\\\\\\\\\\\\\\\__/\\\\____________/\\\\_______/\\\\\_______/\\\\\_____/\\\_
|
||||
_\/\\\\\\___\/\\\_____/\\\///\\\____\/\\\////////\\\__\/\\\///////////__\/\\\\\\________/\\\\\\_____/\\\///\\\____\/\\\\\\___\/\\\_
|
||||
_\/\\\/\\\__\/\\\___/\\\/__\///\\\__\/\\\______\//\\\_\/\\\_____________\/\\\//\\\____/\\\//\\\___/\\\/__\///\\\__\/\\\/\\\__\/\\\_
|
||||
_\/\\\//\\\_\/\\\__/\\\______\//\\\_\/\\\_______\/\\\_\/\\\\\\\\\\\_____\/\\\\///\\\/\\\/_\/\\\__/\\\______\//\\\_\/\\\//\\\_\/\\\_
|
||||
_\/\\\\//\\\\/\\\_\/\\\_______\/\\\_\/\\\_______\/\\\_\/\\\///////______\/\\\__\///\\\/___\/\\\_\/\\\_______\/\\\_\/\\\\//\\\\/\\\_
|
||||
_\/\\\_\//\\\/\\\_\//\\\______/\\\__\/\\\_______\/\\\_\/\\\_____________\/\\\____\///_____\/\\\_\//\\\______/\\\__\/\\\_\//\\\/\\\_
|
||||
_\/\\\__\//\\\\\\__\///\\\__/\\\____\/\\\_______/\\\__\/\\\_____________\/\\\_____________\/\\\__\///\\\__/\\\____\/\\\__\//\\\\\\_
|
||||
_\/\\\___\//\\\\\____\///\\\\\/_____\/\\\\\\\\\\\\/___\/\\\\\\\\\\\\\\\_\/\\\_____________\/\\\____\///\\\\\/_____\/\\\___\//\\\\\_
|
||||
_\///_____\/////_______\/////_______\////////////_____\///////////////__\///______________\///_______\/////_______\///_____\/////__
|
||||
125
qwen/nodejs/node_modules/nodemon/index.d.ts
generated
vendored
Normal file
125
qwen/nodejs/node_modules/nodemon/index.d.ts
generated
vendored
Normal file
@@ -0,0 +1,125 @@
|
||||
import type { WatchOptions } from 'chokidar'
|
||||
|
||||
export type NodemonEventHandler =
|
||||
| 'start'
|
||||
| 'crash'
|
||||
| 'exit'
|
||||
| 'quit'
|
||||
| 'restart'
|
||||
| 'config:update'
|
||||
| 'log'
|
||||
| 'readable'
|
||||
| 'stdout'
|
||||
| 'stderr';
|
||||
|
||||
export type NodemonEventListener = {
|
||||
on(event: 'start' | 'crash' | 'readable', listener: () => void): Nodemon;
|
||||
on(event: 'log', listener: (e: NodemonEventLog) => void): Nodemon;
|
||||
on(event: 'stdout' | 'stderr', listener: (e: string) => void): Nodemon;
|
||||
on(event: 'restart', listener: (e?: NodemonEventRestart) => void): Nodemon;
|
||||
on(event: 'quit', listener: (e?: NodemonEventQuit) => void): Nodemon;
|
||||
on(event: 'exit', listener: (e?: number) => void): Nodemon;
|
||||
on(event: 'config:update', listener: (e?: NodemonEventConfig) => void): Nodemon;
|
||||
};
|
||||
|
||||
export type NodemonEventLog = {
|
||||
/**
|
||||
- detail: what you get with nodemon --verbose.
|
||||
- status: subprocess starting, restarting.
|
||||
- fail: is the subprocess crashing.
|
||||
- error: is a nodemon system error.
|
||||
*/
|
||||
type: 'detail' | 'log' | 'status' | 'error' | 'fail';
|
||||
/** the plain text message */
|
||||
message: string;
|
||||
/** contains the terminal escape codes to add colour, plus the "[nodemon]" prefix */
|
||||
colour: string;
|
||||
};
|
||||
|
||||
export interface NodemonEventRestart {
|
||||
matched?: {
|
||||
result: string[];
|
||||
total: number;
|
||||
};
|
||||
}
|
||||
|
||||
export type NodemonEventQuit = 143 | 130;
|
||||
|
||||
export type NodemonEventConfig = {
|
||||
run: boolean;
|
||||
system: {
|
||||
cwd: string;
|
||||
};
|
||||
required: boolean;
|
||||
dirs: string[];
|
||||
timeout: number;
|
||||
options: NodemonConfig;
|
||||
lastStarted: number;
|
||||
loaded: string[];
|
||||
load: (settings: NodemonSettings, ready: (config: NodemonEventConfig) => void) => void;
|
||||
reset: () => void;
|
||||
};
|
||||
|
||||
export interface NodemonExecOptions {
|
||||
script: string;
|
||||
scriptPosition?: number;
|
||||
args?: string[];
|
||||
ext?: string; // "js,mjs" etc (should really support an array of strings, but I don't think it does right now)
|
||||
exec?: string; // node, python, etc
|
||||
execArgs?: string[]; // args passed to node, etc,
|
||||
nodeArgs?: string[]; // args passed to node, etc,
|
||||
}
|
||||
|
||||
export interface NodemonConfig {
|
||||
/** restartable defaults to "rs" as a string the user enters */
|
||||
restartable?: false | string;
|
||||
colours?: boolean;
|
||||
execMap?: { [key: string]: string };
|
||||
ignoreRoot?: string[];
|
||||
watch?: string[];
|
||||
ignore?: string[];
|
||||
stdin?: boolean;
|
||||
runOnChangeOnly?: boolean;
|
||||
verbose?: boolean;
|
||||
signal?: string;
|
||||
stdout?: boolean;
|
||||
watchOptions?: WatchOptions;
|
||||
help?: string;
|
||||
version?: boolean;
|
||||
cwd?: string;
|
||||
dump?: boolean;
|
||||
delay?: number;
|
||||
monitor?: string[];
|
||||
spawn?: boolean;
|
||||
noUpdateNotifier?: boolean;
|
||||
legacyWatch?: boolean;
|
||||
pollingInterval?: number;
|
||||
/** @deprecated as this is "on" by default */
|
||||
js?: boolean;
|
||||
quiet?: boolean;
|
||||
configFile?: string;
|
||||
exitCrash?: boolean;
|
||||
execOptions?: NodemonExecOptions;
|
||||
}
|
||||
|
||||
export interface NodemonSettings extends NodemonConfig, NodemonExecOptions {
|
||||
events?: Record<string, string>;
|
||||
env?: Record<string, string>;
|
||||
}
|
||||
|
||||
export type Nodemon = {
|
||||
(settings: NodemonSettings): Nodemon;
|
||||
removeAllListeners(event: NodemonEventHandler): Nodemon;
|
||||
emit(type: NodemonEventHandler, event?: any): Nodemon;
|
||||
reset(callback: Function): Nodemon;
|
||||
restart(): Nodemon;
|
||||
config: NodemonSettings;
|
||||
} & NodemonEventListener & {
|
||||
[K in keyof NodemonEventListener as "addListener"]: NodemonEventListener[K];
|
||||
} & {
|
||||
[K in keyof NodemonEventListener as "once"]: NodemonEventListener[K];
|
||||
};
|
||||
|
||||
declare const nodemon: Nodemon;
|
||||
|
||||
export = nodemon;
|
||||
7
qwen/nodejs/node_modules/nodemon/jsconfig.json
generated
vendored
Normal file
7
qwen/nodejs/node_modules/nodemon/jsconfig.json
generated
vendored
Normal file
@@ -0,0 +1,7 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"typeRoots": ["./index.d.ts", "./node_modules/@types"],
|
||||
"checkJs": true
|
||||
},
|
||||
"exclude": ["node_modules"]
|
||||
}
|
||||
49
qwen/nodejs/node_modules/nodemon/lib/cli/index.js
generated
vendored
Normal file
49
qwen/nodejs/node_modules/nodemon/lib/cli/index.js
generated
vendored
Normal file
@@ -0,0 +1,49 @@
|
||||
var parse = require('./parse');
|
||||
|
||||
/**
|
||||
* Converts a string to command line args, in particular
|
||||
* groups together quoted values.
|
||||
* This is a utility function to allow calling nodemon as a required
|
||||
* library, but with the CLI args passed in (instead of an object).
|
||||
*
|
||||
* @param {String} string
|
||||
* @return {Array}
|
||||
*/
|
||||
function stringToArgs(string) {
|
||||
var args = [];
|
||||
|
||||
var parts = string.split(' ');
|
||||
var length = parts.length;
|
||||
var i = 0;
|
||||
var open = false;
|
||||
var grouped = '';
|
||||
var lead = '';
|
||||
|
||||
for (; i < length; i++) {
|
||||
lead = parts[i].substring(0, 1);
|
||||
if (lead === '"' || lead === '\'') {
|
||||
open = lead;
|
||||
grouped = parts[i].substring(1);
|
||||
} else if (open && parts[i].slice(-1) === open) {
|
||||
open = false;
|
||||
grouped += ' ' + parts[i].slice(0, -1);
|
||||
args.push(grouped);
|
||||
} else if (open) {
|
||||
grouped += ' ' + parts[i];
|
||||
} else {
|
||||
args.push(parts[i]);
|
||||
}
|
||||
}
|
||||
|
||||
return args;
|
||||
}
|
||||
|
||||
module.exports = {
|
||||
parse: function (argv) {
|
||||
if (typeof argv === 'string') {
|
||||
argv = stringToArgs(argv);
|
||||
}
|
||||
|
||||
return parse(argv);
|
||||
},
|
||||
};
|
||||
230
qwen/nodejs/node_modules/nodemon/lib/cli/parse.js
generated
vendored
Normal file
230
qwen/nodejs/node_modules/nodemon/lib/cli/parse.js
generated
vendored
Normal file
@@ -0,0 +1,230 @@
|
||||
/*
|
||||
|
||||
nodemon is a utility for node, and replaces the use of the executable
|
||||
node. So the user calls `nodemon foo.js` instead.
|
||||
|
||||
nodemon can be run in a number of ways:
|
||||
|
||||
`nodemon` - tries to use package.json#main property to run
|
||||
`nodemon` - if no package, looks for index.js
|
||||
`nodemon app.js` - runs app.js
|
||||
`nodemon --arg app.js --apparg` - eats arg1, and runs app.js with apparg
|
||||
`nodemon --apparg` - as above, but passes apparg to package.json#main (or
|
||||
index.js)
|
||||
`nodemon --debug app.js
|
||||
|
||||
*/
|
||||
|
||||
var fs = require('fs');
|
||||
var path = require('path');
|
||||
var existsSync = fs.existsSync || path.existsSync;
|
||||
|
||||
module.exports = parse;
|
||||
|
||||
/**
|
||||
* Parses the command line arguments `process.argv` and returns the
|
||||
* nodemon options, the user script and the executable script.
|
||||
*
|
||||
* @param {Array<string> | string} argv full process arguments, including `node` leading arg
|
||||
* @return {Object} { options, script, args }
|
||||
*/
|
||||
function parse(argv) {
|
||||
if (typeof argv === 'string') {
|
||||
argv = argv.split(' ');
|
||||
}
|
||||
|
||||
var eat = function (i, args) {
|
||||
if (i <= args.length) {
|
||||
return args.splice(i + 1, 1).pop();
|
||||
}
|
||||
};
|
||||
|
||||
var args = argv.slice(2);
|
||||
var script = null;
|
||||
var nodemonOptions = { scriptPosition: null };
|
||||
|
||||
var nodemonOpt = nodemonOption.bind(null, nodemonOptions);
|
||||
var lookForArgs = true;
|
||||
|
||||
// move forward through the arguments
|
||||
for (var i = 0; i < args.length; i++) {
|
||||
// if the argument looks like a file, then stop eating
|
||||
if (!script) {
|
||||
if (args[i] === '.' || existsSync(args[i])) {
|
||||
script = args.splice(i, 1).pop();
|
||||
|
||||
// we capture the position of the script because we'll reinsert it in
|
||||
// the right place in run.js:command (though I'm not sure we should even
|
||||
// take it out of the array in the first place, but this solves passing
|
||||
// arguments to the exec process for now).
|
||||
nodemonOptions.scriptPosition = i;
|
||||
i--;
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
if (lookForArgs) {
|
||||
// respect the standard way of saying: hereafter belongs to my script
|
||||
if (args[i] === '--') {
|
||||
args.splice(i, 1);
|
||||
nodemonOptions.scriptPosition = i;
|
||||
// cycle back one argument, as we just ate this one up
|
||||
i--;
|
||||
|
||||
// ignore all further nodemon arguments
|
||||
lookForArgs = false;
|
||||
|
||||
// move to the next iteration
|
||||
continue;
|
||||
}
|
||||
|
||||
if (nodemonOpt(args[i], eat.bind(null, i, args)) !== false) {
|
||||
args.splice(i, 1);
|
||||
// cycle back one argument, as we just ate this one up
|
||||
i--;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
nodemonOptions.script = script;
|
||||
nodemonOptions.args = args;
|
||||
|
||||
return nodemonOptions;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Given an argument (ie. from process.argv), sets nodemon
|
||||
* options and can eat up the argument value
|
||||
*
|
||||
* @param {import('../..').NodemonSettings} options object that will be updated
|
||||
* @param {String} arg current argument from argv
|
||||
* @param {Function} eatNext the callback to eat up the next argument in argv
|
||||
* @return {Boolean} false if argument was not a nodemon arg
|
||||
*/
|
||||
function nodemonOption(options, arg, eatNext) {
|
||||
// line separation on purpose to help legibility
|
||||
if (arg === '--help' || arg === '-h' || arg === '-?') {
|
||||
var help = eatNext();
|
||||
options.help = help ? help : true;
|
||||
} else
|
||||
|
||||
if (arg === '--version' || arg === '-v') {
|
||||
options.version = true;
|
||||
} else
|
||||
|
||||
if (arg === '--no-update-notifier') {
|
||||
options.noUpdateNotifier = true;
|
||||
} else
|
||||
|
||||
if (arg === '--spawn') {
|
||||
options.spawn = true;
|
||||
} else
|
||||
|
||||
if (arg === '--dump') {
|
||||
options.dump = true;
|
||||
} else
|
||||
|
||||
if (arg === '--verbose' || arg === '-V') {
|
||||
options.verbose = true;
|
||||
} else
|
||||
|
||||
if (arg === '--legacy-watch' || arg === '-L') {
|
||||
options.legacyWatch = true;
|
||||
} else
|
||||
|
||||
if (arg === '--polling-interval' || arg === '-P') {
|
||||
options.pollingInterval = parseInt(eatNext(), 10);
|
||||
} else
|
||||
|
||||
// Depricated as this is "on" by default
|
||||
if (arg === '--js') {
|
||||
options.js = true;
|
||||
} else
|
||||
|
||||
if (arg === '--quiet' || arg === '-q') {
|
||||
options.quiet = true;
|
||||
} else
|
||||
|
||||
if (arg === '--config') {
|
||||
options.configFile = eatNext();
|
||||
} else
|
||||
|
||||
if (arg === '--watch' || arg === '-w') {
|
||||
if (!options.watch) { options.watch = []; }
|
||||
options.watch.push(eatNext());
|
||||
} else
|
||||
|
||||
if (arg === '--ignore' || arg === '-i') {
|
||||
if (!options.ignore) { options.ignore = []; }
|
||||
options.ignore.push(eatNext());
|
||||
} else
|
||||
|
||||
if (arg === '--exitcrash') {
|
||||
options.exitCrash = true;
|
||||
} else
|
||||
|
||||
if (arg === '--delay' || arg === '-d') {
|
||||
options.delay = parseDelay(eatNext());
|
||||
} else
|
||||
|
||||
if (arg === '--exec' || arg === '-x') {
|
||||
options.exec = eatNext();
|
||||
} else
|
||||
|
||||
if (arg === '--no-stdin' || arg === '-I') {
|
||||
options.stdin = false;
|
||||
} else
|
||||
|
||||
if (arg === '--on-change-only' || arg === '-C') {
|
||||
options.runOnChangeOnly = true;
|
||||
} else
|
||||
|
||||
if (arg === '--ext' || arg === '-e') {
|
||||
options.ext = eatNext();
|
||||
} else
|
||||
|
||||
if (arg === '--no-colours' || arg === '--no-colors') {
|
||||
options.colours = false;
|
||||
} else
|
||||
|
||||
if (arg === '--signal' || arg === '-s') {
|
||||
options.signal = eatNext();
|
||||
} else
|
||||
|
||||
if (arg === '--cwd') {
|
||||
options.cwd = eatNext();
|
||||
|
||||
// go ahead and change directory. This is primarily for nodemon tools like
|
||||
// grunt-nodemon - we're doing this early because it will affect where the
|
||||
// user script is searched for.
|
||||
process.chdir(path.resolve(options.cwd));
|
||||
} else {
|
||||
|
||||
// this means we didn't match
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Given an argument (ie. from nodemonOption()), will parse and return the
|
||||
* equivalent millisecond value or 0 if the argument cannot be parsed
|
||||
*
|
||||
* @param {String} value argument value given to the --delay option
|
||||
* @return {Number} millisecond equivalent of the argument
|
||||
*/
|
||||
function parseDelay(value) {
|
||||
var millisPerSecond = 1000;
|
||||
var millis = 0;
|
||||
|
||||
if (value.match(/^\d*ms$/)) {
|
||||
// Explicitly parse for milliseconds when using ms time specifier
|
||||
millis = parseInt(value, 10);
|
||||
} else {
|
||||
// Otherwise, parse for seconds, with or without time specifier then convert
|
||||
millis = parseFloat(value) * millisPerSecond;
|
||||
}
|
||||
|
||||
return isNaN(millis) ? 0 : millis;
|
||||
}
|
||||
|
||||
43
qwen/nodejs/node_modules/nodemon/lib/config/command.js
generated
vendored
Normal file
43
qwen/nodejs/node_modules/nodemon/lib/config/command.js
generated
vendored
Normal file
@@ -0,0 +1,43 @@
|
||||
module.exports = command;
|
||||
|
||||
/**
|
||||
* command constructs the executable command to run in a shell including the
|
||||
* user script, the command arguments.
|
||||
*
|
||||
* @param {Object} settings Object as:
|
||||
* { execOptions: {
|
||||
* exec: String,
|
||||
* [script: String],
|
||||
* [scriptPosition: Number],
|
||||
* [execArgs: Array<string>]
|
||||
* }
|
||||
* }
|
||||
* @return {Object} an object with the node executable and the
|
||||
* arguments to the command
|
||||
*/
|
||||
function command(settings) {
|
||||
var options = settings.execOptions;
|
||||
var executable = options.exec;
|
||||
var args = [];
|
||||
|
||||
// after "executable" go the exec args (like --debug, etc)
|
||||
if (options.execArgs) {
|
||||
[].push.apply(args, options.execArgs);
|
||||
}
|
||||
|
||||
// then goes the user's script arguments
|
||||
if (options.args) {
|
||||
[].push.apply(args, options.args);
|
||||
}
|
||||
|
||||
// after the "executable" goes the user's script
|
||||
if (options.script) {
|
||||
args.splice((options.scriptPosition || 0) +
|
||||
options.execArgs.length, 0, options.script);
|
||||
}
|
||||
|
||||
return {
|
||||
executable: executable,
|
||||
args: args,
|
||||
};
|
||||
}
|
||||
34
qwen/nodejs/node_modules/nodemon/lib/config/defaults.js
generated
vendored
Normal file
34
qwen/nodejs/node_modules/nodemon/lib/config/defaults.js
generated
vendored
Normal file
@@ -0,0 +1,34 @@
|
||||
var ignoreRoot = require('ignore-by-default').directories();
|
||||
|
||||
// default options for config.options
|
||||
const defaults = {
|
||||
restartable: 'rs',
|
||||
colours: true,
|
||||
execMap: {
|
||||
py: 'python',
|
||||
rb: 'ruby',
|
||||
ts: 'ts-node',
|
||||
// more can be added here such as ls: lsc - but please ensure it's cross
|
||||
// compatible with linux, mac and windows, or make the default.js
|
||||
// dynamically append the `.cmd` for node based utilities
|
||||
},
|
||||
ignoreRoot: ignoreRoot.map((_) => `**/${_}/**`),
|
||||
watch: ['*.*'],
|
||||
stdin: true,
|
||||
runOnChangeOnly: false,
|
||||
verbose: false,
|
||||
signal: 'SIGUSR2',
|
||||
// 'stdout' refers to the default behaviour of a required nodemon's child,
|
||||
// but also includes stderr. If this is false, data is still dispatched via
|
||||
// nodemon.on('stdout/stderr')
|
||||
stdout: true,
|
||||
watchOptions: {},
|
||||
};
|
||||
|
||||
const nodeOptions = process.env.NODE_OPTIONS || ''; // ?
|
||||
|
||||
if (/--(loader|import)\b/.test(nodeOptions)) {
|
||||
delete defaults.execMap.ts;
|
||||
}
|
||||
|
||||
module.exports = defaults;
|
||||
234
qwen/nodejs/node_modules/nodemon/lib/config/exec.js
generated
vendored
Normal file
234
qwen/nodejs/node_modules/nodemon/lib/config/exec.js
generated
vendored
Normal file
@@ -0,0 +1,234 @@
|
||||
const path = require('path');
|
||||
const fs = require('fs');
|
||||
const existsSync = fs.existsSync;
|
||||
const utils = require('../utils');
|
||||
|
||||
module.exports = exec;
|
||||
module.exports.expandScript = expandScript;
|
||||
|
||||
/**
|
||||
* Reads the cwd/package.json file and looks to see if it can load a script
|
||||
* and possibly an exec first from package.main, then package.start.
|
||||
*
|
||||
* @return {Object} exec & script if found
|
||||
*/
|
||||
function execFromPackage() {
|
||||
// doing a try/catch because we can't use the path.exist callback pattern
|
||||
// or we could, but the code would get messy, so this will do exactly
|
||||
// what we're after - if the file doesn't exist, it'll throw.
|
||||
try {
|
||||
// note: this isn't nodemon's package, it's the user's cwd package
|
||||
var pkg = require(path.join(process.cwd(), 'package.json'));
|
||||
if (pkg.main !== undefined) {
|
||||
// no app found to run - so give them a tip and get the feck out
|
||||
return { exec: null, script: pkg.main };
|
||||
}
|
||||
|
||||
if (pkg.scripts && pkg.scripts.start) {
|
||||
return { exec: pkg.scripts.start };
|
||||
}
|
||||
} catch (e) {}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
function replace(map, str) {
|
||||
var re = new RegExp('{{(' + Object.keys(map).join('|') + ')}}', 'g');
|
||||
return str.replace(re, function (all, m) {
|
||||
return map[m] || all || '';
|
||||
});
|
||||
}
|
||||
|
||||
function expandScript(script, ext) {
|
||||
if (!ext) {
|
||||
ext = '.js';
|
||||
}
|
||||
if (script.indexOf(ext) !== -1) {
|
||||
return script;
|
||||
}
|
||||
|
||||
if (existsSync(path.resolve(script))) {
|
||||
return script;
|
||||
}
|
||||
|
||||
if (existsSync(path.resolve(script + ext))) {
|
||||
return script + ext;
|
||||
}
|
||||
|
||||
return script;
|
||||
}
|
||||
|
||||
/**
|
||||
* Discovers all the options required to run the script
|
||||
* and if a custom exec has been passed in, then it will
|
||||
* also try to work out what extensions to monitor and
|
||||
* whether there's a special way of running that script.
|
||||
*
|
||||
* @param {Object} nodemonOptions
|
||||
* @param {Object} execMap
|
||||
* @return {Object} new and updated version of nodemonOptions
|
||||
*/
|
||||
function exec(nodemonOptions, execMap) {
|
||||
if (!execMap) {
|
||||
execMap = {};
|
||||
}
|
||||
|
||||
var options = utils.clone(nodemonOptions || {});
|
||||
var script;
|
||||
|
||||
// if there's no script passed, try to get it from the first argument
|
||||
if (!options.script && (options.args || []).length) {
|
||||
script = expandScript(
|
||||
options.args[0],
|
||||
options.ext && '.' + (options.ext || 'js').split(',')[0]
|
||||
);
|
||||
|
||||
// if the script was found, shift it off our args
|
||||
if (script !== options.args[0]) {
|
||||
options.script = script;
|
||||
options.args.shift();
|
||||
}
|
||||
}
|
||||
|
||||
// if there's no exec found yet, then try to read it from the local
|
||||
// package.json this logic used to sit in the cli/parse, but actually the cli
|
||||
// should be parsed first, then the user options (via nodemon.json) then
|
||||
// finally default down to pot shots at the directory via package.json
|
||||
if (!options.exec && !options.script) {
|
||||
var found = execFromPackage();
|
||||
if (found !== null) {
|
||||
if (found.exec) {
|
||||
options.exec = found.exec;
|
||||
}
|
||||
if (!options.script) {
|
||||
options.script = found.script;
|
||||
}
|
||||
if (Array.isArray(options.args) && options.scriptPosition === null) {
|
||||
options.scriptPosition = options.args.length;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// var options = utils.clone(nodemonOptions || {});
|
||||
script = path.basename(options.script || '');
|
||||
|
||||
var scriptExt = path.extname(script).slice(1);
|
||||
|
||||
var extension = options.ext;
|
||||
if (extension === undefined) {
|
||||
var isJS = scriptExt === 'js' || scriptExt === 'mjs' || scriptExt === 'cjs';
|
||||
extension = isJS || !scriptExt ? 'js,mjs,cjs' : scriptExt;
|
||||
extension += ',json'; // Always watch JSON files
|
||||
}
|
||||
|
||||
var execDefined = !!options.exec;
|
||||
|
||||
// allows the user to simplify cli usage:
|
||||
// https://github.com/remy/nodemon/issues/195
|
||||
// but always give preference to the user defined argument
|
||||
if (!options.exec && execMap[scriptExt] !== undefined) {
|
||||
options.exec = execMap[scriptExt];
|
||||
execDefined = true;
|
||||
}
|
||||
|
||||
options.execArgs = nodemonOptions.execArgs || [];
|
||||
|
||||
if (Array.isArray(options.exec)) {
|
||||
options.execArgs = options.exec;
|
||||
options.exec = options.execArgs.shift();
|
||||
}
|
||||
|
||||
if (options.exec === undefined) {
|
||||
options.exec = 'node';
|
||||
} else {
|
||||
// allow variable substitution for {{filename}} and {{pwd}}
|
||||
var substitution = replace.bind(null, {
|
||||
filename: options.script,
|
||||
pwd: process.cwd(),
|
||||
});
|
||||
|
||||
var newExec = substitution(options.exec);
|
||||
if (
|
||||
newExec !== options.exec &&
|
||||
options.exec.indexOf('{{filename}}') !== -1
|
||||
) {
|
||||
options.script = null;
|
||||
}
|
||||
options.exec = newExec;
|
||||
|
||||
var newExecArgs = options.execArgs.map(substitution);
|
||||
if (newExecArgs.join('') !== options.execArgs.join('')) {
|
||||
options.execArgs = newExecArgs;
|
||||
delete options.script;
|
||||
}
|
||||
}
|
||||
|
||||
if (options.exec === 'node' && options.nodeArgs && options.nodeArgs.length) {
|
||||
options.execArgs = options.execArgs.concat(options.nodeArgs);
|
||||
}
|
||||
|
||||
// note: indexOf('coffee') handles both .coffee and .litcoffee
|
||||
if (
|
||||
!execDefined &&
|
||||
options.exec === 'node' &&
|
||||
scriptExt.indexOf('coffee') !== -1
|
||||
) {
|
||||
options.exec = 'coffee';
|
||||
|
||||
// we need to get execArgs set before the script
|
||||
// for example, in `nodemon --debug my-script.coffee --my-flag`, debug is an
|
||||
// execArg, while my-flag is a script arg
|
||||
var leadingArgs = (options.args || []).splice(0, options.scriptPosition);
|
||||
options.execArgs = options.execArgs.concat(leadingArgs);
|
||||
options.scriptPosition = 0;
|
||||
|
||||
if (options.execArgs.length > 0) {
|
||||
// because this is the coffee executable, we need to combine the exec args
|
||||
// into a single argument after the nodejs flag
|
||||
options.execArgs = ['--nodejs', options.execArgs.join(' ')];
|
||||
}
|
||||
}
|
||||
|
||||
if (options.exec === 'coffee') {
|
||||
// don't override user specified extension tracking
|
||||
if (options.ext === undefined) {
|
||||
if (extension) {
|
||||
extension += ',';
|
||||
}
|
||||
extension += 'coffee,litcoffee';
|
||||
}
|
||||
|
||||
// because windows can't find 'coffee', it needs the real file 'coffee.cmd'
|
||||
if (utils.isWindows) {
|
||||
options.exec += '.cmd';
|
||||
}
|
||||
}
|
||||
|
||||
// allow users to make a mistake on the extension to monitor
|
||||
// converts .js, pug => js,pug
|
||||
// BIG NOTE: user can't do this: nodemon -e *.js
|
||||
// because the terminal will automatically expand the glob against
|
||||
// the file system :(
|
||||
extension = (extension.match(/[^,*\s]+/g) || [])
|
||||
.map((ext) => ext.replace(/^\./, ''))
|
||||
.join(',');
|
||||
|
||||
options.ext = extension;
|
||||
|
||||
if (options.script) {
|
||||
options.script = expandScript(
|
||||
options.script,
|
||||
extension && '.' + extension.split(',')[0]
|
||||
);
|
||||
}
|
||||
|
||||
options.env = {};
|
||||
// make sure it's an object (and since we don't have )
|
||||
if ({}.toString.apply(nodemonOptions.env) === '[object Object]') {
|
||||
options.env = utils.clone(nodemonOptions.env);
|
||||
} else if (nodemonOptions.env !== undefined) {
|
||||
throw new Error('nodemon env values must be an object: { PORT: 8000 }');
|
||||
}
|
||||
|
||||
return options;
|
||||
}
|
||||
93
qwen/nodejs/node_modules/nodemon/lib/config/index.js
generated
vendored
Normal file
93
qwen/nodejs/node_modules/nodemon/lib/config/index.js
generated
vendored
Normal file
@@ -0,0 +1,93 @@
|
||||
/**
|
||||
* Manages the internal config of nodemon, checking for the state of support
|
||||
* with fs.watch, how nodemon can watch files (using find or fs methods).
|
||||
*
|
||||
* This is *not* the user's config.
|
||||
*/
|
||||
var debug = require('debug')('nodemon');
|
||||
var load = require('./load');
|
||||
var rules = require('../rules');
|
||||
var utils = require('../utils');
|
||||
var pinVersion = require('../version').pin;
|
||||
var command = require('./command');
|
||||
var rulesToMonitor = require('../monitor/match').rulesToMonitor;
|
||||
var bus = utils.bus;
|
||||
|
||||
function reset() {
|
||||
rules.reset();
|
||||
|
||||
config.dirs = [];
|
||||
config.options = { ignore: [], watch: [], monitor: [] };
|
||||
config.lastStarted = 0;
|
||||
config.loaded = [];
|
||||
}
|
||||
|
||||
var config = {
|
||||
run: false,
|
||||
system: {
|
||||
cwd: process.cwd(),
|
||||
},
|
||||
required: false,
|
||||
dirs: [],
|
||||
timeout: 1000,
|
||||
options: {},
|
||||
};
|
||||
|
||||
/**
|
||||
* Take user defined settings, then detect the local machine capability, then
|
||||
* look for local and global nodemon.json files and merge together the final
|
||||
* settings with the config for nodemon.
|
||||
*
|
||||
* @param {Object} settings user defined settings for nodemon (typically on
|
||||
* the cli)
|
||||
* @param {Function} ready callback fired once the config is loaded
|
||||
*/
|
||||
config.load = function (settings, ready) {
|
||||
reset();
|
||||
var config = this;
|
||||
load(settings, config.options, config, function (options) {
|
||||
config.options = options;
|
||||
|
||||
if (options.watch.length === 0) {
|
||||
// this is to catch when the watch is left blank
|
||||
options.watch.push('*.*');
|
||||
}
|
||||
|
||||
if (options['watch_interval']) { // jshint ignore:line
|
||||
options.watchInterval = options['watch_interval']; // jshint ignore:line
|
||||
}
|
||||
|
||||
config.watchInterval = options.watchInterval || null;
|
||||
if (options.signal) {
|
||||
config.signal = options.signal;
|
||||
}
|
||||
|
||||
var cmd = command(config.options);
|
||||
config.command = {
|
||||
raw: cmd,
|
||||
string: utils.stringify(cmd.executable, cmd.args),
|
||||
};
|
||||
|
||||
// now run automatic checks on system adding to the config object
|
||||
options.monitor = rulesToMonitor(options.watch, options.ignore, config);
|
||||
|
||||
var cwd = process.cwd();
|
||||
debug('config: dirs', config.dirs);
|
||||
if (config.dirs.length === 0) {
|
||||
config.dirs.unshift(cwd);
|
||||
}
|
||||
|
||||
bus.emit('config:update', config);
|
||||
pinVersion().then(function () {
|
||||
ready(config);
|
||||
}).catch(e => {
|
||||
// this doesn't help testing, but does give exposure on syntax errors
|
||||
console.error(e.stack);
|
||||
setTimeout(() => { throw e; }, 0);
|
||||
});
|
||||
});
|
||||
};
|
||||
|
||||
config.reset = reset;
|
||||
|
||||
module.exports = config;
|
||||
225
qwen/nodejs/node_modules/nodemon/lib/config/load.js
generated
vendored
Normal file
225
qwen/nodejs/node_modules/nodemon/lib/config/load.js
generated
vendored
Normal file
@@ -0,0 +1,225 @@
|
||||
var debug = require('debug')('nodemon');
|
||||
var fs = require('fs');
|
||||
var path = require('path');
|
||||
var exists = fs.exists || path.exists;
|
||||
var utils = require('../utils');
|
||||
var rules = require('../rules');
|
||||
var parse = require('../rules/parse');
|
||||
var exec = require('./exec');
|
||||
var defaults = require('./defaults');
|
||||
|
||||
module.exports = load;
|
||||
module.exports.mutateExecOptions = mutateExecOptions;
|
||||
|
||||
var existsSync = fs.existsSync || path.existsSync;
|
||||
|
||||
function findAppScript() {
|
||||
// nodemon has been run alone, so try to read the package file
|
||||
// or try to read the index.js file
|
||||
|
||||
var pkg =
|
||||
existsSync(path.join(process.cwd(), 'package.json')) &&
|
||||
require(path.join(process.cwd(), 'package.json'));
|
||||
if ((!pkg || pkg.main == undefined) && existsSync('./index.js')) {
|
||||
return 'index.js';
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Load the nodemon config, first reading the global root/nodemon.json, then
|
||||
* the local nodemon.json to the exec and then overwriting using any user
|
||||
* specified settings (i.e. from the cli)
|
||||
*
|
||||
* @param {Object} settings user defined settings
|
||||
* @param {Object} options global options
|
||||
* @param {Object} config the config object to be updated
|
||||
* @param {Function} callback that receives complete config
|
||||
*/
|
||||
function load(settings, options, config, callback) {
|
||||
config.loaded = [];
|
||||
// first load the root nodemon.json
|
||||
loadFile(options, config, utils.home, function (options) {
|
||||
// then load the user's local configuration file
|
||||
if (settings.configFile) {
|
||||
options.configFile = path.resolve(settings.configFile);
|
||||
}
|
||||
loadFile(options, config, process.cwd(), function (options) {
|
||||
// Then merge over with the user settings (parsed from the cli).
|
||||
// Note that merge protects and favours existing values over new values,
|
||||
// and thus command line arguments get priority
|
||||
options = utils.merge(settings, options);
|
||||
|
||||
// legacy support
|
||||
if (!Array.isArray(options.ignore)) {
|
||||
options.ignore = [options.ignore];
|
||||
}
|
||||
|
||||
if (!options.ignoreRoot) {
|
||||
options.ignoreRoot = defaults.ignoreRoot;
|
||||
}
|
||||
|
||||
// blend the user ignore and the default ignore together
|
||||
if (options.ignoreRoot && options.ignore) {
|
||||
if (!Array.isArray(options.ignoreRoot)) {
|
||||
options.ignoreRoot = [options.ignoreRoot];
|
||||
}
|
||||
options.ignore = options.ignoreRoot.concat(options.ignore);
|
||||
} else {
|
||||
options.ignore = defaults.ignore.concat(options.ignore);
|
||||
}
|
||||
|
||||
// add in any missing defaults
|
||||
options = utils.merge(options, defaults);
|
||||
|
||||
if (!options.script && !options.exec) {
|
||||
var found = findAppScript();
|
||||
if (found) {
|
||||
if (!options.args) {
|
||||
options.args = [];
|
||||
}
|
||||
// if the script is found as a result of not being on the command
|
||||
// line, then we move any of the pre double-dash args in execArgs
|
||||
const n =
|
||||
options.scriptPosition === null
|
||||
? options.args.length
|
||||
: options.scriptPosition;
|
||||
|
||||
options.execArgs = (options.execArgs || []).concat(
|
||||
options.args.splice(0, n)
|
||||
);
|
||||
options.scriptPosition = null;
|
||||
|
||||
options.script = found;
|
||||
}
|
||||
}
|
||||
|
||||
mutateExecOptions(options);
|
||||
|
||||
if (options.quiet) {
|
||||
utils.quiet();
|
||||
}
|
||||
|
||||
if (options.verbose) {
|
||||
utils.debug = true;
|
||||
}
|
||||
|
||||
// simplify the ready callback to be called after the rules are normalised
|
||||
// from strings to regexp through the rules lib. Note that this gets
|
||||
// created *after* options is overwritten twice in the lines above.
|
||||
var ready = function (options) {
|
||||
normaliseRules(options, callback);
|
||||
};
|
||||
|
||||
ready(options);
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
function normaliseRules(options, ready) {
|
||||
// convert ignore and watch options to rules/regexp
|
||||
rules.watch.add(options.watch);
|
||||
rules.ignore.add(options.ignore);
|
||||
|
||||
// normalise the watch and ignore arrays
|
||||
options.watch = options.watch === false ? false : rules.rules.watch;
|
||||
options.ignore = rules.rules.ignore;
|
||||
|
||||
ready(options);
|
||||
}
|
||||
|
||||
/**
|
||||
* Looks for a config in the current working directory, and a config in the
|
||||
* user's home directory, merging the two together, giving priority to local
|
||||
* config. This can then be overwritten later by command line arguments
|
||||
*
|
||||
* @param {Function} ready callback to pass loaded settings to
|
||||
*/
|
||||
function loadFile(options, config, dir, ready) {
|
||||
if (!ready) {
|
||||
ready = function () {};
|
||||
}
|
||||
|
||||
var callback = function (settings) {
|
||||
// prefer the local nodemon.json and fill in missing items using
|
||||
// the global options
|
||||
ready(utils.merge(settings, options));
|
||||
};
|
||||
|
||||
if (!dir) {
|
||||
return callback({});
|
||||
}
|
||||
|
||||
var filename = options.configFile || path.join(dir, 'nodemon.json');
|
||||
|
||||
if (config.loaded.indexOf(filename) !== -1) {
|
||||
// don't bother re-parsing the same config file
|
||||
return callback({});
|
||||
}
|
||||
|
||||
fs.readFile(filename, 'utf8', function (err, data) {
|
||||
if (err) {
|
||||
if (err.code === 'ENOENT') {
|
||||
if (!options.configFile && dir !== utils.home) {
|
||||
// if no specified local config file and local nodemon.json
|
||||
// doesn't exist, try the package.json
|
||||
return loadPackageJSON(config, callback);
|
||||
}
|
||||
}
|
||||
return callback({});
|
||||
}
|
||||
|
||||
var settings = {};
|
||||
|
||||
try {
|
||||
settings = JSON.parse(data.toString('utf8').replace(/^\uFEFF/, ''));
|
||||
if (!filename.endsWith('package.json') || settings.nodemonConfig) {
|
||||
config.loaded.push(filename);
|
||||
}
|
||||
} catch (e) {
|
||||
utils.log.fail('Failed to parse config ' + filename);
|
||||
console.error(e);
|
||||
process.exit(1);
|
||||
}
|
||||
|
||||
// options values will overwrite settings
|
||||
callback(settings);
|
||||
});
|
||||
}
|
||||
|
||||
function loadPackageJSON(config, ready) {
|
||||
if (!ready) {
|
||||
ready = () => {};
|
||||
}
|
||||
|
||||
const dir = process.cwd();
|
||||
const filename = path.join(dir, 'package.json');
|
||||
const packageLoadOptions = { configFile: filename };
|
||||
return loadFile(packageLoadOptions, config, dir, (settings) => {
|
||||
ready(settings.nodemonConfig || {});
|
||||
});
|
||||
}
|
||||
|
||||
function mutateExecOptions(options) {
|
||||
// work out the execOptions based on the final config we have
|
||||
options.execOptions = exec(
|
||||
{
|
||||
script: options.script,
|
||||
exec: options.exec,
|
||||
args: options.args,
|
||||
scriptPosition: options.scriptPosition,
|
||||
nodeArgs: options.nodeArgs,
|
||||
execArgs: options.execArgs,
|
||||
ext: options.ext,
|
||||
env: options.env,
|
||||
},
|
||||
options.execMap
|
||||
);
|
||||
|
||||
// clean up values that we don't need at the top level
|
||||
delete options.scriptPosition;
|
||||
delete options.script;
|
||||
delete options.args;
|
||||
delete options.ext;
|
||||
|
||||
return options;
|
||||
}
|
||||
27
qwen/nodejs/node_modules/nodemon/lib/help/index.js
generated
vendored
Normal file
27
qwen/nodejs/node_modules/nodemon/lib/help/index.js
generated
vendored
Normal file
@@ -0,0 +1,27 @@
|
||||
var fs = require('fs');
|
||||
var path = require('path');
|
||||
const supportsColor = require('supports-color');
|
||||
|
||||
module.exports = help;
|
||||
|
||||
const highlight = supportsColor.stdout ? '\x1B\[$1m' : '';
|
||||
|
||||
function help(item) {
|
||||
if (!item) {
|
||||
item = 'help';
|
||||
} else if (item === true) { // if used with -h or --help and no args
|
||||
item = 'help';
|
||||
}
|
||||
|
||||
// cleanse the filename to only contain letters
|
||||
// aka: /\W/g but figured this was eaiser to read
|
||||
item = item.replace(/[^a-z]/gi, '');
|
||||
|
||||
try {
|
||||
var dir = path.join(__dirname, '..', '..', 'doc', 'cli', item + '.txt');
|
||||
var body = fs.readFileSync(dir, 'utf8');
|
||||
return body.replace(/\\x1B\[(.)m/g, highlight);
|
||||
} catch (e) {
|
||||
return '"' + item + '" help can\'t be found';
|
||||
}
|
||||
}
|
||||
1
qwen/nodejs/node_modules/nodemon/lib/index.js
generated
vendored
Normal file
1
qwen/nodejs/node_modules/nodemon/lib/index.js
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
module.exports = require('./nodemon');
|
||||
4
qwen/nodejs/node_modules/nodemon/lib/monitor/index.js
generated
vendored
Normal file
4
qwen/nodejs/node_modules/nodemon/lib/monitor/index.js
generated
vendored
Normal file
@@ -0,0 +1,4 @@
|
||||
module.exports = {
|
||||
run: require('./run'),
|
||||
watch: require('./watch').watch,
|
||||
};
|
||||
287
qwen/nodejs/node_modules/nodemon/lib/monitor/match.js
generated
vendored
Normal file
287
qwen/nodejs/node_modules/nodemon/lib/monitor/match.js
generated
vendored
Normal file
@@ -0,0 +1,287 @@
|
||||
const minimatch = require('minimatch');
|
||||
const path = require('path');
|
||||
const fs = require('fs');
|
||||
const debug = require('debug')('nodemon:match');
|
||||
const utils = require('../utils');
|
||||
|
||||
module.exports = match;
|
||||
module.exports.rulesToMonitor = rulesToMonitor;
|
||||
|
||||
function rulesToMonitor(watch, ignore, config) {
|
||||
var monitor = [];
|
||||
|
||||
if (!Array.isArray(ignore)) {
|
||||
if (ignore) {
|
||||
ignore = [ignore];
|
||||
} else {
|
||||
ignore = [];
|
||||
}
|
||||
}
|
||||
|
||||
if (!Array.isArray(watch)) {
|
||||
if (watch) {
|
||||
watch = [watch];
|
||||
} else {
|
||||
watch = [];
|
||||
}
|
||||
}
|
||||
|
||||
if (watch && watch.length) {
|
||||
monitor = utils.clone(watch);
|
||||
}
|
||||
|
||||
if (ignore) {
|
||||
[].push.apply(
|
||||
monitor,
|
||||
(ignore || []).map(function (rule) {
|
||||
return '!' + rule;
|
||||
})
|
||||
);
|
||||
}
|
||||
|
||||
var cwd = process.cwd();
|
||||
|
||||
// next check if the monitored paths are actual directories
|
||||
// or just patterns - and expand the rule to include *.*
|
||||
monitor = monitor.map(function (rule) {
|
||||
var not = rule.slice(0, 1) === '!';
|
||||
|
||||
if (not) {
|
||||
rule = rule.slice(1);
|
||||
}
|
||||
|
||||
if (rule === '.' || rule === '.*') {
|
||||
rule = '*.*';
|
||||
}
|
||||
|
||||
var dir = path.resolve(cwd, rule);
|
||||
|
||||
try {
|
||||
var stat = fs.statSync(dir);
|
||||
if (stat.isDirectory()) {
|
||||
rule = dir;
|
||||
if (rule.slice(-1) !== '/') {
|
||||
rule += '/';
|
||||
}
|
||||
rule += '**/*';
|
||||
|
||||
// `!not` ... sorry.
|
||||
if (!not) {
|
||||
config.dirs.push(dir);
|
||||
}
|
||||
} else {
|
||||
// ensures we end up in the check that tries to get a base directory
|
||||
// and then adds it to the watch list
|
||||
throw new Error();
|
||||
}
|
||||
} catch (e) {
|
||||
var base = tryBaseDir(dir);
|
||||
if (!not && base) {
|
||||
if (config.dirs.indexOf(base) === -1) {
|
||||
config.dirs.push(base);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (rule.slice(-1) === '/') {
|
||||
// just slap on a * anyway
|
||||
rule += '*';
|
||||
}
|
||||
|
||||
// if the url ends with * but not **/* and not *.*
|
||||
// then convert to **/* - somehow it was missed :-\
|
||||
if (
|
||||
rule.slice(-4) !== '**/*' &&
|
||||
rule.slice(-1) === '*' &&
|
||||
rule.indexOf('*.') === -1
|
||||
) {
|
||||
if (rule.slice(-2) !== '**') {
|
||||
rule += '*/*';
|
||||
}
|
||||
}
|
||||
|
||||
return (not ? '!' : '') + rule;
|
||||
});
|
||||
|
||||
return monitor;
|
||||
}
|
||||
|
||||
function tryBaseDir(dir) {
|
||||
var stat;
|
||||
if (/[?*\{\[]+/.test(dir)) {
|
||||
// if this is pattern, then try to find the base
|
||||
try {
|
||||
var base = path.dirname(dir.replace(/([?*\{\[]+.*$)/, 'foo'));
|
||||
stat = fs.statSync(base);
|
||||
if (stat.isDirectory()) {
|
||||
return base;
|
||||
}
|
||||
} catch (error) {
|
||||
// console.log(error);
|
||||
}
|
||||
} else {
|
||||
try {
|
||||
stat = fs.statSync(dir);
|
||||
// if this path is actually a single file that exists, then just monitor
|
||||
// that, *specifically*.
|
||||
if (stat.isFile() || stat.isDirectory()) {
|
||||
return dir;
|
||||
}
|
||||
} catch (e) {}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
function match(files, monitor, ext) {
|
||||
// sort the rules by highest specificity (based on number of slashes)
|
||||
// ignore rules (!) get sorted highest as they take precedent
|
||||
const cwd = process.cwd();
|
||||
var rules = monitor
|
||||
.sort(function (a, b) {
|
||||
var r = b.split(path.sep).length - a.split(path.sep).length;
|
||||
var aIsIgnore = a.slice(0, 1) === '!';
|
||||
var bIsIgnore = b.slice(0, 1) === '!';
|
||||
|
||||
if (aIsIgnore || bIsIgnore) {
|
||||
if (aIsIgnore) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
if (r === 0) {
|
||||
return b.length - a.length;
|
||||
}
|
||||
return r;
|
||||
})
|
||||
.map(function (s) {
|
||||
var prefix = s.slice(0, 1);
|
||||
|
||||
if (prefix === '!') {
|
||||
if (s.indexOf('!' + cwd) === 0) {
|
||||
return s;
|
||||
}
|
||||
|
||||
// if it starts with a period, then let's get the relative path
|
||||
if (s.indexOf('!.') === 0) {
|
||||
return '!' + path.resolve(cwd, s.substring(1));
|
||||
}
|
||||
|
||||
return '!**' + (prefix !== path.sep ? path.sep : '') + s.slice(1);
|
||||
}
|
||||
|
||||
// if it starts with a period, then let's get the relative path
|
||||
if (s.indexOf('.') === 0) {
|
||||
return path.resolve(cwd, s);
|
||||
}
|
||||
|
||||
if (s.indexOf(cwd) === 0) {
|
||||
return s;
|
||||
}
|
||||
|
||||
return '**' + (prefix !== path.sep ? path.sep : '') + s;
|
||||
});
|
||||
|
||||
debug('rules', rules);
|
||||
|
||||
var good = [];
|
||||
var whitelist = []; // files that we won't check against the extension
|
||||
var ignored = 0;
|
||||
var watched = 0;
|
||||
var usedRules = [];
|
||||
var minimatchOpts = {
|
||||
dot: true,
|
||||
};
|
||||
|
||||
// enable case-insensitivity on Windows
|
||||
if (utils.isWindows) {
|
||||
minimatchOpts.nocase = true;
|
||||
}
|
||||
|
||||
files.forEach(function (file) {
|
||||
file = path.resolve(cwd, file);
|
||||
|
||||
var matched = false;
|
||||
for (var i = 0; i < rules.length; i++) {
|
||||
if (rules[i].slice(0, 1) === '!') {
|
||||
if (!minimatch(file, rules[i], minimatchOpts)) {
|
||||
debug('ignored', file, 'rule:', rules[i]);
|
||||
ignored++;
|
||||
matched = true;
|
||||
break;
|
||||
}
|
||||
} else {
|
||||
debug('matched', file, 'rule:', rules[i]);
|
||||
if (minimatch(file, rules[i], minimatchOpts)) {
|
||||
watched++;
|
||||
|
||||
// don't repeat the output if a rule is matched
|
||||
if (usedRules.indexOf(rules[i]) === -1) {
|
||||
usedRules.push(rules[i]);
|
||||
utils.log.detail('matched rule: ' + rules[i]);
|
||||
}
|
||||
|
||||
// if the rule doesn't match the WATCH EVERYTHING
|
||||
// but *does* match a rule that ends with *.*, then
|
||||
// white list it - in that we don't run it through
|
||||
// the extension check too.
|
||||
if (
|
||||
rules[i] !== '**' + path.sep + '*.*' &&
|
||||
rules[i].slice(-3) === '*.*'
|
||||
) {
|
||||
whitelist.push(file);
|
||||
} else if (path.basename(file) === path.basename(rules[i])) {
|
||||
// if the file matches the actual rule, then it's put on whitelist
|
||||
whitelist.push(file);
|
||||
} else {
|
||||
good.push(file);
|
||||
}
|
||||
matched = true;
|
||||
} else {
|
||||
// utils.log.detail('no match: ' + rules[i], file);
|
||||
}
|
||||
}
|
||||
}
|
||||
if (!matched) {
|
||||
ignored++;
|
||||
}
|
||||
});
|
||||
|
||||
// finally check the good files against the extensions that we're monitoring
|
||||
if (ext) {
|
||||
if (ext.indexOf(',') === -1) {
|
||||
ext = '**/*.' + ext;
|
||||
} else {
|
||||
ext = '**/*.{' + ext + '}';
|
||||
}
|
||||
|
||||
good = good.filter(function (file) {
|
||||
// only compare the filename to the extension test
|
||||
return minimatch(path.basename(file), ext, minimatchOpts);
|
||||
});
|
||||
debug('good (filtered by ext)', good);
|
||||
} else {
|
||||
// else assume *.*
|
||||
debug('good', good);
|
||||
}
|
||||
|
||||
if (whitelist.length) debug('whitelist', whitelist);
|
||||
|
||||
var result = good.concat(whitelist);
|
||||
|
||||
if (utils.isWindows) {
|
||||
// fix for windows testing - I *think* this is okay to do
|
||||
result = result.map(function (file) {
|
||||
return file.slice(0, 1).toLowerCase() + file.slice(1);
|
||||
});
|
||||
}
|
||||
|
||||
return {
|
||||
result: result,
|
||||
ignored: ignored,
|
||||
watched: watched,
|
||||
total: files.length,
|
||||
};
|
||||
}
|
||||
562
qwen/nodejs/node_modules/nodemon/lib/monitor/run.js
generated
vendored
Normal file
562
qwen/nodejs/node_modules/nodemon/lib/monitor/run.js
generated
vendored
Normal file
@@ -0,0 +1,562 @@
|
||||
var debug = require('debug')('nodemon:run');
|
||||
const statSync = require('fs').statSync;
|
||||
var utils = require('../utils');
|
||||
var bus = utils.bus;
|
||||
var childProcess = require('child_process');
|
||||
var spawn = childProcess.spawn;
|
||||
var exec = childProcess.exec;
|
||||
var execSync = childProcess.execSync;
|
||||
var fork = childProcess.fork;
|
||||
var watch = require('./watch').watch;
|
||||
var config = require('../config');
|
||||
var child = null; // the actual child process we spawn
|
||||
var killedAfterChange = false;
|
||||
var noop = () => {};
|
||||
var restart = null;
|
||||
var psTree = require('pstree.remy');
|
||||
var path = require('path');
|
||||
var signals = require('./signals');
|
||||
const undefsafe = require('undefsafe');
|
||||
const osRelease = parseInt(require('os').release().split('.')[0], 10);
|
||||
|
||||
function run(options) {
|
||||
var cmd = config.command.raw;
|
||||
// moved up
|
||||
// we need restart function below in the global scope for run.kill
|
||||
/*jshint validthis:true*/
|
||||
restart = run.bind(this, options);
|
||||
run.restart = restart;
|
||||
|
||||
// binding options with instance of run
|
||||
// so that we can use it in run.kill
|
||||
run.options = options;
|
||||
|
||||
var runCmd = !options.runOnChangeOnly || config.lastStarted !== 0;
|
||||
if (runCmd) {
|
||||
utils.log.status('starting `' + config.command.string + '`');
|
||||
} else {
|
||||
// should just watch file if command is not to be run
|
||||
// had another alternate approach
|
||||
// to stop process being forked/spawned in the below code
|
||||
// but this approach does early exit and makes code cleaner
|
||||
debug('start watch on: %s', config.options.watch);
|
||||
if (config.options.watch !== false) {
|
||||
watch();
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
config.lastStarted = Date.now();
|
||||
|
||||
var stdio = ['pipe', 'pipe', 'pipe'];
|
||||
|
||||
if (config.options.stdout) {
|
||||
stdio = ['pipe', process.stdout, process.stderr];
|
||||
}
|
||||
|
||||
if (config.options.stdin === false) {
|
||||
stdio = [process.stdin, process.stdout, process.stderr];
|
||||
}
|
||||
|
||||
var sh = 'sh';
|
||||
var shFlag = '-c';
|
||||
|
||||
const binPath = process.cwd() + '/node_modules/.bin';
|
||||
|
||||
const spawnOptions = {
|
||||
env: Object.assign({}, options.execOptions.env, process.env, {
|
||||
PATH:
|
||||
binPath +
|
||||
path.delimiter +
|
||||
(undefsafe(options, '.execOptions.env.PATH') || process.env.PATH),
|
||||
}),
|
||||
stdio: stdio,
|
||||
};
|
||||
|
||||
var executable = cmd.executable;
|
||||
|
||||
if (utils.isWindows) {
|
||||
// if the exec includes a forward slash, reverse it for windows compat
|
||||
// but *only* apply to the first command, and none of the arguments.
|
||||
// ref #1251 and #1236
|
||||
if (executable.indexOf('/') !== -1) {
|
||||
executable = executable
|
||||
.split(' ')
|
||||
.map((e, i) => {
|
||||
if (i === 0) {
|
||||
return path.normalize(e);
|
||||
}
|
||||
return e;
|
||||
})
|
||||
.join(' ');
|
||||
}
|
||||
// taken from npm's cli: https://git.io/vNFD4
|
||||
sh = process.env.comspec || 'cmd';
|
||||
shFlag = '/d /s /c';
|
||||
spawnOptions.windowsVerbatimArguments = true;
|
||||
spawnOptions.windowsHide = true;
|
||||
}
|
||||
|
||||
var args = runCmd ? utils.stringify(executable, cmd.args) : ':';
|
||||
var spawnArgs = [sh, [shFlag, args], spawnOptions];
|
||||
|
||||
const firstArg = cmd.args[0] || '';
|
||||
|
||||
var inBinPath = false;
|
||||
try {
|
||||
inBinPath = statSync(`${binPath}/${executable}`).isFile();
|
||||
} catch (e) {}
|
||||
|
||||
// hasStdio allows us to correctly handle stdin piping
|
||||
// see: https://git.io/vNtX3
|
||||
const hasStdio = utils.satisfies('>= 6.4.0 || < 5');
|
||||
|
||||
// forking helps with sub-process handling and tends to clean up better
|
||||
// than spawning, but it should only be used under specific conditions
|
||||
const shouldFork =
|
||||
!config.options.spawn &&
|
||||
!inBinPath &&
|
||||
!(firstArg.indexOf('-') === 0) && // don't fork if there's a node exec arg
|
||||
firstArg !== 'inspect' && // don't fork it's `inspect` debugger
|
||||
executable === 'node' && // only fork if node
|
||||
utils.version.major > 4; // only fork if node version > 4
|
||||
|
||||
if (shouldFork) {
|
||||
// this assumes the first argument is the script and slices it out, since
|
||||
// we're forking
|
||||
var forkArgs = cmd.args.slice(1);
|
||||
var env = utils.merge(options.execOptions.env, process.env);
|
||||
stdio.push('ipc');
|
||||
const forkOptions = {
|
||||
env: env,
|
||||
stdio: stdio,
|
||||
silent: !hasStdio,
|
||||
};
|
||||
if (utils.isWindows) {
|
||||
forkOptions.windowsHide = true;
|
||||
}
|
||||
child = fork(options.execOptions.script, forkArgs, forkOptions);
|
||||
utils.log.detail('forking');
|
||||
debug('fork', sh, shFlag, args);
|
||||
} else {
|
||||
utils.log.detail('spawning');
|
||||
child = spawn.apply(null, spawnArgs);
|
||||
debug('spawn', sh, shFlag, args);
|
||||
}
|
||||
|
||||
if (config.required) {
|
||||
var emit = {
|
||||
stdout: function (data) {
|
||||
bus.emit('stdout', data);
|
||||
},
|
||||
stderr: function (data) {
|
||||
bus.emit('stderr', data);
|
||||
},
|
||||
};
|
||||
|
||||
// now work out what to bind to...
|
||||
if (config.options.stdout) {
|
||||
child.on('stdout', emit.stdout).on('stderr', emit.stderr);
|
||||
} else {
|
||||
child.stdout.on('data', emit.stdout);
|
||||
child.stderr.on('data', emit.stderr);
|
||||
|
||||
bus.stdout = child.stdout;
|
||||
bus.stderr = child.stderr;
|
||||
}
|
||||
|
||||
if (shouldFork) {
|
||||
child.on('message', function (message, sendHandle) {
|
||||
bus.emit('message', message, sendHandle);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
bus.emit('start');
|
||||
|
||||
utils.log.detail('child pid: ' + child.pid);
|
||||
|
||||
child.on('error', function (error) {
|
||||
bus.emit('error', error);
|
||||
if (error.code === 'ENOENT') {
|
||||
utils.log.error('unable to run executable: "' + cmd.executable + '"');
|
||||
process.exit(1);
|
||||
} else {
|
||||
utils.log.error('failed to start child process: ' + error.code);
|
||||
throw error;
|
||||
}
|
||||
});
|
||||
|
||||
child.on('exit', function (code, signal) {
|
||||
if (child && child.stdin) {
|
||||
process.stdin.unpipe(child.stdin);
|
||||
}
|
||||
|
||||
if (code === 127) {
|
||||
utils.log.error(
|
||||
'failed to start process, "' + cmd.executable + '" exec not found'
|
||||
);
|
||||
bus.emit('error', code);
|
||||
process.exit();
|
||||
}
|
||||
|
||||
// If the command failed with code 2, it may or may not be a syntax error
|
||||
// See: http://git.io/fNOAR
|
||||
// We will only assume a parse error, if the child failed quickly
|
||||
if (code === 2 && Date.now() < config.lastStarted + 500) {
|
||||
utils.log.error('process failed, unhandled exit code (2)');
|
||||
utils.log.error('');
|
||||
utils.log.error('Either the command has a syntax error,');
|
||||
utils.log.error('or it is exiting with reserved code 2.');
|
||||
utils.log.error('');
|
||||
utils.log.error('To keep nodemon running even after a code 2,');
|
||||
utils.log.error('add this to the end of your command: || exit 1');
|
||||
utils.log.error('');
|
||||
utils.log.error('Read more here: https://git.io/fNOAG');
|
||||
utils.log.error('');
|
||||
utils.log.error('nodemon will stop now so that you can fix the command.');
|
||||
utils.log.error('');
|
||||
bus.emit('error', code);
|
||||
process.exit();
|
||||
}
|
||||
|
||||
// In case we killed the app ourselves, set the signal thusly
|
||||
if (killedAfterChange) {
|
||||
killedAfterChange = false;
|
||||
signal = config.signal;
|
||||
}
|
||||
// this is nasty, but it gives it windows support
|
||||
if (utils.isWindows && signal === 'SIGTERM') {
|
||||
signal = config.signal;
|
||||
}
|
||||
|
||||
if (signal === config.signal || code === 0) {
|
||||
// this was a clean exit, so emit exit, rather than crash
|
||||
debug('bus.emit(exit) via ' + config.signal);
|
||||
bus.emit('exit', signal);
|
||||
|
||||
// exit the monitor, but do it gracefully
|
||||
if (signal === config.signal) {
|
||||
return restart();
|
||||
}
|
||||
|
||||
if (code === 0) {
|
||||
// clean exit - wait until file change to restart
|
||||
if (runCmd) {
|
||||
utils.log.status('clean exit - waiting for changes before restart');
|
||||
}
|
||||
child = null;
|
||||
}
|
||||
} else {
|
||||
bus.emit('crash');
|
||||
|
||||
// support the old syntax of `exitcrash` - 2024-12-13
|
||||
if (options.exitcrash) {
|
||||
options.exitCrash = true;
|
||||
delete options.exitcrash;
|
||||
}
|
||||
|
||||
if (options.exitCrash) {
|
||||
utils.log.fail('app crashed');
|
||||
if (!config.required) {
|
||||
process.exit(1);
|
||||
}
|
||||
} else {
|
||||
utils.log.fail(
|
||||
'app crashed - waiting for file changes before' + ' starting...'
|
||||
);
|
||||
child = null;
|
||||
}
|
||||
}
|
||||
|
||||
if (config.options.restartable) {
|
||||
// stdin needs to kick in again to be able to listen to the
|
||||
// restart command
|
||||
process.stdin.resume();
|
||||
}
|
||||
});
|
||||
|
||||
// moved the run.kill outside to handle both the cases
|
||||
// intial start
|
||||
// no start
|
||||
|
||||
// connect stdin to the child process (options.stdin is on by default)
|
||||
if (options.stdin) {
|
||||
process.stdin.resume();
|
||||
// FIXME decide whether or not we need to decide the encoding
|
||||
// process.stdin.setEncoding('utf8');
|
||||
|
||||
// swallow the stdin error if it happens
|
||||
// ref: https://github.com/remy/nodemon/issues/1195
|
||||
if (hasStdio) {
|
||||
child.stdin.on('error', () => {});
|
||||
process.stdin.pipe(child.stdin);
|
||||
} else {
|
||||
if (child.stdout) {
|
||||
child.stdout.pipe(process.stdout);
|
||||
} else {
|
||||
utils.log.error(
|
||||
'running an unsupported version of node ' + process.version
|
||||
);
|
||||
utils.log.error(
|
||||
'nodemon may not work as expected - ' +
|
||||
'please consider upgrading to LTS'
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
bus.once('exit', function () {
|
||||
if (child && process.stdin.unpipe) {
|
||||
// node > 0.8
|
||||
process.stdin.unpipe(child.stdin);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
debug('start watch on: %s', config.options.watch);
|
||||
if (config.options.watch !== false) {
|
||||
watch();
|
||||
}
|
||||
}
|
||||
|
||||
function waitForSubProcesses(pid, callback) {
|
||||
debug('checking ps tree for pids of ' + pid);
|
||||
psTree(pid, (err, pids) => {
|
||||
if (!pids.length) {
|
||||
return callback();
|
||||
}
|
||||
|
||||
utils.log.status(
|
||||
`still waiting for ${pids.length} sub-process${
|
||||
pids.length > 2 ? 'es' : ''
|
||||
} to finish...`
|
||||
);
|
||||
setTimeout(() => waitForSubProcesses(pid, callback), 1000);
|
||||
});
|
||||
}
|
||||
|
||||
function kill(child, signal, callback) {
|
||||
if (!callback) {
|
||||
callback = noop;
|
||||
}
|
||||
|
||||
if (utils.isWindows) {
|
||||
const taskKill = () => {
|
||||
try {
|
||||
exec('taskkill /pid ' + child.pid + ' /T /F');
|
||||
} catch (e) {
|
||||
utils.log.error('Could not shutdown sub process cleanly');
|
||||
}
|
||||
};
|
||||
|
||||
// We are handling a 'SIGKILL' , 'SIGUSR2' and 'SIGUSR1' POSIX signal under Windows the
|
||||
// same way it is handled on a UNIX system: We are performing
|
||||
// a hard shutdown without waiting for the process to clean-up.
|
||||
if (
|
||||
signal === 'SIGKILL' ||
|
||||
osRelease < 10 ||
|
||||
signal === 'SIGUSR2' ||
|
||||
signal === 'SIGUSR1'
|
||||
) {
|
||||
debug('terminating process group by force: %s', child.pid);
|
||||
|
||||
// We are using the taskkill utility to terminate the whole
|
||||
// process group ('/t') of the child ('/pid') by force ('/f').
|
||||
// We need to end all sub processes, because the 'child'
|
||||
// process in this context is actually a cmd.exe wrapper.
|
||||
taskKill();
|
||||
callback();
|
||||
return;
|
||||
}
|
||||
|
||||
try {
|
||||
// We are using the Windows Management Instrumentation Command-line
|
||||
// (wmic.exe) to resolve the sub-child process identifier, because the
|
||||
// 'child' process in this context is actually a cmd.exe wrapper.
|
||||
// We want to send the termination signal directly to the node process.
|
||||
// The '2> nul' silences the no process found error message.
|
||||
const resultBuffer = execSync(
|
||||
`wmic process where (ParentProcessId=${child.pid}) get ProcessId 2> nul`
|
||||
);
|
||||
const result = resultBuffer.toString().match(/^[0-9]+/m);
|
||||
|
||||
// If there is no sub-child process we fall back to the child process.
|
||||
const processId = Array.isArray(result) ? result[0] : child.pid;
|
||||
|
||||
debug('sending kill signal SIGINT to process: %s', processId);
|
||||
|
||||
// We are using the standalone 'windows-kill' executable to send the
|
||||
// standard POSIX signal 'SIGINT' to the node process. This fixes #1720.
|
||||
const windowsKill = path.normalize(
|
||||
`${__dirname}/../../bin/windows-kill.exe`
|
||||
);
|
||||
|
||||
// We have to detach the 'windows-kill' execution completely from this
|
||||
// process group to avoid terminating the nodemon process itself.
|
||||
// See: https://github.com/alirdn/windows-kill#how-it-works--limitations
|
||||
//
|
||||
// Therefore we are using 'start' to create a new cmd.exe context.
|
||||
// The '/min' option hides the new terminal window and the '/wait'
|
||||
// option lets the process wait for the command to finish.
|
||||
|
||||
execSync(
|
||||
`start "windows-kill" /min /wait "${windowsKill}" -SIGINT ${processId}`
|
||||
);
|
||||
} catch (e) {
|
||||
taskKill();
|
||||
}
|
||||
callback();
|
||||
} else {
|
||||
// we use psTree to kill the full subtree of nodemon, because when
|
||||
// spawning processes like `coffee` under the `--debug` flag, it'll spawn
|
||||
// it's own child, and that can't be killed by nodemon, so psTree gives us
|
||||
// an array of PIDs that have spawned under nodemon, and we send each the
|
||||
// configured signal (default: SIGUSR2) signal, which fixes #335
|
||||
// note that psTree also works if `ps` is missing by looking in /proc
|
||||
let sig = signal.replace('SIG', '');
|
||||
|
||||
psTree(child.pid, function (err, pids) {
|
||||
// if ps isn't native to the OS, then we need to send the numeric value
|
||||
// for the signal during the kill, `signals` is a lookup table for that.
|
||||
if (!psTree.hasPS) {
|
||||
sig = signals[signal];
|
||||
}
|
||||
|
||||
// the sub processes need to be killed from smallest to largest
|
||||
debug('sending kill signal to ' + pids.join(', '));
|
||||
|
||||
child.kill(signal);
|
||||
|
||||
pids.sort().forEach((pid) => exec(`kill -${sig} ${pid}`, noop));
|
||||
|
||||
waitForSubProcesses(child.pid, () => {
|
||||
// finally kill the main user process
|
||||
exec(`kill -${sig} ${child.pid}`, callback);
|
||||
});
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
run.kill = function (noRestart, callback) {
|
||||
// I hate code like this :( - Remy (author of said code)
|
||||
if (typeof noRestart === 'function') {
|
||||
callback = noRestart;
|
||||
noRestart = false;
|
||||
}
|
||||
|
||||
if (!callback) {
|
||||
callback = noop;
|
||||
}
|
||||
|
||||
if (child !== null) {
|
||||
// if the stdin piping is on, we need to unpipe, but also close stdin on
|
||||
// the child, otherwise linux can throw EPIPE or ECONNRESET errors.
|
||||
if (run.options.stdin) {
|
||||
process.stdin.unpipe(child.stdin);
|
||||
}
|
||||
|
||||
// For the on('exit', ...) handler above the following looks like a
|
||||
// crash, so we set the killedAfterChange flag if a restart is planned
|
||||
if (!noRestart) {
|
||||
killedAfterChange = true;
|
||||
}
|
||||
|
||||
/* Now kill the entire subtree of processes belonging to nodemon */
|
||||
var oldPid = child.pid;
|
||||
if (child) {
|
||||
kill(child, config.signal, function () {
|
||||
// this seems to fix the 0.11.x issue with the "rs" restart command,
|
||||
// though I'm unsure why. it seems like more data is streamed in to
|
||||
// stdin after we close.
|
||||
if (child && run.options.stdin && child.stdin && oldPid === child.pid) {
|
||||
child.stdin.end();
|
||||
}
|
||||
callback();
|
||||
});
|
||||
}
|
||||
} else if (!noRestart) {
|
||||
// if there's no child, then we need to manually start the process
|
||||
// this is because as there was no child, the child.on('exit') event
|
||||
// handler doesn't exist which would normally trigger the restart.
|
||||
bus.once('start', callback);
|
||||
run.restart();
|
||||
} else {
|
||||
callback();
|
||||
}
|
||||
};
|
||||
|
||||
run.restart = noop;
|
||||
|
||||
bus.on('quit', function onQuit(code) {
|
||||
if (code === undefined) {
|
||||
code = 0;
|
||||
}
|
||||
|
||||
// remove event listener
|
||||
var exitTimer = null;
|
||||
var exit = function () {
|
||||
clearTimeout(exitTimer);
|
||||
exit = noop; // null out in case of race condition
|
||||
child = null;
|
||||
if (!config.required) {
|
||||
// Execute all other quit listeners.
|
||||
bus.listeners('quit').forEach(function (listener) {
|
||||
if (listener !== onQuit) {
|
||||
listener();
|
||||
}
|
||||
});
|
||||
process.exit(code);
|
||||
} else {
|
||||
bus.emit('exit');
|
||||
}
|
||||
};
|
||||
|
||||
// if we're not running already, don't bother with trying to kill
|
||||
if (config.run === false) {
|
||||
return exit();
|
||||
}
|
||||
|
||||
// immediately try to stop any polling
|
||||
config.run = false;
|
||||
|
||||
if (child) {
|
||||
// give up waiting for the kids after 10 seconds
|
||||
exitTimer = setTimeout(exit, 10 * 1000);
|
||||
child.removeAllListeners('exit');
|
||||
child.once('exit', exit);
|
||||
|
||||
kill(child, 'SIGINT');
|
||||
} else {
|
||||
exit();
|
||||
}
|
||||
});
|
||||
|
||||
bus.on('restart', function () {
|
||||
// run.kill will send a SIGINT to the child process, which will cause it
|
||||
// to terminate, which in turn uses the 'exit' event handler to restart
|
||||
run.kill();
|
||||
});
|
||||
|
||||
// remove the child file on exit
|
||||
process.on('exit', function () {
|
||||
utils.log.detail('exiting');
|
||||
if (child) {
|
||||
child.kill();
|
||||
}
|
||||
});
|
||||
|
||||
// because windows borks when listening for the SIG* events
|
||||
if (!utils.isWindows) {
|
||||
bus.once('boot', () => {
|
||||
// usual suspect: ctrl+c exit
|
||||
process.once('SIGINT', () => bus.emit('quit', 130));
|
||||
process.once('SIGTERM', () => {
|
||||
bus.emit('quit', 143);
|
||||
if (child) {
|
||||
child.kill('SIGTERM');
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
module.exports = run;
|
||||
34
qwen/nodejs/node_modules/nodemon/lib/monitor/signals.js
generated
vendored
Normal file
34
qwen/nodejs/node_modules/nodemon/lib/monitor/signals.js
generated
vendored
Normal file
@@ -0,0 +1,34 @@
|
||||
module.exports = {
|
||||
SIGHUP: 1,
|
||||
SIGINT: 2,
|
||||
SIGQUIT: 3,
|
||||
SIGILL: 4,
|
||||
SIGTRAP: 5,
|
||||
SIGABRT: 6,
|
||||
SIGBUS: 7,
|
||||
SIGFPE: 8,
|
||||
SIGKILL: 9,
|
||||
SIGUSR1: 10,
|
||||
SIGSEGV: 11,
|
||||
SIGUSR2: 12,
|
||||
SIGPIPE: 13,
|
||||
SIGALRM: 14,
|
||||
SIGTERM: 15,
|
||||
SIGSTKFLT: 16,
|
||||
SIGCHLD: 17,
|
||||
SIGCONT: 18,
|
||||
SIGSTOP: 19,
|
||||
SIGTSTP: 20,
|
||||
SIGTTIN: 21,
|
||||
SIGTTOU: 22,
|
||||
SIGURG: 23,
|
||||
SIGXCPU: 24,
|
||||
SIGXFSZ: 25,
|
||||
SIGVTALRM: 26,
|
||||
SIGPROF: 27,
|
||||
SIGWINCH: 28,
|
||||
SIGIO: 29,
|
||||
SIGPWR: 30,
|
||||
SIGSYS: 31,
|
||||
SIGRTMIN: 35,
|
||||
}
|
||||
244
qwen/nodejs/node_modules/nodemon/lib/monitor/watch.js
generated
vendored
Normal file
244
qwen/nodejs/node_modules/nodemon/lib/monitor/watch.js
generated
vendored
Normal file
@@ -0,0 +1,244 @@
|
||||
module.exports.watch = watch;
|
||||
module.exports.resetWatchers = resetWatchers;
|
||||
|
||||
var debug = require('debug')('nodemon:watch');
|
||||
var debugRoot = require('debug')('nodemon');
|
||||
var chokidar = require('chokidar');
|
||||
var undefsafe = require('undefsafe');
|
||||
var config = require('../config');
|
||||
var path = require('path');
|
||||
var utils = require('../utils');
|
||||
var bus = utils.bus;
|
||||
var match = require('./match');
|
||||
var watchers = [];
|
||||
var debouncedBus;
|
||||
|
||||
bus.on('reset', resetWatchers);
|
||||
|
||||
function resetWatchers() {
|
||||
debugRoot('resetting watchers');
|
||||
watchers.forEach(function (watcher) {
|
||||
watcher.close();
|
||||
});
|
||||
watchers = [];
|
||||
}
|
||||
|
||||
function watch() {
|
||||
if (watchers.length) {
|
||||
debug('early exit on watch, still watching (%s)', watchers.length);
|
||||
return;
|
||||
}
|
||||
|
||||
var dirs = [].slice.call(config.dirs);
|
||||
|
||||
debugRoot('start watch on: %s', dirs.join(', '));
|
||||
const rootIgnored = config.options.ignore;
|
||||
debugRoot('ignored', rootIgnored);
|
||||
|
||||
var watchedFiles = [];
|
||||
|
||||
const promise = new Promise(function (resolve) {
|
||||
const dotFilePattern = /[/\\]\./;
|
||||
var ignored = match.rulesToMonitor(
|
||||
[], // not needed
|
||||
Array.from(rootIgnored),
|
||||
config
|
||||
).map(pattern => pattern.slice(1));
|
||||
|
||||
const addDotFile = dirs.filter(dir => dir.match(dotFilePattern));
|
||||
|
||||
// don't ignore dotfiles if explicitly watched.
|
||||
if (addDotFile.length === 0) {
|
||||
ignored.push(dotFilePattern);
|
||||
}
|
||||
|
||||
var watchOptions = {
|
||||
ignorePermissionErrors: true,
|
||||
ignored: ignored,
|
||||
persistent: true,
|
||||
usePolling: config.options.legacyWatch || false,
|
||||
interval: config.options.pollingInterval,
|
||||
// note to future developer: I've gone back and forth on adding `cwd`
|
||||
// to the props and in some cases it fixes bugs but typically it causes
|
||||
// bugs elsewhere (since nodemon is used is so many ways). the final
|
||||
// decision is to *not* use it at all and work around it
|
||||
// cwd: ...
|
||||
};
|
||||
|
||||
if (utils.isWindows) {
|
||||
watchOptions.disableGlobbing = true;
|
||||
}
|
||||
|
||||
if (utils.isIBMi) {
|
||||
watchOptions.usePolling = true;
|
||||
}
|
||||
|
||||
if (process.env.TEST) {
|
||||
watchOptions.useFsEvents = false;
|
||||
}
|
||||
|
||||
var watcher = chokidar.watch(
|
||||
dirs,
|
||||
Object.assign({}, watchOptions, config.options.watchOptions || {})
|
||||
);
|
||||
|
||||
watcher.ready = false;
|
||||
|
||||
var total = 0;
|
||||
|
||||
watcher.on('change', filterAndRestart);
|
||||
watcher.on('unlink', filterAndRestart);
|
||||
watcher.on('add', function (file) {
|
||||
if (watcher.ready) {
|
||||
return filterAndRestart(file);
|
||||
}
|
||||
|
||||
watchedFiles.push(file);
|
||||
bus.emit('watching', file);
|
||||
debug('chokidar watching: %s', file);
|
||||
});
|
||||
watcher.on('ready', function () {
|
||||
watchedFiles = Array.from(new Set(watchedFiles)); // ensure no dupes
|
||||
total = watchedFiles.length;
|
||||
watcher.ready = true;
|
||||
resolve(total);
|
||||
debugRoot('watch is complete');
|
||||
});
|
||||
|
||||
watcher.on('error', function (error) {
|
||||
if (error.code === 'EINVAL') {
|
||||
utils.log.error(
|
||||
'Internal watch failed. Likely cause: too many ' +
|
||||
'files being watched (perhaps from the root of a drive?\n' +
|
||||
'See https://github.com/paulmillr/chokidar/issues/229 for details'
|
||||
);
|
||||
} else {
|
||||
utils.log.error('Internal watch failed: ' + error.message);
|
||||
process.exit(1);
|
||||
}
|
||||
});
|
||||
|
||||
watchers.push(watcher);
|
||||
});
|
||||
|
||||
return promise.catch(e => {
|
||||
// this is a core error and it should break nodemon - so I have to break
|
||||
// out of a promise using the setTimeout
|
||||
setTimeout(() => {
|
||||
throw e;
|
||||
});
|
||||
}).then(function () {
|
||||
utils.log.detail(`watching ${watchedFiles.length} file${
|
||||
watchedFiles.length === 1 ? '' : 's'}`);
|
||||
return watchedFiles;
|
||||
});
|
||||
}
|
||||
|
||||
function filterAndRestart(files) {
|
||||
if (!Array.isArray(files)) {
|
||||
files = [files];
|
||||
}
|
||||
|
||||
if (files.length) {
|
||||
var cwd = process.cwd();
|
||||
if (this.options && this.options.cwd) {
|
||||
cwd = this.options.cwd;
|
||||
}
|
||||
|
||||
utils.log.detail(
|
||||
'files triggering change check: ' +
|
||||
files
|
||||
.map(file => {
|
||||
const res = path.relative(cwd, file);
|
||||
return res;
|
||||
})
|
||||
.join(', ')
|
||||
);
|
||||
|
||||
// make sure the path is right and drop an empty
|
||||
// filenames (sometimes on windows)
|
||||
files = files.filter(Boolean).map(file => {
|
||||
return path.relative(process.cwd(), path.relative(cwd, file));
|
||||
});
|
||||
|
||||
if (utils.isWindows) {
|
||||
// ensure the drive letter is in uppercase (c:\foo -> C:\foo)
|
||||
files = files.map(f => {
|
||||
if (f.indexOf(':') === -1) { return f; }
|
||||
return f[0].toUpperCase() + f.slice(1);
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
debug('filterAndRestart on', files);
|
||||
|
||||
var matched = match(
|
||||
files,
|
||||
config.options.monitor,
|
||||
undefsafe(config, 'options.execOptions.ext')
|
||||
);
|
||||
|
||||
debug('matched?', JSON.stringify(matched));
|
||||
|
||||
// if there's no matches, then test to see if the changed file is the
|
||||
// running script, if so, let's allow a restart
|
||||
if (config.options.execOptions && config.options.execOptions.script) {
|
||||
const script = path.resolve(config.options.execOptions.script);
|
||||
if (matched.result.length === 0 && script) {
|
||||
const length = script.length;
|
||||
files.find(file => {
|
||||
if (file.substr(-length, length) === script) {
|
||||
matched = {
|
||||
result: [file],
|
||||
total: 1,
|
||||
};
|
||||
return true;
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
utils.log.detail(
|
||||
'changes after filters (before/after): ' +
|
||||
[files.length, matched.result.length].join('/')
|
||||
);
|
||||
|
||||
// reset the last check so we're only looking at recently modified files
|
||||
config.lastStarted = Date.now();
|
||||
|
||||
if (matched.result.length) {
|
||||
if (config.options.delay > 0) {
|
||||
utils.log.detail('delaying restart for ' + config.options.delay + 'ms');
|
||||
if (debouncedBus === undefined) {
|
||||
debouncedBus = debounce(restartBus, config.options.delay);
|
||||
}
|
||||
debouncedBus(matched);
|
||||
} else {
|
||||
return restartBus(matched);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function restartBus(matched) {
|
||||
utils.log.status('restarting due to changes...');
|
||||
matched.result.map(file => {
|
||||
utils.log.detail(path.relative(process.cwd(), file));
|
||||
});
|
||||
|
||||
if (config.options.verbose) {
|
||||
utils.log._log('');
|
||||
}
|
||||
|
||||
bus.emit('restart', matched.result);
|
||||
}
|
||||
|
||||
function debounce(fn, delay) {
|
||||
var timer = null;
|
||||
return function () {
|
||||
const context = this;
|
||||
const args = arguments;
|
||||
clearTimeout(timer);
|
||||
timer = setTimeout(() =>fn.apply(context, args), delay);
|
||||
};
|
||||
}
|
||||
317
qwen/nodejs/node_modules/nodemon/lib/nodemon.js
generated
vendored
Normal file
317
qwen/nodejs/node_modules/nodemon/lib/nodemon.js
generated
vendored
Normal file
@@ -0,0 +1,317 @@
|
||||
var debug = require('debug')('nodemon');
|
||||
var path = require('path');
|
||||
var monitor = require('./monitor');
|
||||
var cli = require('./cli');
|
||||
var version = require('./version');
|
||||
var util = require('util');
|
||||
var utils = require('./utils');
|
||||
var bus = utils.bus;
|
||||
var help = require('./help');
|
||||
/** @type {import('..').NodemonEventConfig} */
|
||||
var config = require('./config');
|
||||
var spawn = require('./spawn');
|
||||
const defaults = require('./config/defaults')
|
||||
var eventHandlers = {};
|
||||
|
||||
// this is fairly dirty, but theoretically sound since it's part of the
|
||||
// stable module API
|
||||
config.required = utils.isRequired;
|
||||
|
||||
/**
|
||||
* @param {import('..').NodemonSettings | string} settings
|
||||
* @returns {import('..').Nodemon}
|
||||
*/
|
||||
function nodemon(settings) {
|
||||
bus.emit('boot');
|
||||
nodemon.reset();
|
||||
|
||||
/** @type {import('..').NodemonSettings} */
|
||||
let options
|
||||
|
||||
// allow the cli string as the argument to nodemon, and allow for
|
||||
// `node nodemon -V app.js` or just `-V app.js`
|
||||
if (typeof settings === 'string') {
|
||||
settings = settings.trim();
|
||||
if (settings.indexOf('node') !== 0) {
|
||||
if (settings.indexOf('nodemon') !== 0) {
|
||||
settings = 'nodemon ' + settings;
|
||||
}
|
||||
settings = 'node ' + settings;
|
||||
}
|
||||
options = cli.parse(settings);
|
||||
} else options = settings;
|
||||
|
||||
// set the debug flag as early as possible to get all the detailed logging
|
||||
if (options.verbose) {
|
||||
utils.debug = true;
|
||||
}
|
||||
|
||||
if (options.help) {
|
||||
if (process.stdout.isTTY) {
|
||||
process.stdout._handle.setBlocking(true); // nodejs/node#6456
|
||||
}
|
||||
console.log(help(options.help));
|
||||
if (!config.required) {
|
||||
process.exit(0);
|
||||
}
|
||||
}
|
||||
|
||||
if (options.version) {
|
||||
version().then(function (v) {
|
||||
console.log(v);
|
||||
if (!config.required) {
|
||||
process.exit(0);
|
||||
}
|
||||
});
|
||||
return;
|
||||
}
|
||||
|
||||
// nodemon tools like grunt-nodemon. This affects where
|
||||
// the script is being run from, and will affect where
|
||||
// nodemon looks for the nodemon.json files
|
||||
if (options.cwd) {
|
||||
// this is protection to make sure we haven't dont the chdir already...
|
||||
// say like in cli/parse.js (which is where we do this once already!)
|
||||
if (process.cwd() !== path.resolve(config.system.cwd, options.cwd)) {
|
||||
process.chdir(options.cwd);
|
||||
}
|
||||
}
|
||||
|
||||
config.load(options, function (config) {
|
||||
if (!config.options.dump && !config.options.execOptions.script &&
|
||||
config.options.execOptions.exec === 'node') {
|
||||
if (!config.required) {
|
||||
console.log(help('usage'));
|
||||
process.exit();
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
// before we print anything, update the colour setting on logging
|
||||
utils.colours = config.options.colours;
|
||||
|
||||
// always echo out the current version
|
||||
utils.log.info(version.pinned);
|
||||
|
||||
const cwd = process.cwd();
|
||||
|
||||
if (config.options.cwd) {
|
||||
utils.log.detail('process root: ' + cwd);
|
||||
}
|
||||
|
||||
config.loaded.map(file => file.replace(cwd, '.')).forEach(file => {
|
||||
utils.log.detail('reading config ' + file);
|
||||
});
|
||||
|
||||
if (config.options.stdin && config.options.restartable) {
|
||||
// allow nodemon to restart when the use types 'rs\n'
|
||||
process.stdin.resume();
|
||||
process.stdin.setEncoding('utf8');
|
||||
process.stdin.on('data', data => {
|
||||
const str = data.toString().trim().toLowerCase();
|
||||
|
||||
// if the keys entered match the restartable value, then restart!
|
||||
if (str === config.options.restartable) {
|
||||
bus.emit('restart');
|
||||
} else if (data.charCodeAt(0) === 12) { // ctrl+l
|
||||
console.clear();
|
||||
}
|
||||
});
|
||||
} else if (config.options.stdin) {
|
||||
// so let's make sure we don't eat the key presses
|
||||
// but also, since we're wrapping, watch out for
|
||||
// special keys, like ctrl+c x 2 or '.exit' or ctrl+d or ctrl+l
|
||||
var ctrlC = false;
|
||||
var buffer = '';
|
||||
|
||||
process.stdin.on('data', function (data) {
|
||||
data = data.toString();
|
||||
buffer += data;
|
||||
const chr = data.charCodeAt(0);
|
||||
|
||||
// if restartable, echo back
|
||||
if (chr === 3) {
|
||||
if (ctrlC) {
|
||||
process.exit(0);
|
||||
}
|
||||
|
||||
ctrlC = true;
|
||||
return;
|
||||
} else if (buffer === '.exit' || chr === 4) { // ctrl+d
|
||||
process.exit();
|
||||
} else if (chr === 13 || chr === 10) { // enter / carriage return
|
||||
buffer = '';
|
||||
} else if (chr === 12) { // ctrl+l
|
||||
console.clear();
|
||||
buffer = '';
|
||||
}
|
||||
ctrlC = false;
|
||||
});
|
||||
if (process.stdin.setRawMode) {
|
||||
process.stdin.setRawMode(true);
|
||||
}
|
||||
}
|
||||
|
||||
if (config.options.restartable) {
|
||||
utils.log.info('to restart at any time, enter `' +
|
||||
config.options.restartable + '`');
|
||||
}
|
||||
|
||||
if (!config.required) {
|
||||
const restartSignal = config.options.signal === 'SIGUSR2' ? 'SIGHUP' : 'SIGUSR2';
|
||||
process.on(restartSignal, nodemon.restart);
|
||||
utils.bus.on('error', () => {
|
||||
utils.log.fail((new Error().stack));
|
||||
});
|
||||
utils.log.detail((config.options.restartable ? 'or ' : '') + 'send ' +
|
||||
restartSignal + ' to ' + process.pid + ' to restart');
|
||||
}
|
||||
|
||||
const ignoring = config.options.monitor.map(function (rule) {
|
||||
if (rule.slice(0, 1) !== '!') {
|
||||
return false;
|
||||
}
|
||||
|
||||
rule = rule.slice(1);
|
||||
|
||||
// don't notify of default ignores
|
||||
if (defaults.ignoreRoot.indexOf(rule) !== -1) {
|
||||
return false;
|
||||
// return rule.slice(3).slice(0, -3);
|
||||
}
|
||||
|
||||
if (rule.startsWith(cwd)) {
|
||||
return rule.replace(cwd, '.');
|
||||
}
|
||||
|
||||
return rule;
|
||||
}).filter(Boolean).join(' ');
|
||||
if (ignoring) utils.log.detail('ignoring: ' + ignoring);
|
||||
|
||||
utils.log.info('watching path(s): ' + config.options.monitor.map(function (rule) {
|
||||
if (rule.slice(0, 1) !== '!') {
|
||||
try {
|
||||
rule = path.relative(process.cwd(), rule);
|
||||
} catch (e) {}
|
||||
|
||||
return rule;
|
||||
}
|
||||
|
||||
return false;
|
||||
}).filter(Boolean).join(' '));
|
||||
|
||||
utils.log.info('watching extensions: ' + (config.options.execOptions.ext || '(all)'));
|
||||
|
||||
if (config.options.dump) {
|
||||
utils.log._log('log', '--------------');
|
||||
utils.log._log('log', 'node: ' + process.version);
|
||||
utils.log._log('log', 'nodemon: ' + version.pinned);
|
||||
utils.log._log('log', 'command: ' + process.argv.join(' '));
|
||||
utils.log._log('log', 'cwd: ' + cwd);
|
||||
utils.log._log('log', ['OS:', process.platform, process.arch].join(' '));
|
||||
utils.log._log('log', '--------------');
|
||||
utils.log._log('log', util.inspect(config, { depth: null }));
|
||||
utils.log._log('log', '--------------');
|
||||
if (!config.required) {
|
||||
process.exit();
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
config.run = true;
|
||||
|
||||
if (config.options.stdout === false) {
|
||||
nodemon.on('start', function () {
|
||||
nodemon.stdout = bus.stdout;
|
||||
nodemon.stderr = bus.stderr;
|
||||
|
||||
bus.emit('readable');
|
||||
});
|
||||
}
|
||||
|
||||
if (config.options.events && Object.keys(config.options.events).length) {
|
||||
Object.keys(config.options.events).forEach(function (key) {
|
||||
utils.log.detail('bind ' + key + ' -> `' +
|
||||
config.options.events[key] + '`');
|
||||
nodemon.on(key, function () {
|
||||
if (config.options && config.options.events) {
|
||||
spawn(config.options.events[key], config,
|
||||
[].slice.apply(arguments));
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
monitor.run(config.options);
|
||||
|
||||
});
|
||||
|
||||
return nodemon;
|
||||
}
|
||||
|
||||
nodemon.restart = function () {
|
||||
utils.log.status('restarting child process');
|
||||
bus.emit('restart');
|
||||
return nodemon;
|
||||
};
|
||||
|
||||
nodemon.addListener = nodemon.on = function (event, handler) {
|
||||
if (!eventHandlers[event]) { eventHandlers[event] = []; }
|
||||
eventHandlers[event].push(handler);
|
||||
bus.on(event, handler);
|
||||
return nodemon;
|
||||
};
|
||||
|
||||
nodemon.once = function (event, handler) {
|
||||
if (!eventHandlers[event]) { eventHandlers[event] = []; }
|
||||
eventHandlers[event].push(handler);
|
||||
bus.once(event, function () {
|
||||
debug('bus.once(%s)', event);
|
||||
eventHandlers[event].splice(eventHandlers[event].indexOf(handler), 1);
|
||||
handler.apply(this, arguments);
|
||||
});
|
||||
return nodemon;
|
||||
};
|
||||
|
||||
nodemon.emit = function () {
|
||||
bus.emit.apply(bus, [].slice.call(arguments));
|
||||
return nodemon;
|
||||
};
|
||||
|
||||
nodemon.removeAllListeners = function (event) {
|
||||
// unbind only the `nodemon.on` event handlers
|
||||
Object.keys(eventHandlers).filter(function (e) {
|
||||
return event ? e === event : true;
|
||||
}).forEach(function (event) {
|
||||
eventHandlers[event].forEach(function (handler) {
|
||||
bus.removeListener(event, handler);
|
||||
eventHandlers[event].splice(eventHandlers[event].indexOf(handler), 1);
|
||||
});
|
||||
});
|
||||
|
||||
return nodemon;
|
||||
};
|
||||
|
||||
nodemon.reset = function (done) {
|
||||
bus.emit('reset', done);
|
||||
};
|
||||
|
||||
bus.on('reset', function (done) {
|
||||
debug('reset');
|
||||
nodemon.removeAllListeners();
|
||||
monitor.run.kill(true, function () {
|
||||
utils.reset();
|
||||
config.reset();
|
||||
config.run = false;
|
||||
if (done) {
|
||||
done();
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
// expose the full config
|
||||
nodemon.config = config;
|
||||
|
||||
module.exports = nodemon;
|
||||
|
||||
89
qwen/nodejs/node_modules/nodemon/lib/rules/add.js
generated
vendored
Normal file
89
qwen/nodejs/node_modules/nodemon/lib/rules/add.js
generated
vendored
Normal file
@@ -0,0 +1,89 @@
|
||||
'use strict';
|
||||
|
||||
var utils = require('../utils');
|
||||
|
||||
// internal
|
||||
var reEscComments = /\\#/g;
|
||||
// note that '^^' is used in place of escaped comments
|
||||
var reUnescapeComments = /\^\^/g;
|
||||
var reComments = /#.*$/;
|
||||
var reEscapeChars = /[.|\-[\]()\\]/g;
|
||||
var reAsterisk = /\*/g;
|
||||
|
||||
module.exports = add;
|
||||
|
||||
/**
|
||||
* Converts file patterns or regular expressions to nodemon
|
||||
* compatible RegExp matching rules. Note: the `rules` argument
|
||||
* object is modified to include the new rule and new RegExp
|
||||
*
|
||||
* ### Example:
|
||||
*
|
||||
* var rules = { watch: [], ignore: [] };
|
||||
* add(rules, 'watch', '*.js');
|
||||
* add(rules, 'ignore', '/public/');
|
||||
* add(rules, 'watch', ':(\d)*\.js'); // note: string based regexp
|
||||
* add(rules, 'watch', /\d*\.js/);
|
||||
*
|
||||
* @param {Object} rules containing `watch` and `ignore`. Also updated during
|
||||
* execution
|
||||
* @param {String} which must be either "watch" or "ignore"
|
||||
* @param {String|RegExp} rule the actual rule.
|
||||
*/
|
||||
function add(rules, which, rule) {
|
||||
if (!{ ignore: 1, watch: 1}[which]) {
|
||||
throw new Error('rules/index.js#add requires "ignore" or "watch" as the ' +
|
||||
'first argument');
|
||||
}
|
||||
|
||||
if (Array.isArray(rule)) {
|
||||
rule.forEach(function (rule) {
|
||||
add(rules, which, rule);
|
||||
});
|
||||
return;
|
||||
}
|
||||
|
||||
// support the rule being a RegExp, but reformat it to
|
||||
// the custom :<regexp> format that we're working with.
|
||||
if (rule instanceof RegExp) {
|
||||
// rule = ':' + rule.toString().replace(/^\/(.*?)\/$/g, '$1');
|
||||
utils.log.error('RegExp format no longer supported, but globs are.');
|
||||
return;
|
||||
}
|
||||
|
||||
// remove comments and trim lines
|
||||
// this mess of replace methods is escaping "\#" to allow for emacs temp files
|
||||
|
||||
// first up strip comments and remove blank head or tails
|
||||
rule = (rule || '').replace(reEscComments, '^^')
|
||||
.replace(reComments, '')
|
||||
.replace(reUnescapeComments, '#').trim();
|
||||
|
||||
var regexp = false;
|
||||
|
||||
if (typeof rule === 'string' && rule.substring(0, 1) === ':') {
|
||||
rule = rule.substring(1);
|
||||
utils.log.error('RegExp no longer supported: ' + rule);
|
||||
regexp = true;
|
||||
} else if (rule.length === 0) {
|
||||
// blank line (or it was a comment)
|
||||
return;
|
||||
}
|
||||
|
||||
if (regexp) {
|
||||
// rules[which].push(rule);
|
||||
} else {
|
||||
// rule = rule.replace(reEscapeChars, '\\$&')
|
||||
// .replace(reAsterisk, '.*');
|
||||
|
||||
rules[which].push(rule);
|
||||
// compile a regexp of all the rules for this ignore or watch
|
||||
var re = rules[which].map(function (rule) {
|
||||
return rule.replace(reEscapeChars, '\\$&')
|
||||
.replace(reAsterisk, '.*');
|
||||
}).join('|');
|
||||
|
||||
// used for the directory matching
|
||||
rules[which].re = new RegExp(re);
|
||||
}
|
||||
}
|
||||
53
qwen/nodejs/node_modules/nodemon/lib/rules/index.js
generated
vendored
Normal file
53
qwen/nodejs/node_modules/nodemon/lib/rules/index.js
generated
vendored
Normal file
@@ -0,0 +1,53 @@
|
||||
'use strict';
|
||||
var utils = require('../utils');
|
||||
var add = require('./add');
|
||||
var parse = require('./parse');
|
||||
|
||||
// exported
|
||||
var rules = { ignore: [], watch: [] };
|
||||
|
||||
/**
|
||||
* Loads a nodemon config file and populates the ignore
|
||||
* and watch rules with it's contents, and calls callback
|
||||
* with the new rules
|
||||
*
|
||||
* @param {String} filename
|
||||
* @param {Function} callback
|
||||
*/
|
||||
function load(filename, callback) {
|
||||
parse(filename, function (err, result) {
|
||||
if (err) {
|
||||
// we should have bombed already, but
|
||||
utils.log.error(err);
|
||||
callback(err);
|
||||
}
|
||||
|
||||
if (result.raw) {
|
||||
result.raw.forEach(add.bind(null, rules, 'ignore'));
|
||||
} else {
|
||||
result.ignore.forEach(add.bind(null, rules, 'ignore'));
|
||||
result.watch.forEach(add.bind(null, rules, 'watch'));
|
||||
}
|
||||
|
||||
callback(null, rules);
|
||||
});
|
||||
}
|
||||
|
||||
module.exports = {
|
||||
reset: function () { // just used for testing
|
||||
rules.ignore.length = rules.watch.length = 0;
|
||||
delete rules.ignore.re;
|
||||
delete rules.watch.re;
|
||||
},
|
||||
load: load,
|
||||
ignore: {
|
||||
test: add.bind(null, rules, 'ignore'),
|
||||
add: add.bind(null, rules, 'ignore'),
|
||||
},
|
||||
watch: {
|
||||
test: add.bind(null, rules, 'watch'),
|
||||
add: add.bind(null, rules, 'watch'),
|
||||
},
|
||||
add: add.bind(null, rules),
|
||||
rules: rules,
|
||||
};
|
||||
43
qwen/nodejs/node_modules/nodemon/lib/rules/parse.js
generated
vendored
Normal file
43
qwen/nodejs/node_modules/nodemon/lib/rules/parse.js
generated
vendored
Normal file
@@ -0,0 +1,43 @@
|
||||
'use strict';
|
||||
var fs = require('fs');
|
||||
|
||||
/**
|
||||
* Parse the nodemon config file, supporting both old style
|
||||
* plain text config file, and JSON version of the config
|
||||
*
|
||||
* @param {String} filename
|
||||
* @param {Function} callback
|
||||
*/
|
||||
function parse(filename, callback) {
|
||||
var rules = {
|
||||
ignore: [],
|
||||
watch: [],
|
||||
};
|
||||
|
||||
fs.readFile(filename, 'utf8', function (err, content) {
|
||||
|
||||
if (err) {
|
||||
return callback(err);
|
||||
}
|
||||
|
||||
var json = null;
|
||||
try {
|
||||
json = JSON.parse(content);
|
||||
} catch (e) {}
|
||||
|
||||
if (json !== null) {
|
||||
rules = {
|
||||
ignore: json.ignore || [],
|
||||
watch: json.watch || [],
|
||||
};
|
||||
|
||||
return callback(null, rules);
|
||||
}
|
||||
|
||||
// otherwise return the raw file
|
||||
return callback(null, { raw: content.split(/\n/) });
|
||||
});
|
||||
}
|
||||
|
||||
module.exports = parse;
|
||||
|
||||
74
qwen/nodejs/node_modules/nodemon/lib/spawn.js
generated
vendored
Normal file
74
qwen/nodejs/node_modules/nodemon/lib/spawn.js
generated
vendored
Normal file
@@ -0,0 +1,74 @@
|
||||
const path = require('path');
|
||||
const utils = require('./utils');
|
||||
const merge = utils.merge;
|
||||
const bus = utils.bus;
|
||||
const spawn = require('child_process').spawn;
|
||||
|
||||
module.exports = function spawnCommand(command, config, eventArgs) {
|
||||
var stdio = ['pipe', 'pipe', 'pipe'];
|
||||
|
||||
if (config.options.stdout) {
|
||||
stdio = ['pipe', process.stdout, process.stderr];
|
||||
}
|
||||
|
||||
const env = merge(process.env, { FILENAME: eventArgs[0] });
|
||||
|
||||
var sh = 'sh';
|
||||
var shFlag = '-c';
|
||||
var spawnOptions = {
|
||||
env: merge(config.options.execOptions.env, env),
|
||||
stdio: stdio,
|
||||
};
|
||||
|
||||
if (!Array.isArray(command)) {
|
||||
command = [command];
|
||||
}
|
||||
|
||||
if (utils.isWindows) {
|
||||
// if the exec includes a forward slash, reverse it for windows compat
|
||||
// but *only* apply to the first command, and none of the arguments.
|
||||
// ref #1251 and #1236
|
||||
command = command.map(executable => {
|
||||
if (executable.indexOf('/') === -1) {
|
||||
return executable;
|
||||
}
|
||||
|
||||
return executable.split(' ').map((e, i) => {
|
||||
if (i === 0) {
|
||||
return path.normalize(e);
|
||||
}
|
||||
return e;
|
||||
}).join(' ');
|
||||
});
|
||||
// taken from npm's cli: https://git.io/vNFD4
|
||||
sh = process.env.comspec || 'cmd';
|
||||
shFlag = '/d /s /c';
|
||||
spawnOptions.windowsVerbatimArguments = true;
|
||||
spawnOptions.windowsHide = true;
|
||||
}
|
||||
|
||||
const args = command.join(' ');
|
||||
const child = spawn(sh, [shFlag, args], spawnOptions);
|
||||
|
||||
if (config.required) {
|
||||
var emit = {
|
||||
stdout: function (data) {
|
||||
bus.emit('stdout', data);
|
||||
},
|
||||
stderr: function (data) {
|
||||
bus.emit('stderr', data);
|
||||
},
|
||||
};
|
||||
|
||||
// now work out what to bind to...
|
||||
if (config.options.stdout) {
|
||||
child.on('stdout', emit.stdout).on('stderr', emit.stderr);
|
||||
} else {
|
||||
child.stdout.on('data', emit.stdout);
|
||||
child.stderr.on('data', emit.stderr);
|
||||
|
||||
bus.stdout = child.stdout;
|
||||
bus.stderr = child.stderr;
|
||||
}
|
||||
}
|
||||
};
|
||||
44
qwen/nodejs/node_modules/nodemon/lib/utils/bus.js
generated
vendored
Normal file
44
qwen/nodejs/node_modules/nodemon/lib/utils/bus.js
generated
vendored
Normal file
@@ -0,0 +1,44 @@
|
||||
var events = require('events');
|
||||
var debug = require('debug')('nodemon');
|
||||
var util = require('util');
|
||||
|
||||
var Bus = function () {
|
||||
events.EventEmitter.call(this);
|
||||
};
|
||||
|
||||
util.inherits(Bus, events.EventEmitter);
|
||||
|
||||
var bus = new Bus();
|
||||
|
||||
// /*
|
||||
var collected = {};
|
||||
bus.on('newListener', function (event) {
|
||||
debug('bus new listener: %s (%s)', event, bus.listeners(event).length);
|
||||
if (!collected[event]) {
|
||||
collected[event] = true;
|
||||
bus.on(event, function () {
|
||||
debug('bus emit: %s', event);
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
// */
|
||||
|
||||
// proxy process messages (if forked) to the bus
|
||||
process.on('message', function (event) {
|
||||
debug('process.message(%s)', event);
|
||||
bus.emit(event);
|
||||
});
|
||||
|
||||
var emit = bus.emit;
|
||||
|
||||
// if nodemon was spawned via a fork, allow upstream communication
|
||||
// via process.send
|
||||
if (process.send) {
|
||||
bus.emit = function (event, data) {
|
||||
process.send({ type: event, data: data });
|
||||
emit.apply(bus, arguments);
|
||||
};
|
||||
}
|
||||
|
||||
module.exports = bus;
|
||||
40
qwen/nodejs/node_modules/nodemon/lib/utils/clone.js
generated
vendored
Normal file
40
qwen/nodejs/node_modules/nodemon/lib/utils/clone.js
generated
vendored
Normal file
@@ -0,0 +1,40 @@
|
||||
module.exports = clone;
|
||||
|
||||
// via http://stackoverflow.com/a/728694/22617
|
||||
function clone(obj) {
|
||||
// Handle the 3 simple types, and null or undefined
|
||||
if (null === obj || 'object' !== typeof obj) {
|
||||
return obj;
|
||||
}
|
||||
|
||||
var copy;
|
||||
|
||||
// Handle Date
|
||||
if (obj instanceof Date) {
|
||||
copy = new Date();
|
||||
copy.setTime(obj.getTime());
|
||||
return copy;
|
||||
}
|
||||
|
||||
// Handle Array
|
||||
if (obj instanceof Array) {
|
||||
copy = [];
|
||||
for (var i = 0, len = obj.length; i < len; i++) {
|
||||
copy[i] = clone(obj[i]);
|
||||
}
|
||||
return copy;
|
||||
}
|
||||
|
||||
// Handle Object
|
||||
if (obj instanceof Object) {
|
||||
copy = {};
|
||||
for (var attr in obj) {
|
||||
if (obj.hasOwnProperty && obj.hasOwnProperty(attr)) {
|
||||
copy[attr] = clone(obj[attr]);
|
||||
}
|
||||
}
|
||||
return copy;
|
||||
}
|
||||
|
||||
throw new Error('Unable to copy obj! Its type isn\'t supported.');
|
||||
}
|
||||
26
qwen/nodejs/node_modules/nodemon/lib/utils/colour.js
generated
vendored
Normal file
26
qwen/nodejs/node_modules/nodemon/lib/utils/colour.js
generated
vendored
Normal file
@@ -0,0 +1,26 @@
|
||||
/**
|
||||
* Encodes a string in a colour: red, yellow or green
|
||||
* @param {String} c colour to highlight in
|
||||
* @param {String} str the string to encode
|
||||
* @return {String} coloured string for terminal printing
|
||||
*/
|
||||
function colour(c, str) {
|
||||
return (colour[c] || colour.black) + str + colour.black;
|
||||
}
|
||||
|
||||
function strip(str) {
|
||||
re.lastIndex = 0; // reset position
|
||||
return str.replace(re, '');
|
||||
}
|
||||
|
||||
colour.red = '\x1B[31m';
|
||||
colour.yellow = '\x1B[33m';
|
||||
colour.green = '\x1B[32m';
|
||||
colour.black = '\x1B[39m';
|
||||
|
||||
var reStr = Object.keys(colour).map(key => colour[key]).join('|');
|
||||
var re = new RegExp(('(' + reStr + ')').replace(/\[/g, '\\['), 'g');
|
||||
|
||||
colour.strip = strip;
|
||||
|
||||
module.exports = colour;
|
||||
103
qwen/nodejs/node_modules/nodemon/lib/utils/index.js
generated
vendored
Normal file
103
qwen/nodejs/node_modules/nodemon/lib/utils/index.js
generated
vendored
Normal file
@@ -0,0 +1,103 @@
|
||||
var noop = function () { };
|
||||
var path = require('path');
|
||||
const semver = require('semver');
|
||||
var version = process.versions.node.split('.') || [null, null, null];
|
||||
|
||||
var utils = (module.exports = {
|
||||
semver: semver,
|
||||
satisfies: test => semver.satisfies(process.versions.node, test),
|
||||
version: {
|
||||
major: parseInt(version[0] || 0, 10),
|
||||
minor: parseInt(version[1] || 0, 10),
|
||||
patch: parseInt(version[2] || 0, 10),
|
||||
},
|
||||
clone: require('./clone'),
|
||||
merge: require('./merge'),
|
||||
bus: require('./bus'),
|
||||
isWindows: process.platform === 'win32',
|
||||
isMac: process.platform === 'darwin',
|
||||
isLinux: process.platform === 'linux',
|
||||
isIBMi: require('os').type() === 'OS400',
|
||||
isRequired: (function () {
|
||||
var p = module.parent;
|
||||
while (p) {
|
||||
// in electron.js engine it happens
|
||||
if (!p.filename) {
|
||||
return true;
|
||||
}
|
||||
if (p.filename.indexOf('bin' + path.sep + 'nodemon.js') !== -1) {
|
||||
return false;
|
||||
}
|
||||
p = p.parent;
|
||||
}
|
||||
|
||||
return true;
|
||||
})(),
|
||||
home: process.env.HOME || process.env.HOMEPATH,
|
||||
quiet: function () {
|
||||
// nukes the logging
|
||||
if (!this.debug) {
|
||||
for (var method in utils.log) {
|
||||
if (typeof utils.log[method] === 'function') {
|
||||
utils.log[method] = noop;
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
reset: function () {
|
||||
if (!this.debug) {
|
||||
for (var method in utils.log) {
|
||||
if (typeof utils.log[method] === 'function') {
|
||||
delete utils.log[method];
|
||||
}
|
||||
}
|
||||
}
|
||||
this.debug = false;
|
||||
},
|
||||
regexpToText: function (t) {
|
||||
return t
|
||||
.replace(/\.\*\\./g, '*.')
|
||||
.replace(/\\{2}/g, '^^')
|
||||
.replace(/\\/g, '')
|
||||
.replace(/\^\^/g, '\\');
|
||||
},
|
||||
stringify: function (exec, args) {
|
||||
// serializes an executable string and array of arguments into a string
|
||||
args = args || [];
|
||||
|
||||
return [exec]
|
||||
.concat(
|
||||
args.map(function (arg) {
|
||||
// if an argument contains a space, we want to show it with quotes
|
||||
// around it to indicate that it is a single argument
|
||||
if (arg.length > 0 && arg.indexOf(' ') === -1) {
|
||||
return arg;
|
||||
}
|
||||
// this should correctly escape nested quotes
|
||||
return JSON.stringify(arg);
|
||||
})
|
||||
)
|
||||
.join(' ')
|
||||
.trim();
|
||||
},
|
||||
});
|
||||
|
||||
utils.log = require('./log')(utils.isRequired);
|
||||
|
||||
Object.defineProperty(utils, 'debug', {
|
||||
set: function (value) {
|
||||
this.log.debug = value;
|
||||
},
|
||||
get: function () {
|
||||
return this.log.debug;
|
||||
},
|
||||
});
|
||||
|
||||
Object.defineProperty(utils, 'colours', {
|
||||
set: function (value) {
|
||||
this.log.useColours = value;
|
||||
},
|
||||
get: function () {
|
||||
return this.log.useColours;
|
||||
},
|
||||
});
|
||||
82
qwen/nodejs/node_modules/nodemon/lib/utils/log.js
generated
vendored
Normal file
82
qwen/nodejs/node_modules/nodemon/lib/utils/log.js
generated
vendored
Normal file
@@ -0,0 +1,82 @@
|
||||
var colour = require('./colour');
|
||||
var bus = require('./bus');
|
||||
var required = false;
|
||||
var useColours = true;
|
||||
|
||||
var coding = {
|
||||
log: 'black',
|
||||
info: 'yellow',
|
||||
status: 'green',
|
||||
detail: 'yellow',
|
||||
fail: 'red',
|
||||
error: 'red',
|
||||
};
|
||||
|
||||
function log(type, text) {
|
||||
var msg = '[nodemon] ' + (text || '');
|
||||
|
||||
if (useColours) {
|
||||
msg = colour(coding[type], msg);
|
||||
}
|
||||
|
||||
// always push the message through our bus, using nextTick
|
||||
// to help testing and get _out of_ promises.
|
||||
process.nextTick(() => {
|
||||
bus.emit('log', { type: type, message: text, colour: msg });
|
||||
});
|
||||
|
||||
// but if we're running on the command line, also echo out
|
||||
// question: should we actually just consume our own events?
|
||||
if (!required) {
|
||||
if (type === 'error') {
|
||||
console.error(msg);
|
||||
} else {
|
||||
console.log(msg || '');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
var Logger = function (r) {
|
||||
if (!(this instanceof Logger)) {
|
||||
return new Logger(r);
|
||||
}
|
||||
this.required(r);
|
||||
return this;
|
||||
};
|
||||
|
||||
Object.keys(coding).forEach(function (type) {
|
||||
Logger.prototype[type] = log.bind(null, type);
|
||||
});
|
||||
|
||||
// detail is for messages that are turned on during debug
|
||||
Logger.prototype.detail = function (msg) {
|
||||
if (this.debug) {
|
||||
log('detail', msg);
|
||||
}
|
||||
};
|
||||
|
||||
Logger.prototype.required = function (val) {
|
||||
required = val;
|
||||
};
|
||||
|
||||
Logger.prototype.debug = false;
|
||||
Logger.prototype._log = function (type, msg) {
|
||||
if (required) {
|
||||
bus.emit('log', { type: type, message: msg || '', colour: msg || '' });
|
||||
} else if (type === 'error') {
|
||||
console.error(msg);
|
||||
} else {
|
||||
console.log(msg || '');
|
||||
}
|
||||
};
|
||||
|
||||
Object.defineProperty(Logger.prototype, 'useColours', {
|
||||
set: function (val) {
|
||||
useColours = val;
|
||||
},
|
||||
get: function () {
|
||||
return useColours;
|
||||
},
|
||||
});
|
||||
|
||||
module.exports = Logger;
|
||||
47
qwen/nodejs/node_modules/nodemon/lib/utils/merge.js
generated
vendored
Normal file
47
qwen/nodejs/node_modules/nodemon/lib/utils/merge.js
generated
vendored
Normal file
@@ -0,0 +1,47 @@
|
||||
var clone = require('./clone');
|
||||
|
||||
module.exports = merge;
|
||||
|
||||
function typesMatch(a, b) {
|
||||
return (typeof a === typeof b) && (Array.isArray(a) === Array.isArray(b));
|
||||
}
|
||||
|
||||
/**
|
||||
* A deep merge of the source based on the target.
|
||||
* @param {Object} source [description]
|
||||
* @param {Object} target [description]
|
||||
* @return {Object} [description]
|
||||
*/
|
||||
function merge(source, target, result) {
|
||||
if (result === undefined) {
|
||||
result = clone(source);
|
||||
}
|
||||
|
||||
// merge missing values from the target to the source
|
||||
Object.getOwnPropertyNames(target).forEach(function (key) {
|
||||
if (source[key] === undefined) {
|
||||
result[key] = target[key];
|
||||
}
|
||||
});
|
||||
|
||||
Object.getOwnPropertyNames(source).forEach(function (key) {
|
||||
var value = source[key];
|
||||
|
||||
if (target[key] && typesMatch(value, target[key])) {
|
||||
// merge empty values
|
||||
if (value === '') {
|
||||
result[key] = target[key];
|
||||
}
|
||||
|
||||
if (Array.isArray(value)) {
|
||||
if (value.length === 0 && target[key].length) {
|
||||
result[key] = target[key].slice(0);
|
||||
}
|
||||
} else if (typeof value === 'object') {
|
||||
result[key] = merge(value, target[key]);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
return result;
|
||||
}
|
||||
100
qwen/nodejs/node_modules/nodemon/lib/version.js
generated
vendored
Normal file
100
qwen/nodejs/node_modules/nodemon/lib/version.js
generated
vendored
Normal file
@@ -0,0 +1,100 @@
|
||||
module.exports = version;
|
||||
module.exports.pin = pin;
|
||||
|
||||
var fs = require('fs');
|
||||
var path = require('path');
|
||||
var exec = require('child_process').exec;
|
||||
var root = null;
|
||||
|
||||
function pin() {
|
||||
return version().then(function (v) {
|
||||
version.pinned = v;
|
||||
});
|
||||
}
|
||||
|
||||
function version(callback) {
|
||||
// first find the package.json as this will be our root
|
||||
var promise = findPackage(path.dirname(module.parent.filename))
|
||||
.then(function (dir) {
|
||||
// now try to load the package
|
||||
var v = require(path.resolve(dir, 'package.json')).version;
|
||||
|
||||
if (v && v !== '0.0.0-development') {
|
||||
return v;
|
||||
}
|
||||
|
||||
root = dir;
|
||||
|
||||
// else we're in development, give the commit out
|
||||
// get the last commit and whether the working dir is dirty
|
||||
var promises = [
|
||||
branch().catch(function () { return 'master'; }),
|
||||
commit().catch(function () { return '<none>'; }),
|
||||
dirty().catch(function () { return 0; }),
|
||||
];
|
||||
|
||||
// use the cached result as the export
|
||||
return Promise.all(promises).then(function (res) {
|
||||
var branch = res[0];
|
||||
var commit = res[1];
|
||||
var dirtyCount = parseInt(res[2], 10);
|
||||
var curr = branch + ': ' + commit;
|
||||
if (dirtyCount !== 0) {
|
||||
curr += ' (' + dirtyCount + ' dirty files)';
|
||||
}
|
||||
|
||||
return curr;
|
||||
});
|
||||
}).catch(function (error) {
|
||||
console.log(error.stack);
|
||||
throw error;
|
||||
});
|
||||
|
||||
if (callback) {
|
||||
promise.then(function (res) {
|
||||
callback(null, res);
|
||||
}, callback);
|
||||
}
|
||||
|
||||
return promise;
|
||||
}
|
||||
|
||||
function findPackage(dir) {
|
||||
if (dir === '/') {
|
||||
return Promise.reject(new Error('package not found'));
|
||||
}
|
||||
return new Promise(function (resolve) {
|
||||
fs.stat(path.resolve(dir, 'package.json'), function (error, exists) {
|
||||
if (error || !exists) {
|
||||
return resolve(findPackage(path.resolve(dir, '..')));
|
||||
}
|
||||
|
||||
resolve(dir);
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
function command(cmd) {
|
||||
return new Promise(function (resolve, reject) {
|
||||
exec(cmd, { cwd: root }, function (err, stdout, stderr) {
|
||||
var error = stderr.trim();
|
||||
if (error) {
|
||||
return reject(new Error(error));
|
||||
}
|
||||
resolve(stdout.split('\n').join(''));
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
function commit() {
|
||||
return command('git rev-parse HEAD');
|
||||
}
|
||||
|
||||
function branch() {
|
||||
return command('git rev-parse --abbrev-ref HEAD');
|
||||
}
|
||||
|
||||
function dirty() {
|
||||
return command('expr $(git status --porcelain 2>/dev/null| ' +
|
||||
'egrep "^(M| M)" | wc -l)');
|
||||
}
|
||||
1
qwen/nodejs/node_modules/nodemon/node_modules/.bin/semver
generated
vendored
Symbolic link
1
qwen/nodejs/node_modules/nodemon/node_modules/.bin/semver
generated
vendored
Symbolic link
@@ -0,0 +1 @@
|
||||
../semver/bin/semver.js
|
||||
8
qwen/nodejs/node_modules/nodemon/node_modules/has-flag/index.js
generated
vendored
Normal file
8
qwen/nodejs/node_modules/nodemon/node_modules/has-flag/index.js
generated
vendored
Normal file
@@ -0,0 +1,8 @@
|
||||
'use strict';
|
||||
module.exports = (flag, argv) => {
|
||||
argv = argv || process.argv;
|
||||
const prefix = flag.startsWith('-') ? '' : (flag.length === 1 ? '-' : '--');
|
||||
const pos = argv.indexOf(prefix + flag);
|
||||
const terminatorPos = argv.indexOf('--');
|
||||
return pos !== -1 && (terminatorPos === -1 ? true : pos < terminatorPos);
|
||||
};
|
||||
9
qwen/nodejs/node_modules/nodemon/node_modules/has-flag/license
generated
vendored
Normal file
9
qwen/nodejs/node_modules/nodemon/node_modules/has-flag/license
generated
vendored
Normal file
@@ -0,0 +1,9 @@
|
||||
MIT License
|
||||
|
||||
Copyright (c) Sindre Sorhus <sindresorhus@gmail.com> (sindresorhus.com)
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
44
qwen/nodejs/node_modules/nodemon/node_modules/has-flag/package.json
generated
vendored
Normal file
44
qwen/nodejs/node_modules/nodemon/node_modules/has-flag/package.json
generated
vendored
Normal file
@@ -0,0 +1,44 @@
|
||||
{
|
||||
"name": "has-flag",
|
||||
"version": "3.0.0",
|
||||
"description": "Check if argv has a specific flag",
|
||||
"license": "MIT",
|
||||
"repository": "sindresorhus/has-flag",
|
||||
"author": {
|
||||
"name": "Sindre Sorhus",
|
||||
"email": "sindresorhus@gmail.com",
|
||||
"url": "sindresorhus.com"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=4"
|
||||
},
|
||||
"scripts": {
|
||||
"test": "xo && ava"
|
||||
},
|
||||
"files": [
|
||||
"index.js"
|
||||
],
|
||||
"keywords": [
|
||||
"has",
|
||||
"check",
|
||||
"detect",
|
||||
"contains",
|
||||
"find",
|
||||
"flag",
|
||||
"cli",
|
||||
"command-line",
|
||||
"argv",
|
||||
"process",
|
||||
"arg",
|
||||
"args",
|
||||
"argument",
|
||||
"arguments",
|
||||
"getopt",
|
||||
"minimist",
|
||||
"optimist"
|
||||
],
|
||||
"devDependencies": {
|
||||
"ava": "*",
|
||||
"xo": "*"
|
||||
}
|
||||
}
|
||||
70
qwen/nodejs/node_modules/nodemon/node_modules/has-flag/readme.md
generated
vendored
Normal file
70
qwen/nodejs/node_modules/nodemon/node_modules/has-flag/readme.md
generated
vendored
Normal file
@@ -0,0 +1,70 @@
|
||||
# has-flag [](https://travis-ci.org/sindresorhus/has-flag)
|
||||
|
||||
> Check if [`argv`](https://nodejs.org/docs/latest/api/process.html#process_process_argv) has a specific flag
|
||||
|
||||
Correctly stops looking after an `--` argument terminator.
|
||||
|
||||
|
||||
## Install
|
||||
|
||||
```
|
||||
$ npm install has-flag
|
||||
```
|
||||
|
||||
|
||||
## Usage
|
||||
|
||||
```js
|
||||
// foo.js
|
||||
const hasFlag = require('has-flag');
|
||||
|
||||
hasFlag('unicorn');
|
||||
//=> true
|
||||
|
||||
hasFlag('--unicorn');
|
||||
//=> true
|
||||
|
||||
hasFlag('f');
|
||||
//=> true
|
||||
|
||||
hasFlag('-f');
|
||||
//=> true
|
||||
|
||||
hasFlag('foo=bar');
|
||||
//=> true
|
||||
|
||||
hasFlag('foo');
|
||||
//=> false
|
||||
|
||||
hasFlag('rainbow');
|
||||
//=> false
|
||||
```
|
||||
|
||||
```
|
||||
$ node foo.js -f --unicorn --foo=bar -- --rainbow
|
||||
```
|
||||
|
||||
|
||||
## API
|
||||
|
||||
### hasFlag(flag, [argv])
|
||||
|
||||
Returns a boolean for whether the flag exists.
|
||||
|
||||
#### flag
|
||||
|
||||
Type: `string`
|
||||
|
||||
CLI flag to look for. The `--` prefix is optional.
|
||||
|
||||
#### argv
|
||||
|
||||
Type: `string[]`<br>
|
||||
Default: `process.argv`
|
||||
|
||||
CLI arguments.
|
||||
|
||||
|
||||
## License
|
||||
|
||||
MIT © [Sindre Sorhus](https://sindresorhus.com)
|
||||
15
qwen/nodejs/node_modules/nodemon/node_modules/semver/LICENSE
generated
vendored
Normal file
15
qwen/nodejs/node_modules/nodemon/node_modules/semver/LICENSE
generated
vendored
Normal file
@@ -0,0 +1,15 @@
|
||||
The ISC License
|
||||
|
||||
Copyright (c) Isaac Z. Schlueter and Contributors
|
||||
|
||||
Permission to use, copy, modify, and/or distribute this software for any
|
||||
purpose with or without fee is hereby granted, provided that the above
|
||||
copyright notice and this permission notice appear in all copies.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
|
||||
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
||||
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
|
||||
ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
||||
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
|
||||
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR
|
||||
IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
664
qwen/nodejs/node_modules/nodemon/node_modules/semver/README.md
generated
vendored
Normal file
664
qwen/nodejs/node_modules/nodemon/node_modules/semver/README.md
generated
vendored
Normal file
@@ -0,0 +1,664 @@
|
||||
semver(1) -- The semantic versioner for npm
|
||||
===========================================
|
||||
|
||||
## Install
|
||||
|
||||
```bash
|
||||
npm install semver
|
||||
````
|
||||
|
||||
## Usage
|
||||
|
||||
As a node module:
|
||||
|
||||
```js
|
||||
const semver = require('semver')
|
||||
|
||||
semver.valid('1.2.3') // '1.2.3'
|
||||
semver.valid('a.b.c') // null
|
||||
semver.clean(' =v1.2.3 ') // '1.2.3'
|
||||
semver.satisfies('1.2.3', '1.x || >=2.5.0 || 5.0.0 - 7.2.3') // true
|
||||
semver.gt('1.2.3', '9.8.7') // false
|
||||
semver.lt('1.2.3', '9.8.7') // true
|
||||
semver.minVersion('>=1.0.0') // '1.0.0'
|
||||
semver.valid(semver.coerce('v2')) // '2.0.0'
|
||||
semver.valid(semver.coerce('42.6.7.9.3-alpha')) // '42.6.7'
|
||||
```
|
||||
|
||||
You can also just load the module for the function that you care about if
|
||||
you'd like to minimize your footprint.
|
||||
|
||||
```js
|
||||
// load the whole API at once in a single object
|
||||
const semver = require('semver')
|
||||
|
||||
// or just load the bits you need
|
||||
// all of them listed here, just pick and choose what you want
|
||||
|
||||
// classes
|
||||
const SemVer = require('semver/classes/semver')
|
||||
const Comparator = require('semver/classes/comparator')
|
||||
const Range = require('semver/classes/range')
|
||||
|
||||
// functions for working with versions
|
||||
const semverParse = require('semver/functions/parse')
|
||||
const semverValid = require('semver/functions/valid')
|
||||
const semverClean = require('semver/functions/clean')
|
||||
const semverInc = require('semver/functions/inc')
|
||||
const semverDiff = require('semver/functions/diff')
|
||||
const semverMajor = require('semver/functions/major')
|
||||
const semverMinor = require('semver/functions/minor')
|
||||
const semverPatch = require('semver/functions/patch')
|
||||
const semverPrerelease = require('semver/functions/prerelease')
|
||||
const semverCompare = require('semver/functions/compare')
|
||||
const semverRcompare = require('semver/functions/rcompare')
|
||||
const semverCompareLoose = require('semver/functions/compare-loose')
|
||||
const semverCompareBuild = require('semver/functions/compare-build')
|
||||
const semverSort = require('semver/functions/sort')
|
||||
const semverRsort = require('semver/functions/rsort')
|
||||
|
||||
// low-level comparators between versions
|
||||
const semverGt = require('semver/functions/gt')
|
||||
const semverLt = require('semver/functions/lt')
|
||||
const semverEq = require('semver/functions/eq')
|
||||
const semverNeq = require('semver/functions/neq')
|
||||
const semverGte = require('semver/functions/gte')
|
||||
const semverLte = require('semver/functions/lte')
|
||||
const semverCmp = require('semver/functions/cmp')
|
||||
const semverCoerce = require('semver/functions/coerce')
|
||||
|
||||
// working with ranges
|
||||
const semverSatisfies = require('semver/functions/satisfies')
|
||||
const semverMaxSatisfying = require('semver/ranges/max-satisfying')
|
||||
const semverMinSatisfying = require('semver/ranges/min-satisfying')
|
||||
const semverToComparators = require('semver/ranges/to-comparators')
|
||||
const semverMinVersion = require('semver/ranges/min-version')
|
||||
const semverValidRange = require('semver/ranges/valid')
|
||||
const semverOutside = require('semver/ranges/outside')
|
||||
const semverGtr = require('semver/ranges/gtr')
|
||||
const semverLtr = require('semver/ranges/ltr')
|
||||
const semverIntersects = require('semver/ranges/intersects')
|
||||
const semverSimplifyRange = require('semver/ranges/simplify')
|
||||
const semverRangeSubset = require('semver/ranges/subset')
|
||||
```
|
||||
|
||||
As a command-line utility:
|
||||
|
||||
```
|
||||
$ semver -h
|
||||
|
||||
A JavaScript implementation of the https://semver.org/ specification
|
||||
Copyright Isaac Z. Schlueter
|
||||
|
||||
Usage: semver [options] <version> [<version> [...]]
|
||||
Prints valid versions sorted by SemVer precedence
|
||||
|
||||
Options:
|
||||
-r --range <range>
|
||||
Print versions that match the specified range.
|
||||
|
||||
-i --increment [<level>]
|
||||
Increment a version by the specified level. Level can
|
||||
be one of: major, minor, patch, premajor, preminor,
|
||||
prepatch, prerelease, or release. Default level is 'patch'.
|
||||
Only one version may be specified.
|
||||
|
||||
--preid <identifier>
|
||||
Identifier to be used to prefix premajor, preminor,
|
||||
prepatch or prerelease version increments.
|
||||
|
||||
-l --loose
|
||||
Interpret versions and ranges loosely
|
||||
|
||||
-n <0|1>
|
||||
This is the base to be used for the prerelease identifier.
|
||||
|
||||
-p --include-prerelease
|
||||
Always include prerelease versions in range matching
|
||||
|
||||
-c --coerce
|
||||
Coerce a string into SemVer if possible
|
||||
(does not imply --loose)
|
||||
|
||||
--rtl
|
||||
Coerce version strings right to left
|
||||
|
||||
--ltr
|
||||
Coerce version strings left to right (default)
|
||||
|
||||
Program exits successfully if any valid version satisfies
|
||||
all supplied ranges, and prints all satisfying versions.
|
||||
|
||||
If no satisfying versions are found, then exits failure.
|
||||
|
||||
Versions are printed in ascending order, so supplying
|
||||
multiple versions to the utility will just sort them.
|
||||
```
|
||||
|
||||
## Versions
|
||||
|
||||
A "version" is described by the `v2.0.0` specification found at
|
||||
<https://semver.org/>.
|
||||
|
||||
A leading `"="` or `"v"` character is stripped off and ignored.
|
||||
Support for stripping a leading "v" is kept for compatibility with `v1.0.0` of the SemVer
|
||||
specification but should not be used anymore.
|
||||
|
||||
## Ranges
|
||||
|
||||
A `version range` is a set of `comparators` that specify versions
|
||||
that satisfy the range.
|
||||
|
||||
A `comparator` is composed of an `operator` and a `version`. The set
|
||||
of primitive `operators` is:
|
||||
|
||||
* `<` Less than
|
||||
* `<=` Less than or equal to
|
||||
* `>` Greater than
|
||||
* `>=` Greater than or equal to
|
||||
* `=` Equal. If no operator is specified, then equality is assumed,
|
||||
so this operator is optional but MAY be included.
|
||||
|
||||
For example, the comparator `>=1.2.7` would match the versions
|
||||
`1.2.7`, `1.2.8`, `2.5.3`, and `1.3.9`, but not the versions `1.2.6`
|
||||
or `1.1.0`. The comparator `>1` is equivalent to `>=2.0.0` and
|
||||
would match the versions `2.0.0` and `3.1.0`, but not the versions
|
||||
`1.0.1` or `1.1.0`.
|
||||
|
||||
Comparators can be joined by whitespace to form a `comparator set`,
|
||||
which is satisfied by the **intersection** of all of the comparators
|
||||
it includes.
|
||||
|
||||
A range is composed of one or more comparator sets, joined by `||`. A
|
||||
version matches a range if and only if every comparator in at least
|
||||
one of the `||`-separated comparator sets is satisfied by the version.
|
||||
|
||||
For example, the range `>=1.2.7 <1.3.0` would match the versions
|
||||
`1.2.7`, `1.2.8`, and `1.2.99`, but not the versions `1.2.6`, `1.3.0`,
|
||||
or `1.1.0`.
|
||||
|
||||
The range `1.2.7 || >=1.2.9 <2.0.0` would match the versions `1.2.7`,
|
||||
`1.2.9`, and `1.4.6`, but not the versions `1.2.8` or `2.0.0`.
|
||||
|
||||
### Prerelease Tags
|
||||
|
||||
If a version has a prerelease tag (for example, `1.2.3-alpha.3`) then
|
||||
it will only be allowed to satisfy comparator sets if at least one
|
||||
comparator with the same `[major, minor, patch]` tuple also has a
|
||||
prerelease tag.
|
||||
|
||||
For example, the range `>1.2.3-alpha.3` would be allowed to match the
|
||||
version `1.2.3-alpha.7`, but it would *not* be satisfied by
|
||||
`3.4.5-alpha.9`, even though `3.4.5-alpha.9` is technically "greater
|
||||
than" `1.2.3-alpha.3` according to the SemVer sort rules. The version
|
||||
range only accepts prerelease tags on the `1.2.3` version.
|
||||
Version `3.4.5` *would* satisfy the range because it does not have a
|
||||
prerelease flag, and `3.4.5` is greater than `1.2.3-alpha.7`.
|
||||
|
||||
The purpose of this behavior is twofold. First, prerelease versions
|
||||
frequently are updated very quickly, and contain many breaking changes
|
||||
that are (by the author's design) not yet fit for public consumption.
|
||||
Therefore, by default, they are excluded from range-matching
|
||||
semantics.
|
||||
|
||||
Second, a user who has opted into using a prerelease version has
|
||||
indicated the intent to use *that specific* set of
|
||||
alpha/beta/rc versions. By including a prerelease tag in the range,
|
||||
the user is indicating that they are aware of the risk. However, it
|
||||
is still not appropriate to assume that they have opted into taking a
|
||||
similar risk on the *next* set of prerelease versions.
|
||||
|
||||
Note that this behavior can be suppressed (treating all prerelease
|
||||
versions as if they were normal versions, for range-matching)
|
||||
by setting the `includePrerelease` flag on the options
|
||||
object to any
|
||||
[functions](https://github.com/npm/node-semver#functions) that do
|
||||
range matching.
|
||||
|
||||
#### Prerelease Identifiers
|
||||
|
||||
The method `.inc` takes an additional `identifier` string argument that
|
||||
will append the value of the string as a prerelease identifier:
|
||||
|
||||
```javascript
|
||||
semver.inc('1.2.3', 'prerelease', 'beta')
|
||||
// '1.2.4-beta.0'
|
||||
```
|
||||
|
||||
command-line example:
|
||||
|
||||
```bash
|
||||
$ semver 1.2.3 -i prerelease --preid beta
|
||||
1.2.4-beta.0
|
||||
```
|
||||
|
||||
Which then can be used to increment further:
|
||||
|
||||
```bash
|
||||
$ semver 1.2.4-beta.0 -i prerelease
|
||||
1.2.4-beta.1
|
||||
```
|
||||
|
||||
To get out of the prerelease phase, use the `release` option:
|
||||
|
||||
```bash
|
||||
$ semver 1.2.4-beta.1 -i release
|
||||
1.2.4
|
||||
```
|
||||
|
||||
#### Prerelease Identifier Base
|
||||
|
||||
The method `.inc` takes an optional parameter 'identifierBase' string
|
||||
that will let you let your prerelease number as zero-based or one-based.
|
||||
Set to `false` to omit the prerelease number altogether.
|
||||
If you do not specify this parameter, it will default to zero-based.
|
||||
|
||||
```javascript
|
||||
semver.inc('1.2.3', 'prerelease', 'beta', '1')
|
||||
// '1.2.4-beta.1'
|
||||
```
|
||||
|
||||
```javascript
|
||||
semver.inc('1.2.3', 'prerelease', 'beta', false)
|
||||
// '1.2.4-beta'
|
||||
```
|
||||
|
||||
command-line example:
|
||||
|
||||
```bash
|
||||
$ semver 1.2.3 -i prerelease --preid beta -n 1
|
||||
1.2.4-beta.1
|
||||
```
|
||||
|
||||
```bash
|
||||
$ semver 1.2.3 -i prerelease --preid beta -n false
|
||||
1.2.4-beta
|
||||
```
|
||||
|
||||
### Advanced Range Syntax
|
||||
|
||||
Advanced range syntax desugars to primitive comparators in
|
||||
deterministic ways.
|
||||
|
||||
Advanced ranges may be combined in the same way as primitive
|
||||
comparators using white space or `||`.
|
||||
|
||||
#### Hyphen Ranges `X.Y.Z - A.B.C`
|
||||
|
||||
Specifies an inclusive set.
|
||||
|
||||
* `1.2.3 - 2.3.4` := `>=1.2.3 <=2.3.4`
|
||||
|
||||
If a partial version is provided as the first version in the inclusive
|
||||
range, then the missing pieces are replaced with zeroes.
|
||||
|
||||
* `1.2 - 2.3.4` := `>=1.2.0 <=2.3.4`
|
||||
|
||||
If a partial version is provided as the second version in the
|
||||
inclusive range, then all versions that start with the supplied parts
|
||||
of the tuple are accepted, but nothing that would be greater than the
|
||||
provided tuple parts.
|
||||
|
||||
* `1.2.3 - 2.3` := `>=1.2.3 <2.4.0-0`
|
||||
* `1.2.3 - 2` := `>=1.2.3 <3.0.0-0`
|
||||
|
||||
#### X-Ranges `1.2.x` `1.X` `1.2.*` `*`
|
||||
|
||||
Any of `X`, `x`, or `*` may be used to "stand in" for one of the
|
||||
numeric values in the `[major, minor, patch]` tuple.
|
||||
|
||||
* `*` := `>=0.0.0` (Any non-prerelease version satisfies, unless
|
||||
`includePrerelease` is specified, in which case any version at all
|
||||
satisfies)
|
||||
* `1.x` := `>=1.0.0 <2.0.0-0` (Matching major version)
|
||||
* `1.2.x` := `>=1.2.0 <1.3.0-0` (Matching major and minor versions)
|
||||
|
||||
A partial version range is treated as an X-Range, so the special
|
||||
character is in fact optional.
|
||||
|
||||
* `""` (empty string) := `*` := `>=0.0.0`
|
||||
* `1` := `1.x.x` := `>=1.0.0 <2.0.0-0`
|
||||
* `1.2` := `1.2.x` := `>=1.2.0 <1.3.0-0`
|
||||
|
||||
#### Tilde Ranges `~1.2.3` `~1.2` `~1`
|
||||
|
||||
Allows patch-level changes if a minor version is specified on the
|
||||
comparator. Allows minor-level changes if not.
|
||||
|
||||
* `~1.2.3` := `>=1.2.3 <1.(2+1).0` := `>=1.2.3 <1.3.0-0`
|
||||
* `~1.2` := `>=1.2.0 <1.(2+1).0` := `>=1.2.0 <1.3.0-0` (Same as `1.2.x`)
|
||||
* `~1` := `>=1.0.0 <(1+1).0.0` := `>=1.0.0 <2.0.0-0` (Same as `1.x`)
|
||||
* `~0.2.3` := `>=0.2.3 <0.(2+1).0` := `>=0.2.3 <0.3.0-0`
|
||||
* `~0.2` := `>=0.2.0 <0.(2+1).0` := `>=0.2.0 <0.3.0-0` (Same as `0.2.x`)
|
||||
* `~0` := `>=0.0.0 <(0+1).0.0` := `>=0.0.0 <1.0.0-0` (Same as `0.x`)
|
||||
* `~1.2.3-beta.2` := `>=1.2.3-beta.2 <1.3.0-0` Note that prereleases in
|
||||
the `1.2.3` version will be allowed, if they are greater than or
|
||||
equal to `beta.2`. So, `1.2.3-beta.4` would be allowed, but
|
||||
`1.2.4-beta.2` would not, because it is a prerelease of a
|
||||
different `[major, minor, patch]` tuple.
|
||||
|
||||
#### Caret Ranges `^1.2.3` `^0.2.5` `^0.0.4`
|
||||
|
||||
Allows changes that do not modify the left-most non-zero element in the
|
||||
`[major, minor, patch]` tuple. In other words, this allows patch and
|
||||
minor updates for versions `1.0.0` and above, patch updates for
|
||||
versions `0.X >=0.1.0`, and *no* updates for versions `0.0.X`.
|
||||
|
||||
Many authors treat a `0.x` version as if the `x` were the major
|
||||
"breaking-change" indicator.
|
||||
|
||||
Caret ranges are ideal when an author may make breaking changes
|
||||
between `0.2.4` and `0.3.0` releases, which is a common practice.
|
||||
However, it presumes that there will *not* be breaking changes between
|
||||
`0.2.4` and `0.2.5`. It allows for changes that are presumed to be
|
||||
additive (but non-breaking), according to commonly observed practices.
|
||||
|
||||
* `^1.2.3` := `>=1.2.3 <2.0.0-0`
|
||||
* `^0.2.3` := `>=0.2.3 <0.3.0-0`
|
||||
* `^0.0.3` := `>=0.0.3 <0.0.4-0`
|
||||
* `^1.2.3-beta.2` := `>=1.2.3-beta.2 <2.0.0-0` Note that prereleases in
|
||||
the `1.2.3` version will be allowed, if they are greater than or
|
||||
equal to `beta.2`. So, `1.2.3-beta.4` would be allowed, but
|
||||
`1.2.4-beta.2` would not, because it is a prerelease of a
|
||||
different `[major, minor, patch]` tuple.
|
||||
* `^0.0.3-beta` := `>=0.0.3-beta <0.0.4-0` Note that prereleases in the
|
||||
`0.0.3` version *only* will be allowed, if they are greater than or
|
||||
equal to `beta`. So, `0.0.3-pr.2` would be allowed.
|
||||
|
||||
When parsing caret ranges, a missing `patch` value desugars to the
|
||||
number `0`, but will allow flexibility within that value, even if the
|
||||
major and minor versions are both `0`.
|
||||
|
||||
* `^1.2.x` := `>=1.2.0 <2.0.0-0`
|
||||
* `^0.0.x` := `>=0.0.0 <0.1.0-0`
|
||||
* `^0.0` := `>=0.0.0 <0.1.0-0`
|
||||
|
||||
A missing `minor` and `patch` values will desugar to zero, but also
|
||||
allow flexibility within those values, even if the major version is
|
||||
zero.
|
||||
|
||||
* `^1.x` := `>=1.0.0 <2.0.0-0`
|
||||
* `^0.x` := `>=0.0.0 <1.0.0-0`
|
||||
|
||||
### Range Grammar
|
||||
|
||||
Putting all this together, here is a Backus-Naur grammar for ranges,
|
||||
for the benefit of parser authors:
|
||||
|
||||
```bnf
|
||||
range-set ::= range ( logical-or range ) *
|
||||
logical-or ::= ( ' ' ) * '||' ( ' ' ) *
|
||||
range ::= hyphen | simple ( ' ' simple ) * | ''
|
||||
hyphen ::= partial ' - ' partial
|
||||
simple ::= primitive | partial | tilde | caret
|
||||
primitive ::= ( '<' | '>' | '>=' | '<=' | '=' ) partial
|
||||
partial ::= xr ( '.' xr ( '.' xr qualifier ? )? )?
|
||||
xr ::= 'x' | 'X' | '*' | nr
|
||||
nr ::= '0' | ['1'-'9'] ( ['0'-'9'] ) *
|
||||
tilde ::= '~' partial
|
||||
caret ::= '^' partial
|
||||
qualifier ::= ( '-' pre )? ( '+' build )?
|
||||
pre ::= parts
|
||||
build ::= parts
|
||||
parts ::= part ( '.' part ) *
|
||||
part ::= nr | [-0-9A-Za-z]+
|
||||
```
|
||||
|
||||
## Functions
|
||||
|
||||
All methods and classes take a final `options` object argument. All
|
||||
options in this object are `false` by default. The options supported
|
||||
are:
|
||||
|
||||
- `loose`: Be more forgiving about not-quite-valid semver strings.
|
||||
(Any resulting output will always be 100% strict compliant, of
|
||||
course.) For backwards compatibility reasons, if the `options`
|
||||
argument is a boolean value instead of an object, it is interpreted
|
||||
to be the `loose` param.
|
||||
- `includePrerelease`: Set to suppress the [default
|
||||
behavior](https://github.com/npm/node-semver#prerelease-tags) of
|
||||
excluding prerelease tagged versions from ranges unless they are
|
||||
explicitly opted into.
|
||||
|
||||
Strict-mode Comparators and Ranges will be strict about the SemVer
|
||||
strings that they parse.
|
||||
|
||||
* `valid(v)`: Return the parsed version, or null if it's not valid.
|
||||
* `inc(v, releaseType, options, identifier, identifierBase)`:
|
||||
Return the version incremented by the release
|
||||
type (`major`, `premajor`, `minor`, `preminor`, `patch`,
|
||||
`prepatch`, `prerelease`, or `release`), or null if it's not valid
|
||||
* `premajor` in one call will bump the version up to the next major
|
||||
version and down to a prerelease of that major version.
|
||||
`preminor`, and `prepatch` work the same way.
|
||||
* If called from a non-prerelease version, `prerelease` will work the
|
||||
same as `prepatch`. It increments the patch version and then makes a
|
||||
prerelease. If the input version is already a prerelease it simply
|
||||
increments it.
|
||||
* `release` will remove any prerelease part of the version.
|
||||
* `identifier` can be used to prefix `premajor`, `preminor`,
|
||||
`prepatch`, or `prerelease` version increments. `identifierBase`
|
||||
is the base to be used for the `prerelease` identifier.
|
||||
* `prerelease(v)`: Returns an array of prerelease components, or null
|
||||
if none exist. Example: `prerelease('1.2.3-alpha.1') -> ['alpha', 1]`
|
||||
* `major(v)`: Return the major version number.
|
||||
* `minor(v)`: Return the minor version number.
|
||||
* `patch(v)`: Return the patch version number.
|
||||
* `intersects(r1, r2, loose)`: Return true if the two supplied ranges
|
||||
or comparators intersect.
|
||||
* `parse(v)`: Attempt to parse a string as a semantic version, returning either
|
||||
a `SemVer` object or `null`.
|
||||
|
||||
### Comparison
|
||||
|
||||
* `gt(v1, v2)`: `v1 > v2`
|
||||
* `gte(v1, v2)`: `v1 >= v2`
|
||||
* `lt(v1, v2)`: `v1 < v2`
|
||||
* `lte(v1, v2)`: `v1 <= v2`
|
||||
* `eq(v1, v2)`: `v1 == v2` This is true if they're logically equivalent,
|
||||
even if they're not the same string. You already know how to
|
||||
compare strings.
|
||||
* `neq(v1, v2)`: `v1 != v2` The opposite of `eq`.
|
||||
* `cmp(v1, comparator, v2)`: Pass in a comparison string, and it'll call
|
||||
the corresponding function above. `"==="` and `"!=="` do simple
|
||||
string comparison, but are included for completeness. Throws if an
|
||||
invalid comparison string is provided.
|
||||
* `compare(v1, v2)`: Return `0` if `v1 == v2`, or `1` if `v1` is greater, or `-1` if
|
||||
`v2` is greater. Sorts in ascending order if passed to `Array.sort()`.
|
||||
* `rcompare(v1, v2)`: The reverse of `compare`. Sorts an array of versions
|
||||
in descending order when passed to `Array.sort()`.
|
||||
* `compareBuild(v1, v2)`: The same as `compare` but considers `build` when two versions
|
||||
are equal. Sorts in ascending order if passed to `Array.sort()`.
|
||||
* `compareLoose(v1, v2)`: Short for `compare(v1, v2, { loose: true })`.
|
||||
* `diff(v1, v2)`: Returns the difference between two versions by the release type
|
||||
(`major`, `premajor`, `minor`, `preminor`, `patch`, `prepatch`, or `prerelease`),
|
||||
or null if the versions are the same.
|
||||
|
||||
### Sorting
|
||||
|
||||
* `sort(versions)`: Returns a sorted array of versions based on the `compareBuild`
|
||||
function.
|
||||
* `rsort(versions)`: The reverse of `sort`. Returns an array of versions based on
|
||||
the `compareBuild` function in descending order.
|
||||
|
||||
### Comparators
|
||||
|
||||
* `intersects(comparator)`: Return true if the comparators intersect
|
||||
|
||||
### Ranges
|
||||
|
||||
* `validRange(range)`: Return the valid range or null if it's not valid.
|
||||
* `satisfies(version, range)`: Return true if the version satisfies the
|
||||
range.
|
||||
* `maxSatisfying(versions, range)`: Return the highest version in the list
|
||||
that satisfies the range, or `null` if none of them do.
|
||||
* `minSatisfying(versions, range)`: Return the lowest version in the list
|
||||
that satisfies the range, or `null` if none of them do.
|
||||
* `minVersion(range)`: Return the lowest version that can match
|
||||
the given range.
|
||||
* `gtr(version, range)`: Return `true` if the version is greater than all the
|
||||
versions possible in the range.
|
||||
* `ltr(version, range)`: Return `true` if the version is less than all the
|
||||
versions possible in the range.
|
||||
* `outside(version, range, hilo)`: Return true if the version is outside
|
||||
the bounds of the range in either the high or low direction. The
|
||||
`hilo` argument must be either the string `'>'` or `'<'`. (This is
|
||||
the function called by `gtr` and `ltr`.)
|
||||
* `intersects(range)`: Return true if any of the range comparators intersect.
|
||||
* `simplifyRange(versions, range)`: Return a "simplified" range that
|
||||
matches the same items in the `versions` list as the range specified. Note
|
||||
that it does *not* guarantee that it would match the same versions in all
|
||||
cases, only for the set of versions provided. This is useful when
|
||||
generating ranges by joining together multiple versions with `||`
|
||||
programmatically, to provide the user with something a bit more
|
||||
ergonomic. If the provided range is shorter in string-length than the
|
||||
generated range, then that is returned.
|
||||
* `subset(subRange, superRange)`: Return `true` if the `subRange` range is
|
||||
entirely contained by the `superRange` range.
|
||||
|
||||
Note that, since ranges may be non-contiguous, a version might not be
|
||||
greater than a range, less than a range, *or* satisfy a range! For
|
||||
example, the range `1.2 <1.2.9 || >2.0.0` would have a hole from `1.2.9`
|
||||
until `2.0.0`, so version `1.2.10` would not be greater than the
|
||||
range (because `2.0.1` satisfies, which is higher), nor less than the
|
||||
range (since `1.2.8` satisfies, which is lower), and it also does not
|
||||
satisfy the range.
|
||||
|
||||
If you want to know if a version satisfies or does not satisfy a
|
||||
range, use the `satisfies(version, range)` function.
|
||||
|
||||
### Coercion
|
||||
|
||||
* `coerce(version, options)`: Coerces a string to semver if possible
|
||||
|
||||
This aims to provide a very forgiving translation of a non-semver string to
|
||||
semver. It looks for the first digit in a string and consumes all
|
||||
remaining characters which satisfy at least a partial semver (e.g., `1`,
|
||||
`1.2`, `1.2.3`) up to the max permitted length (256 characters). Longer
|
||||
versions are simply truncated (`4.6.3.9.2-alpha2` becomes `4.6.3`). All
|
||||
surrounding text is simply ignored (`v3.4 replaces v3.3.1` becomes
|
||||
`3.4.0`). Only text which lacks digits will fail coercion (`version one`
|
||||
is not valid). The maximum length for any semver component considered for
|
||||
coercion is 16 characters; longer components will be ignored
|
||||
(`10000000000000000.4.7.4` becomes `4.7.4`). The maximum value for any
|
||||
semver component is `Number.MAX_SAFE_INTEGER || (2**53 - 1)`; higher value
|
||||
components are invalid (`9999999999999999.4.7.4` is likely invalid).
|
||||
|
||||
If the `options.rtl` flag is set, then `coerce` will return the right-most
|
||||
coercible tuple that does not share an ending index with a longer coercible
|
||||
tuple. For example, `1.2.3.4` will return `2.3.4` in rtl mode, not
|
||||
`4.0.0`. `1.2.3/4` will return `4.0.0`, because the `4` is not a part of
|
||||
any other overlapping SemVer tuple.
|
||||
|
||||
If the `options.includePrerelease` flag is set, then the `coerce` result will contain
|
||||
prerelease and build parts of a version. For example, `1.2.3.4-rc.1+rev.2`
|
||||
will preserve prerelease `rc.1` and build `rev.2` in the result.
|
||||
|
||||
### Clean
|
||||
|
||||
* `clean(version)`: Clean a string to be a valid semver if possible
|
||||
|
||||
This will return a cleaned and trimmed semver version. If the provided
|
||||
version is not valid a null will be returned. This does not work for
|
||||
ranges.
|
||||
|
||||
ex.
|
||||
* `s.clean(' = v 2.1.5foo')`: `null`
|
||||
* `s.clean(' = v 2.1.5foo', { loose: true })`: `'2.1.5-foo'`
|
||||
* `s.clean(' = v 2.1.5-foo')`: `null`
|
||||
* `s.clean(' = v 2.1.5-foo', { loose: true })`: `'2.1.5-foo'`
|
||||
* `s.clean('=v2.1.5')`: `'2.1.5'`
|
||||
* `s.clean(' =v2.1.5')`: `'2.1.5'`
|
||||
* `s.clean(' 2.1.5 ')`: `'2.1.5'`
|
||||
* `s.clean('~1.0.0')`: `null`
|
||||
|
||||
## Constants
|
||||
|
||||
As a convenience, helper constants are exported to provide information about what `node-semver` supports:
|
||||
|
||||
### `RELEASE_TYPES`
|
||||
|
||||
- major
|
||||
- premajor
|
||||
- minor
|
||||
- preminor
|
||||
- patch
|
||||
- prepatch
|
||||
- prerelease
|
||||
|
||||
```
|
||||
const semver = require('semver');
|
||||
|
||||
if (semver.RELEASE_TYPES.includes(arbitraryUserInput)) {
|
||||
console.log('This is a valid release type!');
|
||||
} else {
|
||||
console.warn('This is NOT a valid release type!');
|
||||
}
|
||||
```
|
||||
|
||||
### `SEMVER_SPEC_VERSION`
|
||||
|
||||
2.0.0
|
||||
|
||||
```
|
||||
const semver = require('semver');
|
||||
|
||||
console.log('We are currently using the semver specification version:', semver.SEMVER_SPEC_VERSION);
|
||||
```
|
||||
|
||||
## Exported Modules
|
||||
|
||||
<!--
|
||||
TODO: Make sure that all of these items are documented (classes aren't,
|
||||
eg), and then pull the module name into the documentation for that specific
|
||||
thing.
|
||||
-->
|
||||
|
||||
You may pull in just the part of this semver utility that you need if you
|
||||
are sensitive to packing and tree-shaking concerns. The main
|
||||
`require('semver')` export uses getter functions to lazily load the parts
|
||||
of the API that are used.
|
||||
|
||||
The following modules are available:
|
||||
|
||||
* `require('semver')`
|
||||
* `require('semver/classes')`
|
||||
* `require('semver/classes/comparator')`
|
||||
* `require('semver/classes/range')`
|
||||
* `require('semver/classes/semver')`
|
||||
* `require('semver/functions/clean')`
|
||||
* `require('semver/functions/cmp')`
|
||||
* `require('semver/functions/coerce')`
|
||||
* `require('semver/functions/compare')`
|
||||
* `require('semver/functions/compare-build')`
|
||||
* `require('semver/functions/compare-loose')`
|
||||
* `require('semver/functions/diff')`
|
||||
* `require('semver/functions/eq')`
|
||||
* `require('semver/functions/gt')`
|
||||
* `require('semver/functions/gte')`
|
||||
* `require('semver/functions/inc')`
|
||||
* `require('semver/functions/lt')`
|
||||
* `require('semver/functions/lte')`
|
||||
* `require('semver/functions/major')`
|
||||
* `require('semver/functions/minor')`
|
||||
* `require('semver/functions/neq')`
|
||||
* `require('semver/functions/parse')`
|
||||
* `require('semver/functions/patch')`
|
||||
* `require('semver/functions/prerelease')`
|
||||
* `require('semver/functions/rcompare')`
|
||||
* `require('semver/functions/rsort')`
|
||||
* `require('semver/functions/satisfies')`
|
||||
* `require('semver/functions/sort')`
|
||||
* `require('semver/functions/valid')`
|
||||
* `require('semver/ranges/gtr')`
|
||||
* `require('semver/ranges/intersects')`
|
||||
* `require('semver/ranges/ltr')`
|
||||
* `require('semver/ranges/max-satisfying')`
|
||||
* `require('semver/ranges/min-satisfying')`
|
||||
* `require('semver/ranges/min-version')`
|
||||
* `require('semver/ranges/outside')`
|
||||
* `require('semver/ranges/simplify')`
|
||||
* `require('semver/ranges/subset')`
|
||||
* `require('semver/ranges/to-comparators')`
|
||||
* `require('semver/ranges/valid')`
|
||||
|
||||
191
qwen/nodejs/node_modules/nodemon/node_modules/semver/bin/semver.js
generated
vendored
Executable file
191
qwen/nodejs/node_modules/nodemon/node_modules/semver/bin/semver.js
generated
vendored
Executable file
@@ -0,0 +1,191 @@
|
||||
#!/usr/bin/env node
|
||||
// Standalone semver comparison program.
|
||||
// Exits successfully and prints matching version(s) if
|
||||
// any supplied version is valid and passes all tests.
|
||||
|
||||
'use strict'
|
||||
|
||||
const argv = process.argv.slice(2)
|
||||
|
||||
let versions = []
|
||||
|
||||
const range = []
|
||||
|
||||
let inc = null
|
||||
|
||||
const version = require('../package.json').version
|
||||
|
||||
let loose = false
|
||||
|
||||
let includePrerelease = false
|
||||
|
||||
let coerce = false
|
||||
|
||||
let rtl = false
|
||||
|
||||
let identifier
|
||||
|
||||
let identifierBase
|
||||
|
||||
const semver = require('../')
|
||||
const parseOptions = require('../internal/parse-options')
|
||||
|
||||
let reverse = false
|
||||
|
||||
let options = {}
|
||||
|
||||
const main = () => {
|
||||
if (!argv.length) {
|
||||
return help()
|
||||
}
|
||||
while (argv.length) {
|
||||
let a = argv.shift()
|
||||
const indexOfEqualSign = a.indexOf('=')
|
||||
if (indexOfEqualSign !== -1) {
|
||||
const value = a.slice(indexOfEqualSign + 1)
|
||||
a = a.slice(0, indexOfEqualSign)
|
||||
argv.unshift(value)
|
||||
}
|
||||
switch (a) {
|
||||
case '-rv': case '-rev': case '--rev': case '--reverse':
|
||||
reverse = true
|
||||
break
|
||||
case '-l': case '--loose':
|
||||
loose = true
|
||||
break
|
||||
case '-p': case '--include-prerelease':
|
||||
includePrerelease = true
|
||||
break
|
||||
case '-v': case '--version':
|
||||
versions.push(argv.shift())
|
||||
break
|
||||
case '-i': case '--inc': case '--increment':
|
||||
switch (argv[0]) {
|
||||
case 'major': case 'minor': case 'patch': case 'prerelease':
|
||||
case 'premajor': case 'preminor': case 'prepatch':
|
||||
case 'release':
|
||||
inc = argv.shift()
|
||||
break
|
||||
default:
|
||||
inc = 'patch'
|
||||
break
|
||||
}
|
||||
break
|
||||
case '--preid':
|
||||
identifier = argv.shift()
|
||||
break
|
||||
case '-r': case '--range':
|
||||
range.push(argv.shift())
|
||||
break
|
||||
case '-n':
|
||||
identifierBase = argv.shift()
|
||||
if (identifierBase === 'false') {
|
||||
identifierBase = false
|
||||
}
|
||||
break
|
||||
case '-c': case '--coerce':
|
||||
coerce = true
|
||||
break
|
||||
case '--rtl':
|
||||
rtl = true
|
||||
break
|
||||
case '--ltr':
|
||||
rtl = false
|
||||
break
|
||||
case '-h': case '--help': case '-?':
|
||||
return help()
|
||||
default:
|
||||
versions.push(a)
|
||||
break
|
||||
}
|
||||
}
|
||||
|
||||
options = parseOptions({ loose, includePrerelease, rtl })
|
||||
|
||||
versions = versions.map((v) => {
|
||||
return coerce ? (semver.coerce(v, options) || { version: v }).version : v
|
||||
}).filter((v) => {
|
||||
return semver.valid(v)
|
||||
})
|
||||
if (!versions.length) {
|
||||
return fail()
|
||||
}
|
||||
if (inc && (versions.length !== 1 || range.length)) {
|
||||
return failInc()
|
||||
}
|
||||
|
||||
for (let i = 0, l = range.length; i < l; i++) {
|
||||
versions = versions.filter((v) => {
|
||||
return semver.satisfies(v, range[i], options)
|
||||
})
|
||||
if (!versions.length) {
|
||||
return fail()
|
||||
}
|
||||
}
|
||||
versions
|
||||
.sort((a, b) => semver[reverse ? 'rcompare' : 'compare'](a, b, options))
|
||||
.map(v => semver.clean(v, options))
|
||||
.map(v => inc ? semver.inc(v, inc, options, identifier, identifierBase) : v)
|
||||
.forEach(v => console.log(v))
|
||||
}
|
||||
|
||||
const failInc = () => {
|
||||
console.error('--inc can only be used on a single version with no range')
|
||||
fail()
|
||||
}
|
||||
|
||||
const fail = () => process.exit(1)
|
||||
|
||||
const help = () => console.log(
|
||||
`SemVer ${version}
|
||||
|
||||
A JavaScript implementation of the https://semver.org/ specification
|
||||
Copyright Isaac Z. Schlueter
|
||||
|
||||
Usage: semver [options] <version> [<version> [...]]
|
||||
Prints valid versions sorted by SemVer precedence
|
||||
|
||||
Options:
|
||||
-r --range <range>
|
||||
Print versions that match the specified range.
|
||||
|
||||
-i --increment [<level>]
|
||||
Increment a version by the specified level. Level can
|
||||
be one of: major, minor, patch, premajor, preminor,
|
||||
prepatch, prerelease, or release. Default level is 'patch'.
|
||||
Only one version may be specified.
|
||||
|
||||
--preid <identifier>
|
||||
Identifier to be used to prefix premajor, preminor,
|
||||
prepatch or prerelease version increments.
|
||||
|
||||
-l --loose
|
||||
Interpret versions and ranges loosely
|
||||
|
||||
-p --include-prerelease
|
||||
Always include prerelease versions in range matching
|
||||
|
||||
-c --coerce
|
||||
Coerce a string into SemVer if possible
|
||||
(does not imply --loose)
|
||||
|
||||
--rtl
|
||||
Coerce version strings right to left
|
||||
|
||||
--ltr
|
||||
Coerce version strings left to right (default)
|
||||
|
||||
-n <base>
|
||||
Base number to be used for the prerelease identifier.
|
||||
Can be either 0 or 1, or false to omit the number altogether.
|
||||
Defaults to 0.
|
||||
|
||||
Program exits successfully if any valid version satisfies
|
||||
all supplied ranges, and prints all satisfying versions.
|
||||
|
||||
If no satisfying versions are found, then exits failure.
|
||||
|
||||
Versions are printed in ascending order, so supplying
|
||||
multiple versions to the utility will just sort them.`)
|
||||
|
||||
main()
|
||||
143
qwen/nodejs/node_modules/nodemon/node_modules/semver/classes/comparator.js
generated
vendored
Normal file
143
qwen/nodejs/node_modules/nodemon/node_modules/semver/classes/comparator.js
generated
vendored
Normal file
@@ -0,0 +1,143 @@
|
||||
'use strict'
|
||||
|
||||
const ANY = Symbol('SemVer ANY')
|
||||
// hoisted class for cyclic dependency
|
||||
class Comparator {
|
||||
static get ANY () {
|
||||
return ANY
|
||||
}
|
||||
|
||||
constructor (comp, options) {
|
||||
options = parseOptions(options)
|
||||
|
||||
if (comp instanceof Comparator) {
|
||||
if (comp.loose === !!options.loose) {
|
||||
return comp
|
||||
} else {
|
||||
comp = comp.value
|
||||
}
|
||||
}
|
||||
|
||||
comp = comp.trim().split(/\s+/).join(' ')
|
||||
debug('comparator', comp, options)
|
||||
this.options = options
|
||||
this.loose = !!options.loose
|
||||
this.parse(comp)
|
||||
|
||||
if (this.semver === ANY) {
|
||||
this.value = ''
|
||||
} else {
|
||||
this.value = this.operator + this.semver.version
|
||||
}
|
||||
|
||||
debug('comp', this)
|
||||
}
|
||||
|
||||
parse (comp) {
|
||||
const r = this.options.loose ? re[t.COMPARATORLOOSE] : re[t.COMPARATOR]
|
||||
const m = comp.match(r)
|
||||
|
||||
if (!m) {
|
||||
throw new TypeError(`Invalid comparator: ${comp}`)
|
||||
}
|
||||
|
||||
this.operator = m[1] !== undefined ? m[1] : ''
|
||||
if (this.operator === '=') {
|
||||
this.operator = ''
|
||||
}
|
||||
|
||||
// if it literally is just '>' or '' then allow anything.
|
||||
if (!m[2]) {
|
||||
this.semver = ANY
|
||||
} else {
|
||||
this.semver = new SemVer(m[2], this.options.loose)
|
||||
}
|
||||
}
|
||||
|
||||
toString () {
|
||||
return this.value
|
||||
}
|
||||
|
||||
test (version) {
|
||||
debug('Comparator.test', version, this.options.loose)
|
||||
|
||||
if (this.semver === ANY || version === ANY) {
|
||||
return true
|
||||
}
|
||||
|
||||
if (typeof version === 'string') {
|
||||
try {
|
||||
version = new SemVer(version, this.options)
|
||||
} catch (er) {
|
||||
return false
|
||||
}
|
||||
}
|
||||
|
||||
return cmp(version, this.operator, this.semver, this.options)
|
||||
}
|
||||
|
||||
intersects (comp, options) {
|
||||
if (!(comp instanceof Comparator)) {
|
||||
throw new TypeError('a Comparator is required')
|
||||
}
|
||||
|
||||
if (this.operator === '') {
|
||||
if (this.value === '') {
|
||||
return true
|
||||
}
|
||||
return new Range(comp.value, options).test(this.value)
|
||||
} else if (comp.operator === '') {
|
||||
if (comp.value === '') {
|
||||
return true
|
||||
}
|
||||
return new Range(this.value, options).test(comp.semver)
|
||||
}
|
||||
|
||||
options = parseOptions(options)
|
||||
|
||||
// Special cases where nothing can possibly be lower
|
||||
if (options.includePrerelease &&
|
||||
(this.value === '<0.0.0-0' || comp.value === '<0.0.0-0')) {
|
||||
return false
|
||||
}
|
||||
if (!options.includePrerelease &&
|
||||
(this.value.startsWith('<0.0.0') || comp.value.startsWith('<0.0.0'))) {
|
||||
return false
|
||||
}
|
||||
|
||||
// Same direction increasing (> or >=)
|
||||
if (this.operator.startsWith('>') && comp.operator.startsWith('>')) {
|
||||
return true
|
||||
}
|
||||
// Same direction decreasing (< or <=)
|
||||
if (this.operator.startsWith('<') && comp.operator.startsWith('<')) {
|
||||
return true
|
||||
}
|
||||
// same SemVer and both sides are inclusive (<= or >=)
|
||||
if (
|
||||
(this.semver.version === comp.semver.version) &&
|
||||
this.operator.includes('=') && comp.operator.includes('=')) {
|
||||
return true
|
||||
}
|
||||
// opposite directions less than
|
||||
if (cmp(this.semver, '<', comp.semver, options) &&
|
||||
this.operator.startsWith('>') && comp.operator.startsWith('<')) {
|
||||
return true
|
||||
}
|
||||
// opposite directions greater than
|
||||
if (cmp(this.semver, '>', comp.semver, options) &&
|
||||
this.operator.startsWith('<') && comp.operator.startsWith('>')) {
|
||||
return true
|
||||
}
|
||||
return false
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = Comparator
|
||||
|
||||
const parseOptions = require('../internal/parse-options')
|
||||
const { safeRe: re, t } = require('../internal/re')
|
||||
const cmp = require('../functions/cmp')
|
||||
const debug = require('../internal/debug')
|
||||
const SemVer = require('./semver')
|
||||
const Range = require('./range')
|
||||
7
qwen/nodejs/node_modules/nodemon/node_modules/semver/classes/index.js
generated
vendored
Normal file
7
qwen/nodejs/node_modules/nodemon/node_modules/semver/classes/index.js
generated
vendored
Normal file
@@ -0,0 +1,7 @@
|
||||
'use strict'
|
||||
|
||||
module.exports = {
|
||||
SemVer: require('./semver.js'),
|
||||
Range: require('./range.js'),
|
||||
Comparator: require('./comparator.js'),
|
||||
}
|
||||
557
qwen/nodejs/node_modules/nodemon/node_modules/semver/classes/range.js
generated
vendored
Normal file
557
qwen/nodejs/node_modules/nodemon/node_modules/semver/classes/range.js
generated
vendored
Normal file
@@ -0,0 +1,557 @@
|
||||
'use strict'
|
||||
|
||||
const SPACE_CHARACTERS = /\s+/g
|
||||
|
||||
// hoisted class for cyclic dependency
|
||||
class Range {
|
||||
constructor (range, options) {
|
||||
options = parseOptions(options)
|
||||
|
||||
if (range instanceof Range) {
|
||||
if (
|
||||
range.loose === !!options.loose &&
|
||||
range.includePrerelease === !!options.includePrerelease
|
||||
) {
|
||||
return range
|
||||
} else {
|
||||
return new Range(range.raw, options)
|
||||
}
|
||||
}
|
||||
|
||||
if (range instanceof Comparator) {
|
||||
// just put it in the set and return
|
||||
this.raw = range.value
|
||||
this.set = [[range]]
|
||||
this.formatted = undefined
|
||||
return this
|
||||
}
|
||||
|
||||
this.options = options
|
||||
this.loose = !!options.loose
|
||||
this.includePrerelease = !!options.includePrerelease
|
||||
|
||||
// First reduce all whitespace as much as possible so we do not have to rely
|
||||
// on potentially slow regexes like \s*. This is then stored and used for
|
||||
// future error messages as well.
|
||||
this.raw = range.trim().replace(SPACE_CHARACTERS, ' ')
|
||||
|
||||
// First, split on ||
|
||||
this.set = this.raw
|
||||
.split('||')
|
||||
// map the range to a 2d array of comparators
|
||||
.map(r => this.parseRange(r.trim()))
|
||||
// throw out any comparator lists that are empty
|
||||
// this generally means that it was not a valid range, which is allowed
|
||||
// in loose mode, but will still throw if the WHOLE range is invalid.
|
||||
.filter(c => c.length)
|
||||
|
||||
if (!this.set.length) {
|
||||
throw new TypeError(`Invalid SemVer Range: ${this.raw}`)
|
||||
}
|
||||
|
||||
// if we have any that are not the null set, throw out null sets.
|
||||
if (this.set.length > 1) {
|
||||
// keep the first one, in case they're all null sets
|
||||
const first = this.set[0]
|
||||
this.set = this.set.filter(c => !isNullSet(c[0]))
|
||||
if (this.set.length === 0) {
|
||||
this.set = [first]
|
||||
} else if (this.set.length > 1) {
|
||||
// if we have any that are *, then the range is just *
|
||||
for (const c of this.set) {
|
||||
if (c.length === 1 && isAny(c[0])) {
|
||||
this.set = [c]
|
||||
break
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
this.formatted = undefined
|
||||
}
|
||||
|
||||
get range () {
|
||||
if (this.formatted === undefined) {
|
||||
this.formatted = ''
|
||||
for (let i = 0; i < this.set.length; i++) {
|
||||
if (i > 0) {
|
||||
this.formatted += '||'
|
||||
}
|
||||
const comps = this.set[i]
|
||||
for (let k = 0; k < comps.length; k++) {
|
||||
if (k > 0) {
|
||||
this.formatted += ' '
|
||||
}
|
||||
this.formatted += comps[k].toString().trim()
|
||||
}
|
||||
}
|
||||
}
|
||||
return this.formatted
|
||||
}
|
||||
|
||||
format () {
|
||||
return this.range
|
||||
}
|
||||
|
||||
toString () {
|
||||
return this.range
|
||||
}
|
||||
|
||||
parseRange (range) {
|
||||
// memoize range parsing for performance.
|
||||
// this is a very hot path, and fully deterministic.
|
||||
const memoOpts =
|
||||
(this.options.includePrerelease && FLAG_INCLUDE_PRERELEASE) |
|
||||
(this.options.loose && FLAG_LOOSE)
|
||||
const memoKey = memoOpts + ':' + range
|
||||
const cached = cache.get(memoKey)
|
||||
if (cached) {
|
||||
return cached
|
||||
}
|
||||
|
||||
const loose = this.options.loose
|
||||
// `1.2.3 - 1.2.4` => `>=1.2.3 <=1.2.4`
|
||||
const hr = loose ? re[t.HYPHENRANGELOOSE] : re[t.HYPHENRANGE]
|
||||
range = range.replace(hr, hyphenReplace(this.options.includePrerelease))
|
||||
debug('hyphen replace', range)
|
||||
|
||||
// `> 1.2.3 < 1.2.5` => `>1.2.3 <1.2.5`
|
||||
range = range.replace(re[t.COMPARATORTRIM], comparatorTrimReplace)
|
||||
debug('comparator trim', range)
|
||||
|
||||
// `~ 1.2.3` => `~1.2.3`
|
||||
range = range.replace(re[t.TILDETRIM], tildeTrimReplace)
|
||||
debug('tilde trim', range)
|
||||
|
||||
// `^ 1.2.3` => `^1.2.3`
|
||||
range = range.replace(re[t.CARETTRIM], caretTrimReplace)
|
||||
debug('caret trim', range)
|
||||
|
||||
// At this point, the range is completely trimmed and
|
||||
// ready to be split into comparators.
|
||||
|
||||
let rangeList = range
|
||||
.split(' ')
|
||||
.map(comp => parseComparator(comp, this.options))
|
||||
.join(' ')
|
||||
.split(/\s+/)
|
||||
// >=0.0.0 is equivalent to *
|
||||
.map(comp => replaceGTE0(comp, this.options))
|
||||
|
||||
if (loose) {
|
||||
// in loose mode, throw out any that are not valid comparators
|
||||
rangeList = rangeList.filter(comp => {
|
||||
debug('loose invalid filter', comp, this.options)
|
||||
return !!comp.match(re[t.COMPARATORLOOSE])
|
||||
})
|
||||
}
|
||||
debug('range list', rangeList)
|
||||
|
||||
// if any comparators are the null set, then replace with JUST null set
|
||||
// if more than one comparator, remove any * comparators
|
||||
// also, don't include the same comparator more than once
|
||||
const rangeMap = new Map()
|
||||
const comparators = rangeList.map(comp => new Comparator(comp, this.options))
|
||||
for (const comp of comparators) {
|
||||
if (isNullSet(comp)) {
|
||||
return [comp]
|
||||
}
|
||||
rangeMap.set(comp.value, comp)
|
||||
}
|
||||
if (rangeMap.size > 1 && rangeMap.has('')) {
|
||||
rangeMap.delete('')
|
||||
}
|
||||
|
||||
const result = [...rangeMap.values()]
|
||||
cache.set(memoKey, result)
|
||||
return result
|
||||
}
|
||||
|
||||
intersects (range, options) {
|
||||
if (!(range instanceof Range)) {
|
||||
throw new TypeError('a Range is required')
|
||||
}
|
||||
|
||||
return this.set.some((thisComparators) => {
|
||||
return (
|
||||
isSatisfiable(thisComparators, options) &&
|
||||
range.set.some((rangeComparators) => {
|
||||
return (
|
||||
isSatisfiable(rangeComparators, options) &&
|
||||
thisComparators.every((thisComparator) => {
|
||||
return rangeComparators.every((rangeComparator) => {
|
||||
return thisComparator.intersects(rangeComparator, options)
|
||||
})
|
||||
})
|
||||
)
|
||||
})
|
||||
)
|
||||
})
|
||||
}
|
||||
|
||||
// if ANY of the sets match ALL of its comparators, then pass
|
||||
test (version) {
|
||||
if (!version) {
|
||||
return false
|
||||
}
|
||||
|
||||
if (typeof version === 'string') {
|
||||
try {
|
||||
version = new SemVer(version, this.options)
|
||||
} catch (er) {
|
||||
return false
|
||||
}
|
||||
}
|
||||
|
||||
for (let i = 0; i < this.set.length; i++) {
|
||||
if (testSet(this.set[i], version, this.options)) {
|
||||
return true
|
||||
}
|
||||
}
|
||||
return false
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = Range
|
||||
|
||||
const LRU = require('../internal/lrucache')
|
||||
const cache = new LRU()
|
||||
|
||||
const parseOptions = require('../internal/parse-options')
|
||||
const Comparator = require('./comparator')
|
||||
const debug = require('../internal/debug')
|
||||
const SemVer = require('./semver')
|
||||
const {
|
||||
safeRe: re,
|
||||
t,
|
||||
comparatorTrimReplace,
|
||||
tildeTrimReplace,
|
||||
caretTrimReplace,
|
||||
} = require('../internal/re')
|
||||
const { FLAG_INCLUDE_PRERELEASE, FLAG_LOOSE } = require('../internal/constants')
|
||||
|
||||
const isNullSet = c => c.value === '<0.0.0-0'
|
||||
const isAny = c => c.value === ''
|
||||
|
||||
// take a set of comparators and determine whether there
|
||||
// exists a version which can satisfy it
|
||||
const isSatisfiable = (comparators, options) => {
|
||||
let result = true
|
||||
const remainingComparators = comparators.slice()
|
||||
let testComparator = remainingComparators.pop()
|
||||
|
||||
while (result && remainingComparators.length) {
|
||||
result = remainingComparators.every((otherComparator) => {
|
||||
return testComparator.intersects(otherComparator, options)
|
||||
})
|
||||
|
||||
testComparator = remainingComparators.pop()
|
||||
}
|
||||
|
||||
return result
|
||||
}
|
||||
|
||||
// comprised of xranges, tildes, stars, and gtlt's at this point.
|
||||
// already replaced the hyphen ranges
|
||||
// turn into a set of JUST comparators.
|
||||
const parseComparator = (comp, options) => {
|
||||
comp = comp.replace(re[t.BUILD], '')
|
||||
debug('comp', comp, options)
|
||||
comp = replaceCarets(comp, options)
|
||||
debug('caret', comp)
|
||||
comp = replaceTildes(comp, options)
|
||||
debug('tildes', comp)
|
||||
comp = replaceXRanges(comp, options)
|
||||
debug('xrange', comp)
|
||||
comp = replaceStars(comp, options)
|
||||
debug('stars', comp)
|
||||
return comp
|
||||
}
|
||||
|
||||
const isX = id => !id || id.toLowerCase() === 'x' || id === '*'
|
||||
|
||||
// ~, ~> --> * (any, kinda silly)
|
||||
// ~2, ~2.x, ~2.x.x, ~>2, ~>2.x ~>2.x.x --> >=2.0.0 <3.0.0-0
|
||||
// ~2.0, ~2.0.x, ~>2.0, ~>2.0.x --> >=2.0.0 <2.1.0-0
|
||||
// ~1.2, ~1.2.x, ~>1.2, ~>1.2.x --> >=1.2.0 <1.3.0-0
|
||||
// ~1.2.3, ~>1.2.3 --> >=1.2.3 <1.3.0-0
|
||||
// ~1.2.0, ~>1.2.0 --> >=1.2.0 <1.3.0-0
|
||||
// ~0.0.1 --> >=0.0.1 <0.1.0-0
|
||||
const replaceTildes = (comp, options) => {
|
||||
return comp
|
||||
.trim()
|
||||
.split(/\s+/)
|
||||
.map((c) => replaceTilde(c, options))
|
||||
.join(' ')
|
||||
}
|
||||
|
||||
const replaceTilde = (comp, options) => {
|
||||
const r = options.loose ? re[t.TILDELOOSE] : re[t.TILDE]
|
||||
return comp.replace(r, (_, M, m, p, pr) => {
|
||||
debug('tilde', comp, _, M, m, p, pr)
|
||||
let ret
|
||||
|
||||
if (isX(M)) {
|
||||
ret = ''
|
||||
} else if (isX(m)) {
|
||||
ret = `>=${M}.0.0 <${+M + 1}.0.0-0`
|
||||
} else if (isX(p)) {
|
||||
// ~1.2 == >=1.2.0 <1.3.0-0
|
||||
ret = `>=${M}.${m}.0 <${M}.${+m + 1}.0-0`
|
||||
} else if (pr) {
|
||||
debug('replaceTilde pr', pr)
|
||||
ret = `>=${M}.${m}.${p}-${pr
|
||||
} <${M}.${+m + 1}.0-0`
|
||||
} else {
|
||||
// ~1.2.3 == >=1.2.3 <1.3.0-0
|
||||
ret = `>=${M}.${m}.${p
|
||||
} <${M}.${+m + 1}.0-0`
|
||||
}
|
||||
|
||||
debug('tilde return', ret)
|
||||
return ret
|
||||
})
|
||||
}
|
||||
|
||||
// ^ --> * (any, kinda silly)
|
||||
// ^2, ^2.x, ^2.x.x --> >=2.0.0 <3.0.0-0
|
||||
// ^2.0, ^2.0.x --> >=2.0.0 <3.0.0-0
|
||||
// ^1.2, ^1.2.x --> >=1.2.0 <2.0.0-0
|
||||
// ^1.2.3 --> >=1.2.3 <2.0.0-0
|
||||
// ^1.2.0 --> >=1.2.0 <2.0.0-0
|
||||
// ^0.0.1 --> >=0.0.1 <0.0.2-0
|
||||
// ^0.1.0 --> >=0.1.0 <0.2.0-0
|
||||
const replaceCarets = (comp, options) => {
|
||||
return comp
|
||||
.trim()
|
||||
.split(/\s+/)
|
||||
.map((c) => replaceCaret(c, options))
|
||||
.join(' ')
|
||||
}
|
||||
|
||||
const replaceCaret = (comp, options) => {
|
||||
debug('caret', comp, options)
|
||||
const r = options.loose ? re[t.CARETLOOSE] : re[t.CARET]
|
||||
const z = options.includePrerelease ? '-0' : ''
|
||||
return comp.replace(r, (_, M, m, p, pr) => {
|
||||
debug('caret', comp, _, M, m, p, pr)
|
||||
let ret
|
||||
|
||||
if (isX(M)) {
|
||||
ret = ''
|
||||
} else if (isX(m)) {
|
||||
ret = `>=${M}.0.0${z} <${+M + 1}.0.0-0`
|
||||
} else if (isX(p)) {
|
||||
if (M === '0') {
|
||||
ret = `>=${M}.${m}.0${z} <${M}.${+m + 1}.0-0`
|
||||
} else {
|
||||
ret = `>=${M}.${m}.0${z} <${+M + 1}.0.0-0`
|
||||
}
|
||||
} else if (pr) {
|
||||
debug('replaceCaret pr', pr)
|
||||
if (M === '0') {
|
||||
if (m === '0') {
|
||||
ret = `>=${M}.${m}.${p}-${pr
|
||||
} <${M}.${m}.${+p + 1}-0`
|
||||
} else {
|
||||
ret = `>=${M}.${m}.${p}-${pr
|
||||
} <${M}.${+m + 1}.0-0`
|
||||
}
|
||||
} else {
|
||||
ret = `>=${M}.${m}.${p}-${pr
|
||||
} <${+M + 1}.0.0-0`
|
||||
}
|
||||
} else {
|
||||
debug('no pr')
|
||||
if (M === '0') {
|
||||
if (m === '0') {
|
||||
ret = `>=${M}.${m}.${p
|
||||
}${z} <${M}.${m}.${+p + 1}-0`
|
||||
} else {
|
||||
ret = `>=${M}.${m}.${p
|
||||
}${z} <${M}.${+m + 1}.0-0`
|
||||
}
|
||||
} else {
|
||||
ret = `>=${M}.${m}.${p
|
||||
} <${+M + 1}.0.0-0`
|
||||
}
|
||||
}
|
||||
|
||||
debug('caret return', ret)
|
||||
return ret
|
||||
})
|
||||
}
|
||||
|
||||
const replaceXRanges = (comp, options) => {
|
||||
debug('replaceXRanges', comp, options)
|
||||
return comp
|
||||
.split(/\s+/)
|
||||
.map((c) => replaceXRange(c, options))
|
||||
.join(' ')
|
||||
}
|
||||
|
||||
const replaceXRange = (comp, options) => {
|
||||
comp = comp.trim()
|
||||
const r = options.loose ? re[t.XRANGELOOSE] : re[t.XRANGE]
|
||||
return comp.replace(r, (ret, gtlt, M, m, p, pr) => {
|
||||
debug('xRange', comp, ret, gtlt, M, m, p, pr)
|
||||
const xM = isX(M)
|
||||
const xm = xM || isX(m)
|
||||
const xp = xm || isX(p)
|
||||
const anyX = xp
|
||||
|
||||
if (gtlt === '=' && anyX) {
|
||||
gtlt = ''
|
||||
}
|
||||
|
||||
// if we're including prereleases in the match, then we need
|
||||
// to fix this to -0, the lowest possible prerelease value
|
||||
pr = options.includePrerelease ? '-0' : ''
|
||||
|
||||
if (xM) {
|
||||
if (gtlt === '>' || gtlt === '<') {
|
||||
// nothing is allowed
|
||||
ret = '<0.0.0-0'
|
||||
} else {
|
||||
// nothing is forbidden
|
||||
ret = '*'
|
||||
}
|
||||
} else if (gtlt && anyX) {
|
||||
// we know patch is an x, because we have any x at all.
|
||||
// replace X with 0
|
||||
if (xm) {
|
||||
m = 0
|
||||
}
|
||||
p = 0
|
||||
|
||||
if (gtlt === '>') {
|
||||
// >1 => >=2.0.0
|
||||
// >1.2 => >=1.3.0
|
||||
gtlt = '>='
|
||||
if (xm) {
|
||||
M = +M + 1
|
||||
m = 0
|
||||
p = 0
|
||||
} else {
|
||||
m = +m + 1
|
||||
p = 0
|
||||
}
|
||||
} else if (gtlt === '<=') {
|
||||
// <=0.7.x is actually <0.8.0, since any 0.7.x should
|
||||
// pass. Similarly, <=7.x is actually <8.0.0, etc.
|
||||
gtlt = '<'
|
||||
if (xm) {
|
||||
M = +M + 1
|
||||
} else {
|
||||
m = +m + 1
|
||||
}
|
||||
}
|
||||
|
||||
if (gtlt === '<') {
|
||||
pr = '-0'
|
||||
}
|
||||
|
||||
ret = `${gtlt + M}.${m}.${p}${pr}`
|
||||
} else if (xm) {
|
||||
ret = `>=${M}.0.0${pr} <${+M + 1}.0.0-0`
|
||||
} else if (xp) {
|
||||
ret = `>=${M}.${m}.0${pr
|
||||
} <${M}.${+m + 1}.0-0`
|
||||
}
|
||||
|
||||
debug('xRange return', ret)
|
||||
|
||||
return ret
|
||||
})
|
||||
}
|
||||
|
||||
// Because * is AND-ed with everything else in the comparator,
|
||||
// and '' means "any version", just remove the *s entirely.
|
||||
const replaceStars = (comp, options) => {
|
||||
debug('replaceStars', comp, options)
|
||||
// Looseness is ignored here. star is always as loose as it gets!
|
||||
return comp
|
||||
.trim()
|
||||
.replace(re[t.STAR], '')
|
||||
}
|
||||
|
||||
const replaceGTE0 = (comp, options) => {
|
||||
debug('replaceGTE0', comp, options)
|
||||
return comp
|
||||
.trim()
|
||||
.replace(re[options.includePrerelease ? t.GTE0PRE : t.GTE0], '')
|
||||
}
|
||||
|
||||
// This function is passed to string.replace(re[t.HYPHENRANGE])
|
||||
// M, m, patch, prerelease, build
|
||||
// 1.2 - 3.4.5 => >=1.2.0 <=3.4.5
|
||||
// 1.2.3 - 3.4 => >=1.2.0 <3.5.0-0 Any 3.4.x will do
|
||||
// 1.2 - 3.4 => >=1.2.0 <3.5.0-0
|
||||
// TODO build?
|
||||
const hyphenReplace = incPr => ($0,
|
||||
from, fM, fm, fp, fpr, fb,
|
||||
to, tM, tm, tp, tpr) => {
|
||||
if (isX(fM)) {
|
||||
from = ''
|
||||
} else if (isX(fm)) {
|
||||
from = `>=${fM}.0.0${incPr ? '-0' : ''}`
|
||||
} else if (isX(fp)) {
|
||||
from = `>=${fM}.${fm}.0${incPr ? '-0' : ''}`
|
||||
} else if (fpr) {
|
||||
from = `>=${from}`
|
||||
} else {
|
||||
from = `>=${from}${incPr ? '-0' : ''}`
|
||||
}
|
||||
|
||||
if (isX(tM)) {
|
||||
to = ''
|
||||
} else if (isX(tm)) {
|
||||
to = `<${+tM + 1}.0.0-0`
|
||||
} else if (isX(tp)) {
|
||||
to = `<${tM}.${+tm + 1}.0-0`
|
||||
} else if (tpr) {
|
||||
to = `<=${tM}.${tm}.${tp}-${tpr}`
|
||||
} else if (incPr) {
|
||||
to = `<${tM}.${tm}.${+tp + 1}-0`
|
||||
} else {
|
||||
to = `<=${to}`
|
||||
}
|
||||
|
||||
return `${from} ${to}`.trim()
|
||||
}
|
||||
|
||||
const testSet = (set, version, options) => {
|
||||
for (let i = 0; i < set.length; i++) {
|
||||
if (!set[i].test(version)) {
|
||||
return false
|
||||
}
|
||||
}
|
||||
|
||||
if (version.prerelease.length && !options.includePrerelease) {
|
||||
// Find the set of versions that are allowed to have prereleases
|
||||
// For example, ^1.2.3-pr.1 desugars to >=1.2.3-pr.1 <2.0.0
|
||||
// That should allow `1.2.3-pr.2` to pass.
|
||||
// However, `1.2.4-alpha.notready` should NOT be allowed,
|
||||
// even though it's within the range set by the comparators.
|
||||
for (let i = 0; i < set.length; i++) {
|
||||
debug(set[i].semver)
|
||||
if (set[i].semver === Comparator.ANY) {
|
||||
continue
|
||||
}
|
||||
|
||||
if (set[i].semver.prerelease.length > 0) {
|
||||
const allowed = set[i].semver
|
||||
if (allowed.major === version.major &&
|
||||
allowed.minor === version.minor &&
|
||||
allowed.patch === version.patch) {
|
||||
return true
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Version has a -pre, but it's not one of the ones we like.
|
||||
return false
|
||||
}
|
||||
|
||||
return true
|
||||
}
|
||||
333
qwen/nodejs/node_modules/nodemon/node_modules/semver/classes/semver.js
generated
vendored
Normal file
333
qwen/nodejs/node_modules/nodemon/node_modules/semver/classes/semver.js
generated
vendored
Normal file
@@ -0,0 +1,333 @@
|
||||
'use strict'
|
||||
|
||||
const debug = require('../internal/debug')
|
||||
const { MAX_LENGTH, MAX_SAFE_INTEGER } = require('../internal/constants')
|
||||
const { safeRe: re, t } = require('../internal/re')
|
||||
|
||||
const parseOptions = require('../internal/parse-options')
|
||||
const { compareIdentifiers } = require('../internal/identifiers')
|
||||
class SemVer {
|
||||
constructor (version, options) {
|
||||
options = parseOptions(options)
|
||||
|
||||
if (version instanceof SemVer) {
|
||||
if (version.loose === !!options.loose &&
|
||||
version.includePrerelease === !!options.includePrerelease) {
|
||||
return version
|
||||
} else {
|
||||
version = version.version
|
||||
}
|
||||
} else if (typeof version !== 'string') {
|
||||
throw new TypeError(`Invalid version. Must be a string. Got type "${typeof version}".`)
|
||||
}
|
||||
|
||||
if (version.length > MAX_LENGTH) {
|
||||
throw new TypeError(
|
||||
`version is longer than ${MAX_LENGTH} characters`
|
||||
)
|
||||
}
|
||||
|
||||
debug('SemVer', version, options)
|
||||
this.options = options
|
||||
this.loose = !!options.loose
|
||||
// this isn't actually relevant for versions, but keep it so that we
|
||||
// don't run into trouble passing this.options around.
|
||||
this.includePrerelease = !!options.includePrerelease
|
||||
|
||||
const m = version.trim().match(options.loose ? re[t.LOOSE] : re[t.FULL])
|
||||
|
||||
if (!m) {
|
||||
throw new TypeError(`Invalid Version: ${version}`)
|
||||
}
|
||||
|
||||
this.raw = version
|
||||
|
||||
// these are actually numbers
|
||||
this.major = +m[1]
|
||||
this.minor = +m[2]
|
||||
this.patch = +m[3]
|
||||
|
||||
if (this.major > MAX_SAFE_INTEGER || this.major < 0) {
|
||||
throw new TypeError('Invalid major version')
|
||||
}
|
||||
|
||||
if (this.minor > MAX_SAFE_INTEGER || this.minor < 0) {
|
||||
throw new TypeError('Invalid minor version')
|
||||
}
|
||||
|
||||
if (this.patch > MAX_SAFE_INTEGER || this.patch < 0) {
|
||||
throw new TypeError('Invalid patch version')
|
||||
}
|
||||
|
||||
// numberify any prerelease numeric ids
|
||||
if (!m[4]) {
|
||||
this.prerelease = []
|
||||
} else {
|
||||
this.prerelease = m[4].split('.').map((id) => {
|
||||
if (/^[0-9]+$/.test(id)) {
|
||||
const num = +id
|
||||
if (num >= 0 && num < MAX_SAFE_INTEGER) {
|
||||
return num
|
||||
}
|
||||
}
|
||||
return id
|
||||
})
|
||||
}
|
||||
|
||||
this.build = m[5] ? m[5].split('.') : []
|
||||
this.format()
|
||||
}
|
||||
|
||||
format () {
|
||||
this.version = `${this.major}.${this.minor}.${this.patch}`
|
||||
if (this.prerelease.length) {
|
||||
this.version += `-${this.prerelease.join('.')}`
|
||||
}
|
||||
return this.version
|
||||
}
|
||||
|
||||
toString () {
|
||||
return this.version
|
||||
}
|
||||
|
||||
compare (other) {
|
||||
debug('SemVer.compare', this.version, this.options, other)
|
||||
if (!(other instanceof SemVer)) {
|
||||
if (typeof other === 'string' && other === this.version) {
|
||||
return 0
|
||||
}
|
||||
other = new SemVer(other, this.options)
|
||||
}
|
||||
|
||||
if (other.version === this.version) {
|
||||
return 0
|
||||
}
|
||||
|
||||
return this.compareMain(other) || this.comparePre(other)
|
||||
}
|
||||
|
||||
compareMain (other) {
|
||||
if (!(other instanceof SemVer)) {
|
||||
other = new SemVer(other, this.options)
|
||||
}
|
||||
|
||||
if (this.major < other.major) {
|
||||
return -1
|
||||
}
|
||||
if (this.major > other.major) {
|
||||
return 1
|
||||
}
|
||||
if (this.minor < other.minor) {
|
||||
return -1
|
||||
}
|
||||
if (this.minor > other.minor) {
|
||||
return 1
|
||||
}
|
||||
if (this.patch < other.patch) {
|
||||
return -1
|
||||
}
|
||||
if (this.patch > other.patch) {
|
||||
return 1
|
||||
}
|
||||
return 0
|
||||
}
|
||||
|
||||
comparePre (other) {
|
||||
if (!(other instanceof SemVer)) {
|
||||
other = new SemVer(other, this.options)
|
||||
}
|
||||
|
||||
// NOT having a prerelease is > having one
|
||||
if (this.prerelease.length && !other.prerelease.length) {
|
||||
return -1
|
||||
} else if (!this.prerelease.length && other.prerelease.length) {
|
||||
return 1
|
||||
} else if (!this.prerelease.length && !other.prerelease.length) {
|
||||
return 0
|
||||
}
|
||||
|
||||
let i = 0
|
||||
do {
|
||||
const a = this.prerelease[i]
|
||||
const b = other.prerelease[i]
|
||||
debug('prerelease compare', i, a, b)
|
||||
if (a === undefined && b === undefined) {
|
||||
return 0
|
||||
} else if (b === undefined) {
|
||||
return 1
|
||||
} else if (a === undefined) {
|
||||
return -1
|
||||
} else if (a === b) {
|
||||
continue
|
||||
} else {
|
||||
return compareIdentifiers(a, b)
|
||||
}
|
||||
} while (++i)
|
||||
}
|
||||
|
||||
compareBuild (other) {
|
||||
if (!(other instanceof SemVer)) {
|
||||
other = new SemVer(other, this.options)
|
||||
}
|
||||
|
||||
let i = 0
|
||||
do {
|
||||
const a = this.build[i]
|
||||
const b = other.build[i]
|
||||
debug('build compare', i, a, b)
|
||||
if (a === undefined && b === undefined) {
|
||||
return 0
|
||||
} else if (b === undefined) {
|
||||
return 1
|
||||
} else if (a === undefined) {
|
||||
return -1
|
||||
} else if (a === b) {
|
||||
continue
|
||||
} else {
|
||||
return compareIdentifiers(a, b)
|
||||
}
|
||||
} while (++i)
|
||||
}
|
||||
|
||||
// preminor will bump the version up to the next minor release, and immediately
|
||||
// down to pre-release. premajor and prepatch work the same way.
|
||||
inc (release, identifier, identifierBase) {
|
||||
if (release.startsWith('pre')) {
|
||||
if (!identifier && identifierBase === false) {
|
||||
throw new Error('invalid increment argument: identifier is empty')
|
||||
}
|
||||
// Avoid an invalid semver results
|
||||
if (identifier) {
|
||||
const match = `-${identifier}`.match(this.options.loose ? re[t.PRERELEASELOOSE] : re[t.PRERELEASE])
|
||||
if (!match || match[1] !== identifier) {
|
||||
throw new Error(`invalid identifier: ${identifier}`)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
switch (release) {
|
||||
case 'premajor':
|
||||
this.prerelease.length = 0
|
||||
this.patch = 0
|
||||
this.minor = 0
|
||||
this.major++
|
||||
this.inc('pre', identifier, identifierBase)
|
||||
break
|
||||
case 'preminor':
|
||||
this.prerelease.length = 0
|
||||
this.patch = 0
|
||||
this.minor++
|
||||
this.inc('pre', identifier, identifierBase)
|
||||
break
|
||||
case 'prepatch':
|
||||
// If this is already a prerelease, it will bump to the next version
|
||||
// drop any prereleases that might already exist, since they are not
|
||||
// relevant at this point.
|
||||
this.prerelease.length = 0
|
||||
this.inc('patch', identifier, identifierBase)
|
||||
this.inc('pre', identifier, identifierBase)
|
||||
break
|
||||
// If the input is a non-prerelease version, this acts the same as
|
||||
// prepatch.
|
||||
case 'prerelease':
|
||||
if (this.prerelease.length === 0) {
|
||||
this.inc('patch', identifier, identifierBase)
|
||||
}
|
||||
this.inc('pre', identifier, identifierBase)
|
||||
break
|
||||
case 'release':
|
||||
if (this.prerelease.length === 0) {
|
||||
throw new Error(`version ${this.raw} is not a prerelease`)
|
||||
}
|
||||
this.prerelease.length = 0
|
||||
break
|
||||
|
||||
case 'major':
|
||||
// If this is a pre-major version, bump up to the same major version.
|
||||
// Otherwise increment major.
|
||||
// 1.0.0-5 bumps to 1.0.0
|
||||
// 1.1.0 bumps to 2.0.0
|
||||
if (
|
||||
this.minor !== 0 ||
|
||||
this.patch !== 0 ||
|
||||
this.prerelease.length === 0
|
||||
) {
|
||||
this.major++
|
||||
}
|
||||
this.minor = 0
|
||||
this.patch = 0
|
||||
this.prerelease = []
|
||||
break
|
||||
case 'minor':
|
||||
// If this is a pre-minor version, bump up to the same minor version.
|
||||
// Otherwise increment minor.
|
||||
// 1.2.0-5 bumps to 1.2.0
|
||||
// 1.2.1 bumps to 1.3.0
|
||||
if (this.patch !== 0 || this.prerelease.length === 0) {
|
||||
this.minor++
|
||||
}
|
||||
this.patch = 0
|
||||
this.prerelease = []
|
||||
break
|
||||
case 'patch':
|
||||
// If this is not a pre-release version, it will increment the patch.
|
||||
// If it is a pre-release it will bump up to the same patch version.
|
||||
// 1.2.0-5 patches to 1.2.0
|
||||
// 1.2.0 patches to 1.2.1
|
||||
if (this.prerelease.length === 0) {
|
||||
this.patch++
|
||||
}
|
||||
this.prerelease = []
|
||||
break
|
||||
// This probably shouldn't be used publicly.
|
||||
// 1.0.0 'pre' would become 1.0.0-0 which is the wrong direction.
|
||||
case 'pre': {
|
||||
const base = Number(identifierBase) ? 1 : 0
|
||||
|
||||
if (this.prerelease.length === 0) {
|
||||
this.prerelease = [base]
|
||||
} else {
|
||||
let i = this.prerelease.length
|
||||
while (--i >= 0) {
|
||||
if (typeof this.prerelease[i] === 'number') {
|
||||
this.prerelease[i]++
|
||||
i = -2
|
||||
}
|
||||
}
|
||||
if (i === -1) {
|
||||
// didn't increment anything
|
||||
if (identifier === this.prerelease.join('.') && identifierBase === false) {
|
||||
throw new Error('invalid increment argument: identifier already exists')
|
||||
}
|
||||
this.prerelease.push(base)
|
||||
}
|
||||
}
|
||||
if (identifier) {
|
||||
// 1.2.0-beta.1 bumps to 1.2.0-beta.2,
|
||||
// 1.2.0-beta.fooblz or 1.2.0-beta bumps to 1.2.0-beta.0
|
||||
let prerelease = [identifier, base]
|
||||
if (identifierBase === false) {
|
||||
prerelease = [identifier]
|
||||
}
|
||||
if (compareIdentifiers(this.prerelease[0], identifier) === 0) {
|
||||
if (isNaN(this.prerelease[1])) {
|
||||
this.prerelease = prerelease
|
||||
}
|
||||
} else {
|
||||
this.prerelease = prerelease
|
||||
}
|
||||
}
|
||||
break
|
||||
}
|
||||
default:
|
||||
throw new Error(`invalid increment argument: ${release}`)
|
||||
}
|
||||
this.raw = this.format()
|
||||
if (this.build.length) {
|
||||
this.raw += `+${this.build.join('.')}`
|
||||
}
|
||||
return this
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = SemVer
|
||||
8
qwen/nodejs/node_modules/nodemon/node_modules/semver/functions/clean.js
generated
vendored
Normal file
8
qwen/nodejs/node_modules/nodemon/node_modules/semver/functions/clean.js
generated
vendored
Normal file
@@ -0,0 +1,8 @@
|
||||
'use strict'
|
||||
|
||||
const parse = require('./parse')
|
||||
const clean = (version, options) => {
|
||||
const s = parse(version.trim().replace(/^[=v]+/, ''), options)
|
||||
return s ? s.version : null
|
||||
}
|
||||
module.exports = clean
|
||||
54
qwen/nodejs/node_modules/nodemon/node_modules/semver/functions/cmp.js
generated
vendored
Normal file
54
qwen/nodejs/node_modules/nodemon/node_modules/semver/functions/cmp.js
generated
vendored
Normal file
@@ -0,0 +1,54 @@
|
||||
'use strict'
|
||||
|
||||
const eq = require('./eq')
|
||||
const neq = require('./neq')
|
||||
const gt = require('./gt')
|
||||
const gte = require('./gte')
|
||||
const lt = require('./lt')
|
||||
const lte = require('./lte')
|
||||
|
||||
const cmp = (a, op, b, loose) => {
|
||||
switch (op) {
|
||||
case '===':
|
||||
if (typeof a === 'object') {
|
||||
a = a.version
|
||||
}
|
||||
if (typeof b === 'object') {
|
||||
b = b.version
|
||||
}
|
||||
return a === b
|
||||
|
||||
case '!==':
|
||||
if (typeof a === 'object') {
|
||||
a = a.version
|
||||
}
|
||||
if (typeof b === 'object') {
|
||||
b = b.version
|
||||
}
|
||||
return a !== b
|
||||
|
||||
case '':
|
||||
case '=':
|
||||
case '==':
|
||||
return eq(a, b, loose)
|
||||
|
||||
case '!=':
|
||||
return neq(a, b, loose)
|
||||
|
||||
case '>':
|
||||
return gt(a, b, loose)
|
||||
|
||||
case '>=':
|
||||
return gte(a, b, loose)
|
||||
|
||||
case '<':
|
||||
return lt(a, b, loose)
|
||||
|
||||
case '<=':
|
||||
return lte(a, b, loose)
|
||||
|
||||
default:
|
||||
throw new TypeError(`Invalid operator: ${op}`)
|
||||
}
|
||||
}
|
||||
module.exports = cmp
|
||||
62
qwen/nodejs/node_modules/nodemon/node_modules/semver/functions/coerce.js
generated
vendored
Normal file
62
qwen/nodejs/node_modules/nodemon/node_modules/semver/functions/coerce.js
generated
vendored
Normal file
@@ -0,0 +1,62 @@
|
||||
'use strict'
|
||||
|
||||
const SemVer = require('../classes/semver')
|
||||
const parse = require('./parse')
|
||||
const { safeRe: re, t } = require('../internal/re')
|
||||
|
||||
const coerce = (version, options) => {
|
||||
if (version instanceof SemVer) {
|
||||
return version
|
||||
}
|
||||
|
||||
if (typeof version === 'number') {
|
||||
version = String(version)
|
||||
}
|
||||
|
||||
if (typeof version !== 'string') {
|
||||
return null
|
||||
}
|
||||
|
||||
options = options || {}
|
||||
|
||||
let match = null
|
||||
if (!options.rtl) {
|
||||
match = version.match(options.includePrerelease ? re[t.COERCEFULL] : re[t.COERCE])
|
||||
} else {
|
||||
// Find the right-most coercible string that does not share
|
||||
// a terminus with a more left-ward coercible string.
|
||||
// Eg, '1.2.3.4' wants to coerce '2.3.4', not '3.4' or '4'
|
||||
// With includePrerelease option set, '1.2.3.4-rc' wants to coerce '2.3.4-rc', not '2.3.4'
|
||||
//
|
||||
// Walk through the string checking with a /g regexp
|
||||
// Manually set the index so as to pick up overlapping matches.
|
||||
// Stop when we get a match that ends at the string end, since no
|
||||
// coercible string can be more right-ward without the same terminus.
|
||||
const coerceRtlRegex = options.includePrerelease ? re[t.COERCERTLFULL] : re[t.COERCERTL]
|
||||
let next
|
||||
while ((next = coerceRtlRegex.exec(version)) &&
|
||||
(!match || match.index + match[0].length !== version.length)
|
||||
) {
|
||||
if (!match ||
|
||||
next.index + next[0].length !== match.index + match[0].length) {
|
||||
match = next
|
||||
}
|
||||
coerceRtlRegex.lastIndex = next.index + next[1].length + next[2].length
|
||||
}
|
||||
// leave it in a clean state
|
||||
coerceRtlRegex.lastIndex = -1
|
||||
}
|
||||
|
||||
if (match === null) {
|
||||
return null
|
||||
}
|
||||
|
||||
const major = match[2]
|
||||
const minor = match[3] || '0'
|
||||
const patch = match[4] || '0'
|
||||
const prerelease = options.includePrerelease && match[5] ? `-${match[5]}` : ''
|
||||
const build = options.includePrerelease && match[6] ? `+${match[6]}` : ''
|
||||
|
||||
return parse(`${major}.${minor}.${patch}${prerelease}${build}`, options)
|
||||
}
|
||||
module.exports = coerce
|
||||
9
qwen/nodejs/node_modules/nodemon/node_modules/semver/functions/compare-build.js
generated
vendored
Normal file
9
qwen/nodejs/node_modules/nodemon/node_modules/semver/functions/compare-build.js
generated
vendored
Normal file
@@ -0,0 +1,9 @@
|
||||
'use strict'
|
||||
|
||||
const SemVer = require('../classes/semver')
|
||||
const compareBuild = (a, b, loose) => {
|
||||
const versionA = new SemVer(a, loose)
|
||||
const versionB = new SemVer(b, loose)
|
||||
return versionA.compare(versionB) || versionA.compareBuild(versionB)
|
||||
}
|
||||
module.exports = compareBuild
|
||||
5
qwen/nodejs/node_modules/nodemon/node_modules/semver/functions/compare-loose.js
generated
vendored
Normal file
5
qwen/nodejs/node_modules/nodemon/node_modules/semver/functions/compare-loose.js
generated
vendored
Normal file
@@ -0,0 +1,5 @@
|
||||
'use strict'
|
||||
|
||||
const compare = require('./compare')
|
||||
const compareLoose = (a, b) => compare(a, b, true)
|
||||
module.exports = compareLoose
|
||||
7
qwen/nodejs/node_modules/nodemon/node_modules/semver/functions/compare.js
generated
vendored
Normal file
7
qwen/nodejs/node_modules/nodemon/node_modules/semver/functions/compare.js
generated
vendored
Normal file
@@ -0,0 +1,7 @@
|
||||
'use strict'
|
||||
|
||||
const SemVer = require('../classes/semver')
|
||||
const compare = (a, b, loose) =>
|
||||
new SemVer(a, loose).compare(new SemVer(b, loose))
|
||||
|
||||
module.exports = compare
|
||||
60
qwen/nodejs/node_modules/nodemon/node_modules/semver/functions/diff.js
generated
vendored
Normal file
60
qwen/nodejs/node_modules/nodemon/node_modules/semver/functions/diff.js
generated
vendored
Normal file
@@ -0,0 +1,60 @@
|
||||
'use strict'
|
||||
|
||||
const parse = require('./parse.js')
|
||||
|
||||
const diff = (version1, version2) => {
|
||||
const v1 = parse(version1, null, true)
|
||||
const v2 = parse(version2, null, true)
|
||||
const comparison = v1.compare(v2)
|
||||
|
||||
if (comparison === 0) {
|
||||
return null
|
||||
}
|
||||
|
||||
const v1Higher = comparison > 0
|
||||
const highVersion = v1Higher ? v1 : v2
|
||||
const lowVersion = v1Higher ? v2 : v1
|
||||
const highHasPre = !!highVersion.prerelease.length
|
||||
const lowHasPre = !!lowVersion.prerelease.length
|
||||
|
||||
if (lowHasPre && !highHasPre) {
|
||||
// Going from prerelease -> no prerelease requires some special casing
|
||||
|
||||
// If the low version has only a major, then it will always be a major
|
||||
// Some examples:
|
||||
// 1.0.0-1 -> 1.0.0
|
||||
// 1.0.0-1 -> 1.1.1
|
||||
// 1.0.0-1 -> 2.0.0
|
||||
if (!lowVersion.patch && !lowVersion.minor) {
|
||||
return 'major'
|
||||
}
|
||||
|
||||
// If the main part has no difference
|
||||
if (lowVersion.compareMain(highVersion) === 0) {
|
||||
if (lowVersion.minor && !lowVersion.patch) {
|
||||
return 'minor'
|
||||
}
|
||||
return 'patch'
|
||||
}
|
||||
}
|
||||
|
||||
// add the `pre` prefix if we are going to a prerelease version
|
||||
const prefix = highHasPre ? 'pre' : ''
|
||||
|
||||
if (v1.major !== v2.major) {
|
||||
return prefix + 'major'
|
||||
}
|
||||
|
||||
if (v1.minor !== v2.minor) {
|
||||
return prefix + 'minor'
|
||||
}
|
||||
|
||||
if (v1.patch !== v2.patch) {
|
||||
return prefix + 'patch'
|
||||
}
|
||||
|
||||
// high and low are preleases
|
||||
return 'prerelease'
|
||||
}
|
||||
|
||||
module.exports = diff
|
||||
5
qwen/nodejs/node_modules/nodemon/node_modules/semver/functions/eq.js
generated
vendored
Normal file
5
qwen/nodejs/node_modules/nodemon/node_modules/semver/functions/eq.js
generated
vendored
Normal file
@@ -0,0 +1,5 @@
|
||||
'use strict'
|
||||
|
||||
const compare = require('./compare')
|
||||
const eq = (a, b, loose) => compare(a, b, loose) === 0
|
||||
module.exports = eq
|
||||
5
qwen/nodejs/node_modules/nodemon/node_modules/semver/functions/gt.js
generated
vendored
Normal file
5
qwen/nodejs/node_modules/nodemon/node_modules/semver/functions/gt.js
generated
vendored
Normal file
@@ -0,0 +1,5 @@
|
||||
'use strict'
|
||||
|
||||
const compare = require('./compare')
|
||||
const gt = (a, b, loose) => compare(a, b, loose) > 0
|
||||
module.exports = gt
|
||||
5
qwen/nodejs/node_modules/nodemon/node_modules/semver/functions/gte.js
generated
vendored
Normal file
5
qwen/nodejs/node_modules/nodemon/node_modules/semver/functions/gte.js
generated
vendored
Normal file
@@ -0,0 +1,5 @@
|
||||
'use strict'
|
||||
|
||||
const compare = require('./compare')
|
||||
const gte = (a, b, loose) => compare(a, b, loose) >= 0
|
||||
module.exports = gte
|
||||
21
qwen/nodejs/node_modules/nodemon/node_modules/semver/functions/inc.js
generated
vendored
Normal file
21
qwen/nodejs/node_modules/nodemon/node_modules/semver/functions/inc.js
generated
vendored
Normal file
@@ -0,0 +1,21 @@
|
||||
'use strict'
|
||||
|
||||
const SemVer = require('../classes/semver')
|
||||
|
||||
const inc = (version, release, options, identifier, identifierBase) => {
|
||||
if (typeof (options) === 'string') {
|
||||
identifierBase = identifier
|
||||
identifier = options
|
||||
options = undefined
|
||||
}
|
||||
|
||||
try {
|
||||
return new SemVer(
|
||||
version instanceof SemVer ? version.version : version,
|
||||
options
|
||||
).inc(release, identifier, identifierBase).version
|
||||
} catch (er) {
|
||||
return null
|
||||
}
|
||||
}
|
||||
module.exports = inc
|
||||
5
qwen/nodejs/node_modules/nodemon/node_modules/semver/functions/lt.js
generated
vendored
Normal file
5
qwen/nodejs/node_modules/nodemon/node_modules/semver/functions/lt.js
generated
vendored
Normal file
@@ -0,0 +1,5 @@
|
||||
'use strict'
|
||||
|
||||
const compare = require('./compare')
|
||||
const lt = (a, b, loose) => compare(a, b, loose) < 0
|
||||
module.exports = lt
|
||||
5
qwen/nodejs/node_modules/nodemon/node_modules/semver/functions/lte.js
generated
vendored
Normal file
5
qwen/nodejs/node_modules/nodemon/node_modules/semver/functions/lte.js
generated
vendored
Normal file
@@ -0,0 +1,5 @@
|
||||
'use strict'
|
||||
|
||||
const compare = require('./compare')
|
||||
const lte = (a, b, loose) => compare(a, b, loose) <= 0
|
||||
module.exports = lte
|
||||
5
qwen/nodejs/node_modules/nodemon/node_modules/semver/functions/major.js
generated
vendored
Normal file
5
qwen/nodejs/node_modules/nodemon/node_modules/semver/functions/major.js
generated
vendored
Normal file
@@ -0,0 +1,5 @@
|
||||
'use strict'
|
||||
|
||||
const SemVer = require('../classes/semver')
|
||||
const major = (a, loose) => new SemVer(a, loose).major
|
||||
module.exports = major
|
||||
5
qwen/nodejs/node_modules/nodemon/node_modules/semver/functions/minor.js
generated
vendored
Normal file
5
qwen/nodejs/node_modules/nodemon/node_modules/semver/functions/minor.js
generated
vendored
Normal file
@@ -0,0 +1,5 @@
|
||||
'use strict'
|
||||
|
||||
const SemVer = require('../classes/semver')
|
||||
const minor = (a, loose) => new SemVer(a, loose).minor
|
||||
module.exports = minor
|
||||
5
qwen/nodejs/node_modules/nodemon/node_modules/semver/functions/neq.js
generated
vendored
Normal file
5
qwen/nodejs/node_modules/nodemon/node_modules/semver/functions/neq.js
generated
vendored
Normal file
@@ -0,0 +1,5 @@
|
||||
'use strict'
|
||||
|
||||
const compare = require('./compare')
|
||||
const neq = (a, b, loose) => compare(a, b, loose) !== 0
|
||||
module.exports = neq
|
||||
18
qwen/nodejs/node_modules/nodemon/node_modules/semver/functions/parse.js
generated
vendored
Normal file
18
qwen/nodejs/node_modules/nodemon/node_modules/semver/functions/parse.js
generated
vendored
Normal file
@@ -0,0 +1,18 @@
|
||||
'use strict'
|
||||
|
||||
const SemVer = require('../classes/semver')
|
||||
const parse = (version, options, throwErrors = false) => {
|
||||
if (version instanceof SemVer) {
|
||||
return version
|
||||
}
|
||||
try {
|
||||
return new SemVer(version, options)
|
||||
} catch (er) {
|
||||
if (!throwErrors) {
|
||||
return null
|
||||
}
|
||||
throw er
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = parse
|
||||
5
qwen/nodejs/node_modules/nodemon/node_modules/semver/functions/patch.js
generated
vendored
Normal file
5
qwen/nodejs/node_modules/nodemon/node_modules/semver/functions/patch.js
generated
vendored
Normal file
@@ -0,0 +1,5 @@
|
||||
'use strict'
|
||||
|
||||
const SemVer = require('../classes/semver')
|
||||
const patch = (a, loose) => new SemVer(a, loose).patch
|
||||
module.exports = patch
|
||||
8
qwen/nodejs/node_modules/nodemon/node_modules/semver/functions/prerelease.js
generated
vendored
Normal file
8
qwen/nodejs/node_modules/nodemon/node_modules/semver/functions/prerelease.js
generated
vendored
Normal file
@@ -0,0 +1,8 @@
|
||||
'use strict'
|
||||
|
||||
const parse = require('./parse')
|
||||
const prerelease = (version, options) => {
|
||||
const parsed = parse(version, options)
|
||||
return (parsed && parsed.prerelease.length) ? parsed.prerelease : null
|
||||
}
|
||||
module.exports = prerelease
|
||||
5
qwen/nodejs/node_modules/nodemon/node_modules/semver/functions/rcompare.js
generated
vendored
Normal file
5
qwen/nodejs/node_modules/nodemon/node_modules/semver/functions/rcompare.js
generated
vendored
Normal file
@@ -0,0 +1,5 @@
|
||||
'use strict'
|
||||
|
||||
const compare = require('./compare')
|
||||
const rcompare = (a, b, loose) => compare(b, a, loose)
|
||||
module.exports = rcompare
|
||||
5
qwen/nodejs/node_modules/nodemon/node_modules/semver/functions/rsort.js
generated
vendored
Normal file
5
qwen/nodejs/node_modules/nodemon/node_modules/semver/functions/rsort.js
generated
vendored
Normal file
@@ -0,0 +1,5 @@
|
||||
'use strict'
|
||||
|
||||
const compareBuild = require('./compare-build')
|
||||
const rsort = (list, loose) => list.sort((a, b) => compareBuild(b, a, loose))
|
||||
module.exports = rsort
|
||||
12
qwen/nodejs/node_modules/nodemon/node_modules/semver/functions/satisfies.js
generated
vendored
Normal file
12
qwen/nodejs/node_modules/nodemon/node_modules/semver/functions/satisfies.js
generated
vendored
Normal file
@@ -0,0 +1,12 @@
|
||||
'use strict'
|
||||
|
||||
const Range = require('../classes/range')
|
||||
const satisfies = (version, range, options) => {
|
||||
try {
|
||||
range = new Range(range, options)
|
||||
} catch (er) {
|
||||
return false
|
||||
}
|
||||
return range.test(version)
|
||||
}
|
||||
module.exports = satisfies
|
||||
5
qwen/nodejs/node_modules/nodemon/node_modules/semver/functions/sort.js
generated
vendored
Normal file
5
qwen/nodejs/node_modules/nodemon/node_modules/semver/functions/sort.js
generated
vendored
Normal file
@@ -0,0 +1,5 @@
|
||||
'use strict'
|
||||
|
||||
const compareBuild = require('./compare-build')
|
||||
const sort = (list, loose) => list.sort((a, b) => compareBuild(a, b, loose))
|
||||
module.exports = sort
|
||||
8
qwen/nodejs/node_modules/nodemon/node_modules/semver/functions/valid.js
generated
vendored
Normal file
8
qwen/nodejs/node_modules/nodemon/node_modules/semver/functions/valid.js
generated
vendored
Normal file
@@ -0,0 +1,8 @@
|
||||
'use strict'
|
||||
|
||||
const parse = require('./parse')
|
||||
const valid = (version, options) => {
|
||||
const v = parse(version, options)
|
||||
return v ? v.version : null
|
||||
}
|
||||
module.exports = valid
|
||||
91
qwen/nodejs/node_modules/nodemon/node_modules/semver/index.js
generated
vendored
Normal file
91
qwen/nodejs/node_modules/nodemon/node_modules/semver/index.js
generated
vendored
Normal file
@@ -0,0 +1,91 @@
|
||||
'use strict'
|
||||
|
||||
// just pre-load all the stuff that index.js lazily exports
|
||||
const internalRe = require('./internal/re')
|
||||
const constants = require('./internal/constants')
|
||||
const SemVer = require('./classes/semver')
|
||||
const identifiers = require('./internal/identifiers')
|
||||
const parse = require('./functions/parse')
|
||||
const valid = require('./functions/valid')
|
||||
const clean = require('./functions/clean')
|
||||
const inc = require('./functions/inc')
|
||||
const diff = require('./functions/diff')
|
||||
const major = require('./functions/major')
|
||||
const minor = require('./functions/minor')
|
||||
const patch = require('./functions/patch')
|
||||
const prerelease = require('./functions/prerelease')
|
||||
const compare = require('./functions/compare')
|
||||
const rcompare = require('./functions/rcompare')
|
||||
const compareLoose = require('./functions/compare-loose')
|
||||
const compareBuild = require('./functions/compare-build')
|
||||
const sort = require('./functions/sort')
|
||||
const rsort = require('./functions/rsort')
|
||||
const gt = require('./functions/gt')
|
||||
const lt = require('./functions/lt')
|
||||
const eq = require('./functions/eq')
|
||||
const neq = require('./functions/neq')
|
||||
const gte = require('./functions/gte')
|
||||
const lte = require('./functions/lte')
|
||||
const cmp = require('./functions/cmp')
|
||||
const coerce = require('./functions/coerce')
|
||||
const Comparator = require('./classes/comparator')
|
||||
const Range = require('./classes/range')
|
||||
const satisfies = require('./functions/satisfies')
|
||||
const toComparators = require('./ranges/to-comparators')
|
||||
const maxSatisfying = require('./ranges/max-satisfying')
|
||||
const minSatisfying = require('./ranges/min-satisfying')
|
||||
const minVersion = require('./ranges/min-version')
|
||||
const validRange = require('./ranges/valid')
|
||||
const outside = require('./ranges/outside')
|
||||
const gtr = require('./ranges/gtr')
|
||||
const ltr = require('./ranges/ltr')
|
||||
const intersects = require('./ranges/intersects')
|
||||
const simplifyRange = require('./ranges/simplify')
|
||||
const subset = require('./ranges/subset')
|
||||
module.exports = {
|
||||
parse,
|
||||
valid,
|
||||
clean,
|
||||
inc,
|
||||
diff,
|
||||
major,
|
||||
minor,
|
||||
patch,
|
||||
prerelease,
|
||||
compare,
|
||||
rcompare,
|
||||
compareLoose,
|
||||
compareBuild,
|
||||
sort,
|
||||
rsort,
|
||||
gt,
|
||||
lt,
|
||||
eq,
|
||||
neq,
|
||||
gte,
|
||||
lte,
|
||||
cmp,
|
||||
coerce,
|
||||
Comparator,
|
||||
Range,
|
||||
satisfies,
|
||||
toComparators,
|
||||
maxSatisfying,
|
||||
minSatisfying,
|
||||
minVersion,
|
||||
validRange,
|
||||
outside,
|
||||
gtr,
|
||||
ltr,
|
||||
intersects,
|
||||
simplifyRange,
|
||||
subset,
|
||||
SemVer,
|
||||
re: internalRe.re,
|
||||
src: internalRe.src,
|
||||
tokens: internalRe.t,
|
||||
SEMVER_SPEC_VERSION: constants.SEMVER_SPEC_VERSION,
|
||||
RELEASE_TYPES: constants.RELEASE_TYPES,
|
||||
compareIdentifiers: identifiers.compareIdentifiers,
|
||||
rcompareIdentifiers: identifiers.rcompareIdentifiers,
|
||||
}
|
||||
37
qwen/nodejs/node_modules/nodemon/node_modules/semver/internal/constants.js
generated
vendored
Normal file
37
qwen/nodejs/node_modules/nodemon/node_modules/semver/internal/constants.js
generated
vendored
Normal file
@@ -0,0 +1,37 @@
|
||||
'use strict'
|
||||
|
||||
// Note: this is the semver.org version of the spec that it implements
|
||||
// Not necessarily the package version of this code.
|
||||
const SEMVER_SPEC_VERSION = '2.0.0'
|
||||
|
||||
const MAX_LENGTH = 256
|
||||
const MAX_SAFE_INTEGER = Number.MAX_SAFE_INTEGER ||
|
||||
/* istanbul ignore next */ 9007199254740991
|
||||
|
||||
// Max safe segment length for coercion.
|
||||
const MAX_SAFE_COMPONENT_LENGTH = 16
|
||||
|
||||
// Max safe length for a build identifier. The max length minus 6 characters for
|
||||
// the shortest version with a build 0.0.0+BUILD.
|
||||
const MAX_SAFE_BUILD_LENGTH = MAX_LENGTH - 6
|
||||
|
||||
const RELEASE_TYPES = [
|
||||
'major',
|
||||
'premajor',
|
||||
'minor',
|
||||
'preminor',
|
||||
'patch',
|
||||
'prepatch',
|
||||
'prerelease',
|
||||
]
|
||||
|
||||
module.exports = {
|
||||
MAX_LENGTH,
|
||||
MAX_SAFE_COMPONENT_LENGTH,
|
||||
MAX_SAFE_BUILD_LENGTH,
|
||||
MAX_SAFE_INTEGER,
|
||||
RELEASE_TYPES,
|
||||
SEMVER_SPEC_VERSION,
|
||||
FLAG_INCLUDE_PRERELEASE: 0b001,
|
||||
FLAG_LOOSE: 0b010,
|
||||
}
|
||||
11
qwen/nodejs/node_modules/nodemon/node_modules/semver/internal/debug.js
generated
vendored
Normal file
11
qwen/nodejs/node_modules/nodemon/node_modules/semver/internal/debug.js
generated
vendored
Normal file
@@ -0,0 +1,11 @@
|
||||
'use strict'
|
||||
|
||||
const debug = (
|
||||
typeof process === 'object' &&
|
||||
process.env &&
|
||||
process.env.NODE_DEBUG &&
|
||||
/\bsemver\b/i.test(process.env.NODE_DEBUG)
|
||||
) ? (...args) => console.error('SEMVER', ...args)
|
||||
: () => {}
|
||||
|
||||
module.exports = debug
|
||||
29
qwen/nodejs/node_modules/nodemon/node_modules/semver/internal/identifiers.js
generated
vendored
Normal file
29
qwen/nodejs/node_modules/nodemon/node_modules/semver/internal/identifiers.js
generated
vendored
Normal file
@@ -0,0 +1,29 @@
|
||||
'use strict'
|
||||
|
||||
const numeric = /^[0-9]+$/
|
||||
const compareIdentifiers = (a, b) => {
|
||||
if (typeof a === 'number' && typeof b === 'number') {
|
||||
return a === b ? 0 : a < b ? -1 : 1
|
||||
}
|
||||
|
||||
const anum = numeric.test(a)
|
||||
const bnum = numeric.test(b)
|
||||
|
||||
if (anum && bnum) {
|
||||
a = +a
|
||||
b = +b
|
||||
}
|
||||
|
||||
return a === b ? 0
|
||||
: (anum && !bnum) ? -1
|
||||
: (bnum && !anum) ? 1
|
||||
: a < b ? -1
|
||||
: 1
|
||||
}
|
||||
|
||||
const rcompareIdentifiers = (a, b) => compareIdentifiers(b, a)
|
||||
|
||||
module.exports = {
|
||||
compareIdentifiers,
|
||||
rcompareIdentifiers,
|
||||
}
|
||||
42
qwen/nodejs/node_modules/nodemon/node_modules/semver/internal/lrucache.js
generated
vendored
Normal file
42
qwen/nodejs/node_modules/nodemon/node_modules/semver/internal/lrucache.js
generated
vendored
Normal file
@@ -0,0 +1,42 @@
|
||||
'use strict'
|
||||
|
||||
class LRUCache {
|
||||
constructor () {
|
||||
this.max = 1000
|
||||
this.map = new Map()
|
||||
}
|
||||
|
||||
get (key) {
|
||||
const value = this.map.get(key)
|
||||
if (value === undefined) {
|
||||
return undefined
|
||||
} else {
|
||||
// Remove the key from the map and add it to the end
|
||||
this.map.delete(key)
|
||||
this.map.set(key, value)
|
||||
return value
|
||||
}
|
||||
}
|
||||
|
||||
delete (key) {
|
||||
return this.map.delete(key)
|
||||
}
|
||||
|
||||
set (key, value) {
|
||||
const deleted = this.delete(key)
|
||||
|
||||
if (!deleted && value !== undefined) {
|
||||
// If cache is full, delete the least recently used item
|
||||
if (this.map.size >= this.max) {
|
||||
const firstKey = this.map.keys().next().value
|
||||
this.delete(firstKey)
|
||||
}
|
||||
|
||||
this.map.set(key, value)
|
||||
}
|
||||
|
||||
return this
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = LRUCache
|
||||
17
qwen/nodejs/node_modules/nodemon/node_modules/semver/internal/parse-options.js
generated
vendored
Normal file
17
qwen/nodejs/node_modules/nodemon/node_modules/semver/internal/parse-options.js
generated
vendored
Normal file
@@ -0,0 +1,17 @@
|
||||
'use strict'
|
||||
|
||||
// parse out just the options we care about
|
||||
const looseOption = Object.freeze({ loose: true })
|
||||
const emptyOpts = Object.freeze({ })
|
||||
const parseOptions = options => {
|
||||
if (!options) {
|
||||
return emptyOpts
|
||||
}
|
||||
|
||||
if (typeof options !== 'object') {
|
||||
return looseOption
|
||||
}
|
||||
|
||||
return options
|
||||
}
|
||||
module.exports = parseOptions
|
||||
223
qwen/nodejs/node_modules/nodemon/node_modules/semver/internal/re.js
generated
vendored
Normal file
223
qwen/nodejs/node_modules/nodemon/node_modules/semver/internal/re.js
generated
vendored
Normal file
@@ -0,0 +1,223 @@
|
||||
'use strict'
|
||||
|
||||
const {
|
||||
MAX_SAFE_COMPONENT_LENGTH,
|
||||
MAX_SAFE_BUILD_LENGTH,
|
||||
MAX_LENGTH,
|
||||
} = require('./constants')
|
||||
const debug = require('./debug')
|
||||
exports = module.exports = {}
|
||||
|
||||
// The actual regexps go on exports.re
|
||||
const re = exports.re = []
|
||||
const safeRe = exports.safeRe = []
|
||||
const src = exports.src = []
|
||||
const safeSrc = exports.safeSrc = []
|
||||
const t = exports.t = {}
|
||||
let R = 0
|
||||
|
||||
const LETTERDASHNUMBER = '[a-zA-Z0-9-]'
|
||||
|
||||
// Replace some greedy regex tokens to prevent regex dos issues. These regex are
|
||||
// used internally via the safeRe object since all inputs in this library get
|
||||
// normalized first to trim and collapse all extra whitespace. The original
|
||||
// regexes are exported for userland consumption and lower level usage. A
|
||||
// future breaking change could export the safer regex only with a note that
|
||||
// all input should have extra whitespace removed.
|
||||
const safeRegexReplacements = [
|
||||
['\\s', 1],
|
||||
['\\d', MAX_LENGTH],
|
||||
[LETTERDASHNUMBER, MAX_SAFE_BUILD_LENGTH],
|
||||
]
|
||||
|
||||
const makeSafeRegex = (value) => {
|
||||
for (const [token, max] of safeRegexReplacements) {
|
||||
value = value
|
||||
.split(`${token}*`).join(`${token}{0,${max}}`)
|
||||
.split(`${token}+`).join(`${token}{1,${max}}`)
|
||||
}
|
||||
return value
|
||||
}
|
||||
|
||||
const createToken = (name, value, isGlobal) => {
|
||||
const safe = makeSafeRegex(value)
|
||||
const index = R++
|
||||
debug(name, index, value)
|
||||
t[name] = index
|
||||
src[index] = value
|
||||
safeSrc[index] = safe
|
||||
re[index] = new RegExp(value, isGlobal ? 'g' : undefined)
|
||||
safeRe[index] = new RegExp(safe, isGlobal ? 'g' : undefined)
|
||||
}
|
||||
|
||||
// The following Regular Expressions can be used for tokenizing,
|
||||
// validating, and parsing SemVer version strings.
|
||||
|
||||
// ## Numeric Identifier
|
||||
// A single `0`, or a non-zero digit followed by zero or more digits.
|
||||
|
||||
createToken('NUMERICIDENTIFIER', '0|[1-9]\\d*')
|
||||
createToken('NUMERICIDENTIFIERLOOSE', '\\d+')
|
||||
|
||||
// ## Non-numeric Identifier
|
||||
// Zero or more digits, followed by a letter or hyphen, and then zero or
|
||||
// more letters, digits, or hyphens.
|
||||
|
||||
createToken('NONNUMERICIDENTIFIER', `\\d*[a-zA-Z-]${LETTERDASHNUMBER}*`)
|
||||
|
||||
// ## Main Version
|
||||
// Three dot-separated numeric identifiers.
|
||||
|
||||
createToken('MAINVERSION', `(${src[t.NUMERICIDENTIFIER]})\\.` +
|
||||
`(${src[t.NUMERICIDENTIFIER]})\\.` +
|
||||
`(${src[t.NUMERICIDENTIFIER]})`)
|
||||
|
||||
createToken('MAINVERSIONLOOSE', `(${src[t.NUMERICIDENTIFIERLOOSE]})\\.` +
|
||||
`(${src[t.NUMERICIDENTIFIERLOOSE]})\\.` +
|
||||
`(${src[t.NUMERICIDENTIFIERLOOSE]})`)
|
||||
|
||||
// ## Pre-release Version Identifier
|
||||
// A numeric identifier, or a non-numeric identifier.
|
||||
// Non-numberic identifiers include numberic identifiers but can be longer.
|
||||
// Therefore non-numberic identifiers must go first.
|
||||
|
||||
createToken('PRERELEASEIDENTIFIER', `(?:${src[t.NONNUMERICIDENTIFIER]
|
||||
}|${src[t.NUMERICIDENTIFIER]})`)
|
||||
|
||||
createToken('PRERELEASEIDENTIFIERLOOSE', `(?:${src[t.NONNUMERICIDENTIFIER]
|
||||
}|${src[t.NUMERICIDENTIFIERLOOSE]})`)
|
||||
|
||||
// ## Pre-release Version
|
||||
// Hyphen, followed by one or more dot-separated pre-release version
|
||||
// identifiers.
|
||||
|
||||
createToken('PRERELEASE', `(?:-(${src[t.PRERELEASEIDENTIFIER]
|
||||
}(?:\\.${src[t.PRERELEASEIDENTIFIER]})*))`)
|
||||
|
||||
createToken('PRERELEASELOOSE', `(?:-?(${src[t.PRERELEASEIDENTIFIERLOOSE]
|
||||
}(?:\\.${src[t.PRERELEASEIDENTIFIERLOOSE]})*))`)
|
||||
|
||||
// ## Build Metadata Identifier
|
||||
// Any combination of digits, letters, or hyphens.
|
||||
|
||||
createToken('BUILDIDENTIFIER', `${LETTERDASHNUMBER}+`)
|
||||
|
||||
// ## Build Metadata
|
||||
// Plus sign, followed by one or more period-separated build metadata
|
||||
// identifiers.
|
||||
|
||||
createToken('BUILD', `(?:\\+(${src[t.BUILDIDENTIFIER]
|
||||
}(?:\\.${src[t.BUILDIDENTIFIER]})*))`)
|
||||
|
||||
// ## Full Version String
|
||||
// A main version, followed optionally by a pre-release version and
|
||||
// build metadata.
|
||||
|
||||
// Note that the only major, minor, patch, and pre-release sections of
|
||||
// the version string are capturing groups. The build metadata is not a
|
||||
// capturing group, because it should not ever be used in version
|
||||
// comparison.
|
||||
|
||||
createToken('FULLPLAIN', `v?${src[t.MAINVERSION]
|
||||
}${src[t.PRERELEASE]}?${
|
||||
src[t.BUILD]}?`)
|
||||
|
||||
createToken('FULL', `^${src[t.FULLPLAIN]}$`)
|
||||
|
||||
// like full, but allows v1.2.3 and =1.2.3, which people do sometimes.
|
||||
// also, 1.0.0alpha1 (prerelease without the hyphen) which is pretty
|
||||
// common in the npm registry.
|
||||
createToken('LOOSEPLAIN', `[v=\\s]*${src[t.MAINVERSIONLOOSE]
|
||||
}${src[t.PRERELEASELOOSE]}?${
|
||||
src[t.BUILD]}?`)
|
||||
|
||||
createToken('LOOSE', `^${src[t.LOOSEPLAIN]}$`)
|
||||
|
||||
createToken('GTLT', '((?:<|>)?=?)')
|
||||
|
||||
// Something like "2.*" or "1.2.x".
|
||||
// Note that "x.x" is a valid xRange identifer, meaning "any version"
|
||||
// Only the first item is strictly required.
|
||||
createToken('XRANGEIDENTIFIERLOOSE', `${src[t.NUMERICIDENTIFIERLOOSE]}|x|X|\\*`)
|
||||
createToken('XRANGEIDENTIFIER', `${src[t.NUMERICIDENTIFIER]}|x|X|\\*`)
|
||||
|
||||
createToken('XRANGEPLAIN', `[v=\\s]*(${src[t.XRANGEIDENTIFIER]})` +
|
||||
`(?:\\.(${src[t.XRANGEIDENTIFIER]})` +
|
||||
`(?:\\.(${src[t.XRANGEIDENTIFIER]})` +
|
||||
`(?:${src[t.PRERELEASE]})?${
|
||||
src[t.BUILD]}?` +
|
||||
`)?)?`)
|
||||
|
||||
createToken('XRANGEPLAINLOOSE', `[v=\\s]*(${src[t.XRANGEIDENTIFIERLOOSE]})` +
|
||||
`(?:\\.(${src[t.XRANGEIDENTIFIERLOOSE]})` +
|
||||
`(?:\\.(${src[t.XRANGEIDENTIFIERLOOSE]})` +
|
||||
`(?:${src[t.PRERELEASELOOSE]})?${
|
||||
src[t.BUILD]}?` +
|
||||
`)?)?`)
|
||||
|
||||
createToken('XRANGE', `^${src[t.GTLT]}\\s*${src[t.XRANGEPLAIN]}$`)
|
||||
createToken('XRANGELOOSE', `^${src[t.GTLT]}\\s*${src[t.XRANGEPLAINLOOSE]}$`)
|
||||
|
||||
// Coercion.
|
||||
// Extract anything that could conceivably be a part of a valid semver
|
||||
createToken('COERCEPLAIN', `${'(^|[^\\d])' +
|
||||
'(\\d{1,'}${MAX_SAFE_COMPONENT_LENGTH}})` +
|
||||
`(?:\\.(\\d{1,${MAX_SAFE_COMPONENT_LENGTH}}))?` +
|
||||
`(?:\\.(\\d{1,${MAX_SAFE_COMPONENT_LENGTH}}))?`)
|
||||
createToken('COERCE', `${src[t.COERCEPLAIN]}(?:$|[^\\d])`)
|
||||
createToken('COERCEFULL', src[t.COERCEPLAIN] +
|
||||
`(?:${src[t.PRERELEASE]})?` +
|
||||
`(?:${src[t.BUILD]})?` +
|
||||
`(?:$|[^\\d])`)
|
||||
createToken('COERCERTL', src[t.COERCE], true)
|
||||
createToken('COERCERTLFULL', src[t.COERCEFULL], true)
|
||||
|
||||
// Tilde ranges.
|
||||
// Meaning is "reasonably at or greater than"
|
||||
createToken('LONETILDE', '(?:~>?)')
|
||||
|
||||
createToken('TILDETRIM', `(\\s*)${src[t.LONETILDE]}\\s+`, true)
|
||||
exports.tildeTrimReplace = '$1~'
|
||||
|
||||
createToken('TILDE', `^${src[t.LONETILDE]}${src[t.XRANGEPLAIN]}$`)
|
||||
createToken('TILDELOOSE', `^${src[t.LONETILDE]}${src[t.XRANGEPLAINLOOSE]}$`)
|
||||
|
||||
// Caret ranges.
|
||||
// Meaning is "at least and backwards compatible with"
|
||||
createToken('LONECARET', '(?:\\^)')
|
||||
|
||||
createToken('CARETTRIM', `(\\s*)${src[t.LONECARET]}\\s+`, true)
|
||||
exports.caretTrimReplace = '$1^'
|
||||
|
||||
createToken('CARET', `^${src[t.LONECARET]}${src[t.XRANGEPLAIN]}$`)
|
||||
createToken('CARETLOOSE', `^${src[t.LONECARET]}${src[t.XRANGEPLAINLOOSE]}$`)
|
||||
|
||||
// A simple gt/lt/eq thing, or just "" to indicate "any version"
|
||||
createToken('COMPARATORLOOSE', `^${src[t.GTLT]}\\s*(${src[t.LOOSEPLAIN]})$|^$`)
|
||||
createToken('COMPARATOR', `^${src[t.GTLT]}\\s*(${src[t.FULLPLAIN]})$|^$`)
|
||||
|
||||
// An expression to strip any whitespace between the gtlt and the thing
|
||||
// it modifies, so that `> 1.2.3` ==> `>1.2.3`
|
||||
createToken('COMPARATORTRIM', `(\\s*)${src[t.GTLT]
|
||||
}\\s*(${src[t.LOOSEPLAIN]}|${src[t.XRANGEPLAIN]})`, true)
|
||||
exports.comparatorTrimReplace = '$1$2$3'
|
||||
|
||||
// Something like `1.2.3 - 1.2.4`
|
||||
// Note that these all use the loose form, because they'll be
|
||||
// checked against either the strict or loose comparator form
|
||||
// later.
|
||||
createToken('HYPHENRANGE', `^\\s*(${src[t.XRANGEPLAIN]})` +
|
||||
`\\s+-\\s+` +
|
||||
`(${src[t.XRANGEPLAIN]})` +
|
||||
`\\s*$`)
|
||||
|
||||
createToken('HYPHENRANGELOOSE', `^\\s*(${src[t.XRANGEPLAINLOOSE]})` +
|
||||
`\\s+-\\s+` +
|
||||
`(${src[t.XRANGEPLAINLOOSE]})` +
|
||||
`\\s*$`)
|
||||
|
||||
// Star ranges basically just allow anything at all.
|
||||
createToken('STAR', '(<|>)?=?\\s*\\*')
|
||||
// >=0.0.0 is like a star
|
||||
createToken('GTE0', '^\\s*>=\\s*0\\.0\\.0\\s*$')
|
||||
createToken('GTE0PRE', '^\\s*>=\\s*0\\.0\\.0-0\\s*$')
|
||||
78
qwen/nodejs/node_modules/nodemon/node_modules/semver/package.json
generated
vendored
Normal file
78
qwen/nodejs/node_modules/nodemon/node_modules/semver/package.json
generated
vendored
Normal file
@@ -0,0 +1,78 @@
|
||||
{
|
||||
"name": "semver",
|
||||
"version": "7.7.3",
|
||||
"description": "The semantic version parser used by npm.",
|
||||
"main": "index.js",
|
||||
"scripts": {
|
||||
"test": "tap",
|
||||
"snap": "tap",
|
||||
"lint": "npm run eslint",
|
||||
"postlint": "template-oss-check",
|
||||
"lintfix": "npm run eslint -- --fix",
|
||||
"posttest": "npm run lint",
|
||||
"template-oss-apply": "template-oss-apply --force",
|
||||
"eslint": "eslint \"**/*.{js,cjs,ts,mjs,jsx,tsx}\""
|
||||
},
|
||||
"devDependencies": {
|
||||
"@npmcli/eslint-config": "^5.0.0",
|
||||
"@npmcli/template-oss": "4.25.1",
|
||||
"benchmark": "^2.1.4",
|
||||
"tap": "^16.0.0"
|
||||
},
|
||||
"license": "ISC",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git+https://github.com/npm/node-semver.git"
|
||||
},
|
||||
"bin": {
|
||||
"semver": "bin/semver.js"
|
||||
},
|
||||
"files": [
|
||||
"bin/",
|
||||
"lib/",
|
||||
"classes/",
|
||||
"functions/",
|
||||
"internal/",
|
||||
"ranges/",
|
||||
"index.js",
|
||||
"preload.js",
|
||||
"range.bnf"
|
||||
],
|
||||
"tap": {
|
||||
"timeout": 30,
|
||||
"coverage-map": "map.js",
|
||||
"nyc-arg": [
|
||||
"--exclude",
|
||||
"tap-snapshots/**"
|
||||
]
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=10"
|
||||
},
|
||||
"author": "GitHub Inc.",
|
||||
"templateOSS": {
|
||||
"//@npmcli/template-oss": "This file is partially managed by @npmcli/template-oss. Edits may be overwritten.",
|
||||
"version": "4.25.1",
|
||||
"engines": ">=10",
|
||||
"distPaths": [
|
||||
"classes/",
|
||||
"functions/",
|
||||
"internal/",
|
||||
"ranges/",
|
||||
"index.js",
|
||||
"preload.js",
|
||||
"range.bnf"
|
||||
],
|
||||
"allowPaths": [
|
||||
"/classes/",
|
||||
"/functions/",
|
||||
"/internal/",
|
||||
"/ranges/",
|
||||
"/index.js",
|
||||
"/preload.js",
|
||||
"/range.bnf",
|
||||
"/benchmarks"
|
||||
],
|
||||
"publish": "true"
|
||||
}
|
||||
}
|
||||
4
qwen/nodejs/node_modules/nodemon/node_modules/semver/preload.js
generated
vendored
Normal file
4
qwen/nodejs/node_modules/nodemon/node_modules/semver/preload.js
generated
vendored
Normal file
@@ -0,0 +1,4 @@
|
||||
'use strict'
|
||||
|
||||
// XXX remove in v8 or beyond
|
||||
module.exports = require('./index.js')
|
||||
16
qwen/nodejs/node_modules/nodemon/node_modules/semver/range.bnf
generated
vendored
Normal file
16
qwen/nodejs/node_modules/nodemon/node_modules/semver/range.bnf
generated
vendored
Normal file
@@ -0,0 +1,16 @@
|
||||
range-set ::= range ( logical-or range ) *
|
||||
logical-or ::= ( ' ' ) * '||' ( ' ' ) *
|
||||
range ::= hyphen | simple ( ' ' simple ) * | ''
|
||||
hyphen ::= partial ' - ' partial
|
||||
simple ::= primitive | partial | tilde | caret
|
||||
primitive ::= ( '<' | '>' | '>=' | '<=' | '=' ) partial
|
||||
partial ::= xr ( '.' xr ( '.' xr qualifier ? )? )?
|
||||
xr ::= 'x' | 'X' | '*' | nr
|
||||
nr ::= '0' | [1-9] ( [0-9] ) *
|
||||
tilde ::= '~' partial
|
||||
caret ::= '^' partial
|
||||
qualifier ::= ( '-' pre )? ( '+' build )?
|
||||
pre ::= parts
|
||||
build ::= parts
|
||||
parts ::= part ( '.' part ) *
|
||||
part ::= nr | [-0-9A-Za-z]+
|
||||
6
qwen/nodejs/node_modules/nodemon/node_modules/semver/ranges/gtr.js
generated
vendored
Normal file
6
qwen/nodejs/node_modules/nodemon/node_modules/semver/ranges/gtr.js
generated
vendored
Normal file
@@ -0,0 +1,6 @@
|
||||
'use strict'
|
||||
|
||||
// Determine if version is greater than all the versions possible in the range.
|
||||
const outside = require('./outside')
|
||||
const gtr = (version, range, options) => outside(version, range, '>', options)
|
||||
module.exports = gtr
|
||||
9
qwen/nodejs/node_modules/nodemon/node_modules/semver/ranges/intersects.js
generated
vendored
Normal file
9
qwen/nodejs/node_modules/nodemon/node_modules/semver/ranges/intersects.js
generated
vendored
Normal file
@@ -0,0 +1,9 @@
|
||||
'use strict'
|
||||
|
||||
const Range = require('../classes/range')
|
||||
const intersects = (r1, r2, options) => {
|
||||
r1 = new Range(r1, options)
|
||||
r2 = new Range(r2, options)
|
||||
return r1.intersects(r2, options)
|
||||
}
|
||||
module.exports = intersects
|
||||
6
qwen/nodejs/node_modules/nodemon/node_modules/semver/ranges/ltr.js
generated
vendored
Normal file
6
qwen/nodejs/node_modules/nodemon/node_modules/semver/ranges/ltr.js
generated
vendored
Normal file
@@ -0,0 +1,6 @@
|
||||
'use strict'
|
||||
|
||||
const outside = require('./outside')
|
||||
// Determine if version is less than all the versions possible in the range
|
||||
const ltr = (version, range, options) => outside(version, range, '<', options)
|
||||
module.exports = ltr
|
||||
27
qwen/nodejs/node_modules/nodemon/node_modules/semver/ranges/max-satisfying.js
generated
vendored
Normal file
27
qwen/nodejs/node_modules/nodemon/node_modules/semver/ranges/max-satisfying.js
generated
vendored
Normal file
@@ -0,0 +1,27 @@
|
||||
'use strict'
|
||||
|
||||
const SemVer = require('../classes/semver')
|
||||
const Range = require('../classes/range')
|
||||
|
||||
const maxSatisfying = (versions, range, options) => {
|
||||
let max = null
|
||||
let maxSV = null
|
||||
let rangeObj = null
|
||||
try {
|
||||
rangeObj = new Range(range, options)
|
||||
} catch (er) {
|
||||
return null
|
||||
}
|
||||
versions.forEach((v) => {
|
||||
if (rangeObj.test(v)) {
|
||||
// satisfies(v, range, options)
|
||||
if (!max || maxSV.compare(v) === -1) {
|
||||
// compare(max, v, true)
|
||||
max = v
|
||||
maxSV = new SemVer(max, options)
|
||||
}
|
||||
}
|
||||
})
|
||||
return max
|
||||
}
|
||||
module.exports = maxSatisfying
|
||||
26
qwen/nodejs/node_modules/nodemon/node_modules/semver/ranges/min-satisfying.js
generated
vendored
Normal file
26
qwen/nodejs/node_modules/nodemon/node_modules/semver/ranges/min-satisfying.js
generated
vendored
Normal file
@@ -0,0 +1,26 @@
|
||||
'use strict'
|
||||
|
||||
const SemVer = require('../classes/semver')
|
||||
const Range = require('../classes/range')
|
||||
const minSatisfying = (versions, range, options) => {
|
||||
let min = null
|
||||
let minSV = null
|
||||
let rangeObj = null
|
||||
try {
|
||||
rangeObj = new Range(range, options)
|
||||
} catch (er) {
|
||||
return null
|
||||
}
|
||||
versions.forEach((v) => {
|
||||
if (rangeObj.test(v)) {
|
||||
// satisfies(v, range, options)
|
||||
if (!min || minSV.compare(v) === 1) {
|
||||
// compare(min, v, true)
|
||||
min = v
|
||||
minSV = new SemVer(min, options)
|
||||
}
|
||||
}
|
||||
})
|
||||
return min
|
||||
}
|
||||
module.exports = minSatisfying
|
||||
63
qwen/nodejs/node_modules/nodemon/node_modules/semver/ranges/min-version.js
generated
vendored
Normal file
63
qwen/nodejs/node_modules/nodemon/node_modules/semver/ranges/min-version.js
generated
vendored
Normal file
@@ -0,0 +1,63 @@
|
||||
'use strict'
|
||||
|
||||
const SemVer = require('../classes/semver')
|
||||
const Range = require('../classes/range')
|
||||
const gt = require('../functions/gt')
|
||||
|
||||
const minVersion = (range, loose) => {
|
||||
range = new Range(range, loose)
|
||||
|
||||
let minver = new SemVer('0.0.0')
|
||||
if (range.test(minver)) {
|
||||
return minver
|
||||
}
|
||||
|
||||
minver = new SemVer('0.0.0-0')
|
||||
if (range.test(minver)) {
|
||||
return minver
|
||||
}
|
||||
|
||||
minver = null
|
||||
for (let i = 0; i < range.set.length; ++i) {
|
||||
const comparators = range.set[i]
|
||||
|
||||
let setMin = null
|
||||
comparators.forEach((comparator) => {
|
||||
// Clone to avoid manipulating the comparator's semver object.
|
||||
const compver = new SemVer(comparator.semver.version)
|
||||
switch (comparator.operator) {
|
||||
case '>':
|
||||
if (compver.prerelease.length === 0) {
|
||||
compver.patch++
|
||||
} else {
|
||||
compver.prerelease.push(0)
|
||||
}
|
||||
compver.raw = compver.format()
|
||||
/* fallthrough */
|
||||
case '':
|
||||
case '>=':
|
||||
if (!setMin || gt(compver, setMin)) {
|
||||
setMin = compver
|
||||
}
|
||||
break
|
||||
case '<':
|
||||
case '<=':
|
||||
/* Ignore maximum versions */
|
||||
break
|
||||
/* istanbul ignore next */
|
||||
default:
|
||||
throw new Error(`Unexpected operation: ${comparator.operator}`)
|
||||
}
|
||||
})
|
||||
if (setMin && (!minver || gt(minver, setMin))) {
|
||||
minver = setMin
|
||||
}
|
||||
}
|
||||
|
||||
if (minver && range.test(minver)) {
|
||||
return minver
|
||||
}
|
||||
|
||||
return null
|
||||
}
|
||||
module.exports = minVersion
|
||||
82
qwen/nodejs/node_modules/nodemon/node_modules/semver/ranges/outside.js
generated
vendored
Normal file
82
qwen/nodejs/node_modules/nodemon/node_modules/semver/ranges/outside.js
generated
vendored
Normal file
@@ -0,0 +1,82 @@
|
||||
'use strict'
|
||||
|
||||
const SemVer = require('../classes/semver')
|
||||
const Comparator = require('../classes/comparator')
|
||||
const { ANY } = Comparator
|
||||
const Range = require('../classes/range')
|
||||
const satisfies = require('../functions/satisfies')
|
||||
const gt = require('../functions/gt')
|
||||
const lt = require('../functions/lt')
|
||||
const lte = require('../functions/lte')
|
||||
const gte = require('../functions/gte')
|
||||
|
||||
const outside = (version, range, hilo, options) => {
|
||||
version = new SemVer(version, options)
|
||||
range = new Range(range, options)
|
||||
|
||||
let gtfn, ltefn, ltfn, comp, ecomp
|
||||
switch (hilo) {
|
||||
case '>':
|
||||
gtfn = gt
|
||||
ltefn = lte
|
||||
ltfn = lt
|
||||
comp = '>'
|
||||
ecomp = '>='
|
||||
break
|
||||
case '<':
|
||||
gtfn = lt
|
||||
ltefn = gte
|
||||
ltfn = gt
|
||||
comp = '<'
|
||||
ecomp = '<='
|
||||
break
|
||||
default:
|
||||
throw new TypeError('Must provide a hilo val of "<" or ">"')
|
||||
}
|
||||
|
||||
// If it satisfies the range it is not outside
|
||||
if (satisfies(version, range, options)) {
|
||||
return false
|
||||
}
|
||||
|
||||
// From now on, variable terms are as if we're in "gtr" mode.
|
||||
// but note that everything is flipped for the "ltr" function.
|
||||
|
||||
for (let i = 0; i < range.set.length; ++i) {
|
||||
const comparators = range.set[i]
|
||||
|
||||
let high = null
|
||||
let low = null
|
||||
|
||||
comparators.forEach((comparator) => {
|
||||
if (comparator.semver === ANY) {
|
||||
comparator = new Comparator('>=0.0.0')
|
||||
}
|
||||
high = high || comparator
|
||||
low = low || comparator
|
||||
if (gtfn(comparator.semver, high.semver, options)) {
|
||||
high = comparator
|
||||
} else if (ltfn(comparator.semver, low.semver, options)) {
|
||||
low = comparator
|
||||
}
|
||||
})
|
||||
|
||||
// If the edge version comparator has a operator then our version
|
||||
// isn't outside it
|
||||
if (high.operator === comp || high.operator === ecomp) {
|
||||
return false
|
||||
}
|
||||
|
||||
// If the lowest version comparator has an operator and our version
|
||||
// is less than it then it isn't higher than the range
|
||||
if ((!low.operator || low.operator === comp) &&
|
||||
ltefn(version, low.semver)) {
|
||||
return false
|
||||
} else if (low.operator === ecomp && ltfn(version, low.semver)) {
|
||||
return false
|
||||
}
|
||||
}
|
||||
return true
|
||||
}
|
||||
|
||||
module.exports = outside
|
||||
49
qwen/nodejs/node_modules/nodemon/node_modules/semver/ranges/simplify.js
generated
vendored
Normal file
49
qwen/nodejs/node_modules/nodemon/node_modules/semver/ranges/simplify.js
generated
vendored
Normal file
@@ -0,0 +1,49 @@
|
||||
'use strict'
|
||||
|
||||
// given a set of versions and a range, create a "simplified" range
|
||||
// that includes the same versions that the original range does
|
||||
// If the original range is shorter than the simplified one, return that.
|
||||
const satisfies = require('../functions/satisfies.js')
|
||||
const compare = require('../functions/compare.js')
|
||||
module.exports = (versions, range, options) => {
|
||||
const set = []
|
||||
let first = null
|
||||
let prev = null
|
||||
const v = versions.sort((a, b) => compare(a, b, options))
|
||||
for (const version of v) {
|
||||
const included = satisfies(version, range, options)
|
||||
if (included) {
|
||||
prev = version
|
||||
if (!first) {
|
||||
first = version
|
||||
}
|
||||
} else {
|
||||
if (prev) {
|
||||
set.push([first, prev])
|
||||
}
|
||||
prev = null
|
||||
first = null
|
||||
}
|
||||
}
|
||||
if (first) {
|
||||
set.push([first, null])
|
||||
}
|
||||
|
||||
const ranges = []
|
||||
for (const [min, max] of set) {
|
||||
if (min === max) {
|
||||
ranges.push(min)
|
||||
} else if (!max && min === v[0]) {
|
||||
ranges.push('*')
|
||||
} else if (!max) {
|
||||
ranges.push(`>=${min}`)
|
||||
} else if (min === v[0]) {
|
||||
ranges.push(`<=${max}`)
|
||||
} else {
|
||||
ranges.push(`${min} - ${max}`)
|
||||
}
|
||||
}
|
||||
const simplified = ranges.join(' || ')
|
||||
const original = typeof range.raw === 'string' ? range.raw : String(range)
|
||||
return simplified.length < original.length ? simplified : range
|
||||
}
|
||||
249
qwen/nodejs/node_modules/nodemon/node_modules/semver/ranges/subset.js
generated
vendored
Normal file
249
qwen/nodejs/node_modules/nodemon/node_modules/semver/ranges/subset.js
generated
vendored
Normal file
@@ -0,0 +1,249 @@
|
||||
'use strict'
|
||||
|
||||
const Range = require('../classes/range.js')
|
||||
const Comparator = require('../classes/comparator.js')
|
||||
const { ANY } = Comparator
|
||||
const satisfies = require('../functions/satisfies.js')
|
||||
const compare = require('../functions/compare.js')
|
||||
|
||||
// Complex range `r1 || r2 || ...` is a subset of `R1 || R2 || ...` iff:
|
||||
// - Every simple range `r1, r2, ...` is a null set, OR
|
||||
// - Every simple range `r1, r2, ...` which is not a null set is a subset of
|
||||
// some `R1, R2, ...`
|
||||
//
|
||||
// Simple range `c1 c2 ...` is a subset of simple range `C1 C2 ...` iff:
|
||||
// - If c is only the ANY comparator
|
||||
// - If C is only the ANY comparator, return true
|
||||
// - Else if in prerelease mode, return false
|
||||
// - else replace c with `[>=0.0.0]`
|
||||
// - If C is only the ANY comparator
|
||||
// - if in prerelease mode, return true
|
||||
// - else replace C with `[>=0.0.0]`
|
||||
// - Let EQ be the set of = comparators in c
|
||||
// - If EQ is more than one, return true (null set)
|
||||
// - Let GT be the highest > or >= comparator in c
|
||||
// - Let LT be the lowest < or <= comparator in c
|
||||
// - If GT and LT, and GT.semver > LT.semver, return true (null set)
|
||||
// - If any C is a = range, and GT or LT are set, return false
|
||||
// - If EQ
|
||||
// - If GT, and EQ does not satisfy GT, return true (null set)
|
||||
// - If LT, and EQ does not satisfy LT, return true (null set)
|
||||
// - If EQ satisfies every C, return true
|
||||
// - Else return false
|
||||
// - If GT
|
||||
// - If GT.semver is lower than any > or >= comp in C, return false
|
||||
// - If GT is >=, and GT.semver does not satisfy every C, return false
|
||||
// - If GT.semver has a prerelease, and not in prerelease mode
|
||||
// - If no C has a prerelease and the GT.semver tuple, return false
|
||||
// - If LT
|
||||
// - If LT.semver is greater than any < or <= comp in C, return false
|
||||
// - If LT is <=, and LT.semver does not satisfy every C, return false
|
||||
// - If GT.semver has a prerelease, and not in prerelease mode
|
||||
// - If no C has a prerelease and the LT.semver tuple, return false
|
||||
// - Else return true
|
||||
|
||||
const subset = (sub, dom, options = {}) => {
|
||||
if (sub === dom) {
|
||||
return true
|
||||
}
|
||||
|
||||
sub = new Range(sub, options)
|
||||
dom = new Range(dom, options)
|
||||
let sawNonNull = false
|
||||
|
||||
OUTER: for (const simpleSub of sub.set) {
|
||||
for (const simpleDom of dom.set) {
|
||||
const isSub = simpleSubset(simpleSub, simpleDom, options)
|
||||
sawNonNull = sawNonNull || isSub !== null
|
||||
if (isSub) {
|
||||
continue OUTER
|
||||
}
|
||||
}
|
||||
// the null set is a subset of everything, but null simple ranges in
|
||||
// a complex range should be ignored. so if we saw a non-null range,
|
||||
// then we know this isn't a subset, but if EVERY simple range was null,
|
||||
// then it is a subset.
|
||||
if (sawNonNull) {
|
||||
return false
|
||||
}
|
||||
}
|
||||
return true
|
||||
}
|
||||
|
||||
const minimumVersionWithPreRelease = [new Comparator('>=0.0.0-0')]
|
||||
const minimumVersion = [new Comparator('>=0.0.0')]
|
||||
|
||||
const simpleSubset = (sub, dom, options) => {
|
||||
if (sub === dom) {
|
||||
return true
|
||||
}
|
||||
|
||||
if (sub.length === 1 && sub[0].semver === ANY) {
|
||||
if (dom.length === 1 && dom[0].semver === ANY) {
|
||||
return true
|
||||
} else if (options.includePrerelease) {
|
||||
sub = minimumVersionWithPreRelease
|
||||
} else {
|
||||
sub = minimumVersion
|
||||
}
|
||||
}
|
||||
|
||||
if (dom.length === 1 && dom[0].semver === ANY) {
|
||||
if (options.includePrerelease) {
|
||||
return true
|
||||
} else {
|
||||
dom = minimumVersion
|
||||
}
|
||||
}
|
||||
|
||||
const eqSet = new Set()
|
||||
let gt, lt
|
||||
for (const c of sub) {
|
||||
if (c.operator === '>' || c.operator === '>=') {
|
||||
gt = higherGT(gt, c, options)
|
||||
} else if (c.operator === '<' || c.operator === '<=') {
|
||||
lt = lowerLT(lt, c, options)
|
||||
} else {
|
||||
eqSet.add(c.semver)
|
||||
}
|
||||
}
|
||||
|
||||
if (eqSet.size > 1) {
|
||||
return null
|
||||
}
|
||||
|
||||
let gtltComp
|
||||
if (gt && lt) {
|
||||
gtltComp = compare(gt.semver, lt.semver, options)
|
||||
if (gtltComp > 0) {
|
||||
return null
|
||||
} else if (gtltComp === 0 && (gt.operator !== '>=' || lt.operator !== '<=')) {
|
||||
return null
|
||||
}
|
||||
}
|
||||
|
||||
// will iterate one or zero times
|
||||
for (const eq of eqSet) {
|
||||
if (gt && !satisfies(eq, String(gt), options)) {
|
||||
return null
|
||||
}
|
||||
|
||||
if (lt && !satisfies(eq, String(lt), options)) {
|
||||
return null
|
||||
}
|
||||
|
||||
for (const c of dom) {
|
||||
if (!satisfies(eq, String(c), options)) {
|
||||
return false
|
||||
}
|
||||
}
|
||||
|
||||
return true
|
||||
}
|
||||
|
||||
let higher, lower
|
||||
let hasDomLT, hasDomGT
|
||||
// if the subset has a prerelease, we need a comparator in the superset
|
||||
// with the same tuple and a prerelease, or it's not a subset
|
||||
let needDomLTPre = lt &&
|
||||
!options.includePrerelease &&
|
||||
lt.semver.prerelease.length ? lt.semver : false
|
||||
let needDomGTPre = gt &&
|
||||
!options.includePrerelease &&
|
||||
gt.semver.prerelease.length ? gt.semver : false
|
||||
// exception: <1.2.3-0 is the same as <1.2.3
|
||||
if (needDomLTPre && needDomLTPre.prerelease.length === 1 &&
|
||||
lt.operator === '<' && needDomLTPre.prerelease[0] === 0) {
|
||||
needDomLTPre = false
|
||||
}
|
||||
|
||||
for (const c of dom) {
|
||||
hasDomGT = hasDomGT || c.operator === '>' || c.operator === '>='
|
||||
hasDomLT = hasDomLT || c.operator === '<' || c.operator === '<='
|
||||
if (gt) {
|
||||
if (needDomGTPre) {
|
||||
if (c.semver.prerelease && c.semver.prerelease.length &&
|
||||
c.semver.major === needDomGTPre.major &&
|
||||
c.semver.minor === needDomGTPre.minor &&
|
||||
c.semver.patch === needDomGTPre.patch) {
|
||||
needDomGTPre = false
|
||||
}
|
||||
}
|
||||
if (c.operator === '>' || c.operator === '>=') {
|
||||
higher = higherGT(gt, c, options)
|
||||
if (higher === c && higher !== gt) {
|
||||
return false
|
||||
}
|
||||
} else if (gt.operator === '>=' && !satisfies(gt.semver, String(c), options)) {
|
||||
return false
|
||||
}
|
||||
}
|
||||
if (lt) {
|
||||
if (needDomLTPre) {
|
||||
if (c.semver.prerelease && c.semver.prerelease.length &&
|
||||
c.semver.major === needDomLTPre.major &&
|
||||
c.semver.minor === needDomLTPre.minor &&
|
||||
c.semver.patch === needDomLTPre.patch) {
|
||||
needDomLTPre = false
|
||||
}
|
||||
}
|
||||
if (c.operator === '<' || c.operator === '<=') {
|
||||
lower = lowerLT(lt, c, options)
|
||||
if (lower === c && lower !== lt) {
|
||||
return false
|
||||
}
|
||||
} else if (lt.operator === '<=' && !satisfies(lt.semver, String(c), options)) {
|
||||
return false
|
||||
}
|
||||
}
|
||||
if (!c.operator && (lt || gt) && gtltComp !== 0) {
|
||||
return false
|
||||
}
|
||||
}
|
||||
|
||||
// if there was a < or >, and nothing in the dom, then must be false
|
||||
// UNLESS it was limited by another range in the other direction.
|
||||
// Eg, >1.0.0 <1.0.1 is still a subset of <2.0.0
|
||||
if (gt && hasDomLT && !lt && gtltComp !== 0) {
|
||||
return false
|
||||
}
|
||||
|
||||
if (lt && hasDomGT && !gt && gtltComp !== 0) {
|
||||
return false
|
||||
}
|
||||
|
||||
// we needed a prerelease range in a specific tuple, but didn't get one
|
||||
// then this isn't a subset. eg >=1.2.3-pre is not a subset of >=1.0.0,
|
||||
// because it includes prereleases in the 1.2.3 tuple
|
||||
if (needDomGTPre || needDomLTPre) {
|
||||
return false
|
||||
}
|
||||
|
||||
return true
|
||||
}
|
||||
|
||||
// >=1.2.3 is lower than >1.2.3
|
||||
const higherGT = (a, b, options) => {
|
||||
if (!a) {
|
||||
return b
|
||||
}
|
||||
const comp = compare(a.semver, b.semver, options)
|
||||
return comp > 0 ? a
|
||||
: comp < 0 ? b
|
||||
: b.operator === '>' && a.operator === '>=' ? b
|
||||
: a
|
||||
}
|
||||
|
||||
// <=1.2.3 is higher than <1.2.3
|
||||
const lowerLT = (a, b, options) => {
|
||||
if (!a) {
|
||||
return b
|
||||
}
|
||||
const comp = compare(a.semver, b.semver, options)
|
||||
return comp < 0 ? a
|
||||
: comp > 0 ? b
|
||||
: b.operator === '<' && a.operator === '<=' ? b
|
||||
: a
|
||||
}
|
||||
|
||||
module.exports = subset
|
||||
10
qwen/nodejs/node_modules/nodemon/node_modules/semver/ranges/to-comparators.js
generated
vendored
Normal file
10
qwen/nodejs/node_modules/nodemon/node_modules/semver/ranges/to-comparators.js
generated
vendored
Normal file
@@ -0,0 +1,10 @@
|
||||
'use strict'
|
||||
|
||||
const Range = require('../classes/range')
|
||||
|
||||
// Mostly just for testing and legacy API reasons
|
||||
const toComparators = (range, options) =>
|
||||
new Range(range, options).set
|
||||
.map(comp => comp.map(c => c.value).join(' ').trim().split(' '))
|
||||
|
||||
module.exports = toComparators
|
||||
13
qwen/nodejs/node_modules/nodemon/node_modules/semver/ranges/valid.js
generated
vendored
Normal file
13
qwen/nodejs/node_modules/nodemon/node_modules/semver/ranges/valid.js
generated
vendored
Normal file
@@ -0,0 +1,13 @@
|
||||
'use strict'
|
||||
|
||||
const Range = require('../classes/range')
|
||||
const validRange = (range, options) => {
|
||||
try {
|
||||
// Return '*' instead of '' so that truthiness works.
|
||||
// This will throw if it's invalid anyway
|
||||
return new Range(range, options).range || '*'
|
||||
} catch (er) {
|
||||
return null
|
||||
}
|
||||
}
|
||||
module.exports = validRange
|
||||
5
qwen/nodejs/node_modules/nodemon/node_modules/supports-color/browser.js
generated
vendored
Normal file
5
qwen/nodejs/node_modules/nodemon/node_modules/supports-color/browser.js
generated
vendored
Normal file
@@ -0,0 +1,5 @@
|
||||
'use strict';
|
||||
module.exports = {
|
||||
stdout: false,
|
||||
stderr: false
|
||||
};
|
||||
131
qwen/nodejs/node_modules/nodemon/node_modules/supports-color/index.js
generated
vendored
Normal file
131
qwen/nodejs/node_modules/nodemon/node_modules/supports-color/index.js
generated
vendored
Normal file
@@ -0,0 +1,131 @@
|
||||
'use strict';
|
||||
const os = require('os');
|
||||
const hasFlag = require('has-flag');
|
||||
|
||||
const env = process.env;
|
||||
|
||||
let forceColor;
|
||||
if (hasFlag('no-color') ||
|
||||
hasFlag('no-colors') ||
|
||||
hasFlag('color=false')) {
|
||||
forceColor = false;
|
||||
} else if (hasFlag('color') ||
|
||||
hasFlag('colors') ||
|
||||
hasFlag('color=true') ||
|
||||
hasFlag('color=always')) {
|
||||
forceColor = true;
|
||||
}
|
||||
if ('FORCE_COLOR' in env) {
|
||||
forceColor = env.FORCE_COLOR.length === 0 || parseInt(env.FORCE_COLOR, 10) !== 0;
|
||||
}
|
||||
|
||||
function translateLevel(level) {
|
||||
if (level === 0) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return {
|
||||
level,
|
||||
hasBasic: true,
|
||||
has256: level >= 2,
|
||||
has16m: level >= 3
|
||||
};
|
||||
}
|
||||
|
||||
function supportsColor(stream) {
|
||||
if (forceColor === false) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (hasFlag('color=16m') ||
|
||||
hasFlag('color=full') ||
|
||||
hasFlag('color=truecolor')) {
|
||||
return 3;
|
||||
}
|
||||
|
||||
if (hasFlag('color=256')) {
|
||||
return 2;
|
||||
}
|
||||
|
||||
if (stream && !stream.isTTY && forceColor !== true) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
const min = forceColor ? 1 : 0;
|
||||
|
||||
if (process.platform === 'win32') {
|
||||
// Node.js 7.5.0 is the first version of Node.js to include a patch to
|
||||
// libuv that enables 256 color output on Windows. Anything earlier and it
|
||||
// won't work. However, here we target Node.js 8 at minimum as it is an LTS
|
||||
// release, and Node.js 7 is not. Windows 10 build 10586 is the first Windows
|
||||
// release that supports 256 colors. Windows 10 build 14931 is the first release
|
||||
// that supports 16m/TrueColor.
|
||||
const osRelease = os.release().split('.');
|
||||
if (
|
||||
Number(process.versions.node.split('.')[0]) >= 8 &&
|
||||
Number(osRelease[0]) >= 10 &&
|
||||
Number(osRelease[2]) >= 10586
|
||||
) {
|
||||
return Number(osRelease[2]) >= 14931 ? 3 : 2;
|
||||
}
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
if ('CI' in env) {
|
||||
if (['TRAVIS', 'CIRCLECI', 'APPVEYOR', 'GITLAB_CI'].some(sign => sign in env) || env.CI_NAME === 'codeship') {
|
||||
return 1;
|
||||
}
|
||||
|
||||
return min;
|
||||
}
|
||||
|
||||
if ('TEAMCITY_VERSION' in env) {
|
||||
return /^(9\.(0*[1-9]\d*)\.|\d{2,}\.)/.test(env.TEAMCITY_VERSION) ? 1 : 0;
|
||||
}
|
||||
|
||||
if (env.COLORTERM === 'truecolor') {
|
||||
return 3;
|
||||
}
|
||||
|
||||
if ('TERM_PROGRAM' in env) {
|
||||
const version = parseInt((env.TERM_PROGRAM_VERSION || '').split('.')[0], 10);
|
||||
|
||||
switch (env.TERM_PROGRAM) {
|
||||
case 'iTerm.app':
|
||||
return version >= 3 ? 3 : 2;
|
||||
case 'Apple_Terminal':
|
||||
return 2;
|
||||
// No default
|
||||
}
|
||||
}
|
||||
|
||||
if (/-256(color)?$/i.test(env.TERM)) {
|
||||
return 2;
|
||||
}
|
||||
|
||||
if (/^screen|^xterm|^vt100|^vt220|^rxvt|color|ansi|cygwin|linux/i.test(env.TERM)) {
|
||||
return 1;
|
||||
}
|
||||
|
||||
if ('COLORTERM' in env) {
|
||||
return 1;
|
||||
}
|
||||
|
||||
if (env.TERM === 'dumb') {
|
||||
return min;
|
||||
}
|
||||
|
||||
return min;
|
||||
}
|
||||
|
||||
function getSupportLevel(stream) {
|
||||
const level = supportsColor(stream);
|
||||
return translateLevel(level);
|
||||
}
|
||||
|
||||
module.exports = {
|
||||
supportsColor: getSupportLevel,
|
||||
stdout: getSupportLevel(process.stdout),
|
||||
stderr: getSupportLevel(process.stderr)
|
||||
};
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user