TheDesk Mio (ver.4)
This commit is contained in:
parent
97e4d16642
commit
d4de0a6ca8
|
@ -26,7 +26,7 @@
|
||||||
<script type="text/javascript" src="./js/ui/jquery-ui.min.js"></script>
|
<script type="text/javascript" src="./js/ui/jquery-ui.min.js"></script>
|
||||||
<script>
|
<script>
|
||||||
//必ずアプデ時のremove instance消して!
|
//必ずアプデ時のremove instance消して!
|
||||||
var ver="Mio (ver.4)";
|
var ver="Mio (ver.3)";
|
||||||
//betaを入れるとバージョンチェックしない
|
//betaを入れるとバージョンチェックしない
|
||||||
//var ver="beta";
|
//var ver="beta";
|
||||||
var acct_id=0;
|
var acct_id=0;
|
||||||
|
|
|
@ -177,7 +177,14 @@ function parse(obj, mix, acct_id, tlid, popup) {
|
||||||
if(native=="yes"){
|
if(native=="yes"){
|
||||||
var electron = require("electron");
|
var electron = require("electron");
|
||||||
var ipc = electron.ipcRenderer;
|
var ipc = electron.ipcRenderer;
|
||||||
ipc.send('native-notf', ['TheDesk:'+domain,toot.account.display_name+"(" + toot.account.acct +")"+what+"\n\n"+$.strip_tags(toot.status.content),toot.account.avatar]);
|
var options = {
|
||||||
|
body: toot.account.display_name+"(" + toot.account.acct +")"+what+"\n\n"+$.strip_tags(toot.status.content),
|
||||||
|
icon: toot.account.avatar
|
||||||
|
};
|
||||||
|
var n = new Notification('TheDesk:'+domain, options);
|
||||||
|
|
||||||
|
console.log(n);
|
||||||
|
//ipc.send('native-notf', ['TheDesk:'+domain,toot.account.display_name+"(" + toot.account.acct +")"+what+"\n\n"+$.strip_tags(toot.status.content),toot.account.avatar]);
|
||||||
}
|
}
|
||||||
Materialize.toast("["+domain+"より]"+escapeHTML(toot.account.display_name)+what, popup * 1000);
|
Materialize.toast("["+domain+"より]"+escapeHTML(toot.account.display_name)+what, popup * 1000);
|
||||||
}
|
}
|
||||||
|
|
20
app/main.js
20
app/main.js
|
@ -20,6 +20,8 @@ const app = electron.app;
|
||||||
withFallback: false, // Fallback to Growl or Balloons?
|
withFallback: false, // Fallback to Growl or Balloons?
|
||||||
customPath: void 0 // Relative path if you want to use your fork of toast.exe
|
customPath: void 0 // Relative path if you want to use your fork of toast.exe
|
||||||
});
|
});
|
||||||
|
}else if(platform=="darwin"){
|
||||||
|
Notification = require('node-mac-notifier');
|
||||||
}
|
}
|
||||||
|
|
||||||
// ウィンドウを作成するモジュール
|
// ウィンドウを作成するモジュール
|
||||||
|
@ -130,16 +132,24 @@ ipc.on('native-notf', function(e, args) {
|
||||||
var tmp_imge="";
|
var tmp_imge="";
|
||||||
}
|
}
|
||||||
notifier.notify({
|
notifier.notify({
|
||||||
message: args[1],
|
body: args[1],
|
||||||
title: args[0],
|
title: args[0],
|
||||||
sound: false,//"Bottle",
|
|
||||||
icon : tmp_imge,
|
icon : tmp_imge,
|
||||||
wait:false
|
|
||||||
}, function(error, response) {
|
|
||||||
});
|
});
|
||||||
|
|
||||||
});
|
});
|
||||||
}
|
}else if(platform=="darwin"){
|
||||||
|
Jimp.read(args[2], function (err, lenna) {
|
||||||
|
if(!err && lenna){
|
||||||
|
lenna.write(tmp_img);
|
||||||
|
var tmp_imge=tmp_img;
|
||||||
|
}else{
|
||||||
|
var tmp_imge="";
|
||||||
|
}
|
||||||
|
noti = new Notification(args[0], {body: args[0],icon: tmp_imge});
|
||||||
|
|
||||||
|
});
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
ipc.on('update', function(e, x, y) {
|
ipc.on('update', function(e, x, y) {
|
||||||
|
|
13
app/node_modules/node-notifier/package.json
generated
vendored
13
app/node_modules/node-notifier/package.json
generated
vendored
|
@ -1,26 +1,27 @@
|
||||||
{
|
{
|
||||||
"_from": "node-notifier@5.2.1",
|
"_from": "node-notifier",
|
||||||
"_id": "node-notifier@5.2.1",
|
"_id": "node-notifier@5.2.1",
|
||||||
"_inBundle": false,
|
"_inBundle": false,
|
||||||
"_integrity": "sha512-MIBs+AAd6dJ2SklbbE8RUDRlIVhU8MaNLh1A9SUZDUHPiZkWLFde6UNwG41yQHZEToHgJMXqyVZ9UcS/ReOVTg==",
|
"_integrity": "sha512-MIBs+AAd6dJ2SklbbE8RUDRlIVhU8MaNLh1A9SUZDUHPiZkWLFde6UNwG41yQHZEToHgJMXqyVZ9UcS/ReOVTg==",
|
||||||
"_location": "/node-notifier",
|
"_location": "/node-notifier",
|
||||||
"_phantomChildren": {},
|
"_phantomChildren": {},
|
||||||
"_requested": {
|
"_requested": {
|
||||||
"type": "version",
|
"type": "tag",
|
||||||
"registry": true,
|
"registry": true,
|
||||||
"raw": "node-notifier@5.2.1",
|
"raw": "node-notifier",
|
||||||
"name": "node-notifier",
|
"name": "node-notifier",
|
||||||
"escapedName": "node-notifier",
|
"escapedName": "node-notifier",
|
||||||
"rawSpec": "5.2.1",
|
"rawSpec": "",
|
||||||
"saveSpec": null,
|
"saveSpec": null,
|
||||||
"fetchSpec": "5.2.1"
|
"fetchSpec": "latest"
|
||||||
},
|
},
|
||||||
"_requiredBy": [
|
"_requiredBy": [
|
||||||
|
"#USER",
|
||||||
"/"
|
"/"
|
||||||
],
|
],
|
||||||
"_resolved": "https://registry.npmjs.org/node-notifier/-/node-notifier-5.2.1.tgz",
|
"_resolved": "https://registry.npmjs.org/node-notifier/-/node-notifier-5.2.1.tgz",
|
||||||
"_shasum": "fa313dd08f5517db0e2502e5758d664ac69f9dea",
|
"_shasum": "fa313dd08f5517db0e2502e5758d664ac69f9dea",
|
||||||
"_spec": "node-notifier@5.2.1",
|
"_spec": "node-notifier",
|
||||||
"_where": "C:\\Users\\ryuki\\TheDesk\\app",
|
"_where": "C:\\Users\\ryuki\\TheDesk\\app",
|
||||||
"author": {
|
"author": {
|
||||||
"name": "Mikael Brevik"
|
"name": "Mikael Brevik"
|
||||||
|
|
8
app/package-lock.json
generated
8
app/package-lock.json
generated
|
@ -1,6 +1,6 @@
|
||||||
{
|
{
|
||||||
"name": "TheDesk",
|
"name": "TheDesk",
|
||||||
"version": "14.7.0",
|
"version": "15.4.0",
|
||||||
"lockfileVersion": 1,
|
"lockfileVersion": 1,
|
||||||
"requires": true,
|
"requires": true,
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
|
@ -317,6 +317,12 @@
|
||||||
"resolved": "https://registry.npmjs.org/isstream/-/isstream-0.1.2.tgz",
|
"resolved": "https://registry.npmjs.org/isstream/-/isstream-0.1.2.tgz",
|
||||||
"integrity": "sha1-R+Y/evVa+m+S4VAOaQ64uFKcCZo="
|
"integrity": "sha1-R+Y/evVa+m+S4VAOaQ64uFKcCZo="
|
||||||
},
|
},
|
||||||
|
"itunes-nowplaying-mac": {
|
||||||
|
"version": "0.2.3",
|
||||||
|
"resolved": "https://registry.npmjs.org/itunes-nowplaying-mac/-/itunes-nowplaying-mac-0.2.3.tgz",
|
||||||
|
"integrity": "sha512-1n418TnV4BnpSP6IzuxVECgPYnlm/nUZIXsblvzFVu4+rxmswXPnz3xi8XUq0r28I9njTi3g6vmBFa5YFHb8TA==",
|
||||||
|
"optional": true
|
||||||
|
},
|
||||||
"jimp": {
|
"jimp": {
|
||||||
"version": "0.2.28",
|
"version": "0.2.28",
|
||||||
"resolved": "https://registry.npmjs.org/jimp/-/jimp-0.2.28.tgz",
|
"resolved": "https://registry.npmjs.org/jimp/-/jimp-0.2.28.tgz",
|
||||||
|
|
|
@ -12,9 +12,10 @@
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"electron-dl": "^1.11.0",
|
"electron-dl": "^1.11.0",
|
||||||
"jimp": "^0.2.28",
|
"jimp": "^0.2.28",
|
||||||
"node-notifier": "5.2.1"
|
"node-notifier": "^5.2.1"
|
||||||
},
|
},
|
||||||
"optionalDependencies": {
|
"optionalDependencies": {
|
||||||
"itunes-nowplaying-mac": "^0.2.3"
|
"itunes-nowplaying-mac": "^0.2.3",
|
||||||
|
"node-mac-notifier":"0.1.0"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
15
node_modules/.bin/semver
generated
vendored
Normal file
15
node_modules/.bin/semver
generated
vendored
Normal file
|
@ -0,0 +1,15 @@
|
||||||
|
#!/bin/sh
|
||||||
|
basedir=$(dirname "$(echo "$0" | sed -e 's,\\,/,g')")
|
||||||
|
|
||||||
|
case `uname` in
|
||||||
|
*CYGWIN*) basedir=`cygpath -w "$basedir"`;;
|
||||||
|
esac
|
||||||
|
|
||||||
|
if [ -x "$basedir/node" ]; then
|
||||||
|
"$basedir/node" "$basedir/../semver/bin/semver" "$@"
|
||||||
|
ret=$?
|
||||||
|
else
|
||||||
|
node "$basedir/../semver/bin/semver" "$@"
|
||||||
|
ret=$?
|
||||||
|
fi
|
||||||
|
exit $ret
|
7
node_modules/.bin/semver.cmd
generated
vendored
Normal file
7
node_modules/.bin/semver.cmd
generated
vendored
Normal file
|
@ -0,0 +1,7 @@
|
||||||
|
@IF EXIST "%~dp0\node.exe" (
|
||||||
|
"%~dp0\node.exe" "%~dp0\..\semver\bin\semver" %*
|
||||||
|
) ELSE (
|
||||||
|
@SETLOCAL
|
||||||
|
@SET PATHEXT=%PATHEXT:;.JS;=;%
|
||||||
|
node "%~dp0\..\semver\bin\semver" %*
|
||||||
|
)
|
15
node_modules/.bin/which
generated
vendored
Normal file
15
node_modules/.bin/which
generated
vendored
Normal file
|
@ -0,0 +1,15 @@
|
||||||
|
#!/bin/sh
|
||||||
|
basedir=$(dirname "$(echo "$0" | sed -e 's,\\,/,g')")
|
||||||
|
|
||||||
|
case `uname` in
|
||||||
|
*CYGWIN*) basedir=`cygpath -w "$basedir"`;;
|
||||||
|
esac
|
||||||
|
|
||||||
|
if [ -x "$basedir/node" ]; then
|
||||||
|
"$basedir/node" "$basedir/../which/bin/which" "$@"
|
||||||
|
ret=$?
|
||||||
|
else
|
||||||
|
node "$basedir/../which/bin/which" "$@"
|
||||||
|
ret=$?
|
||||||
|
fi
|
||||||
|
exit $ret
|
7
node_modules/.bin/which.cmd
generated
vendored
Normal file
7
node_modules/.bin/which.cmd
generated
vendored
Normal file
|
@ -0,0 +1,7 @@
|
||||||
|
@IF EXIST "%~dp0\node.exe" (
|
||||||
|
"%~dp0\node.exe" "%~dp0\..\which\bin\which" %*
|
||||||
|
) ELSE (
|
||||||
|
@SETLOCAL
|
||||||
|
@SET PATHEXT=%PATHEXT:;.JS;=;%
|
||||||
|
node "%~dp0\..\which\bin\which" %*
|
||||||
|
)
|
5
node_modules/growly/HISTORY.md
generated
vendored
Normal file
5
node_modules/growly/HISTORY.md
generated
vendored
Normal file
|
@ -0,0 +1,5 @@
|
||||||
|
1.1.0 / 2012-12-12
|
||||||
|
==================
|
||||||
|
|
||||||
|
- Default registration work lazily, and is performed on the first call to `Growly.notify()`.
|
||||||
|
- Added callback to `Growly.register()`.
|
95
node_modules/growly/README.md
generated
vendored
Normal file
95
node_modules/growly/README.md
generated
vendored
Normal file
|
@ -0,0 +1,95 @@
|
||||||
|
# Growly #
|
||||||
|
|
||||||
|
Simple zero-dependency Growl notifications using GNTP.
|
||||||
|
|
||||||
|
## Installation ##
|
||||||
|
|
||||||
|
Install growly using `npm`:
|
||||||
|
|
||||||
|
```
|
||||||
|
npm install growly
|
||||||
|
```
|
||||||
|
|
||||||
|
And then require it:
|
||||||
|
|
||||||
|
```javascript
|
||||||
|
var growly = require('growly');
|
||||||
|
```
|
||||||
|
|
||||||
|
This module uses the Growl Network Transport Protocol (GNTP) which was implemented in Growl since version 1.3, so you **must have an appropriate version of Growl installed** for Growly to work.
|
||||||
|
|
||||||
|
## Example ##
|
||||||
|
|
||||||
|
Sending a minimal Growl notification:
|
||||||
|
|
||||||
|
```javascript
|
||||||
|
var growly = require('growly');
|
||||||
|
|
||||||
|
growly.notify('This is as easy as it gets', { title: 'Hello, World!' });
|
||||||
|
```
|
||||||
|
|
||||||
|
More examples can be found in the *example/* directory.
|
||||||
|
|
||||||
|
## Usage ##
|
||||||
|
|
||||||
|
The growly module exposes only three methods: `Growly.register()`, `Growly.notify()`, and `Growly.setHost()`.
|
||||||
|
|
||||||
|
### Growly.register(appname, [appicon], [notifications], [callback]) ###
|
||||||
|
|
||||||
|
Registers a new application with Growl. Registration is completely optional since it will be performed automatically for you with sensible defaults. Useful if you want your application, with its own icon and types of notifications, to show up in Growl's prefence panel.
|
||||||
|
|
||||||
|
- `appname` the name of the application (required.)
|
||||||
|
- `appicon` url, file path, or Buffer instance for an application icon image.
|
||||||
|
- `notifications` a list of defined notification types with the following properties:
|
||||||
|
- `.label` name used to identify the type of notification being used (required.)
|
||||||
|
- `.dispname` name users will see in Growl's preference panel (defaults to `.label`.)
|
||||||
|
- `.enabled` whether or not notifications of this type are enabled (defaults to true.)
|
||||||
|
- `callback` called when the registration completes; if registration fails, the first argument will be an Error object.
|
||||||
|
|
||||||
|
An example:
|
||||||
|
|
||||||
|
```javascript
|
||||||
|
growly.register('My Application', 'path/to/icon.png', [
|
||||||
|
{ label: 'success', dispname: 'Success' },
|
||||||
|
{ label: 'warning', dispname: 'Warning', enabled: false }
|
||||||
|
], function(err) {
|
||||||
|
console.log(err || 'Registration successful!');
|
||||||
|
});
|
||||||
|
```
|
||||||
|
|
||||||
|
### Growly.notify(text, [opts], [callback]) ###
|
||||||
|
|
||||||
|
Sends a Growl notification. If an application wasn't registered beforehand with `growly.register()`, a default application will automatically be registered beforesending the notification.
|
||||||
|
|
||||||
|
- `text` the body of the notification.
|
||||||
|
- `opts` an object with the following properties:
|
||||||
|
- `.title` title of the notification.
|
||||||
|
- `.icon` url, file path, or Buffer instance for the notification's icon.
|
||||||
|
- `.sticky` whether or not to sticky the notification (defaults to false.)
|
||||||
|
- `.label` type of notification to use (defaults to the first registered notification type.)
|
||||||
|
- `.priority` the priority of the notification from lowest (-2) to highest (2).
|
||||||
|
- `.coalescingId` replace/update the matching previous notification. May be ignored.
|
||||||
|
- `callback` called when the user has closed/clicked the notification. The callback is passed an Error object `err` as the first argument when the notification fails; otherwise, the second argument `action` is a string that'll describe which action has been taken by the user (either 'closed' or 'clicked'.)
|
||||||
|
|
||||||
|
An example:
|
||||||
|
|
||||||
|
```javascript
|
||||||
|
/* Assuming an application was registered with a notification type labeled 'warning'. */
|
||||||
|
growly.notify('Stuffs broken!', { label: 'warning' }, function(err, action) {
|
||||||
|
console.log('Action:', action);
|
||||||
|
});
|
||||||
|
```
|
||||||
|
|
||||||
|
### Growly.setHost(host, port) ###
|
||||||
|
|
||||||
|
Set the host and port that Growl (GNTP) requests will be sent to. Using this method is optional since GNTP defaults to using host 'localhost' and port 23053.
|
||||||
|
|
||||||
|
## License ##
|
||||||
|
|
||||||
|
Copyright (C) 2014 Ibrahim Al-Rajhi <abrahamalrajhi@gmail.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.
|
22
node_modules/growly/example/bakery.js
generated
vendored
Normal file
22
node_modules/growly/example/bakery.js
generated
vendored
Normal file
|
@ -0,0 +1,22 @@
|
||||||
|
var growly = require('../lib/growly.js');
|
||||||
|
|
||||||
|
var notifications = [
|
||||||
|
{ label: 'muffin', dispname: 'Muffin' },
|
||||||
|
{ label: 'cake', dispname: 'Cake' }
|
||||||
|
],
|
||||||
|
muffinopts = { label: 'muffin', icon: 'muffin.png' },
|
||||||
|
cakeopts = { label: 'cake', title: 'Cake is ready!', icon: 'cake.png', sticky: true };
|
||||||
|
|
||||||
|
growly.register('Bakery', 'muffin.png', notifications, function(err) {
|
||||||
|
if (err) {
|
||||||
|
console.log(err);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
growly.notify('Looks like it is half past muffin time!', muffinopts);
|
||||||
|
|
||||||
|
growly.notify('Click to deliver', cakeopts, function(err, action) {
|
||||||
|
console.log('You', action, 'the notification, so the cake is on its way!');
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
BIN
node_modules/growly/example/cake.png
generated
vendored
Normal file
BIN
node_modules/growly/example/cake.png
generated
vendored
Normal file
Binary file not shown.
After Width: | Height: | Size: 14 KiB |
BIN
node_modules/growly/example/muffin.png
generated
vendored
Normal file
BIN
node_modules/growly/example/muffin.png
generated
vendored
Normal file
Binary file not shown.
After Width: | Height: | Size: 17 KiB |
3
node_modules/growly/example/simple.js
generated
vendored
Normal file
3
node_modules/growly/example/simple.js
generated
vendored
Normal file
|
@ -0,0 +1,3 @@
|
||||||
|
var growly = require('../lib/growly.js');
|
||||||
|
|
||||||
|
growly.notify('Hello, world!');
|
200
node_modules/growly/lib/gntp.js
generated
vendored
Normal file
200
node_modules/growly/lib/gntp.js
generated
vendored
Normal file
|
@ -0,0 +1,200 @@
|
||||||
|
var net = require('net'),
|
||||||
|
crypto = require('crypto'),
|
||||||
|
format = require('util').format,
|
||||||
|
fs = require('fs');
|
||||||
|
|
||||||
|
var nl = '\r\n';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Create a new GNTP request of the given `type`.
|
||||||
|
*
|
||||||
|
* @param {String} type either NOTIFY or REGISTER
|
||||||
|
* @api private
|
||||||
|
*/
|
||||||
|
|
||||||
|
function GNTP(type, opts) {
|
||||||
|
opts = opts || {};
|
||||||
|
this.type = type;
|
||||||
|
this.host = opts.host || 'localhost';
|
||||||
|
this.port = opts.port || 23053;
|
||||||
|
this.request = 'GNTP/1.0 ' + type + ' NONE' + nl;
|
||||||
|
this.resources = [];
|
||||||
|
this.attempts = 0;
|
||||||
|
this.maxAttempts = 5;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Build a response object from the given `resp` response string.
|
||||||
|
*
|
||||||
|
* The response object has a key/value pair for every header in the response, and
|
||||||
|
* a `.state` property equal to either OK, ERROR, or CALLBACK.
|
||||||
|
*
|
||||||
|
* An example GNTP response:
|
||||||
|
*
|
||||||
|
* GNTP/1.0 -OK NONE\r\n
|
||||||
|
* Response-Action: REGISTER\r\n
|
||||||
|
* \r\n
|
||||||
|
*
|
||||||
|
* Which would parse to:
|
||||||
|
*
|
||||||
|
* { state: 'OK', 'Response-Action': 'REGISTER' }
|
||||||
|
*
|
||||||
|
* @param {String} resp
|
||||||
|
* @return {Object}
|
||||||
|
* @api private
|
||||||
|
*/
|
||||||
|
|
||||||
|
GNTP.prototype.parseResp = function(resp) {
|
||||||
|
var parsed = {}, head, body;
|
||||||
|
resp = resp.slice(0, resp.indexOf(nl + nl)).split(nl);
|
||||||
|
head = resp[0];
|
||||||
|
body = resp.slice(1);
|
||||||
|
|
||||||
|
parsed.state = head.match(/-(OK|ERROR|CALLBACK)/)[0].slice(1);
|
||||||
|
body.forEach(function(ln) {
|
||||||
|
ln = ln.split(': ');
|
||||||
|
parsed[ln[0]] = ln[1];
|
||||||
|
});
|
||||||
|
|
||||||
|
return parsed;
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Call `GNTP.send()` with the given arguments after a certain delay.
|
||||||
|
*
|
||||||
|
* @api private
|
||||||
|
*/
|
||||||
|
|
||||||
|
GNTP.prototype.retry = function() {
|
||||||
|
var self = this,
|
||||||
|
args = arguments;
|
||||||
|
setTimeout(function() {
|
||||||
|
self.send.apply(self, args);
|
||||||
|
}, 750);
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Add a resource to the GNTP request.
|
||||||
|
*
|
||||||
|
* @param {Buffer} file
|
||||||
|
* @return {String}
|
||||||
|
* @api private
|
||||||
|
*/
|
||||||
|
|
||||||
|
GNTP.prototype.addResource = function(file) {
|
||||||
|
var id = crypto.createHash('md5').update(file).digest('hex'),
|
||||||
|
header = 'Identifier: ' + id + nl + 'Length: ' + file.length + nl + nl;
|
||||||
|
this.resources.push({ header: header, file: file });
|
||||||
|
return 'x-growl-resource://' + id;
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Append another header `name` with a value of `val` to the request. If `val` is
|
||||||
|
* undefined, the header will be left out.
|
||||||
|
*
|
||||||
|
* @param {String} name
|
||||||
|
* @param {String} val
|
||||||
|
* @api public
|
||||||
|
*/
|
||||||
|
|
||||||
|
GNTP.prototype.add = function(name, val) {
|
||||||
|
if (val === undefined)
|
||||||
|
return;
|
||||||
|
|
||||||
|
/* Handle icon files when they're image paths or Buffers. */
|
||||||
|
if (/-Icon/.test(name) && !/^https?:\/\//.test(val) ) {
|
||||||
|
if (/\.(png|gif|jpe?g)$/.test(val))
|
||||||
|
val = this.addResource(fs.readFileSync(val));
|
||||||
|
else if (val instanceof Buffer)
|
||||||
|
val = this.addResource(val);
|
||||||
|
}
|
||||||
|
|
||||||
|
this.request += name + ': ' + val + nl;
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Append a newline to the request.
|
||||||
|
*
|
||||||
|
* @api public
|
||||||
|
*/
|
||||||
|
|
||||||
|
GNTP.prototype.newline = function() {
|
||||||
|
this.request += nl;
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Send the GNTP request, calling `callback` after successfully sending the
|
||||||
|
* request.
|
||||||
|
*
|
||||||
|
* An example GNTP request:
|
||||||
|
*
|
||||||
|
* GNTP/1.0 REGISTER NONE\r\n
|
||||||
|
* Application-Name: Growly.js\r\n
|
||||||
|
* Notifications-Count: 1\r\n
|
||||||
|
* \r\n
|
||||||
|
* Notification-Name: default\r\n
|
||||||
|
* Notification-Display-Name: Default Notification\r\n
|
||||||
|
* Notification-Enabled: True\r\n
|
||||||
|
* \r\n
|
||||||
|
*
|
||||||
|
* @param {Function} callback which will be passed the parsed response
|
||||||
|
* @api public
|
||||||
|
*/
|
||||||
|
|
||||||
|
GNTP.prototype.send = function(callback) {
|
||||||
|
var self = this,
|
||||||
|
socket = net.connect(this.port, this.host),
|
||||||
|
resp = '';
|
||||||
|
|
||||||
|
callback = callback || function() {};
|
||||||
|
|
||||||
|
this.attempts += 1;
|
||||||
|
|
||||||
|
socket.on('connect', function() {
|
||||||
|
socket.write(self.request);
|
||||||
|
|
||||||
|
self.resources.forEach(function(res) {
|
||||||
|
socket.write(res.header);
|
||||||
|
socket.write(res.file);
|
||||||
|
socket.write(nl + nl);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
socket.on('data', function(data) {
|
||||||
|
resp += data.toString();
|
||||||
|
|
||||||
|
/* Wait until we have a complete response which is signaled by two CRLF's. */
|
||||||
|
if (resp.slice(resp.length - 4) !== (nl + nl)) return;
|
||||||
|
|
||||||
|
resp = self.parseResp(resp);
|
||||||
|
|
||||||
|
/* We have to manually close the connection for certain responses; otherwise,
|
||||||
|
reset `resp` to prepare for the next response chunk. */
|
||||||
|
if (resp.state === 'ERROR' || resp.state === 'CALLBACK')
|
||||||
|
socket.end();
|
||||||
|
else
|
||||||
|
resp = '';
|
||||||
|
});
|
||||||
|
|
||||||
|
socket.on('end', function() {
|
||||||
|
/* Retry on 200 (timed out), 401 (unknown app), or 402 (unknown notification). */
|
||||||
|
if (['200', '401', '402'].indexOf(resp['Error-Code']) >= 0) {
|
||||||
|
if (self.attempts <= self.maxAttempts) {
|
||||||
|
self.retry(callback);
|
||||||
|
} else {
|
||||||
|
var msg = 'GNTP request to "%s:%d" failed with error code %s (%s)';
|
||||||
|
callback(new Error(format(msg, self.host, self.port, resp['Error-Code'], resp['Error-Description'])));
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
callback(undefined, resp);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
socket.on('error', function() {
|
||||||
|
callback(new Error(format('Error while sending GNTP request to "%s:%d"', self.host, self.port)));
|
||||||
|
socket.destroy();
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
module.exports = GNTP;
|
193
node_modules/growly/lib/growly.js
generated
vendored
Normal file
193
node_modules/growly/lib/growly.js
generated
vendored
Normal file
|
@ -0,0 +1,193 @@
|
||||||
|
var GNTP = require('./gntp.js');
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Interface for registering Growl applications and sending Growl notifications.
|
||||||
|
*
|
||||||
|
* @api private
|
||||||
|
*/
|
||||||
|
|
||||||
|
function Growly() {
|
||||||
|
this.appname = 'Growly';
|
||||||
|
this.notifications = undefined;
|
||||||
|
this.labels = undefined;
|
||||||
|
this.count = 0;
|
||||||
|
this.registered = false;
|
||||||
|
this.host = undefined;
|
||||||
|
this.port = undefined;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns an array of label strings extracted from each notification object in
|
||||||
|
* `Growly.notifications`.
|
||||||
|
*
|
||||||
|
* @param {Array} notifications
|
||||||
|
* @return {Array} notification labels
|
||||||
|
* @api private
|
||||||
|
*/
|
||||||
|
|
||||||
|
Growly.prototype.getLabels = function() {
|
||||||
|
return this.notifications.map(function(notif) {
|
||||||
|
return notif.label;
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set the host to be used by GNTP requests.
|
||||||
|
*
|
||||||
|
* @param {String} host
|
||||||
|
* @param {Number} port
|
||||||
|
* @api public
|
||||||
|
*/
|
||||||
|
|
||||||
|
Growly.prototype.setHost = function(host, port) {
|
||||||
|
this.host = host;
|
||||||
|
this.port = port;
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Register an application with the name `appname` (required), icon `appicon`, and
|
||||||
|
* a list of notification types `notifications`. If provided, `callback` will be
|
||||||
|
* called when the request completes with the first argument being an `err` error
|
||||||
|
* object if the request failed.
|
||||||
|
*
|
||||||
|
* Each object in the `notifications` array defines a type of notification the
|
||||||
|
* application will have with the following properties:
|
||||||
|
*
|
||||||
|
* - `.label` name used to identify the type of notification being used (required)
|
||||||
|
* - `.dispname` name users will see in Growl's preference panel (defaults to `.label`)
|
||||||
|
* - `.enabled` whether or not notifications of this type are enabled (defaults to true)
|
||||||
|
* - `.icon` default icon notifications of this type should use (url, file path, or Buffer object)
|
||||||
|
*
|
||||||
|
* Example registration:
|
||||||
|
*
|
||||||
|
* growl.register('My Application', 'path/to/icon.png', [
|
||||||
|
* { label: 'success', dispname: 'Success', icon: 'path/to/success.png' },
|
||||||
|
* { label: 'warning', dispname: 'Warning', icon: 'path/to/warning.png', enabled: false }
|
||||||
|
* ], function(err) { console.log(err || 'Registration successful!'); });
|
||||||
|
*
|
||||||
|
* @param {String} appname
|
||||||
|
* @param {String|Buffer} appicon
|
||||||
|
* @param {Array} notifications
|
||||||
|
* @param {Function} callback
|
||||||
|
* @api public
|
||||||
|
*/
|
||||||
|
|
||||||
|
Growly.prototype.register = function(appname, appicon, notifications, callback) {
|
||||||
|
var gntp;
|
||||||
|
|
||||||
|
if (typeof appicon === 'object') {
|
||||||
|
notifications = appicon;
|
||||||
|
appicon = undefined;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (notifications === undefined || !notifications.length) {
|
||||||
|
notifications = [{ label: 'default', dispname: 'Default Notification', enabled: true }];
|
||||||
|
}
|
||||||
|
|
||||||
|
if (typeof arguments[arguments.length - 1] === 'function') {
|
||||||
|
callback = arguments[arguments.length - 1];
|
||||||
|
} else {
|
||||||
|
callback = function() {};
|
||||||
|
}
|
||||||
|
|
||||||
|
this.appname = appname;
|
||||||
|
this.notifications = notifications;
|
||||||
|
this.labels = this.getLabels();
|
||||||
|
this.registered = true;
|
||||||
|
|
||||||
|
gntp = new GNTP('REGISTER', { host: this.host, port: this.port });
|
||||||
|
gntp.add('Application-Name', appname);
|
||||||
|
gntp.add('Application-Icon', appicon);
|
||||||
|
gntp.add('Notifications-Count', notifications.length);
|
||||||
|
gntp.newline();
|
||||||
|
|
||||||
|
notifications.forEach(function(notif) {
|
||||||
|
if (notif.enabled === undefined) notif.enabled = true;
|
||||||
|
gntp.add('Notification-Name', notif.label);
|
||||||
|
gntp.add('Notification-Display-Name', notif.dispname);
|
||||||
|
gntp.add('Notification-Enabled', notif.enabled ? 'True' : 'False');
|
||||||
|
gntp.add('Notification-Icon', notif.icon);
|
||||||
|
gntp.newline();
|
||||||
|
});
|
||||||
|
|
||||||
|
gntp.send(callback);
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Send a notification with `text` content. Growly will lazily register itself
|
||||||
|
* if the user hasn't already before sending the notification.
|
||||||
|
*
|
||||||
|
* A notification can have the following `opts` options:
|
||||||
|
*
|
||||||
|
* - `.label` type of notification to use (defaults to the first registered type)
|
||||||
|
* - `.title` title of the notification
|
||||||
|
* - `.icon` url, file path, or Buffer instance for the notification's icon.
|
||||||
|
* - `.sticky` whether or not to sticky the notification (defaults to false)
|
||||||
|
* - `.priority` the priority of the notification from lowest (-2) to highest (2)
|
||||||
|
* - `.coalescingId` replace/update the matching previous notification. May be ignored.
|
||||||
|
*
|
||||||
|
* If provided, `callback` will be called when the user interacts with the notification.
|
||||||
|
* The first argument will be an `err` error object, and the second argument an `action`
|
||||||
|
* string equal to either 'clicked' or 'closed' (whichever action the user took.)
|
||||||
|
*
|
||||||
|
* Example notification:
|
||||||
|
*
|
||||||
|
* growl.notify('Stuffs broken!', { label: 'warning' }, function(err, action) {
|
||||||
|
* console.log('Action:', action);
|
||||||
|
* });
|
||||||
|
*
|
||||||
|
* @param {String} text
|
||||||
|
* @param {Object} opts
|
||||||
|
* @param {Function} callback
|
||||||
|
* @api public
|
||||||
|
*/
|
||||||
|
|
||||||
|
Growly.prototype.notify = function(text, opts, callback) {
|
||||||
|
var self = this,
|
||||||
|
gntp;
|
||||||
|
|
||||||
|
/* Lazy registration. */
|
||||||
|
if (!this.registered) {
|
||||||
|
this.register(this.appname, function(err) {
|
||||||
|
if (err) console.log(err);
|
||||||
|
self.notify.call(self, text, opts, callback);
|
||||||
|
});
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
opts = opts || {};
|
||||||
|
|
||||||
|
if (typeof opts === 'function') {
|
||||||
|
callback = opts;
|
||||||
|
opts = {};
|
||||||
|
}
|
||||||
|
|
||||||
|
gntp = new GNTP('NOTIFY', { host: this.host, port: this.port });
|
||||||
|
gntp.add('Application-Name', this.appname);
|
||||||
|
gntp.add('Notification-Name', opts.label || this.labels[0]);
|
||||||
|
gntp.add('Notification-ID', ++this.count);
|
||||||
|
gntp.add('Notification-Title', opts.title);
|
||||||
|
gntp.add('Notification-Text', text);
|
||||||
|
gntp.add('Notification-Sticky', opts.sticky ? 'True' : 'False');
|
||||||
|
gntp.add('Notification-Priority', opts.priority);
|
||||||
|
gntp.add('Notification-Icon', opts.icon);
|
||||||
|
gntp.add('Notification-Coalescing-ID', opts.coalescingId || undefined);
|
||||||
|
gntp.add('Notification-Callback-Context', callback ? 'context' : undefined);
|
||||||
|
gntp.add('Notification-Callback-Context-Type', callback ? 'string' : undefined);
|
||||||
|
gntp.add('Notification-Callback-Target', undefined);
|
||||||
|
gntp.newline();
|
||||||
|
|
||||||
|
gntp.send(function(err, resp) {
|
||||||
|
if (callback && err) {
|
||||||
|
callback(err);
|
||||||
|
} else if (callback && resp.state === 'CALLBACK') {
|
||||||
|
callback(undefined, resp['Notification-Callback-Result'].toLowerCase());
|
||||||
|
}
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Expose an instance of the Growly object.
|
||||||
|
*/
|
||||||
|
|
||||||
|
module.exports = new Growly();
|
57
node_modules/growly/package.json
generated
vendored
Normal file
57
node_modules/growly/package.json
generated
vendored
Normal file
|
@ -0,0 +1,57 @@
|
||||||
|
{
|
||||||
|
"_from": "growly@^1.3.0",
|
||||||
|
"_id": "growly@1.3.0",
|
||||||
|
"_inBundle": false,
|
||||||
|
"_integrity": "sha1-8QdIy+dq+WS3yWyTxrzCivEgwIE=",
|
||||||
|
"_location": "/growly",
|
||||||
|
"_phantomChildren": {},
|
||||||
|
"_requested": {
|
||||||
|
"type": "range",
|
||||||
|
"registry": true,
|
||||||
|
"raw": "growly@^1.3.0",
|
||||||
|
"name": "growly",
|
||||||
|
"escapedName": "growly",
|
||||||
|
"rawSpec": "^1.3.0",
|
||||||
|
"saveSpec": null,
|
||||||
|
"fetchSpec": "^1.3.0"
|
||||||
|
},
|
||||||
|
"_requiredBy": [
|
||||||
|
"/node-notifier"
|
||||||
|
],
|
||||||
|
"_resolved": "https://registry.npmjs.org/growly/-/growly-1.3.0.tgz",
|
||||||
|
"_shasum": "f10748cbe76af964b7c96c93c6bcc28af120c081",
|
||||||
|
"_spec": "growly@^1.3.0",
|
||||||
|
"_where": "C:\\Users\\ryuki\\TheDesk\\node_modules\\node-notifier",
|
||||||
|
"author": {
|
||||||
|
"name": "Ibrahim Al-Rajhi",
|
||||||
|
"email": "abrahamalrajhi@gmail.com",
|
||||||
|
"url": "http://ibrahimalrajhi.com/"
|
||||||
|
},
|
||||||
|
"bugs": {
|
||||||
|
"url": "http://github.com/theabraham/growly/issues"
|
||||||
|
},
|
||||||
|
"bundleDependencies": false,
|
||||||
|
"deprecated": false,
|
||||||
|
"description": "Simple zero-dependency Growl notifications using GNTP.",
|
||||||
|
"directories": {
|
||||||
|
"example": "example",
|
||||||
|
"lib": "lib"
|
||||||
|
},
|
||||||
|
"homepage": "https://github.com/theabraham/growly#readme",
|
||||||
|
"keywords": [
|
||||||
|
"growl",
|
||||||
|
"growly",
|
||||||
|
"snarl",
|
||||||
|
"notifications",
|
||||||
|
"gntp",
|
||||||
|
"messages"
|
||||||
|
],
|
||||||
|
"license": "MIT",
|
||||||
|
"main": "lib/growly.js",
|
||||||
|
"name": "growly",
|
||||||
|
"repository": {
|
||||||
|
"type": "git",
|
||||||
|
"url": "git+ssh://git@github.com/theabraham/growly.git"
|
||||||
|
},
|
||||||
|
"version": "1.3.0"
|
||||||
|
}
|
2
node_modules/isexe/.npmignore
generated
vendored
Normal file
2
node_modules/isexe/.npmignore
generated
vendored
Normal file
|
@ -0,0 +1,2 @@
|
||||||
|
.nyc_output/
|
||||||
|
coverage/
|
15
node_modules/isexe/LICENSE
generated
vendored
Normal file
15
node_modules/isexe/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.
|
51
node_modules/isexe/README.md
generated
vendored
Normal file
51
node_modules/isexe/README.md
generated
vendored
Normal file
|
@ -0,0 +1,51 @@
|
||||||
|
# isexe
|
||||||
|
|
||||||
|
Minimal module to check if a file is executable, and a normal file.
|
||||||
|
|
||||||
|
Uses `fs.stat` and tests against the `PATHEXT` environment variable on
|
||||||
|
Windows.
|
||||||
|
|
||||||
|
## USAGE
|
||||||
|
|
||||||
|
```javascript
|
||||||
|
var isexe = require('isexe')
|
||||||
|
isexe('some-file-name', function (err, isExe) {
|
||||||
|
if (err) {
|
||||||
|
console.error('probably file does not exist or something', err)
|
||||||
|
} else if (isExe) {
|
||||||
|
console.error('this thing can be run')
|
||||||
|
} else {
|
||||||
|
console.error('cannot be run')
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
// same thing but synchronous, throws errors
|
||||||
|
var isExe = isexe.sync('some-file-name')
|
||||||
|
|
||||||
|
// treat errors as just "not executable"
|
||||||
|
isexe('maybe-missing-file', { ignoreErrors: true }, callback)
|
||||||
|
var isExe = isexe.sync('maybe-missing-file', { ignoreErrors: true })
|
||||||
|
```
|
||||||
|
|
||||||
|
## API
|
||||||
|
|
||||||
|
### `isexe(path, [options], [callback])`
|
||||||
|
|
||||||
|
Check if the path is executable. If no callback provided, and a
|
||||||
|
global `Promise` object is available, then a Promise will be returned.
|
||||||
|
|
||||||
|
Will raise whatever errors may be raised by `fs.stat`, unless
|
||||||
|
`options.ignoreErrors` is set to true.
|
||||||
|
|
||||||
|
### `isexe.sync(path, [options])`
|
||||||
|
|
||||||
|
Same as `isexe` but returns the value and throws any errors raised.
|
||||||
|
|
||||||
|
### Options
|
||||||
|
|
||||||
|
* `ignoreErrors` Treat all errors as "no, this is not executable", but
|
||||||
|
don't raise them.
|
||||||
|
* `uid` Number to use as the user id
|
||||||
|
* `gid` Number to use as the group id
|
||||||
|
* `pathExt` List of path extensions to use instead of `PATHEXT`
|
||||||
|
environment variable on Windows.
|
57
node_modules/isexe/index.js
generated
vendored
Normal file
57
node_modules/isexe/index.js
generated
vendored
Normal file
|
@ -0,0 +1,57 @@
|
||||||
|
var fs = require('fs')
|
||||||
|
var core
|
||||||
|
if (process.platform === 'win32' || global.TESTING_WINDOWS) {
|
||||||
|
core = require('./windows.js')
|
||||||
|
} else {
|
||||||
|
core = require('./mode.js')
|
||||||
|
}
|
||||||
|
|
||||||
|
module.exports = isexe
|
||||||
|
isexe.sync = sync
|
||||||
|
|
||||||
|
function isexe (path, options, cb) {
|
||||||
|
if (typeof options === 'function') {
|
||||||
|
cb = options
|
||||||
|
options = {}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!cb) {
|
||||||
|
if (typeof Promise !== 'function') {
|
||||||
|
throw new TypeError('callback not provided')
|
||||||
|
}
|
||||||
|
|
||||||
|
return new Promise(function (resolve, reject) {
|
||||||
|
isexe(path, options || {}, function (er, is) {
|
||||||
|
if (er) {
|
||||||
|
reject(er)
|
||||||
|
} else {
|
||||||
|
resolve(is)
|
||||||
|
}
|
||||||
|
})
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
core(path, options || {}, function (er, is) {
|
||||||
|
// ignore EACCES because that just means we aren't allowed to run it
|
||||||
|
if (er) {
|
||||||
|
if (er.code === 'EACCES' || options && options.ignoreErrors) {
|
||||||
|
er = null
|
||||||
|
is = false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
cb(er, is)
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
function sync (path, options) {
|
||||||
|
// my kingdom for a filtered catch
|
||||||
|
try {
|
||||||
|
return core.sync(path, options || {})
|
||||||
|
} catch (er) {
|
||||||
|
if (options && options.ignoreErrors || er.code === 'EACCES') {
|
||||||
|
return false
|
||||||
|
} else {
|
||||||
|
throw er
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
41
node_modules/isexe/mode.js
generated
vendored
Normal file
41
node_modules/isexe/mode.js
generated
vendored
Normal file
|
@ -0,0 +1,41 @@
|
||||||
|
module.exports = isexe
|
||||||
|
isexe.sync = sync
|
||||||
|
|
||||||
|
var fs = require('fs')
|
||||||
|
|
||||||
|
function isexe (path, options, cb) {
|
||||||
|
fs.stat(path, function (er, stat) {
|
||||||
|
cb(er, er ? false : checkStat(stat, options))
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
function sync (path, options) {
|
||||||
|
return checkStat(fs.statSync(path), options)
|
||||||
|
}
|
||||||
|
|
||||||
|
function checkStat (stat, options) {
|
||||||
|
return stat.isFile() && checkMode(stat, options)
|
||||||
|
}
|
||||||
|
|
||||||
|
function checkMode (stat, options) {
|
||||||
|
var mod = stat.mode
|
||||||
|
var uid = stat.uid
|
||||||
|
var gid = stat.gid
|
||||||
|
|
||||||
|
var myUid = options.uid !== undefined ?
|
||||||
|
options.uid : process.getuid && process.getuid()
|
||||||
|
var myGid = options.gid !== undefined ?
|
||||||
|
options.gid : process.getgid && process.getgid()
|
||||||
|
|
||||||
|
var u = parseInt('100', 8)
|
||||||
|
var g = parseInt('010', 8)
|
||||||
|
var o = parseInt('001', 8)
|
||||||
|
var ug = u | g
|
||||||
|
|
||||||
|
var ret = (mod & o) ||
|
||||||
|
(mod & g) && gid === myGid ||
|
||||||
|
(mod & u) && uid === myUid ||
|
||||||
|
(mod & ug) && myUid === 0
|
||||||
|
|
||||||
|
return ret
|
||||||
|
}
|
60
node_modules/isexe/package.json
generated
vendored
Normal file
60
node_modules/isexe/package.json
generated
vendored
Normal file
|
@ -0,0 +1,60 @@
|
||||||
|
{
|
||||||
|
"_from": "isexe@^2.0.0",
|
||||||
|
"_id": "isexe@2.0.0",
|
||||||
|
"_inBundle": false,
|
||||||
|
"_integrity": "sha1-6PvzdNxVb/iUehDcsFctYz8s+hA=",
|
||||||
|
"_location": "/isexe",
|
||||||
|
"_phantomChildren": {},
|
||||||
|
"_requested": {
|
||||||
|
"type": "range",
|
||||||
|
"registry": true,
|
||||||
|
"raw": "isexe@^2.0.0",
|
||||||
|
"name": "isexe",
|
||||||
|
"escapedName": "isexe",
|
||||||
|
"rawSpec": "^2.0.0",
|
||||||
|
"saveSpec": null,
|
||||||
|
"fetchSpec": "^2.0.0"
|
||||||
|
},
|
||||||
|
"_requiredBy": [
|
||||||
|
"/which"
|
||||||
|
],
|
||||||
|
"_resolved": "https://registry.npmjs.org/isexe/-/isexe-2.0.0.tgz",
|
||||||
|
"_shasum": "e8fbf374dc556ff8947a10dcb0572d633f2cfa10",
|
||||||
|
"_spec": "isexe@^2.0.0",
|
||||||
|
"_where": "C:\\Users\\ryuki\\TheDesk\\node_modules\\which",
|
||||||
|
"author": {
|
||||||
|
"name": "Isaac Z. Schlueter",
|
||||||
|
"email": "i@izs.me",
|
||||||
|
"url": "http://blog.izs.me/"
|
||||||
|
},
|
||||||
|
"bugs": {
|
||||||
|
"url": "https://github.com/isaacs/isexe/issues"
|
||||||
|
},
|
||||||
|
"bundleDependencies": false,
|
||||||
|
"deprecated": false,
|
||||||
|
"description": "Minimal module to check if a file is executable.",
|
||||||
|
"devDependencies": {
|
||||||
|
"mkdirp": "^0.5.1",
|
||||||
|
"rimraf": "^2.5.0",
|
||||||
|
"tap": "^10.3.0"
|
||||||
|
},
|
||||||
|
"directories": {
|
||||||
|
"test": "test"
|
||||||
|
},
|
||||||
|
"homepage": "https://github.com/isaacs/isexe#readme",
|
||||||
|
"keywords": [],
|
||||||
|
"license": "ISC",
|
||||||
|
"main": "index.js",
|
||||||
|
"name": "isexe",
|
||||||
|
"repository": {
|
||||||
|
"type": "git",
|
||||||
|
"url": "git+https://github.com/isaacs/isexe.git"
|
||||||
|
},
|
||||||
|
"scripts": {
|
||||||
|
"postpublish": "git push origin --all; git push origin --tags",
|
||||||
|
"postversion": "npm publish",
|
||||||
|
"preversion": "npm test",
|
||||||
|
"test": "tap test/*.js --100"
|
||||||
|
},
|
||||||
|
"version": "2.0.0"
|
||||||
|
}
|
221
node_modules/isexe/test/basic.js
generated
vendored
Normal file
221
node_modules/isexe/test/basic.js
generated
vendored
Normal file
|
@ -0,0 +1,221 @@
|
||||||
|
var t = require('tap')
|
||||||
|
var fs = require('fs')
|
||||||
|
var path = require('path')
|
||||||
|
var fixture = path.resolve(__dirname, 'fixtures')
|
||||||
|
var meow = fixture + '/meow.cat'
|
||||||
|
var mine = fixture + '/mine.cat'
|
||||||
|
var ours = fixture + '/ours.cat'
|
||||||
|
var fail = fixture + '/fail.false'
|
||||||
|
var noent = fixture + '/enoent.exe'
|
||||||
|
var mkdirp = require('mkdirp')
|
||||||
|
var rimraf = require('rimraf')
|
||||||
|
|
||||||
|
var isWindows = process.platform === 'win32'
|
||||||
|
var hasAccess = typeof fs.access === 'function'
|
||||||
|
var winSkip = isWindows && 'windows'
|
||||||
|
var accessSkip = !hasAccess && 'no fs.access function'
|
||||||
|
var hasPromise = typeof Promise === 'function'
|
||||||
|
var promiseSkip = !hasPromise && 'no global Promise'
|
||||||
|
|
||||||
|
function reset () {
|
||||||
|
delete require.cache[require.resolve('../')]
|
||||||
|
return require('../')
|
||||||
|
}
|
||||||
|
|
||||||
|
t.test('setup fixtures', function (t) {
|
||||||
|
rimraf.sync(fixture)
|
||||||
|
mkdirp.sync(fixture)
|
||||||
|
fs.writeFileSync(meow, '#!/usr/bin/env cat\nmeow\n')
|
||||||
|
fs.chmodSync(meow, parseInt('0755', 8))
|
||||||
|
fs.writeFileSync(fail, '#!/usr/bin/env false\n')
|
||||||
|
fs.chmodSync(fail, parseInt('0644', 8))
|
||||||
|
fs.writeFileSync(mine, '#!/usr/bin/env cat\nmine\n')
|
||||||
|
fs.chmodSync(mine, parseInt('0744', 8))
|
||||||
|
fs.writeFileSync(ours, '#!/usr/bin/env cat\nours\n')
|
||||||
|
fs.chmodSync(ours, parseInt('0754', 8))
|
||||||
|
t.end()
|
||||||
|
})
|
||||||
|
|
||||||
|
t.test('promise', { skip: promiseSkip }, function (t) {
|
||||||
|
var isexe = reset()
|
||||||
|
t.test('meow async', function (t) {
|
||||||
|
isexe(meow).then(function (is) {
|
||||||
|
t.ok(is)
|
||||||
|
t.end()
|
||||||
|
})
|
||||||
|
})
|
||||||
|
t.test('fail async', function (t) {
|
||||||
|
isexe(fail).then(function (is) {
|
||||||
|
t.notOk(is)
|
||||||
|
t.end()
|
||||||
|
})
|
||||||
|
})
|
||||||
|
t.test('noent async', function (t) {
|
||||||
|
isexe(noent).catch(function (er) {
|
||||||
|
t.ok(er)
|
||||||
|
t.end()
|
||||||
|
})
|
||||||
|
})
|
||||||
|
t.test('noent ignore async', function (t) {
|
||||||
|
isexe(noent, { ignoreErrors: true }).then(function (is) {
|
||||||
|
t.notOk(is)
|
||||||
|
t.end()
|
||||||
|
})
|
||||||
|
})
|
||||||
|
t.end()
|
||||||
|
})
|
||||||
|
|
||||||
|
t.test('no promise', function (t) {
|
||||||
|
global.Promise = null
|
||||||
|
var isexe = reset()
|
||||||
|
t.throws('try to meow a promise', function () {
|
||||||
|
isexe(meow)
|
||||||
|
})
|
||||||
|
t.end()
|
||||||
|
})
|
||||||
|
|
||||||
|
t.test('access', { skip: accessSkip || winSkip }, function (t) {
|
||||||
|
runTest(t)
|
||||||
|
})
|
||||||
|
|
||||||
|
t.test('mode', { skip: winSkip }, function (t) {
|
||||||
|
delete fs.access
|
||||||
|
delete fs.accessSync
|
||||||
|
var isexe = reset()
|
||||||
|
t.ok(isexe.sync(ours, { uid: 0, gid: 0 }))
|
||||||
|
t.ok(isexe.sync(mine, { uid: 0, gid: 0 }))
|
||||||
|
runTest(t)
|
||||||
|
})
|
||||||
|
|
||||||
|
t.test('windows', function (t) {
|
||||||
|
global.TESTING_WINDOWS = true
|
||||||
|
var pathExt = '.EXE;.CAT;.CMD;.COM'
|
||||||
|
t.test('pathExt option', function (t) {
|
||||||
|
runTest(t, { pathExt: '.EXE;.CAT;.CMD;.COM' })
|
||||||
|
})
|
||||||
|
t.test('pathExt env', function (t) {
|
||||||
|
process.env.PATHEXT = pathExt
|
||||||
|
runTest(t)
|
||||||
|
})
|
||||||
|
t.test('no pathExt', function (t) {
|
||||||
|
// with a pathExt of '', any filename is fine.
|
||||||
|
// so the "fail" one would still pass.
|
||||||
|
runTest(t, { pathExt: '', skipFail: true })
|
||||||
|
})
|
||||||
|
t.test('pathext with empty entry', function (t) {
|
||||||
|
// with a pathExt of '', any filename is fine.
|
||||||
|
// so the "fail" one would still pass.
|
||||||
|
runTest(t, { pathExt: ';' + pathExt, skipFail: true })
|
||||||
|
})
|
||||||
|
t.end()
|
||||||
|
})
|
||||||
|
|
||||||
|
t.test('cleanup', function (t) {
|
||||||
|
rimraf.sync(fixture)
|
||||||
|
t.end()
|
||||||
|
})
|
||||||
|
|
||||||
|
function runTest (t, options) {
|
||||||
|
var isexe = reset()
|
||||||
|
|
||||||
|
var optionsIgnore = Object.create(options || {})
|
||||||
|
optionsIgnore.ignoreErrors = true
|
||||||
|
|
||||||
|
if (!options || !options.skipFail) {
|
||||||
|
t.notOk(isexe.sync(fail, options))
|
||||||
|
}
|
||||||
|
t.notOk(isexe.sync(noent, optionsIgnore))
|
||||||
|
if (!options) {
|
||||||
|
t.ok(isexe.sync(meow))
|
||||||
|
} else {
|
||||||
|
t.ok(isexe.sync(meow, options))
|
||||||
|
}
|
||||||
|
|
||||||
|
t.ok(isexe.sync(mine, options))
|
||||||
|
t.ok(isexe.sync(ours, options))
|
||||||
|
t.throws(function () {
|
||||||
|
isexe.sync(noent, options)
|
||||||
|
})
|
||||||
|
|
||||||
|
t.test('meow async', function (t) {
|
||||||
|
if (!options) {
|
||||||
|
isexe(meow, function (er, is) {
|
||||||
|
if (er) {
|
||||||
|
throw er
|
||||||
|
}
|
||||||
|
t.ok(is)
|
||||||
|
t.end()
|
||||||
|
})
|
||||||
|
} else {
|
||||||
|
isexe(meow, options, function (er, is) {
|
||||||
|
if (er) {
|
||||||
|
throw er
|
||||||
|
}
|
||||||
|
t.ok(is)
|
||||||
|
t.end()
|
||||||
|
})
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
t.test('mine async', function (t) {
|
||||||
|
isexe(mine, options, function (er, is) {
|
||||||
|
if (er) {
|
||||||
|
throw er
|
||||||
|
}
|
||||||
|
t.ok(is)
|
||||||
|
t.end()
|
||||||
|
})
|
||||||
|
})
|
||||||
|
|
||||||
|
t.test('ours async', function (t) {
|
||||||
|
isexe(ours, options, function (er, is) {
|
||||||
|
if (er) {
|
||||||
|
throw er
|
||||||
|
}
|
||||||
|
t.ok(is)
|
||||||
|
t.end()
|
||||||
|
})
|
||||||
|
})
|
||||||
|
|
||||||
|
if (!options || !options.skipFail) {
|
||||||
|
t.test('fail async', function (t) {
|
||||||
|
isexe(fail, options, function (er, is) {
|
||||||
|
if (er) {
|
||||||
|
throw er
|
||||||
|
}
|
||||||
|
t.notOk(is)
|
||||||
|
t.end()
|
||||||
|
})
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
t.test('noent async', function (t) {
|
||||||
|
isexe(noent, options, function (er, is) {
|
||||||
|
t.ok(er)
|
||||||
|
t.notOk(is)
|
||||||
|
t.end()
|
||||||
|
})
|
||||||
|
})
|
||||||
|
|
||||||
|
t.test('noent ignore async', function (t) {
|
||||||
|
isexe(noent, optionsIgnore, function (er, is) {
|
||||||
|
if (er) {
|
||||||
|
throw er
|
||||||
|
}
|
||||||
|
t.notOk(is)
|
||||||
|
t.end()
|
||||||
|
})
|
||||||
|
})
|
||||||
|
|
||||||
|
t.test('directory is not executable', function (t) {
|
||||||
|
isexe(__dirname, options, function (er, is) {
|
||||||
|
if (er) {
|
||||||
|
throw er
|
||||||
|
}
|
||||||
|
t.notOk(is)
|
||||||
|
t.end()
|
||||||
|
})
|
||||||
|
})
|
||||||
|
|
||||||
|
t.end()
|
||||||
|
}
|
42
node_modules/isexe/windows.js
generated
vendored
Normal file
42
node_modules/isexe/windows.js
generated
vendored
Normal file
|
@ -0,0 +1,42 @@
|
||||||
|
module.exports = isexe
|
||||||
|
isexe.sync = sync
|
||||||
|
|
||||||
|
var fs = require('fs')
|
||||||
|
|
||||||
|
function checkPathExt (path, options) {
|
||||||
|
var pathext = options.pathExt !== undefined ?
|
||||||
|
options.pathExt : process.env.PATHEXT
|
||||||
|
|
||||||
|
if (!pathext) {
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
|
||||||
|
pathext = pathext.split(';')
|
||||||
|
if (pathext.indexOf('') !== -1) {
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
for (var i = 0; i < pathext.length; i++) {
|
||||||
|
var p = pathext[i].toLowerCase()
|
||||||
|
if (p && path.substr(-p.length).toLowerCase() === p) {
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
|
function checkStat (stat, path, options) {
|
||||||
|
if (!stat.isSymbolicLink() && !stat.isFile()) {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
return checkPathExt(path, options)
|
||||||
|
}
|
||||||
|
|
||||||
|
function isexe (path, options, cb) {
|
||||||
|
fs.stat(path, function (er, stat) {
|
||||||
|
cb(er, er ? false : checkStat(stat, path, options))
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
function sync (path, options) {
|
||||||
|
return checkStat(fs.statSync(path), path, options)
|
||||||
|
}
|
15
node_modules/semver/LICENSE
generated
vendored
Normal file
15
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.
|
388
node_modules/semver/README.md
generated
vendored
Normal file
388
node_modules/semver/README.md
generated
vendored
Normal file
|
@ -0,0 +1,388 @@
|
||||||
|
semver(1) -- The semantic versioner for npm
|
||||||
|
===========================================
|
||||||
|
|
||||||
|
## Install
|
||||||
|
|
||||||
|
```bash
|
||||||
|
npm install --save 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.valid(semver.coerce('v2')) // '2.0.0'
|
||||||
|
semver.valid(semver.coerce('42.6.7.9.3-alpha')) // '42.6.7'
|
||||||
|
```
|
||||||
|
|
||||||
|
As a command-line utility:
|
||||||
|
|
||||||
|
```
|
||||||
|
$ semver -h
|
||||||
|
|
||||||
|
SemVer 5.3.0
|
||||||
|
|
||||||
|
A JavaScript implementation of the http://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, or prerelease. 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
|
||||||
|
|
||||||
|
-c --coerce
|
||||||
|
Coerce a string into SemVer if possible
|
||||||
|
(does not imply --loose)
|
||||||
|
|
||||||
|
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
|
||||||
|
<http://semver.org/>.
|
||||||
|
|
||||||
|
A leading `"="` or `"v"` character is stripped off and ignored.
|
||||||
|
|
||||||
|
## Ranges
|
||||||
|
|
||||||
|
A `version range` is a set of `comparators` which 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`.
|
||||||
|
|
||||||
|
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. The
|
||||||
|
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 for 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
|
||||||
|
clearly 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.
|
||||||
|
|
||||||
|
#### 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
|
||||||
|
```
|
||||||
|
|
||||||
|
### 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`
|
||||||
|
* `1.2.3 - 2` := `>=1.2.3 <3.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 version satisfies)
|
||||||
|
* `1.x` := `>=1.0.0 <2.0.0` (Matching major version)
|
||||||
|
* `1.2.x` := `>=1.2.0 <1.3.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`
|
||||||
|
* `1.2` := `1.2.x` := `>=1.2.0 <1.3.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`
|
||||||
|
* `~1.2` := `>=1.2.0 <1.(2+1).0` := `>=1.2.0 <1.3.0` (Same as `1.2.x`)
|
||||||
|
* `~1` := `>=1.0.0 <(1+1).0.0` := `>=1.0.0 <2.0.0` (Same as `1.x`)
|
||||||
|
* `~0.2.3` := `>=0.2.3 <0.(2+1).0` := `>=0.2.3 <0.3.0`
|
||||||
|
* `~0.2` := `>=0.2.0 <0.(2+1).0` := `>=0.2.0 <0.3.0` (Same as `0.2.x`)
|
||||||
|
* `~0` := `>=0.0.0 <(0+1).0.0` := `>=0.0.0 <1.0.0` (Same as `0.x`)
|
||||||
|
* `~1.2.3-beta.2` := `>=1.2.3-beta.2 <1.3.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 digit 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.2.3` := `>=0.2.3 <0.3.0`
|
||||||
|
* `^0.0.3` := `>=0.0.3 <0.0.4`
|
||||||
|
* `^1.2.3-beta.2` := `>=1.2.3-beta.2 <2.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` 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.x` := `>=0.0.0 <0.1.0`
|
||||||
|
* `^0.0` := `>=0.0.0 <0.1.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.x` := `>=0.0.0 <1.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 `loose` boolean argument that, if
|
||||||
|
true, will be more forgiving about not-quite-valid semver strings.
|
||||||
|
The resulting output will always be 100% strict, of course.
|
||||||
|
|
||||||
|
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, release)`: Return the version incremented by the release
|
||||||
|
type (`major`, `premajor`, `minor`, `preminor`, `patch`,
|
||||||
|
`prepatch`, or `prerelease`), 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, the `prerelease` will work the
|
||||||
|
same as `prepatch`. It increments the patch version, then makes a
|
||||||
|
prerelease. If the input version is already a prerelease it simply
|
||||||
|
increments it.
|
||||||
|
* `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.
|
||||||
|
|
||||||
|
### 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 exact 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()`.
|
||||||
|
* `diff(v1, v2)`: Returns difference between two versions by the release type
|
||||||
|
(`major`, `premajor`, `minor`, `preminor`, `patch`, `prepatch`, or `prerelease`),
|
||||||
|
or null if the versions are the same.
|
||||||
|
|
||||||
|
### 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.
|
||||||
|
* `gtr(version, range)`: Return `true` if version is greater than all the
|
||||||
|
versions possible in the range.
|
||||||
|
* `ltr(version, range)`: Return `true` if 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 ranges comparators intersect
|
||||||
|
|
||||||
|
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 the 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)`: 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 `Integer.MAX_SAFE_INTEGER || (2**53 - 1)`;
|
||||||
|
higher value components are invalid (`9999999999999999.4.7.4` is likely invalid).
|
143
node_modules/semver/bin/semver
generated
vendored
Normal file
143
node_modules/semver/bin/semver
generated
vendored
Normal file
|
@ -0,0 +1,143 @@
|
||||||
|
#!/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.
|
||||||
|
|
||||||
|
var argv = process.argv.slice(2)
|
||||||
|
, versions = []
|
||||||
|
, range = []
|
||||||
|
, gt = []
|
||||||
|
, lt = []
|
||||||
|
, eq = []
|
||||||
|
, inc = null
|
||||||
|
, version = require("../package.json").version
|
||||||
|
, loose = false
|
||||||
|
, coerce = false
|
||||||
|
, identifier = undefined
|
||||||
|
, semver = require("../semver")
|
||||||
|
, reverse = false
|
||||||
|
|
||||||
|
main()
|
||||||
|
|
||||||
|
function main () {
|
||||||
|
if (!argv.length) return help()
|
||||||
|
while (argv.length) {
|
||||||
|
var a = argv.shift()
|
||||||
|
var i = a.indexOf('=')
|
||||||
|
if (i !== -1) {
|
||||||
|
a = a.slice(0, i)
|
||||||
|
argv.unshift(a.slice(i + 1))
|
||||||
|
}
|
||||||
|
switch (a) {
|
||||||
|
case "-rv": case "-rev": case "--rev": case "--reverse":
|
||||||
|
reverse = true
|
||||||
|
break
|
||||||
|
case "-l": case "--loose":
|
||||||
|
loose = 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":
|
||||||
|
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 "-c": case "--coerce":
|
||||||
|
coerce = true
|
||||||
|
break
|
||||||
|
case "-h": case "--help": case "-?":
|
||||||
|
return help()
|
||||||
|
default:
|
||||||
|
versions.push(a)
|
||||||
|
break
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
versions = versions.map(function (v) {
|
||||||
|
return coerce ? (semver.coerce(v) || {version: v}).version : v
|
||||||
|
}).filter(function (v) {
|
||||||
|
return semver.valid(v)
|
||||||
|
})
|
||||||
|
if (!versions.length) return fail()
|
||||||
|
if (inc && (versions.length !== 1 || range.length))
|
||||||
|
return failInc()
|
||||||
|
|
||||||
|
for (var i = 0, l = range.length; i < l ; i ++) {
|
||||||
|
versions = versions.filter(function (v) {
|
||||||
|
return semver.satisfies(v, range[i], loose)
|
||||||
|
})
|
||||||
|
if (!versions.length) return fail()
|
||||||
|
}
|
||||||
|
return success(versions)
|
||||||
|
}
|
||||||
|
|
||||||
|
function failInc () {
|
||||||
|
console.error("--inc can only be used on a single version with no range")
|
||||||
|
fail()
|
||||||
|
}
|
||||||
|
|
||||||
|
function fail () { process.exit(1) }
|
||||||
|
|
||||||
|
function success () {
|
||||||
|
var compare = reverse ? "rcompare" : "compare"
|
||||||
|
versions.sort(function (a, b) {
|
||||||
|
return semver[compare](a, b, loose)
|
||||||
|
}).map(function (v) {
|
||||||
|
return semver.clean(v, loose)
|
||||||
|
}).map(function (v) {
|
||||||
|
return inc ? semver.inc(v, inc, loose, identifier) : v
|
||||||
|
}).forEach(function (v,i,_) { console.log(v) })
|
||||||
|
}
|
||||||
|
|
||||||
|
function help () {
|
||||||
|
console.log(["SemVer " + version
|
||||||
|
,""
|
||||||
|
,"A JavaScript implementation of the http://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, or prerelease. 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"
|
||||||
|
,""
|
||||||
|
,"-c --coerce"
|
||||||
|
," Coerce a string into SemVer if possible"
|
||||||
|
," (does not imply --loose)"
|
||||||
|
,""
|
||||||
|
,"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."
|
||||||
|
].join("\n"))
|
||||||
|
}
|
54
node_modules/semver/package.json
generated
vendored
Normal file
54
node_modules/semver/package.json
generated
vendored
Normal file
|
@ -0,0 +1,54 @@
|
||||||
|
{
|
||||||
|
"_from": "semver@^5.4.1",
|
||||||
|
"_id": "semver@5.5.0",
|
||||||
|
"_inBundle": false,
|
||||||
|
"_integrity": "sha512-4SJ3dm0WAwWy/NVeioZh5AntkdJoWKxHxcmyP622fOkgHa4z3R0TdBJICINyaSDE6uNwVc8gZr+ZinwZAH4xIA==",
|
||||||
|
"_location": "/semver",
|
||||||
|
"_phantomChildren": {},
|
||||||
|
"_requested": {
|
||||||
|
"type": "range",
|
||||||
|
"registry": true,
|
||||||
|
"raw": "semver@^5.4.1",
|
||||||
|
"name": "semver",
|
||||||
|
"escapedName": "semver",
|
||||||
|
"rawSpec": "^5.4.1",
|
||||||
|
"saveSpec": null,
|
||||||
|
"fetchSpec": "^5.4.1"
|
||||||
|
},
|
||||||
|
"_requiredBy": [
|
||||||
|
"/node-notifier"
|
||||||
|
],
|
||||||
|
"_resolved": "https://registry.npmjs.org/semver/-/semver-5.5.0.tgz",
|
||||||
|
"_shasum": "dc4bbc7a6ca9d916dee5d43516f0092b58f7b8ab",
|
||||||
|
"_spec": "semver@^5.4.1",
|
||||||
|
"_where": "C:\\Users\\ryuki\\TheDesk\\node_modules\\node-notifier",
|
||||||
|
"bin": {
|
||||||
|
"semver": "./bin/semver"
|
||||||
|
},
|
||||||
|
"bugs": {
|
||||||
|
"url": "https://github.com/npm/node-semver/issues"
|
||||||
|
},
|
||||||
|
"bundleDependencies": false,
|
||||||
|
"deprecated": false,
|
||||||
|
"description": "The semantic version parser used by npm.",
|
||||||
|
"devDependencies": {
|
||||||
|
"tap": "^10.7.0"
|
||||||
|
},
|
||||||
|
"files": [
|
||||||
|
"bin",
|
||||||
|
"range.bnf",
|
||||||
|
"semver.js"
|
||||||
|
],
|
||||||
|
"homepage": "https://github.com/npm/node-semver#readme",
|
||||||
|
"license": "ISC",
|
||||||
|
"main": "semver.js",
|
||||||
|
"name": "semver",
|
||||||
|
"repository": {
|
||||||
|
"type": "git",
|
||||||
|
"url": "git+https://github.com/npm/node-semver.git"
|
||||||
|
},
|
||||||
|
"scripts": {
|
||||||
|
"test": "tap test/*.js --cov -J"
|
||||||
|
},
|
||||||
|
"version": "5.5.0"
|
||||||
|
}
|
16
node_modules/semver/range.bnf
generated
vendored
Normal file
16
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]+
|
1324
node_modules/semver/semver.js
generated
vendored
Normal file
1324
node_modules/semver/semver.js
generated
vendored
Normal file
File diff suppressed because it is too large
Load Diff
19
node_modules/shellwords/LICENSE
generated
vendored
Normal file
19
node_modules/shellwords/LICENSE
generated
vendored
Normal file
|
@ -0,0 +1,19 @@
|
||||||
|
Copyright (C) 2011 by Jimmy Cuadra
|
||||||
|
|
||||||
|
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.
|
19
node_modules/shellwords/README.md
generated
vendored
Normal file
19
node_modules/shellwords/README.md
generated
vendored
Normal file
|
@ -0,0 +1,19 @@
|
||||||
|
# Shellwords
|
||||||
|
|
||||||
|
Shellwords provides functions to manipulate strings according to the word parsing rules of the UNIX Bourne shell. It is based on [the Ruby module of the same name](http://www.ruby-doc.org/stdlib-1.9.3/libdoc/shellwords/rdoc/Shellwords.html).
|
||||||
|
|
||||||
|
## Installation
|
||||||
|
|
||||||
|
Add "shellwords" to your `package.json` file and run `npm install`.
|
||||||
|
|
||||||
|
## Example
|
||||||
|
|
||||||
|
``` javascript
|
||||||
|
var shellwords = require("shellwords");
|
||||||
|
|
||||||
|
shellwords.split("foo 'bar baz'");
|
||||||
|
// ["foo", "bar baz"]
|
||||||
|
|
||||||
|
shellwords.escape("What's up, yo?");
|
||||||
|
// 'What\\\'s\\ up,\\ yo\\?'
|
||||||
|
```
|
57
node_modules/shellwords/lib/shellwords.js
generated
vendored
Normal file
57
node_modules/shellwords/lib/shellwords.js
generated
vendored
Normal file
|
@ -0,0 +1,57 @@
|
||||||
|
// Generated by CoffeeScript 1.3.3
|
||||||
|
(function() {
|
||||||
|
var scan;
|
||||||
|
|
||||||
|
scan = function(string, pattern, callback) {
|
||||||
|
var match, result;
|
||||||
|
result = "";
|
||||||
|
while (string.length > 0) {
|
||||||
|
match = string.match(pattern);
|
||||||
|
if (match) {
|
||||||
|
result += string.slice(0, match.index);
|
||||||
|
result += callback(match);
|
||||||
|
string = string.slice(match.index + match[0].length);
|
||||||
|
} else {
|
||||||
|
result += string;
|
||||||
|
string = "";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return result;
|
||||||
|
};
|
||||||
|
|
||||||
|
exports.split = function(line) {
|
||||||
|
var field, words;
|
||||||
|
if (line == null) {
|
||||||
|
line = "";
|
||||||
|
}
|
||||||
|
words = [];
|
||||||
|
field = "";
|
||||||
|
scan(line, /\s*(?:([^\s\\\'\"]+)|'((?:[^\'\\]|\\.)*)'|"((?:[^\"\\]|\\.)*)"|(\\.?)|(\S))(\s|$)?/, function(match) {
|
||||||
|
var dq, escape, garbage, raw, seperator, sq, word;
|
||||||
|
raw = match[0], word = match[1], sq = match[2], dq = match[3], escape = match[4], garbage = match[5], seperator = match[6];
|
||||||
|
if (garbage != null) {
|
||||||
|
throw new Error("Unmatched quote");
|
||||||
|
}
|
||||||
|
field += word || (sq || dq || escape).replace(/\\(?=.)/, "");
|
||||||
|
if (seperator != null) {
|
||||||
|
words.push(field);
|
||||||
|
return field = "";
|
||||||
|
}
|
||||||
|
});
|
||||||
|
if (field) {
|
||||||
|
words.push(field);
|
||||||
|
}
|
||||||
|
return words;
|
||||||
|
};
|
||||||
|
|
||||||
|
exports.escape = function(str) {
|
||||||
|
if (str == null) {
|
||||||
|
str = "";
|
||||||
|
}
|
||||||
|
if (str == null) {
|
||||||
|
return "''";
|
||||||
|
}
|
||||||
|
return str.replace(/([^A-Za-z0-9_\-.,:\/@\n])/g, "\\$1").replace(/\n/g, "'\n'");
|
||||||
|
};
|
||||||
|
|
||||||
|
}).call(this);
|
56
node_modules/shellwords/package.json
generated
vendored
Normal file
56
node_modules/shellwords/package.json
generated
vendored
Normal file
|
@ -0,0 +1,56 @@
|
||||||
|
{
|
||||||
|
"_from": "shellwords@^0.1.1",
|
||||||
|
"_id": "shellwords@0.1.1",
|
||||||
|
"_inBundle": false,
|
||||||
|
"_integrity": "sha512-vFwSUfQvqybiICwZY5+DAWIPLKsWO31Q91JSKl3UYv+K5c2QRPzn0qzec6QPu1Qc9eHYItiP3NdJqNVqetYAww==",
|
||||||
|
"_location": "/shellwords",
|
||||||
|
"_phantomChildren": {},
|
||||||
|
"_requested": {
|
||||||
|
"type": "range",
|
||||||
|
"registry": true,
|
||||||
|
"raw": "shellwords@^0.1.1",
|
||||||
|
"name": "shellwords",
|
||||||
|
"escapedName": "shellwords",
|
||||||
|
"rawSpec": "^0.1.1",
|
||||||
|
"saveSpec": null,
|
||||||
|
"fetchSpec": "^0.1.1"
|
||||||
|
},
|
||||||
|
"_requiredBy": [
|
||||||
|
"/node-notifier"
|
||||||
|
],
|
||||||
|
"_resolved": "https://registry.npmjs.org/shellwords/-/shellwords-0.1.1.tgz",
|
||||||
|
"_shasum": "d6b9181c1a48d397324c84871efbcfc73fc0654b",
|
||||||
|
"_spec": "shellwords@^0.1.1",
|
||||||
|
"_where": "C:\\Users\\ryuki\\TheDesk\\node_modules\\node-notifier",
|
||||||
|
"author": {
|
||||||
|
"name": "Jimmy Cuadra",
|
||||||
|
"email": "jimmy@jimmycuadra.com",
|
||||||
|
"url": "http://jimmycuadra.com/"
|
||||||
|
},
|
||||||
|
"bugs": {
|
||||||
|
"url": "https://github.com/jimmycuadra/shellwords/issues"
|
||||||
|
},
|
||||||
|
"bundleDependencies": false,
|
||||||
|
"dependencies": {},
|
||||||
|
"deprecated": false,
|
||||||
|
"description": "Manipulate strings according to the word parsing rules of the UNIX Bourne shell.",
|
||||||
|
"devDependencies": {
|
||||||
|
"jasmine-node": "~1.0.26",
|
||||||
|
"nodewatch": "~0.1.0"
|
||||||
|
},
|
||||||
|
"files": [
|
||||||
|
"lib"
|
||||||
|
],
|
||||||
|
"homepage": "https://github.com/jimmycuadra/shellwords",
|
||||||
|
"license": "MIT",
|
||||||
|
"main": "./lib/shellwords",
|
||||||
|
"name": "shellwords",
|
||||||
|
"repository": {
|
||||||
|
"type": "git",
|
||||||
|
"url": "git://github.com/jimmycuadra/shellwords.git"
|
||||||
|
},
|
||||||
|
"scripts": {
|
||||||
|
"test": "cake spec"
|
||||||
|
},
|
||||||
|
"version": "0.1.1"
|
||||||
|
}
|
147
node_modules/which/CHANGELOG.md
generated
vendored
Normal file
147
node_modules/which/CHANGELOG.md
generated
vendored
Normal file
|
@ -0,0 +1,147 @@
|
||||||
|
# Changes
|
||||||
|
|
||||||
|
|
||||||
|
## v1.3.0
|
||||||
|
|
||||||
|
* Add nothrow option to which.sync
|
||||||
|
* update tap
|
||||||
|
|
||||||
|
## v1.2.14
|
||||||
|
|
||||||
|
* appveyor: drop node 5 and 0.x
|
||||||
|
* travis-ci: add node 6, drop 0.x
|
||||||
|
|
||||||
|
## v1.2.13
|
||||||
|
|
||||||
|
* test: Pass missing option to pass on windows
|
||||||
|
* update tap
|
||||||
|
* update isexe to 2.0.0
|
||||||
|
* neveragain.tech pledge request
|
||||||
|
|
||||||
|
## v1.2.12
|
||||||
|
|
||||||
|
* Removed unused require
|
||||||
|
|
||||||
|
## v1.2.11
|
||||||
|
|
||||||
|
* Prevent changelog script from being included in package
|
||||||
|
|
||||||
|
## v1.2.10
|
||||||
|
|
||||||
|
* Use env.PATH only, not env.Path
|
||||||
|
|
||||||
|
## v1.2.9
|
||||||
|
|
||||||
|
* fix for paths starting with ../
|
||||||
|
* Remove unused `is-absolute` module
|
||||||
|
|
||||||
|
## v1.2.8
|
||||||
|
|
||||||
|
* bullet items in changelog that contain (but don't start with) #
|
||||||
|
|
||||||
|
## v1.2.7
|
||||||
|
|
||||||
|
* strip 'update changelog' changelog entries out of changelog
|
||||||
|
|
||||||
|
## v1.2.6
|
||||||
|
|
||||||
|
* make the changelog bulleted
|
||||||
|
|
||||||
|
## v1.2.5
|
||||||
|
|
||||||
|
* make a changelog, and keep it up to date
|
||||||
|
* don't include tests in package
|
||||||
|
* Properly handle relative-path executables
|
||||||
|
* appveyor
|
||||||
|
* Attach error code to Not Found error
|
||||||
|
* Make tests pass on Windows
|
||||||
|
|
||||||
|
## v1.2.4
|
||||||
|
|
||||||
|
* Fix typo
|
||||||
|
|
||||||
|
## v1.2.3
|
||||||
|
|
||||||
|
* update isexe, fix regression in pathExt handling
|
||||||
|
|
||||||
|
## v1.2.2
|
||||||
|
|
||||||
|
* update deps, use isexe module, test windows
|
||||||
|
|
||||||
|
## v1.2.1
|
||||||
|
|
||||||
|
* Sometimes windows PATH entries are quoted
|
||||||
|
* Fixed a bug in the check for group and user mode bits. This bug was introduced during refactoring for supporting strict mode.
|
||||||
|
* doc cli
|
||||||
|
|
||||||
|
## v1.2.0
|
||||||
|
|
||||||
|
* Add support for opt.all and -as cli flags
|
||||||
|
* test the bin
|
||||||
|
* update travis
|
||||||
|
* Allow checking for multiple programs in bin/which
|
||||||
|
* tap 2
|
||||||
|
|
||||||
|
## v1.1.2
|
||||||
|
|
||||||
|
* travis
|
||||||
|
* Refactored and fixed undefined error on Windows
|
||||||
|
* Support strict mode
|
||||||
|
|
||||||
|
## v1.1.1
|
||||||
|
|
||||||
|
* test +g exes against secondary groups, if available
|
||||||
|
* Use windows exe semantics on cygwin & msys
|
||||||
|
* cwd should be first in path on win32, not last
|
||||||
|
* Handle lower-case 'env.Path' on Windows
|
||||||
|
* Update docs
|
||||||
|
* use single-quotes
|
||||||
|
|
||||||
|
## v1.1.0
|
||||||
|
|
||||||
|
* Add tests, depend on is-absolute
|
||||||
|
|
||||||
|
## v1.0.9
|
||||||
|
|
||||||
|
* which.js: root is allowed to execute files owned by anyone
|
||||||
|
|
||||||
|
## v1.0.8
|
||||||
|
|
||||||
|
* don't use graceful-fs
|
||||||
|
|
||||||
|
## v1.0.7
|
||||||
|
|
||||||
|
* add license to package.json
|
||||||
|
|
||||||
|
## v1.0.6
|
||||||
|
|
||||||
|
* isc license
|
||||||
|
|
||||||
|
## 1.0.5
|
||||||
|
|
||||||
|
* Awful typo
|
||||||
|
|
||||||
|
## 1.0.4
|
||||||
|
|
||||||
|
* Test for path absoluteness properly
|
||||||
|
* win: Allow '' as a pathext if cmd has a . in it
|
||||||
|
|
||||||
|
## 1.0.3
|
||||||
|
|
||||||
|
* Remove references to execPath
|
||||||
|
* Make `which.sync()` work on Windows by honoring the PATHEXT variable.
|
||||||
|
* Make `isExe()` always return true on Windows.
|
||||||
|
* MIT
|
||||||
|
|
||||||
|
## 1.0.2
|
||||||
|
|
||||||
|
* Only files can be exes
|
||||||
|
|
||||||
|
## 1.0.1
|
||||||
|
|
||||||
|
* Respect the PATHEXT env for win32 support
|
||||||
|
* should 0755 the bin
|
||||||
|
* binary
|
||||||
|
* guts
|
||||||
|
* package
|
||||||
|
* 1st
|
15
node_modules/which/LICENSE
generated
vendored
Normal file
15
node_modules/which/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.
|
51
node_modules/which/README.md
generated
vendored
Normal file
51
node_modules/which/README.md
generated
vendored
Normal file
|
@ -0,0 +1,51 @@
|
||||||
|
# which
|
||||||
|
|
||||||
|
Like the unix `which` utility.
|
||||||
|
|
||||||
|
Finds the first instance of a specified executable in the PATH
|
||||||
|
environment variable. Does not cache the results, so `hash -r` is not
|
||||||
|
needed when the PATH changes.
|
||||||
|
|
||||||
|
## USAGE
|
||||||
|
|
||||||
|
```javascript
|
||||||
|
var which = require('which')
|
||||||
|
|
||||||
|
// async usage
|
||||||
|
which('node', function (er, resolvedPath) {
|
||||||
|
// er is returned if no "node" is found on the PATH
|
||||||
|
// if it is found, then the absolute path to the exec is returned
|
||||||
|
})
|
||||||
|
|
||||||
|
// sync usage
|
||||||
|
// throws if not found
|
||||||
|
var resolved = which.sync('node')
|
||||||
|
|
||||||
|
// if nothrow option is used, returns null if not found
|
||||||
|
resolved = which.sync('node', {nothrow: true})
|
||||||
|
|
||||||
|
// Pass options to override the PATH and PATHEXT environment vars.
|
||||||
|
which('node', { path: someOtherPath }, function (er, resolved) {
|
||||||
|
if (er)
|
||||||
|
throw er
|
||||||
|
console.log('found at %j', resolved)
|
||||||
|
})
|
||||||
|
```
|
||||||
|
|
||||||
|
## CLI USAGE
|
||||||
|
|
||||||
|
Same as the BSD `which(1)` binary.
|
||||||
|
|
||||||
|
```
|
||||||
|
usage: which [-as] program ...
|
||||||
|
```
|
||||||
|
|
||||||
|
## OPTIONS
|
||||||
|
|
||||||
|
You may pass an options object as the second argument.
|
||||||
|
|
||||||
|
- `path`: Use instead of the `PATH` environment variable.
|
||||||
|
- `pathExt`: Use instead of the `PATHEXT` environment variable.
|
||||||
|
- `all`: Return all matches, instead of just the first one. Note that
|
||||||
|
this means the function returns an array of strings instead of a
|
||||||
|
single string.
|
52
node_modules/which/bin/which
generated
vendored
Normal file
52
node_modules/which/bin/which
generated
vendored
Normal file
|
@ -0,0 +1,52 @@
|
||||||
|
#!/usr/bin/env node
|
||||||
|
var which = require("../")
|
||||||
|
if (process.argv.length < 3)
|
||||||
|
usage()
|
||||||
|
|
||||||
|
function usage () {
|
||||||
|
console.error('usage: which [-as] program ...')
|
||||||
|
process.exit(1)
|
||||||
|
}
|
||||||
|
|
||||||
|
var all = false
|
||||||
|
var silent = false
|
||||||
|
var dashdash = false
|
||||||
|
var args = process.argv.slice(2).filter(function (arg) {
|
||||||
|
if (dashdash || !/^-/.test(arg))
|
||||||
|
return true
|
||||||
|
|
||||||
|
if (arg === '--') {
|
||||||
|
dashdash = true
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
|
var flags = arg.substr(1).split('')
|
||||||
|
for (var f = 0; f < flags.length; f++) {
|
||||||
|
var flag = flags[f]
|
||||||
|
switch (flag) {
|
||||||
|
case 's':
|
||||||
|
silent = true
|
||||||
|
break
|
||||||
|
case 'a':
|
||||||
|
all = true
|
||||||
|
break
|
||||||
|
default:
|
||||||
|
console.error('which: illegal option -- ' + flag)
|
||||||
|
usage()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return false
|
||||||
|
})
|
||||||
|
|
||||||
|
process.exit(args.reduce(function (pv, current) {
|
||||||
|
try {
|
||||||
|
var f = which.sync(current, { all: all })
|
||||||
|
if (all)
|
||||||
|
f = f.join('\n')
|
||||||
|
if (!silent)
|
||||||
|
console.log(f)
|
||||||
|
return pv;
|
||||||
|
} catch (e) {
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
}, 0))
|
65
node_modules/which/package.json
generated
vendored
Normal file
65
node_modules/which/package.json
generated
vendored
Normal file
|
@ -0,0 +1,65 @@
|
||||||
|
{
|
||||||
|
"_from": "which@^1.3.0",
|
||||||
|
"_id": "which@1.3.0",
|
||||||
|
"_inBundle": false,
|
||||||
|
"_integrity": "sha512-xcJpopdamTuY5duC/KnTTNBraPK54YwpenP4lzxU8H91GudWpFv38u0CKjclE1Wi2EH2EDz5LRcHcKbCIzqGyg==",
|
||||||
|
"_location": "/which",
|
||||||
|
"_phantomChildren": {},
|
||||||
|
"_requested": {
|
||||||
|
"type": "range",
|
||||||
|
"registry": true,
|
||||||
|
"raw": "which@^1.3.0",
|
||||||
|
"name": "which",
|
||||||
|
"escapedName": "which",
|
||||||
|
"rawSpec": "^1.3.0",
|
||||||
|
"saveSpec": null,
|
||||||
|
"fetchSpec": "^1.3.0"
|
||||||
|
},
|
||||||
|
"_requiredBy": [
|
||||||
|
"/node-notifier"
|
||||||
|
],
|
||||||
|
"_resolved": "https://registry.npmjs.org/which/-/which-1.3.0.tgz",
|
||||||
|
"_shasum": "ff04bdfc010ee547d780bec38e1ac1c2777d253a",
|
||||||
|
"_spec": "which@^1.3.0",
|
||||||
|
"_where": "C:\\Users\\ryuki\\TheDesk\\node_modules\\node-notifier",
|
||||||
|
"author": {
|
||||||
|
"name": "Isaac Z. Schlueter",
|
||||||
|
"email": "i@izs.me",
|
||||||
|
"url": "http://blog.izs.me"
|
||||||
|
},
|
||||||
|
"bin": {
|
||||||
|
"which": "./bin/which"
|
||||||
|
},
|
||||||
|
"bugs": {
|
||||||
|
"url": "https://github.com/isaacs/node-which/issues"
|
||||||
|
},
|
||||||
|
"bundleDependencies": false,
|
||||||
|
"dependencies": {
|
||||||
|
"isexe": "^2.0.0"
|
||||||
|
},
|
||||||
|
"deprecated": false,
|
||||||
|
"description": "Like which(1) unix command. Find the first instance of an executable in the PATH.",
|
||||||
|
"devDependencies": {
|
||||||
|
"mkdirp": "^0.5.0",
|
||||||
|
"rimraf": "^2.3.3",
|
||||||
|
"tap": "^10.7.0"
|
||||||
|
},
|
||||||
|
"files": [
|
||||||
|
"which.js",
|
||||||
|
"bin/which"
|
||||||
|
],
|
||||||
|
"homepage": "https://github.com/isaacs/node-which#readme",
|
||||||
|
"license": "ISC",
|
||||||
|
"main": "which.js",
|
||||||
|
"name": "which",
|
||||||
|
"repository": {
|
||||||
|
"type": "git",
|
||||||
|
"url": "git://github.com/isaacs/node-which.git"
|
||||||
|
},
|
||||||
|
"scripts": {
|
||||||
|
"changelog": "bash gen-changelog.sh",
|
||||||
|
"postversion": "npm run changelog && git add CHANGELOG.md && git commit -m 'update changelog - '${npm_package_version}",
|
||||||
|
"test": "tap test/*.js --cov"
|
||||||
|
},
|
||||||
|
"version": "1.3.0"
|
||||||
|
}
|
135
node_modules/which/which.js
generated
vendored
Normal file
135
node_modules/which/which.js
generated
vendored
Normal file
|
@ -0,0 +1,135 @@
|
||||||
|
module.exports = which
|
||||||
|
which.sync = whichSync
|
||||||
|
|
||||||
|
var isWindows = process.platform === 'win32' ||
|
||||||
|
process.env.OSTYPE === 'cygwin' ||
|
||||||
|
process.env.OSTYPE === 'msys'
|
||||||
|
|
||||||
|
var path = require('path')
|
||||||
|
var COLON = isWindows ? ';' : ':'
|
||||||
|
var isexe = require('isexe')
|
||||||
|
|
||||||
|
function getNotFoundError (cmd) {
|
||||||
|
var er = new Error('not found: ' + cmd)
|
||||||
|
er.code = 'ENOENT'
|
||||||
|
|
||||||
|
return er
|
||||||
|
}
|
||||||
|
|
||||||
|
function getPathInfo (cmd, opt) {
|
||||||
|
var colon = opt.colon || COLON
|
||||||
|
var pathEnv = opt.path || process.env.PATH || ''
|
||||||
|
var pathExt = ['']
|
||||||
|
|
||||||
|
pathEnv = pathEnv.split(colon)
|
||||||
|
|
||||||
|
var pathExtExe = ''
|
||||||
|
if (isWindows) {
|
||||||
|
pathEnv.unshift(process.cwd())
|
||||||
|
pathExtExe = (opt.pathExt || process.env.PATHEXT || '.EXE;.CMD;.BAT;.COM')
|
||||||
|
pathExt = pathExtExe.split(colon)
|
||||||
|
|
||||||
|
|
||||||
|
// Always test the cmd itself first. isexe will check to make sure
|
||||||
|
// it's found in the pathExt set.
|
||||||
|
if (cmd.indexOf('.') !== -1 && pathExt[0] !== '')
|
||||||
|
pathExt.unshift('')
|
||||||
|
}
|
||||||
|
|
||||||
|
// If it has a slash, then we don't bother searching the pathenv.
|
||||||
|
// just check the file itself, and that's it.
|
||||||
|
if (cmd.match(/\//) || isWindows && cmd.match(/\\/))
|
||||||
|
pathEnv = ['']
|
||||||
|
|
||||||
|
return {
|
||||||
|
env: pathEnv,
|
||||||
|
ext: pathExt,
|
||||||
|
extExe: pathExtExe
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function which (cmd, opt, cb) {
|
||||||
|
if (typeof opt === 'function') {
|
||||||
|
cb = opt
|
||||||
|
opt = {}
|
||||||
|
}
|
||||||
|
|
||||||
|
var info = getPathInfo(cmd, opt)
|
||||||
|
var pathEnv = info.env
|
||||||
|
var pathExt = info.ext
|
||||||
|
var pathExtExe = info.extExe
|
||||||
|
var found = []
|
||||||
|
|
||||||
|
;(function F (i, l) {
|
||||||
|
if (i === l) {
|
||||||
|
if (opt.all && found.length)
|
||||||
|
return cb(null, found)
|
||||||
|
else
|
||||||
|
return cb(getNotFoundError(cmd))
|
||||||
|
}
|
||||||
|
|
||||||
|
var pathPart = pathEnv[i]
|
||||||
|
if (pathPart.charAt(0) === '"' && pathPart.slice(-1) === '"')
|
||||||
|
pathPart = pathPart.slice(1, -1)
|
||||||
|
|
||||||
|
var p = path.join(pathPart, cmd)
|
||||||
|
if (!pathPart && (/^\.[\\\/]/).test(cmd)) {
|
||||||
|
p = cmd.slice(0, 2) + p
|
||||||
|
}
|
||||||
|
;(function E (ii, ll) {
|
||||||
|
if (ii === ll) return F(i + 1, l)
|
||||||
|
var ext = pathExt[ii]
|
||||||
|
isexe(p + ext, { pathExt: pathExtExe }, function (er, is) {
|
||||||
|
if (!er && is) {
|
||||||
|
if (opt.all)
|
||||||
|
found.push(p + ext)
|
||||||
|
else
|
||||||
|
return cb(null, p + ext)
|
||||||
|
}
|
||||||
|
return E(ii + 1, ll)
|
||||||
|
})
|
||||||
|
})(0, pathExt.length)
|
||||||
|
})(0, pathEnv.length)
|
||||||
|
}
|
||||||
|
|
||||||
|
function whichSync (cmd, opt) {
|
||||||
|
opt = opt || {}
|
||||||
|
|
||||||
|
var info = getPathInfo(cmd, opt)
|
||||||
|
var pathEnv = info.env
|
||||||
|
var pathExt = info.ext
|
||||||
|
var pathExtExe = info.extExe
|
||||||
|
var found = []
|
||||||
|
|
||||||
|
for (var i = 0, l = pathEnv.length; i < l; i ++) {
|
||||||
|
var pathPart = pathEnv[i]
|
||||||
|
if (pathPart.charAt(0) === '"' && pathPart.slice(-1) === '"')
|
||||||
|
pathPart = pathPart.slice(1, -1)
|
||||||
|
|
||||||
|
var p = path.join(pathPart, cmd)
|
||||||
|
if (!pathPart && /^\.[\\\/]/.test(cmd)) {
|
||||||
|
p = cmd.slice(0, 2) + p
|
||||||
|
}
|
||||||
|
for (var j = 0, ll = pathExt.length; j < ll; j ++) {
|
||||||
|
var cur = p + pathExt[j]
|
||||||
|
var is
|
||||||
|
try {
|
||||||
|
is = isexe.sync(cur, { pathExt: pathExtExe })
|
||||||
|
if (is) {
|
||||||
|
if (opt.all)
|
||||||
|
found.push(cur)
|
||||||
|
else
|
||||||
|
return cur
|
||||||
|
}
|
||||||
|
} catch (ex) {}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (opt.all && found.length)
|
||||||
|
return found
|
||||||
|
|
||||||
|
if (opt.nothrow)
|
||||||
|
return null
|
||||||
|
|
||||||
|
throw getNotFoundError(cmd)
|
||||||
|
}
|
33
package-lock.json
generated
33
package-lock.json
generated
|
@ -1,3 +1,34 @@
|
||||||
{
|
{
|
||||||
"lockfileVersion": 1
|
"requires": true,
|
||||||
|
"lockfileVersion": 1,
|
||||||
|
"dependencies": {
|
||||||
|
"growly": {
|
||||||
|
"version": "1.3.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/growly/-/growly-1.3.0.tgz",
|
||||||
|
"integrity": "sha1-8QdIy+dq+WS3yWyTxrzCivEgwIE="
|
||||||
|
},
|
||||||
|
"isexe": {
|
||||||
|
"version": "2.0.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/isexe/-/isexe-2.0.0.tgz",
|
||||||
|
"integrity": "sha1-6PvzdNxVb/iUehDcsFctYz8s+hA="
|
||||||
|
},
|
||||||
|
"semver": {
|
||||||
|
"version": "5.5.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/semver/-/semver-5.5.0.tgz",
|
||||||
|
"integrity": "sha512-4SJ3dm0WAwWy/NVeioZh5AntkdJoWKxHxcmyP622fOkgHa4z3R0TdBJICINyaSDE6uNwVc8gZr+ZinwZAH4xIA=="
|
||||||
|
},
|
||||||
|
"shellwords": {
|
||||||
|
"version": "0.1.1",
|
||||||
|
"resolved": "https://registry.npmjs.org/shellwords/-/shellwords-0.1.1.tgz",
|
||||||
|
"integrity": "sha512-vFwSUfQvqybiICwZY5+DAWIPLKsWO31Q91JSKl3UYv+K5c2QRPzn0qzec6QPu1Qc9eHYItiP3NdJqNVqetYAww=="
|
||||||
|
},
|
||||||
|
"which": {
|
||||||
|
"version": "1.3.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/which/-/which-1.3.0.tgz",
|
||||||
|
"integrity": "sha512-xcJpopdamTuY5duC/KnTTNBraPK54YwpenP4lzxU8H91GudWpFv38u0CKjclE1Wi2EH2EDz5LRcHcKbCIzqGyg==",
|
||||||
|
"requires": {
|
||||||
|
"isexe": "2.0.0"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user