Initial commit.
This commit is contained in:
1
node_modules/.bin/har-validator
generated
vendored
1
node_modules/.bin/har-validator
generated
vendored
@ -1 +0,0 @@
|
||||
../har-validator/bin/har-validator
|
65
node_modules/ansi-styles/index.js
generated
vendored
65
node_modules/ansi-styles/index.js
generated
vendored
@ -1,65 +0,0 @@
|
||||
'use strict';
|
||||
|
||||
function assembleStyles () {
|
||||
var styles = {
|
||||
modifiers: {
|
||||
reset: [0, 0],
|
||||
bold: [1, 22], // 21 isn't widely supported and 22 does the same thing
|
||||
dim: [2, 22],
|
||||
italic: [3, 23],
|
||||
underline: [4, 24],
|
||||
inverse: [7, 27],
|
||||
hidden: [8, 28],
|
||||
strikethrough: [9, 29]
|
||||
},
|
||||
colors: {
|
||||
black: [30, 39],
|
||||
red: [31, 39],
|
||||
green: [32, 39],
|
||||
yellow: [33, 39],
|
||||
blue: [34, 39],
|
||||
magenta: [35, 39],
|
||||
cyan: [36, 39],
|
||||
white: [37, 39],
|
||||
gray: [90, 39]
|
||||
},
|
||||
bgColors: {
|
||||
bgBlack: [40, 49],
|
||||
bgRed: [41, 49],
|
||||
bgGreen: [42, 49],
|
||||
bgYellow: [43, 49],
|
||||
bgBlue: [44, 49],
|
||||
bgMagenta: [45, 49],
|
||||
bgCyan: [46, 49],
|
||||
bgWhite: [47, 49]
|
||||
}
|
||||
};
|
||||
|
||||
// fix humans
|
||||
styles.colors.grey = styles.colors.gray;
|
||||
|
||||
Object.keys(styles).forEach(function (groupName) {
|
||||
var group = styles[groupName];
|
||||
|
||||
Object.keys(group).forEach(function (styleName) {
|
||||
var style = group[styleName];
|
||||
|
||||
styles[styleName] = group[styleName] = {
|
||||
open: '\u001b[' + style[0] + 'm',
|
||||
close: '\u001b[' + style[1] + 'm'
|
||||
};
|
||||
});
|
||||
|
||||
Object.defineProperty(styles, groupName, {
|
||||
value: group,
|
||||
enumerable: false
|
||||
});
|
||||
});
|
||||
|
||||
return styles;
|
||||
}
|
||||
|
||||
Object.defineProperty(module, 'exports', {
|
||||
enumerable: true,
|
||||
get: assembleStyles
|
||||
});
|
21
node_modules/ansi-styles/license
generated
vendored
21
node_modules/ansi-styles/license
generated
vendored
@ -1,21 +0,0 @@
|
||||
The MIT License (MIT)
|
||||
|
||||
Copyright (c) Sindre Sorhus <sindresorhus@gmail.com> (sindresorhus.com)
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in
|
||||
all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
THE SOFTWARE.
|
114
node_modules/ansi-styles/package.json
generated
vendored
114
node_modules/ansi-styles/package.json
generated
vendored
@ -1,114 +0,0 @@
|
||||
{
|
||||
"_args": [
|
||||
[
|
||||
{
|
||||
"raw": "ansi-styles@^2.2.1",
|
||||
"scope": null,
|
||||
"escapedName": "ansi-styles",
|
||||
"name": "ansi-styles",
|
||||
"rawSpec": "^2.2.1",
|
||||
"spec": ">=2.2.1 <3.0.0",
|
||||
"type": "range"
|
||||
},
|
||||
"/tank/data/SERVER/zoneadm-master/node_modules/chalk"
|
||||
]
|
||||
],
|
||||
"_from": "ansi-styles@>=2.2.1 <3.0.0",
|
||||
"_id": "ansi-styles@2.2.1",
|
||||
"_inCache": true,
|
||||
"_location": "/ansi-styles",
|
||||
"_nodeVersion": "4.3.0",
|
||||
"_npmOperationalInternal": {
|
||||
"host": "packages-12-west.internal.npmjs.com",
|
||||
"tmp": "tmp/ansi-styles-2.2.1.tgz_1459197317833_0.9694824463222176"
|
||||
},
|
||||
"_npmUser": {
|
||||
"name": "sindresorhus",
|
||||
"email": "sindresorhus@gmail.com"
|
||||
},
|
||||
"_npmVersion": "3.8.3",
|
||||
"_phantomChildren": {},
|
||||
"_requested": {
|
||||
"raw": "ansi-styles@^2.2.1",
|
||||
"scope": null,
|
||||
"escapedName": "ansi-styles",
|
||||
"name": "ansi-styles",
|
||||
"rawSpec": "^2.2.1",
|
||||
"spec": ">=2.2.1 <3.0.0",
|
||||
"type": "range"
|
||||
},
|
||||
"_requiredBy": [
|
||||
"/chalk"
|
||||
],
|
||||
"_resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-2.2.1.tgz",
|
||||
"_shasum": "b432dd3358b634cf75e1e4664368240533c1ddbe",
|
||||
"_shrinkwrap": null,
|
||||
"_spec": "ansi-styles@^2.2.1",
|
||||
"_where": "/tank/data/SERVER/zoneadm-master/node_modules/chalk",
|
||||
"author": {
|
||||
"name": "Sindre Sorhus",
|
||||
"email": "sindresorhus@gmail.com",
|
||||
"url": "sindresorhus.com"
|
||||
},
|
||||
"bugs": {
|
||||
"url": "https://github.com/chalk/ansi-styles/issues"
|
||||
},
|
||||
"dependencies": {},
|
||||
"description": "ANSI escape codes for styling strings in the terminal",
|
||||
"devDependencies": {
|
||||
"mocha": "*"
|
||||
},
|
||||
"directories": {},
|
||||
"dist": {
|
||||
"shasum": "b432dd3358b634cf75e1e4664368240533c1ddbe",
|
||||
"tarball": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-2.2.1.tgz"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=0.10.0"
|
||||
},
|
||||
"files": [
|
||||
"index.js"
|
||||
],
|
||||
"gitHead": "95c59b23be760108b6530ca1c89477c21b258032",
|
||||
"homepage": "https://github.com/chalk/ansi-styles#readme",
|
||||
"keywords": [
|
||||
"ansi",
|
||||
"styles",
|
||||
"color",
|
||||
"colour",
|
||||
"colors",
|
||||
"terminal",
|
||||
"console",
|
||||
"cli",
|
||||
"string",
|
||||
"tty",
|
||||
"escape",
|
||||
"formatting",
|
||||
"rgb",
|
||||
"256",
|
||||
"shell",
|
||||
"xterm",
|
||||
"log",
|
||||
"logging",
|
||||
"command-line",
|
||||
"text"
|
||||
],
|
||||
"license": "MIT",
|
||||
"maintainers": [
|
||||
{
|
||||
"name": "sindresorhus",
|
||||
"email": "sindresorhus@gmail.com"
|
||||
}
|
||||
],
|
||||
"name": "ansi-styles",
|
||||
"optionalDependencies": {},
|
||||
"readme": "ERROR: No README data found!",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git+https://github.com/chalk/ansi-styles.git"
|
||||
},
|
||||
"scripts": {
|
||||
"test": "mocha"
|
||||
},
|
||||
"version": "2.2.1"
|
||||
}
|
86
node_modules/ansi-styles/readme.md
generated
vendored
86
node_modules/ansi-styles/readme.md
generated
vendored
@ -1,86 +0,0 @@
|
||||
# ansi-styles [](https://travis-ci.org/chalk/ansi-styles)
|
||||
|
||||
> [ANSI escape codes](http://en.wikipedia.org/wiki/ANSI_escape_code#Colors_and_Styles) for styling strings in the terminal
|
||||
|
||||
You probably want the higher-level [chalk](https://github.com/chalk/chalk) module for styling your strings.
|
||||
|
||||

|
||||
|
||||
|
||||
## Install
|
||||
|
||||
```
|
||||
$ npm install --save ansi-styles
|
||||
```
|
||||
|
||||
|
||||
## Usage
|
||||
|
||||
```js
|
||||
var ansi = require('ansi-styles');
|
||||
|
||||
console.log(ansi.green.open + 'Hello world!' + ansi.green.close);
|
||||
```
|
||||
|
||||
|
||||
## API
|
||||
|
||||
Each style has an `open` and `close` property.
|
||||
|
||||
|
||||
## Styles
|
||||
|
||||
### Modifiers
|
||||
|
||||
- `reset`
|
||||
- `bold`
|
||||
- `dim`
|
||||
- `italic` *(not widely supported)*
|
||||
- `underline`
|
||||
- `inverse`
|
||||
- `hidden`
|
||||
- `strikethrough` *(not widely supported)*
|
||||
|
||||
### Colors
|
||||
|
||||
- `black`
|
||||
- `red`
|
||||
- `green`
|
||||
- `yellow`
|
||||
- `blue`
|
||||
- `magenta`
|
||||
- `cyan`
|
||||
- `white`
|
||||
- `gray`
|
||||
|
||||
### Background colors
|
||||
|
||||
- `bgBlack`
|
||||
- `bgRed`
|
||||
- `bgGreen`
|
||||
- `bgYellow`
|
||||
- `bgBlue`
|
||||
- `bgMagenta`
|
||||
- `bgCyan`
|
||||
- `bgWhite`
|
||||
|
||||
|
||||
## Advanced usage
|
||||
|
||||
By default you get a map of styles, but the styles are also available as groups. They are non-enumerable so they don't show up unless you access them explicitly. This makes it easier to expose only a subset in a higher-level module.
|
||||
|
||||
- `ansi.modifiers`
|
||||
- `ansi.colors`
|
||||
- `ansi.bgColors`
|
||||
|
||||
|
||||
###### Example
|
||||
|
||||
```js
|
||||
console.log(ansi.colors.green.open);
|
||||
```
|
||||
|
||||
|
||||
## License
|
||||
|
||||
MIT © [Sindre Sorhus](http://sindresorhus.com)
|
57
node_modules/asn1/package.json
generated
vendored
57
node_modules/asn1/package.json
generated
vendored
@ -1,45 +1,27 @@
|
||||
{
|
||||
"_args": [
|
||||
[
|
||||
{
|
||||
"raw": "asn1@~0.2.3",
|
||||
"scope": null,
|
||||
"escapedName": "asn1",
|
||||
"name": "asn1",
|
||||
"rawSpec": "~0.2.3",
|
||||
"spec": ">=0.2.3 <0.3.0",
|
||||
"type": "range"
|
||||
},
|
||||
"/tank/data/SERVER/zoneadm-master/node_modules/sshpk"
|
||||
]
|
||||
],
|
||||
"_from": "asn1@>=0.2.3 <0.3.0",
|
||||
"_from": "asn1@~0.2.3",
|
||||
"_id": "asn1@0.2.3",
|
||||
"_inCache": true,
|
||||
"_inBundle": false,
|
||||
"_integrity": "sha1-2sh4dxPJlmhJ/IGAd36+nB3fO4Y=",
|
||||
"_location": "/asn1",
|
||||
"_npmUser": {
|
||||
"name": "pfmooney",
|
||||
"email": "patrick.f.mooney@gmail.com"
|
||||
},
|
||||
"_npmVersion": "1.4.28",
|
||||
"_phantomChildren": {},
|
||||
"_requested": {
|
||||
"type": "range",
|
||||
"registry": true,
|
||||
"raw": "asn1@~0.2.3",
|
||||
"scope": null,
|
||||
"escapedName": "asn1",
|
||||
"name": "asn1",
|
||||
"escapedName": "asn1",
|
||||
"rawSpec": "~0.2.3",
|
||||
"spec": ">=0.2.3 <0.3.0",
|
||||
"type": "range"
|
||||
"saveSpec": null,
|
||||
"fetchSpec": "~0.2.3"
|
||||
},
|
||||
"_requiredBy": [
|
||||
"/sshpk"
|
||||
],
|
||||
"_resolved": "https://registry.npmjs.org/asn1/-/asn1-0.2.3.tgz",
|
||||
"_shasum": "dac8787713c9966849fc8180777ebe9c1ddf3b86",
|
||||
"_shrinkwrap": null,
|
||||
"_spec": "asn1@~0.2.3",
|
||||
"_where": "/tank/data/SERVER/zoneadm-master/node_modules/sshpk",
|
||||
"_where": "/export/home/matjaz/git/zoneadmin-master/node_modules/sshpk",
|
||||
"author": {
|
||||
"name": "Mark Cavage",
|
||||
"email": "mcavage@gmail.com"
|
||||
@ -47,6 +29,7 @@
|
||||
"bugs": {
|
||||
"url": "https://github.com/mcavage/node-asn1/issues"
|
||||
},
|
||||
"bundleDependencies": false,
|
||||
"contributors": [
|
||||
{
|
||||
"name": "David Gwynne",
|
||||
@ -62,31 +45,15 @@
|
||||
}
|
||||
],
|
||||
"dependencies": {},
|
||||
"deprecated": false,
|
||||
"description": "Contains parsers and serializers for ASN.1 (currently BER only)",
|
||||
"devDependencies": {
|
||||
"tap": "0.4.8"
|
||||
},
|
||||
"directories": {},
|
||||
"dist": {
|
||||
"shasum": "dac8787713c9966849fc8180777ebe9c1ddf3b86",
|
||||
"tarball": "https://registry.npmjs.org/asn1/-/asn1-0.2.3.tgz"
|
||||
},
|
||||
"homepage": "https://github.com/mcavage/node-asn1",
|
||||
"homepage": "https://github.com/mcavage/node-asn1#readme",
|
||||
"license": "MIT",
|
||||
"main": "lib/index.js",
|
||||
"maintainers": [
|
||||
{
|
||||
"name": "mcavage",
|
||||
"email": "mcavage@gmail.com"
|
||||
},
|
||||
{
|
||||
"name": "pfmooney",
|
||||
"email": "patrick.f.mooney@gmail.com"
|
||||
}
|
||||
],
|
||||
"name": "asn1",
|
||||
"optionalDependencies": {},
|
||||
"readme": "ERROR: No README data found!",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git://github.com/mcavage/node-asn1.git"
|
||||
|
6
node_modules/assert-plus/CHANGES.md
generated
vendored
6
node_modules/assert-plus/CHANGES.md
generated
vendored
@ -1,5 +1,11 @@
|
||||
# assert-plus Changelog
|
||||
|
||||
## 1.0.0
|
||||
|
||||
- *BREAKING* assert.number (and derivatives) now accept Infinity as valid input
|
||||
- Add assert.finite check. Previous assert.number callers should use this if
|
||||
they expect Infinity inputs to throw.
|
||||
|
||||
## 0.2.0
|
||||
|
||||
- Fix `assert.object(null)` so it throws
|
||||
|
9
node_modules/assert-plus/README.md
generated
vendored
9
node_modules/assert-plus/README.md
generated
vendored
@ -74,41 +74,48 @@ The complete list of APIs is:
|
||||
* assert.buffer
|
||||
* assert.func
|
||||
* assert.number
|
||||
* assert.finite
|
||||
* assert.object
|
||||
* assert.string
|
||||
* assert.stream
|
||||
* assert.date
|
||||
* assert.regex
|
||||
* assert.regexp
|
||||
* assert.uuid
|
||||
* assert.arrayOfArray
|
||||
* assert.arrayOfBool
|
||||
* assert.arrayOfBuffer
|
||||
* assert.arrayOfFunc
|
||||
* assert.arrayOfNumber
|
||||
* assert.arrayOfFinite
|
||||
* assert.arrayOfObject
|
||||
* assert.arrayOfString
|
||||
* assert.arrayOfStream
|
||||
* assert.arrayOfDate
|
||||
* assert.arrayOfRegexp
|
||||
* assert.arrayOfUuid
|
||||
* assert.optionalArray
|
||||
* assert.optionalBool
|
||||
* assert.optionalBuffer
|
||||
* assert.optionalFunc
|
||||
* assert.optionalNumber
|
||||
* assert.optionalFinite
|
||||
* assert.optionalObject
|
||||
* assert.optionalString
|
||||
* assert.optionalStream
|
||||
* assert.optionalDate
|
||||
* assert.optionalRegexp
|
||||
* assert.optionalUuid
|
||||
* assert.optionalArrayOfArray
|
||||
* assert.optionalArrayOfBool
|
||||
* assert.optionalArrayOfBuffer
|
||||
* assert.optionalArrayOfFunc
|
||||
* assert.optionalArrayOfNumber
|
||||
* assert.optionalArrayOfFinite
|
||||
* assert.optionalArrayOfObject
|
||||
* assert.optionalArrayOfString
|
||||
* assert.optionalArrayOfStream
|
||||
* assert.optionalArrayOfDate
|
||||
* assert.optionalArrayOfRegexp
|
||||
* assert.optionalArrayOfUuid
|
||||
* assert.AssertionError
|
||||
* assert.fail
|
||||
|
5
node_modules/assert-plus/assert.js
generated
vendored
5
node_modules/assert-plus/assert.js
generated
vendored
@ -55,6 +55,11 @@ var types = {
|
||||
}
|
||||
},
|
||||
number: {
|
||||
check: function (arg) {
|
||||
return typeof (arg) === 'number' && !isNaN(arg);
|
||||
}
|
||||
},
|
||||
finite: {
|
||||
check: function (arg) {
|
||||
return typeof (arg) === 'number' && !isNaN(arg) && isFinite(arg);
|
||||
}
|
||||
|
76
node_modules/assert-plus/package.json
generated
vendored
76
node_modules/assert-plus/package.json
generated
vendored
@ -1,46 +1,32 @@
|
||||
{
|
||||
"_args": [
|
||||
[
|
||||
{
|
||||
"raw": "assert-plus@^0.2.0",
|
||||
"scope": null,
|
||||
"escapedName": "assert-plus",
|
||||
"name": "assert-plus",
|
||||
"rawSpec": "^0.2.0",
|
||||
"spec": ">=0.2.0 <0.3.0",
|
||||
"type": "range"
|
||||
},
|
||||
"/tank/data/SERVER/zoneadm-master/node_modules/http-signature"
|
||||
]
|
||||
],
|
||||
"_from": "assert-plus@>=0.2.0 <0.3.0",
|
||||
"_id": "assert-plus@0.2.0",
|
||||
"_inCache": true,
|
||||
"_from": "assert-plus@^1.0.0",
|
||||
"_id": "assert-plus@1.0.0",
|
||||
"_inBundle": false,
|
||||
"_integrity": "sha1-8S4PPF13sLHN2RRpQuTpbB5N1SU=",
|
||||
"_location": "/assert-plus",
|
||||
"_nodeVersion": "0.10.36",
|
||||
"_npmUser": {
|
||||
"name": "pfmooney",
|
||||
"email": "patrick.f.mooney@gmail.com"
|
||||
},
|
||||
"_npmVersion": "3.3.8",
|
||||
"_phantomChildren": {},
|
||||
"_requested": {
|
||||
"raw": "assert-plus@^0.2.0",
|
||||
"scope": null,
|
||||
"escapedName": "assert-plus",
|
||||
"type": "range",
|
||||
"registry": true,
|
||||
"raw": "assert-plus@^1.0.0",
|
||||
"name": "assert-plus",
|
||||
"rawSpec": "^0.2.0",
|
||||
"spec": ">=0.2.0 <0.3.0",
|
||||
"type": "range"
|
||||
"escapedName": "assert-plus",
|
||||
"rawSpec": "^1.0.0",
|
||||
"saveSpec": null,
|
||||
"fetchSpec": "^1.0.0"
|
||||
},
|
||||
"_requiredBy": [
|
||||
"/http-signature"
|
||||
"/dashdash",
|
||||
"/getpass",
|
||||
"/http-signature",
|
||||
"/jsprim",
|
||||
"/sshpk",
|
||||
"/verror"
|
||||
],
|
||||
"_resolved": "https://registry.npmjs.org/assert-plus/-/assert-plus-0.2.0.tgz",
|
||||
"_shasum": "d74e1b87e7affc0db8aadb7021f3fe48101ab234",
|
||||
"_shrinkwrap": null,
|
||||
"_spec": "assert-plus@^0.2.0",
|
||||
"_where": "/tank/data/SERVER/zoneadm-master/node_modules/http-signature",
|
||||
"_resolved": "https://registry.npmjs.org/assert-plus/-/assert-plus-1.0.0.tgz",
|
||||
"_shasum": "f12e0f3c5d77b0b1cdd9146942e4e96c1e4dd525",
|
||||
"_spec": "assert-plus@^1.0.0",
|
||||
"_where": "/export/home/matjaz/git/zoneadmin-master/node_modules/http-signature",
|
||||
"author": {
|
||||
"name": "Mark Cavage",
|
||||
"email": "mcavage@gmail.com"
|
||||
@ -48,6 +34,7 @@
|
||||
"bugs": {
|
||||
"url": "https://github.com/mcavage/node-assert-plus/issues"
|
||||
},
|
||||
"bundleDependencies": false,
|
||||
"contributors": [
|
||||
{
|
||||
"name": "Dave Eddy",
|
||||
@ -75,35 +62,20 @@
|
||||
}
|
||||
],
|
||||
"dependencies": {},
|
||||
"deprecated": false,
|
||||
"description": "Extra assertions on top of node's assert module",
|
||||
"devDependencies": {
|
||||
"faucet": "0.0.1",
|
||||
"tape": "4.2.2"
|
||||
},
|
||||
"directories": {},
|
||||
"dist": {
|
||||
"shasum": "d74e1b87e7affc0db8aadb7021f3fe48101ab234",
|
||||
"tarball": "https://registry.npmjs.org/assert-plus/-/assert-plus-0.2.0.tgz"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=0.8"
|
||||
},
|
||||
"homepage": "https://github.com/mcavage/node-assert-plus#readme",
|
||||
"license": "MIT",
|
||||
"main": "./assert.js",
|
||||
"maintainers": [
|
||||
{
|
||||
"name": "mcavage",
|
||||
"email": "mcavage@gmail.com"
|
||||
},
|
||||
{
|
||||
"name": "pfmooney",
|
||||
"email": "patrick.f.mooney@gmail.com"
|
||||
}
|
||||
],
|
||||
"name": "assert-plus",
|
||||
"optionalDependencies": {},
|
||||
"readme": "ERROR: No README data found!",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git+https://github.com/mcavage/node-assert-plus.git"
|
||||
@ -111,5 +83,5 @@
|
||||
"scripts": {
|
||||
"test": "tape tests/*.js | ./node_modules/.bin/faucet"
|
||||
},
|
||||
"version": "0.2.0"
|
||||
"version": "1.0.0"
|
||||
}
|
||||
|
57
node_modules/asynckit/package.json
generated
vendored
57
node_modules/asynckit/package.json
generated
vendored
@ -1,50 +1,27 @@
|
||||
{
|
||||
"_args": [
|
||||
[
|
||||
{
|
||||
"raw": "asynckit@^0.4.0",
|
||||
"scope": null,
|
||||
"escapedName": "asynckit",
|
||||
"name": "asynckit",
|
||||
"rawSpec": "^0.4.0",
|
||||
"spec": ">=0.4.0 <0.5.0",
|
||||
"type": "range"
|
||||
},
|
||||
"/tank/data/SERVER/zoneadm-master/node_modules/form-data"
|
||||
]
|
||||
],
|
||||
"_from": "asynckit@>=0.4.0 <0.5.0",
|
||||
"_from": "asynckit@^0.4.0",
|
||||
"_id": "asynckit@0.4.0",
|
||||
"_inCache": true,
|
||||
"_inBundle": false,
|
||||
"_integrity": "sha1-x57Zf380y48robyXkLzDZkdLS3k=",
|
||||
"_location": "/asynckit",
|
||||
"_nodeVersion": "0.12.11",
|
||||
"_npmOperationalInternal": {
|
||||
"host": "packages-16-east.internal.npmjs.com",
|
||||
"tmp": "tmp/asynckit-0.4.0.tgz_1465928940169_0.8008207362145185"
|
||||
},
|
||||
"_npmUser": {
|
||||
"name": "alexindigo",
|
||||
"email": "iam@alexindigo.com"
|
||||
},
|
||||
"_npmVersion": "2.15.6",
|
||||
"_phantomChildren": {},
|
||||
"_requested": {
|
||||
"type": "range",
|
||||
"registry": true,
|
||||
"raw": "asynckit@^0.4.0",
|
||||
"scope": null,
|
||||
"escapedName": "asynckit",
|
||||
"name": "asynckit",
|
||||
"escapedName": "asynckit",
|
||||
"rawSpec": "^0.4.0",
|
||||
"spec": ">=0.4.0 <0.5.0",
|
||||
"type": "range"
|
||||
"saveSpec": null,
|
||||
"fetchSpec": "^0.4.0"
|
||||
},
|
||||
"_requiredBy": [
|
||||
"/form-data"
|
||||
],
|
||||
"_resolved": "https://registry.npmjs.org/asynckit/-/asynckit-0.4.0.tgz",
|
||||
"_shasum": "c79ed97f7f34cb8f2ba1bc9790bcc366474b4b79",
|
||||
"_shrinkwrap": null,
|
||||
"_spec": "asynckit@^0.4.0",
|
||||
"_where": "/tank/data/SERVER/zoneadm-master/node_modules/form-data",
|
||||
"_where": "/export/home/matjaz/git/zoneadmin-master/node_modules/form-data",
|
||||
"author": {
|
||||
"name": "Alex Indigo",
|
||||
"email": "iam@alexindigo.com"
|
||||
@ -52,7 +29,9 @@
|
||||
"bugs": {
|
||||
"url": "https://github.com/alexindigo/asynckit/issues"
|
||||
},
|
||||
"bundleDependencies": false,
|
||||
"dependencies": {},
|
||||
"deprecated": false,
|
||||
"description": "Minimal async jobs utility library, with streams support",
|
||||
"devDependencies": {
|
||||
"browserify": "^13.0.0",
|
||||
@ -69,12 +48,6 @@
|
||||
"tap-spec": "^4.1.1",
|
||||
"tape": "^4.5.1"
|
||||
},
|
||||
"directories": {},
|
||||
"dist": {
|
||||
"shasum": "c79ed97f7f34cb8f2ba1bc9790bcc366474b4b79",
|
||||
"tarball": "https://registry.npmjs.org/asynckit/-/asynckit-0.4.0.tgz"
|
||||
},
|
||||
"gitHead": "583a75ed4fe41761b66416bb6e703ebb1f8963bf",
|
||||
"homepage": "https://github.com/alexindigo/asynckit#readme",
|
||||
"keywords": [
|
||||
"async",
|
||||
@ -91,14 +64,7 @@
|
||||
],
|
||||
"license": "MIT",
|
||||
"main": "index.js",
|
||||
"maintainers": [
|
||||
{
|
||||
"name": "alexindigo",
|
||||
"email": "iam@alexindigo.com"
|
||||
}
|
||||
],
|
||||
"name": "asynckit",
|
||||
"optionalDependencies": {},
|
||||
"pre-commit": [
|
||||
"clean",
|
||||
"lint",
|
||||
@ -107,7 +73,6 @@
|
||||
"report",
|
||||
"size"
|
||||
],
|
||||
"readme": "ERROR: No README data found!",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git+https://github.com/alexindigo/asynckit.git"
|
||||
|
2
node_modules/aws-sign2/index.js
generated
vendored
2
node_modules/aws-sign2/index.js
generated
vendored
@ -133,7 +133,7 @@ function stringToSign (options) {
|
||||
]
|
||||
return r.join('\n')
|
||||
}
|
||||
module.exports.queryStringToSign = stringToSign
|
||||
module.exports.stringToSign = stringToSign
|
||||
|
||||
/**
|
||||
* Return a string for sign() with the given `options`, but is meant exclusively
|
||||
|
67
node_modules/aws-sign2/package.json
generated
vendored
67
node_modules/aws-sign2/package.json
generated
vendored
@ -1,46 +1,27 @@
|
||||
{
|
||||
"_args": [
|
||||
[
|
||||
{
|
||||
"raw": "aws-sign2@~0.6.0",
|
||||
"scope": null,
|
||||
"escapedName": "aws-sign2",
|
||||
"name": "aws-sign2",
|
||||
"rawSpec": "~0.6.0",
|
||||
"spec": ">=0.6.0 <0.7.0",
|
||||
"type": "range"
|
||||
},
|
||||
"/tank/data/SERVER/zoneadm-master/node_modules/request"
|
||||
]
|
||||
],
|
||||
"_from": "aws-sign2@>=0.6.0 <0.7.0",
|
||||
"_id": "aws-sign2@0.6.0",
|
||||
"_inCache": true,
|
||||
"_from": "aws-sign2@~0.7.0",
|
||||
"_id": "aws-sign2@0.7.0",
|
||||
"_inBundle": false,
|
||||
"_integrity": "sha1-tG6JCTSpWR8tL2+G1+ap8bP+dqg=",
|
||||
"_location": "/aws-sign2",
|
||||
"_nodeVersion": "4.1.2",
|
||||
"_npmUser": {
|
||||
"name": "mikeal",
|
||||
"email": "mikeal.rogers@gmail.com"
|
||||
},
|
||||
"_npmVersion": "2.14.4",
|
||||
"_phantomChildren": {},
|
||||
"_requested": {
|
||||
"raw": "aws-sign2@~0.6.0",
|
||||
"scope": null,
|
||||
"escapedName": "aws-sign2",
|
||||
"type": "range",
|
||||
"registry": true,
|
||||
"raw": "aws-sign2@~0.7.0",
|
||||
"name": "aws-sign2",
|
||||
"rawSpec": "~0.6.0",
|
||||
"spec": ">=0.6.0 <0.7.0",
|
||||
"type": "range"
|
||||
"escapedName": "aws-sign2",
|
||||
"rawSpec": "~0.7.0",
|
||||
"saveSpec": null,
|
||||
"fetchSpec": "~0.7.0"
|
||||
},
|
||||
"_requiredBy": [
|
||||
"/request"
|
||||
],
|
||||
"_resolved": "https://registry.npmjs.org/aws-sign2/-/aws-sign2-0.6.0.tgz",
|
||||
"_shasum": "14342dd38dbcc94d0e5b87d763cd63612c0e794f",
|
||||
"_shrinkwrap": null,
|
||||
"_spec": "aws-sign2@~0.6.0",
|
||||
"_where": "/tank/data/SERVER/zoneadm-master/node_modules/request",
|
||||
"_resolved": "https://registry.npmjs.org/aws-sign2/-/aws-sign2-0.7.0.tgz",
|
||||
"_shasum": "b46e890934a9591f2d2f6f86d7e6a9f1b3fe76a8",
|
||||
"_spec": "aws-sign2@~0.7.0",
|
||||
"_where": "/export/home/matjaz/git/zoneadmin-master/node_modules/request",
|
||||
"author": {
|
||||
"name": "Mikeal Rogers",
|
||||
"email": "mikeal.rogers@gmail.com",
|
||||
@ -49,33 +30,21 @@
|
||||
"bugs": {
|
||||
"url": "https://github.com/mikeal/aws-sign/issues"
|
||||
},
|
||||
"bundleDependencies": false,
|
||||
"dependencies": {},
|
||||
"deprecated": false,
|
||||
"description": "AWS signing. Originally pulled from LearnBoost/knox, maintained as vendor in request, now a standalone module.",
|
||||
"devDependencies": {},
|
||||
"directories": {},
|
||||
"dist": {
|
||||
"shasum": "14342dd38dbcc94d0e5b87d763cd63612c0e794f",
|
||||
"tarball": "https://registry.npmjs.org/aws-sign2/-/aws-sign2-0.6.0.tgz"
|
||||
},
|
||||
"engines": {
|
||||
"node": "*"
|
||||
},
|
||||
"gitHead": "8554bdb41268fa295eb1ee300f4adaa9f7f07fec",
|
||||
"homepage": "https://github.com/mikeal/aws-sign#readme",
|
||||
"license": "Apache-2.0",
|
||||
"main": "index.js",
|
||||
"maintainers": [
|
||||
{
|
||||
"name": "mikeal",
|
||||
"email": "mikeal.rogers@gmail.com"
|
||||
}
|
||||
],
|
||||
"name": "aws-sign2",
|
||||
"optionalDependencies": {},
|
||||
"readme": "ERROR: No README data found!",
|
||||
"repository": {
|
||||
"url": "git+https://github.com/mikeal/aws-sign.git"
|
||||
},
|
||||
"scripts": {},
|
||||
"version": "0.6.0"
|
||||
"version": "0.7.0"
|
||||
}
|
||||
|
21
node_modules/aws4/aws4.js
generated
vendored
21
node_modules/aws4/aws4.js
generated
vendored
@ -118,14 +118,14 @@ RequestSigner.prototype.prepareRequest = function() {
|
||||
if (request.body && !headers['Content-Length'] && !headers['content-length'])
|
||||
headers['Content-Length'] = Buffer.byteLength(request.body)
|
||||
|
||||
if (this.credentials.sessionToken)
|
||||
if (this.credentials.sessionToken && !headers['X-Amz-Security-Token'] && !headers['x-amz-security-token'])
|
||||
headers['X-Amz-Security-Token'] = this.credentials.sessionToken
|
||||
|
||||
if (this.service === 's3')
|
||||
if (this.service === 's3' && !headers['X-Amz-Content-Sha256'] && !headers['x-amz-content-sha256'])
|
||||
headers['X-Amz-Content-Sha256'] = hash(this.request.body || '', 'hex')
|
||||
|
||||
if (headers['X-Amz-Date'])
|
||||
this.datetime = headers['X-Amz-Date']
|
||||
if (headers['X-Amz-Date'] || headers['x-amz-date'])
|
||||
this.datetime = headers['X-Amz-Date'] || headers['x-amz-date']
|
||||
else
|
||||
headers['X-Amz-Date'] = this.getDateTime()
|
||||
}
|
||||
@ -202,13 +202,22 @@ RequestSigner.prototype.canonicalString = function() {
|
||||
|
||||
var pathStr = this.parsedPath.path,
|
||||
query = this.parsedPath.query,
|
||||
headers = this.request.headers,
|
||||
queryStr = '',
|
||||
normalizePath = this.service !== 's3',
|
||||
decodePath = this.service === 's3' || this.request.doNotEncodePath,
|
||||
decodeSlashesInPath = this.service === 's3',
|
||||
firstValOnly = this.service === 's3',
|
||||
bodyHash = this.service === 's3' && this.request.signQuery ? 'UNSIGNED-PAYLOAD' :
|
||||
(this.isCodeCommitGit ? '' : hash(this.request.body || '', 'hex'))
|
||||
bodyHash
|
||||
|
||||
if (this.service === 's3' && this.request.signQuery) {
|
||||
bodyHash = 'UNSIGNED-PAYLOAD'
|
||||
} else if (this.isCodeCommitGit) {
|
||||
bodyHash = ''
|
||||
} else {
|
||||
bodyHash = headers['X-Amz-Content-Sha256'] || headers['x-amz-content-sha256'] ||
|
||||
hash(this.request.body || '', 'hex')
|
||||
}
|
||||
|
||||
if (query) {
|
||||
queryStr = encodeRfc3986(querystring.stringify(Object.keys(query).sort().reduce(function(obj, key) {
|
||||
|
72
node_modules/aws4/package.json
generated
vendored
72
node_modules/aws4/package.json
generated
vendored
@ -1,50 +1,27 @@
|
||||
{
|
||||
"_args": [
|
||||
[
|
||||
{
|
||||
"raw": "aws4@^1.2.1",
|
||||
"scope": null,
|
||||
"escapedName": "aws4",
|
||||
"name": "aws4",
|
||||
"rawSpec": "^1.2.1",
|
||||
"spec": ">=1.2.1 <2.0.0",
|
||||
"type": "range"
|
||||
},
|
||||
"/tank/data/SERVER/zoneadm-master/node_modules/request"
|
||||
]
|
||||
],
|
||||
"_from": "aws4@>=1.2.1 <2.0.0",
|
||||
"_id": "aws4@1.5.0",
|
||||
"_inCache": true,
|
||||
"_from": "aws4@^1.6.0",
|
||||
"_id": "aws4@1.6.0",
|
||||
"_inBundle": false,
|
||||
"_integrity": "sha1-g+9cqGCysy5KDe7e6MdxudtXRx4=",
|
||||
"_location": "/aws4",
|
||||
"_nodeVersion": "4.5.0",
|
||||
"_npmOperationalInternal": {
|
||||
"host": "packages-16-east.internal.npmjs.com",
|
||||
"tmp": "tmp/aws4-1.5.0.tgz_1476226259635_0.2796843808609992"
|
||||
},
|
||||
"_npmUser": {
|
||||
"name": "hichaelmart",
|
||||
"email": "michael.hart.au@gmail.com"
|
||||
},
|
||||
"_npmVersion": "2.15.11",
|
||||
"_phantomChildren": {},
|
||||
"_requested": {
|
||||
"raw": "aws4@^1.2.1",
|
||||
"scope": null,
|
||||
"escapedName": "aws4",
|
||||
"type": "range",
|
||||
"registry": true,
|
||||
"raw": "aws4@^1.6.0",
|
||||
"name": "aws4",
|
||||
"rawSpec": "^1.2.1",
|
||||
"spec": ">=1.2.1 <2.0.0",
|
||||
"type": "range"
|
||||
"escapedName": "aws4",
|
||||
"rawSpec": "^1.6.0",
|
||||
"saveSpec": null,
|
||||
"fetchSpec": "^1.6.0"
|
||||
},
|
||||
"_requiredBy": [
|
||||
"/request"
|
||||
],
|
||||
"_resolved": "https://registry.npmjs.org/aws4/-/aws4-1.5.0.tgz",
|
||||
"_shasum": "0a29ffb79c31c9e712eeb087e8e7a64b4a56d755",
|
||||
"_shrinkwrap": null,
|
||||
"_spec": "aws4@^1.2.1",
|
||||
"_where": "/tank/data/SERVER/zoneadm-master/node_modules/request",
|
||||
"_resolved": "https://registry.npmjs.org/aws4/-/aws4-1.6.0.tgz",
|
||||
"_shasum": "83ef5ca860b2b32e4a0deedee8c771b9db57471e",
|
||||
"_spec": "aws4@^1.6.0",
|
||||
"_where": "/export/home/matjaz/git/zoneadmin-master/node_modules/request",
|
||||
"author": {
|
||||
"name": "Michael Hart",
|
||||
"email": "michael.hart.au@gmail.com",
|
||||
@ -53,18 +30,13 @@
|
||||
"bugs": {
|
||||
"url": "https://github.com/mhart/aws4/issues"
|
||||
},
|
||||
"dependencies": {},
|
||||
"bundleDependencies": false,
|
||||
"deprecated": false,
|
||||
"description": "Signs and prepares requests using AWS Signature Version 4",
|
||||
"devDependencies": {
|
||||
"mocha": "^2.4.5",
|
||||
"should": "^8.2.2"
|
||||
},
|
||||
"directories": {},
|
||||
"dist": {
|
||||
"shasum": "0a29ffb79c31c9e712eeb087e8e7a64b4a56d755",
|
||||
"tarball": "https://registry.npmjs.org/aws4/-/aws4-1.5.0.tgz"
|
||||
},
|
||||
"gitHead": "ba136334ee08884c6042c8578a22e376233eef34",
|
||||
"homepage": "https://github.com/mhart/aws4#readme",
|
||||
"keywords": [
|
||||
"amazon",
|
||||
@ -120,15 +92,7 @@
|
||||
],
|
||||
"license": "MIT",
|
||||
"main": "aws4.js",
|
||||
"maintainers": [
|
||||
{
|
||||
"name": "hichaelmart",
|
||||
"email": "michael.hart.au@gmail.com"
|
||||
}
|
||||
],
|
||||
"name": "aws4",
|
||||
"optionalDependencies": {},
|
||||
"readme": "ERROR: No README data found!",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git+https://github.com/mhart/aws4.git"
|
||||
@ -136,5 +100,5 @@
|
||||
"scripts": {
|
||||
"test": "mocha ./test/fast.js ./test/slow.js -b -t 100s -R list"
|
||||
},
|
||||
"version": "1.5.0"
|
||||
"version": "1.6.0"
|
||||
}
|
||||
|
5
node_modules/bcrypt-pbkdf/index.js
generated
vendored
5
node_modules/bcrypt-pbkdf/index.js
generated
vendored
@ -29,10 +29,7 @@ var crypto_hash_sha512 = require('tweetnacl').lowlevel.crypto_hash;
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* 3. All advertising materials mentioning features or use of this software
|
||||
* must display the following acknowledgement:
|
||||
* This product includes software developed by Niels Provos.
|
||||
* 4. The name of the author may not be used to endorse or promote products
|
||||
* 3. The name of the author may not be used to endorse or promote products
|
||||
* derived from this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
|
||||
|
68
node_modules/bcrypt-pbkdf/package.json
generated
vendored
68
node_modules/bcrypt-pbkdf/package.json
generated
vendored
@ -1,72 +1,36 @@
|
||||
{
|
||||
"_args": [
|
||||
[
|
||||
{
|
||||
"raw": "bcrypt-pbkdf@^1.0.0",
|
||||
"scope": null,
|
||||
"escapedName": "bcrypt-pbkdf",
|
||||
"name": "bcrypt-pbkdf",
|
||||
"rawSpec": "^1.0.0",
|
||||
"spec": ">=1.0.0 <2.0.0",
|
||||
"type": "range"
|
||||
},
|
||||
"/tank/data/SERVER/zoneadm-master/node_modules/sshpk"
|
||||
]
|
||||
],
|
||||
"_from": "bcrypt-pbkdf@>=1.0.0 <2.0.0",
|
||||
"_id": "bcrypt-pbkdf@1.0.0",
|
||||
"_inCache": true,
|
||||
"_from": "bcrypt-pbkdf@^1.0.0",
|
||||
"_id": "bcrypt-pbkdf@1.0.1",
|
||||
"_inBundle": false,
|
||||
"_integrity": "sha1-Y7xdy2EzG5K8Bf1SiVPDNGKgb40=",
|
||||
"_location": "/bcrypt-pbkdf",
|
||||
"_nodeVersion": "0.12.15",
|
||||
"_npmOperationalInternal": {
|
||||
"host": "packages-16-east.internal.npmjs.com",
|
||||
"tmp": "tmp/bcrypt-pbkdf-1.0.0.tgz_1471381825814_0.06877309852279723"
|
||||
},
|
||||
"_npmUser": {
|
||||
"name": "arekinath",
|
||||
"email": "alex@cooperi.net"
|
||||
},
|
||||
"_npmVersion": "3.10.3",
|
||||
"_phantomChildren": {},
|
||||
"_requested": {
|
||||
"type": "range",
|
||||
"registry": true,
|
||||
"raw": "bcrypt-pbkdf@^1.0.0",
|
||||
"scope": null,
|
||||
"escapedName": "bcrypt-pbkdf",
|
||||
"name": "bcrypt-pbkdf",
|
||||
"escapedName": "bcrypt-pbkdf",
|
||||
"rawSpec": "^1.0.0",
|
||||
"spec": ">=1.0.0 <2.0.0",
|
||||
"type": "range"
|
||||
"saveSpec": null,
|
||||
"fetchSpec": "^1.0.0"
|
||||
},
|
||||
"_requiredBy": [
|
||||
"/sshpk"
|
||||
],
|
||||
"_resolved": "https://registry.npmjs.org/bcrypt-pbkdf/-/bcrypt-pbkdf-1.0.0.tgz",
|
||||
"_shasum": "3ca76b85241c7170bf7d9703e7b9aa74630040d4",
|
||||
"_shrinkwrap": null,
|
||||
"_resolved": "https://registry.npmjs.org/bcrypt-pbkdf/-/bcrypt-pbkdf-1.0.1.tgz",
|
||||
"_shasum": "63bc5dcb61331b92bc05fd528953c33462a06f8d",
|
||||
"_spec": "bcrypt-pbkdf@^1.0.0",
|
||||
"_where": "/tank/data/SERVER/zoneadm-master/node_modules/sshpk",
|
||||
"_where": "/export/home/matjaz/git/zoneadmin-master/node_modules/sshpk",
|
||||
"bundleDependencies": false,
|
||||
"dependencies": {
|
||||
"tweetnacl": "^0.14.3"
|
||||
},
|
||||
"deprecated": false,
|
||||
"description": "Port of the OpenBSD bcrypt_pbkdf function to pure JS",
|
||||
"devDependencies": {},
|
||||
"directories": {},
|
||||
"dist": {
|
||||
"shasum": "3ca76b85241c7170bf7d9703e7b9aa74630040d4",
|
||||
"tarball": "https://registry.npmjs.org/bcrypt-pbkdf/-/bcrypt-pbkdf-1.0.0.tgz"
|
||||
},
|
||||
"gitHead": "e88be37d3cd25395b4aa496ac468b33671368be6",
|
||||
"license": "BSD-4-Clause",
|
||||
"license": "BSD-3-Clause",
|
||||
"main": "index.js",
|
||||
"maintainers": [
|
||||
{
|
||||
"name": "arekinath",
|
||||
"email": "alex@cooperi.net"
|
||||
}
|
||||
],
|
||||
"name": "bcrypt-pbkdf",
|
||||
"optionalDependencies": {},
|
||||
"readme": "ERROR: No README data found!",
|
||||
"scripts": {},
|
||||
"version": "1.0.0"
|
||||
"version": "1.0.1"
|
||||
}
|
||||
|
18
node_modules/boom/.npmignore
generated
vendored
18
node_modules/boom/.npmignore
generated
vendored
@ -1,18 +0,0 @@
|
||||
.idea
|
||||
*.iml
|
||||
npm-debug.log
|
||||
dump.rdb
|
||||
node_modules
|
||||
results.tap
|
||||
results.xml
|
||||
npm-shrinkwrap.json
|
||||
config.json
|
||||
.DS_Store
|
||||
*/.DS_Store
|
||||
*/*/.DS_Store
|
||||
._*
|
||||
*/._*
|
||||
*/*/._*
|
||||
coverage.*
|
||||
lib-cov
|
||||
|
8
node_modules/boom/.travis.yml
generated
vendored
8
node_modules/boom/.travis.yml
generated
vendored
@ -1,8 +0,0 @@
|
||||
language: node_js
|
||||
|
||||
node_js:
|
||||
- 0.10
|
||||
- 4.0
|
||||
|
||||
sudo: false
|
||||
|
1
node_modules/boom/CONTRIBUTING.md
generated
vendored
1
node_modules/boom/CONTRIBUTING.md
generated
vendored
@ -1 +0,0 @@
|
||||
Please view our [hapijs contributing guide](https://github.com/hapijs/hapi/blob/master/CONTRIBUTING.md).
|
3
node_modules/boom/LICENSE
generated
vendored
3
node_modules/boom/LICENSE
generated
vendored
@ -1,4 +1,5 @@
|
||||
Copyright (c) 2012-2014, Walmart and other contributors.
|
||||
Copyright (c) 2012-2017, Project contributors.
|
||||
Copyright (c) 2012-2014, Walmart.
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
|
196
node_modules/boom/README.md
generated
vendored
196
node_modules/boom/README.md
generated
vendored
@ -2,11 +2,54 @@
|
||||
|
||||
HTTP-friendly error objects
|
||||
|
||||
[](http://travis-ci.org/hapijs/boom)
|
||||
[](http://travis-ci.org/hapijs/boom)
|
||||
[](https://www.npmjs.com/package/boom)
|
||||
|
||||
Lead Maintainer: [Adam Bretz](https://github.com/arb)
|
||||
|
||||
<!-- toc -->
|
||||
|
||||
- [Boom](#boom)
|
||||
- [Helper Methods](#helper-methods)
|
||||
- [`wrap(error, [statusCode], [message])`](#wraperror-statuscode-message)
|
||||
- [`create(statusCode, [message], [data])`](#createstatuscode-message-data)
|
||||
- [HTTP 4xx Errors](#http-4xx-errors)
|
||||
- [`Boom.badRequest([message], [data])`](#boombadrequestmessage-data)
|
||||
- [`Boom.unauthorized([message], [scheme], [attributes])`](#boomunauthorizedmessage-scheme-attributes)
|
||||
- [`Boom.paymentRequired([message], [data])`](#boompaymentrequiredmessage-data)
|
||||
- [`Boom.forbidden([message], [data])`](#boomforbiddenmessage-data)
|
||||
- [`Boom.notFound([message], [data])`](#boomnotfoundmessage-data)
|
||||
- [`Boom.methodNotAllowed([message], [data], [allow])`](#boommethodnotallowedmessage-data-allow)
|
||||
- [`Boom.notAcceptable([message], [data])`](#boomnotacceptablemessage-data)
|
||||
- [`Boom.proxyAuthRequired([message], [data])`](#boomproxyauthrequiredmessage-data)
|
||||
- [`Boom.clientTimeout([message], [data])`](#boomclienttimeoutmessage-data)
|
||||
- [`Boom.conflict([message], [data])`](#boomconflictmessage-data)
|
||||
- [`Boom.resourceGone([message], [data])`](#boomresourcegonemessage-data)
|
||||
- [`Boom.lengthRequired([message], [data])`](#boomlengthrequiredmessage-data)
|
||||
- [`Boom.preconditionFailed([message], [data])`](#boompreconditionfailedmessage-data)
|
||||
- [`Boom.entityTooLarge([message], [data])`](#boomentitytoolargemessage-data)
|
||||
- [`Boom.uriTooLong([message], [data])`](#boomuritoolongmessage-data)
|
||||
- [`Boom.unsupportedMediaType([message], [data])`](#boomunsupportedmediatypemessage-data)
|
||||
- [`Boom.rangeNotSatisfiable([message], [data])`](#boomrangenotsatisfiablemessage-data)
|
||||
- [`Boom.expectationFailed([message], [data])`](#boomexpectationfailedmessage-data)
|
||||
- [`Boom.teapot([message], [data])`](#boomteapotmessage-data)
|
||||
- [`Boom.badData([message], [data])`](#boombaddatamessage-data)
|
||||
- [`Boom.locked([message], [data])`](#boomlockedmessage-data)
|
||||
- [`Boom.preconditionRequired([message], [data])`](#boompreconditionrequiredmessage-data)
|
||||
- [`Boom.tooManyRequests([message], [data])`](#boomtoomanyrequestsmessage-data)
|
||||
- [`Boom.illegal([message], [data])`](#boomillegalmessage-data)
|
||||
- [HTTP 5xx Errors](#http-5xx-errors)
|
||||
- [`Boom.badImplementation([message], [data])` - (*alias: `internal`*)](#boombadimplementationmessage-data---alias-internal)
|
||||
- [`Boom.notImplemented([message], [data])`](#boomnotimplementedmessage-data)
|
||||
- [`Boom.badGateway([message], [data])`](#boombadgatewaymessage-data)
|
||||
- [`Boom.serverUnavailable([message], [data])`](#boomserverunavailablemessage-data)
|
||||
- [`Boom.gatewayTimeout([message], [data])`](#boomgatewaytimeoutmessage-data)
|
||||
- [F.A.Q.](#faq)
|
||||
|
||||
<!-- tocstop -->
|
||||
|
||||
# Boom
|
||||
|
||||
**boom** provides a set of utilities for returning HTTP errors. Each utility returns a `Boom` error response
|
||||
object (instance of `Error`) which includes the following properties:
|
||||
- `isBoom` - if `true`, indicates this is a `Boom` object instance.
|
||||
@ -27,41 +70,6 @@ object (instance of `Error`) which includes the following properties:
|
||||
The `Boom` object also supports the following method:
|
||||
- `reformat()` - rebuilds `error.output` using the other object properties.
|
||||
|
||||
## Overview
|
||||
|
||||
- Helper methods
|
||||
- [`wrap(error, [statusCode], [message])`](#wraperror-statuscode-message)
|
||||
- [`create(statusCode, [message], [data])`](#createstatuscode-message-data)
|
||||
- HTTP 4xx Errors
|
||||
- 400: [`Boom.badRequest([message], [data])`](#boombadrequestmessage-data)
|
||||
- 401: [`Boom.unauthorized([message], [scheme], [attributes])`](#boomunauthorizedmessage-scheme-attributes)
|
||||
- 403: [`Boom.forbidden([message], [data])`](#boomforbiddenmessage-data)
|
||||
- 404: [`Boom.notFound([message], [data])`](#boomnotfoundmessage-data)
|
||||
- 405: [`Boom.methodNotAllowed([message], [data])`](#boommethodnotallowedmessage-data)
|
||||
- 406: [`Boom.notAcceptable([message], [data])`](#boomnotacceptablemessage-data)
|
||||
- 407: [`Boom.proxyAuthRequired([message], [data])`](#boomproxyauthrequiredmessage-data)
|
||||
- 408: [`Boom.clientTimeout([message], [data])`](#boomclienttimeoutmessage-data)
|
||||
- 409: [`Boom.conflict([message], [data])`](#boomconflictmessage-data)
|
||||
- 410: [`Boom.resourceGone([message], [data])`](#boomresourcegonemessage-data)
|
||||
- 411: [`Boom.lengthRequired([message], [data])`](#boomlengthrequiredmessage-data)
|
||||
- 412: [`Boom.preconditionFailed([message], [data])`](#boompreconditionfailedmessage-data)
|
||||
- 413: [`Boom.entityTooLarge([message], [data])`](#boomentitytoolargemessage-data)
|
||||
- 414: [`Boom.uriTooLong([message], [data])`](#boomuritoolongmessage-data)
|
||||
- 415: [`Boom.unsupportedMediaType([message], [data])`](#boomunsupportedmediatypemessage-data)
|
||||
- 416: [`Boom.rangeNotSatisfiable([message], [data])`](#boomrangenotsatisfiablemessage-data)
|
||||
- 417: [`Boom.expectationFailed([message], [data])`](#boomexpectationfailedmessage-data)
|
||||
- 422: [`Boom.badData([message], [data])`](#boombaddatamessage-data)
|
||||
- 428: [`Boom.preconditionRequired([message], [data])`](#boompreconditionrequiredmessage-data)
|
||||
- 429: [`Boom.tooManyRequests([message], [data])`](#boomtoomanyrequestsmessage-data)
|
||||
- HTTP 5xx Errors
|
||||
- 500: [`Boom.badImplementation([message], [data])`](#boombadimplementationmessage-data)
|
||||
- 501: [`Boom.notImplemented([message], [data])`](#boomnotimplementedmessage-data)
|
||||
- 502: [`Boom.badGateway([message], [data])`](#boombadgatewaymessage-data)
|
||||
- 503: [`Boom.serverTimeout([message], [data])`](#boomservertimeoutmessage-data)
|
||||
- 504: [`Boom.gatewayTimeout([message], [data])`](#boomgatewaytimeoutmessage-data)
|
||||
- [FAQ](#faq)
|
||||
|
||||
|
||||
## Helper Methods
|
||||
|
||||
### `wrap(error, [statusCode], [message])`
|
||||
@ -118,8 +126,8 @@ Returns a 401 Unauthorized error where:
|
||||
- an authentication scheme name
|
||||
- an array of string values. These values will be separated by ', ' and set to the 'WWW-Authenticate' header.
|
||||
- `attributes` - an object of values to use while setting the 'WWW-Authenticate' header. This value is only used
|
||||
when `schema` is a string, otherwise it is ignored. Every key/value pair will be included in the
|
||||
'WWW-Authenticate' in the format of 'key="value"' as well as in the response payload under the `attributes` key.
|
||||
when `scheme` is a string, otherwise it is ignored. Every key/value pair will be included in the
|
||||
'WWW-Authenticate' in the format of 'key="value"' as well as in the response payload under the `attributes` key. Alternatively value can be a string which is use to set the value of the scheme, for example setting the token value for negotiate header. If string is used message parameter must be null.
|
||||
`null` and `undefined` will be replaced with an empty string. If `attributes` is set, `message` will be used as
|
||||
the 'error' segment of the 'WWW-Authenticate' header. If `message` is unset, the 'error' segment of the header
|
||||
will not be present and `isMissing` will be true on the error object.
|
||||
@ -161,6 +169,23 @@ Generates the following response:
|
||||
}
|
||||
```
|
||||
|
||||
```js
|
||||
Boom.unauthorized(null, 'Negotiate', 'VGhpcyBpcyBhIHRlc3QgdG9rZW4=');
|
||||
```
|
||||
|
||||
Generates the following response:
|
||||
|
||||
```json
|
||||
"payload": {
|
||||
"statusCode": 401,
|
||||
"error": "Unauthorized",
|
||||
"attributes": "VGhpcyBpcyBhIHRlc3QgdG9rZW4="
|
||||
},
|
||||
"headers" {
|
||||
"WWW-Authenticate": "Negotiate VGhpcyBpcyBhIHRlc3QgdG9rZW4="
|
||||
}
|
||||
```
|
||||
|
||||
```js
|
||||
Boom.unauthorized('invalid password', 'sample', { ttl: 0, cache: null, foo: 'bar' });
|
||||
```
|
||||
@ -184,6 +209,26 @@ Generates the following response:
|
||||
}
|
||||
```
|
||||
|
||||
### `Boom.paymentRequired([message], [data])`
|
||||
|
||||
Returns a 402 Payment Required error where:
|
||||
- `message` - optional message.
|
||||
- `data` - optional additional error data.
|
||||
|
||||
```js
|
||||
Boom.paymentRequired('bandwidth used');
|
||||
```
|
||||
|
||||
Generates the following response payload:
|
||||
|
||||
```json
|
||||
{
|
||||
"statusCode": 402,
|
||||
"error": "Payment Required",
|
||||
"message": "bandwidth used"
|
||||
}
|
||||
```
|
||||
|
||||
### `Boom.forbidden([message], [data])`
|
||||
|
||||
Returns a 403 Forbidden error where:
|
||||
@ -224,11 +269,12 @@ Generates the following response payload:
|
||||
}
|
||||
```
|
||||
|
||||
### `Boom.methodNotAllowed([message], [data])`
|
||||
### `Boom.methodNotAllowed([message], [data], [allow])`
|
||||
|
||||
Returns a 405 Method Not Allowed error where:
|
||||
- `message` - optional message.
|
||||
- `data` - optional additional error data.
|
||||
- `allow` - optional string or array of strings (to be combined and separated by ', ') which is set to the 'Allow' header.
|
||||
|
||||
```js
|
||||
Boom.methodNotAllowed('that method is not allowed');
|
||||
@ -482,6 +528,26 @@ Generates the following response payload:
|
||||
}
|
||||
```
|
||||
|
||||
### `Boom.teapot([message], [data])`
|
||||
|
||||
Returns a 418 I'm a Teapot error where:
|
||||
- `message` - optional message.
|
||||
- `data` - optional additional error data.
|
||||
|
||||
```js
|
||||
Boom.teapot('sorry, no coffee...');
|
||||
```
|
||||
|
||||
Generates the following response payload:
|
||||
|
||||
```json
|
||||
{
|
||||
"statusCode": 418,
|
||||
"error": "I'm a Teapot",
|
||||
"message": "Sorry, no coffee..."
|
||||
}
|
||||
```
|
||||
|
||||
### `Boom.badData([message], [data])`
|
||||
|
||||
Returns a 422 Unprocessable Entity error where:
|
||||
@ -502,6 +568,26 @@ Generates the following response payload:
|
||||
}
|
||||
```
|
||||
|
||||
### `Boom.locked([message], [data])`
|
||||
|
||||
Returns a 423 Locked error where:
|
||||
- `message` - optional message.
|
||||
- `data` - optional additional error data.
|
||||
|
||||
```js
|
||||
Boom.locked('this resource has been locked');
|
||||
```
|
||||
|
||||
Generates the following response payload:
|
||||
|
||||
```json
|
||||
{
|
||||
"statusCode": 423,
|
||||
"error": "Locked",
|
||||
"message": "this resource has been locked"
|
||||
}
|
||||
```
|
||||
|
||||
### `Boom.preconditionRequired([message], [data])`
|
||||
|
||||
Returns a 428 Precondition Required error where:
|
||||
@ -542,11 +628,31 @@ Generates the following response payload:
|
||||
}
|
||||
```
|
||||
|
||||
### `Boom.illegal([message], [data])`
|
||||
|
||||
Returns a 451 Unavailable For Legal Reasons error where:
|
||||
- `message` - optional message.
|
||||
- `data` - optional additional error data.
|
||||
|
||||
```js
|
||||
Boom.illegal('you are not permitted to view this resource for legal reasons');
|
||||
```
|
||||
|
||||
Generates the following response payload:
|
||||
|
||||
```json
|
||||
{
|
||||
"statusCode": 451,
|
||||
"error": "Unavailable For Legal Reasons",
|
||||
"message": "you are not permitted to view this resource for legal reasons"
|
||||
}
|
||||
```
|
||||
|
||||
## HTTP 5xx Errors
|
||||
|
||||
All 500 errors hide your message from the end user. Your message is recorded in the server log.
|
||||
|
||||
### `Boom.badImplementation([message], [data])`
|
||||
### `Boom.badImplementation([message], [data])` - (*alias: `internal`*)
|
||||
|
||||
Returns a 500 Internal Server Error error where:
|
||||
- `message` - optional message.
|
||||
@ -606,14 +712,14 @@ Generates the following response payload:
|
||||
}
|
||||
```
|
||||
|
||||
### `Boom.serverTimeout([message], [data])`
|
||||
### `Boom.serverUnavailable([message], [data])`
|
||||
|
||||
Returns a 503 Service Unavailable error where:
|
||||
- `message` - optional message.
|
||||
- `data` - optional additional error data.
|
||||
|
||||
```js
|
||||
Boom.serverTimeout('unavailable');
|
||||
Boom.serverUnavailable('unavailable');
|
||||
```
|
||||
|
||||
Generates the following response payload:
|
||||
@ -647,6 +753,8 @@ Generates the following response payload:
|
||||
|
||||
## F.A.Q.
|
||||
|
||||
###### How do I include extra information in my responses? `output.payload` is missing `data`, what gives?
|
||||
**Q** How do I include extra information in my responses? `output.payload` is missing `data`, what gives?
|
||||
|
||||
There is a reason the values passed back in the response payloads are pretty locked down. It's mostly for security and to not leak any important information back to the client. This means you will need to put in a little more effort to include extra information about your custom error. Check out the ["Error transformation"](https://github.com/hapijs/hapi/blob/master/API.md#error-transformation) section in the hapi documentation.
|
||||
**A** There is a reason the values passed back in the response payloads are pretty locked down. It's mostly for security and to not leak any important information back to the client. This means you will need to put in a little more effort to include extra information about your custom error. Check out the ["Error transformation"](https://github.com/hapijs/hapi/blob/master/API.md#error-transformation) section in the hapi documentation.
|
||||
|
||||
---
|
||||
|
BIN
node_modules/boom/images/boom.png
generated
vendored
BIN
node_modules/boom/images/boom.png
generated
vendored
Binary file not shown.
Before Width: | Height: | Size: 29 KiB |
185
node_modules/boom/lib/index.js
generated
vendored
185
node_modules/boom/lib/index.js
generated
vendored
@ -1,16 +1,80 @@
|
||||
'use strict';
|
||||
|
||||
// Load modules
|
||||
|
||||
var Http = require('http');
|
||||
var Hoek = require('hoek');
|
||||
const Hoek = require('hoek');
|
||||
|
||||
|
||||
// Declare internals
|
||||
|
||||
var internals = {};
|
||||
const internals = {
|
||||
STATUS_CODES: Object.setPrototypeOf({
|
||||
'100': 'Continue',
|
||||
'101': 'Switching Protocols',
|
||||
'102': 'Processing',
|
||||
'200': 'OK',
|
||||
'201': 'Created',
|
||||
'202': 'Accepted',
|
||||
'203': 'Non-Authoritative Information',
|
||||
'204': 'No Content',
|
||||
'205': 'Reset Content',
|
||||
'206': 'Partial Content',
|
||||
'207': 'Multi-Status',
|
||||
'300': 'Multiple Choices',
|
||||
'301': 'Moved Permanently',
|
||||
'302': 'Moved Temporarily',
|
||||
'303': 'See Other',
|
||||
'304': 'Not Modified',
|
||||
'305': 'Use Proxy',
|
||||
'307': 'Temporary Redirect',
|
||||
'400': 'Bad Request',
|
||||
'401': 'Unauthorized',
|
||||
'402': 'Payment Required',
|
||||
'403': 'Forbidden',
|
||||
'404': 'Not Found',
|
||||
'405': 'Method Not Allowed',
|
||||
'406': 'Not Acceptable',
|
||||
'407': 'Proxy Authentication Required',
|
||||
'408': 'Request Time-out',
|
||||
'409': 'Conflict',
|
||||
'410': 'Gone',
|
||||
'411': 'Length Required',
|
||||
'412': 'Precondition Failed',
|
||||
'413': 'Request Entity Too Large',
|
||||
'414': 'Request-URI Too Large',
|
||||
'415': 'Unsupported Media Type',
|
||||
'416': 'Requested Range Not Satisfiable',
|
||||
'417': 'Expectation Failed',
|
||||
'418': 'I\'m a teapot',
|
||||
'422': 'Unprocessable Entity',
|
||||
'423': 'Locked',
|
||||
'424': 'Failed Dependency',
|
||||
'425': 'Unordered Collection',
|
||||
'426': 'Upgrade Required',
|
||||
'428': 'Precondition Required',
|
||||
'429': 'Too Many Requests',
|
||||
'431': 'Request Header Fields Too Large',
|
||||
'451': 'Unavailable For Legal Reasons',
|
||||
'500': 'Internal Server Error',
|
||||
'501': 'Not Implemented',
|
||||
'502': 'Bad Gateway',
|
||||
'503': 'Service Unavailable',
|
||||
'504': 'Gateway Time-out',
|
||||
'505': 'HTTP Version Not Supported',
|
||||
'506': 'Variant Also Negotiates',
|
||||
'507': 'Insufficient Storage',
|
||||
'509': 'Bandwidth Limit Exceeded',
|
||||
'510': 'Not Extended',
|
||||
'511': 'Network Authentication Required'
|
||||
}, null)
|
||||
};
|
||||
|
||||
|
||||
exports.wrap = function (error, statusCode, message) {
|
||||
|
||||
Hoek.assert(error instanceof Error, 'Cannot wrap non-Error object');
|
||||
Hoek.assert(!error.isBoom || (!statusCode && !message), 'Cannot provide statusCode or message with boom error');
|
||||
|
||||
return (error.isBoom ? error : internals.initialize(error, statusCode || 500, message));
|
||||
};
|
||||
|
||||
@ -20,18 +84,27 @@ exports.create = function (statusCode, message, data) {
|
||||
return internals.create(statusCode, message, data, exports.create);
|
||||
};
|
||||
|
||||
|
||||
internals.create = function (statusCode, message, data, ctor) {
|
||||
|
||||
var error = new Error(message ? message : undefined); // Avoids settings null message
|
||||
if (message instanceof Error) {
|
||||
if (data) {
|
||||
message.data = data;
|
||||
}
|
||||
return exports.wrap(message, statusCode);
|
||||
}
|
||||
|
||||
const error = new Error(message ? message : undefined); // Avoids settings null message
|
||||
Error.captureStackTrace(error, ctor); // Filter the stack to our external API
|
||||
error.data = data || null;
|
||||
internals.initialize(error, statusCode);
|
||||
return error;
|
||||
};
|
||||
|
||||
|
||||
internals.initialize = function (error, statusCode, message) {
|
||||
|
||||
var numberCode = parseInt(statusCode, 10);
|
||||
const numberCode = parseInt(statusCode, 10);
|
||||
Hoek.assert(!isNaN(numberCode) && numberCode >= 400, 'First argument must be a number (400+):', statusCode);
|
||||
|
||||
error.isBoom = true;
|
||||
@ -67,7 +140,7 @@ internals.initialize = function (error, statusCode, message) {
|
||||
internals.reformat = function () {
|
||||
|
||||
this.output.payload.statusCode = this.output.statusCode;
|
||||
this.output.payload.error = Http.STATUS_CODES[this.output.statusCode] || 'Unknown';
|
||||
this.output.payload.error = internals.STATUS_CODES[this.output.statusCode] || 'Unknown';
|
||||
|
||||
if (this.output.statusCode === 500) {
|
||||
this.output.payload.message = 'An internal server error occurred'; // Hide actual error from user
|
||||
@ -88,15 +161,13 @@ exports.badRequest = function (message, data) {
|
||||
|
||||
exports.unauthorized = function (message, scheme, attributes) { // Or function (message, wwwAuthenticate[])
|
||||
|
||||
var err = internals.create(401, message, undefined, exports.unauthorized);
|
||||
const err = internals.create(401, message, undefined, exports.unauthorized);
|
||||
|
||||
if (!scheme) {
|
||||
return err;
|
||||
}
|
||||
|
||||
var wwwAuthenticate = '';
|
||||
var i = 0;
|
||||
var il = 0;
|
||||
let wwwAuthenticate = '';
|
||||
|
||||
if (typeof scheme === 'string') {
|
||||
|
||||
@ -109,29 +180,36 @@ exports.unauthorized = function (message, scheme, attributes) { // Or f
|
||||
}
|
||||
|
||||
if (attributes) {
|
||||
var names = Object.keys(attributes);
|
||||
for (i = 0, il = names.length; i < il; ++i) {
|
||||
var name = names[i];
|
||||
if (i) {
|
||||
wwwAuthenticate += ',';
|
||||
}
|
||||
if (typeof attributes === 'string') {
|
||||
wwwAuthenticate = wwwAuthenticate + ' ' + Hoek.escapeHeaderAttribute(attributes);
|
||||
err.output.payload.attributes = attributes;
|
||||
}
|
||||
else {
|
||||
const names = Object.keys(attributes);
|
||||
for (let i = 0; i < names.length; ++i) {
|
||||
const name = names[i];
|
||||
if (i) {
|
||||
wwwAuthenticate = wwwAuthenticate + ',';
|
||||
}
|
||||
|
||||
var value = attributes[name];
|
||||
if (value === null ||
|
||||
value === undefined) { // Value can be zero
|
||||
let value = attributes[name];
|
||||
if (value === null ||
|
||||
value === undefined) { // Value can be zero
|
||||
|
||||
value = '';
|
||||
value = '';
|
||||
}
|
||||
wwwAuthenticate = wwwAuthenticate + ' ' + name + '="' + Hoek.escapeHeaderAttribute(value.toString()) + '"';
|
||||
err.output.payload.attributes[name] = value;
|
||||
}
|
||||
wwwAuthenticate += ' ' + name + '="' + Hoek.escapeHeaderAttribute(value.toString()) + '"';
|
||||
err.output.payload.attributes[name] = value;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (message) {
|
||||
if (attributes) {
|
||||
wwwAuthenticate += ',';
|
||||
wwwAuthenticate = wwwAuthenticate + ',';
|
||||
}
|
||||
wwwAuthenticate += ' error="' + Hoek.escapeHeaderAttribute(message) + '"';
|
||||
wwwAuthenticate = wwwAuthenticate + ' error="' + Hoek.escapeHeaderAttribute(message) + '"';
|
||||
err.output.payload.attributes.error = message;
|
||||
}
|
||||
else {
|
||||
@ -142,13 +220,13 @@ exports.unauthorized = function (message, scheme, attributes) { // Or f
|
||||
|
||||
// function (message, wwwAuthenticate[])
|
||||
|
||||
var wwwArray = scheme;
|
||||
for (i = 0, il = wwwArray.length; i < il; ++i) {
|
||||
const wwwArray = scheme;
|
||||
for (let i = 0; i < wwwArray.length; ++i) {
|
||||
if (i) {
|
||||
wwwAuthenticate += ', ';
|
||||
wwwAuthenticate = wwwAuthenticate + ', ';
|
||||
}
|
||||
|
||||
wwwAuthenticate += wwwArray[i];
|
||||
wwwAuthenticate = wwwAuthenticate + wwwArray[i];
|
||||
}
|
||||
}
|
||||
|
||||
@ -158,6 +236,12 @@ exports.unauthorized = function (message, scheme, attributes) { // Or f
|
||||
};
|
||||
|
||||
|
||||
exports.paymentRequired = function (message, data) {
|
||||
|
||||
return internals.create(402, message, data, exports.paymentRequired);
|
||||
};
|
||||
|
||||
|
||||
exports.forbidden = function (message, data) {
|
||||
|
||||
return internals.create(403, message, data, exports.forbidden);
|
||||
@ -170,9 +254,19 @@ exports.notFound = function (message, data) {
|
||||
};
|
||||
|
||||
|
||||
exports.methodNotAllowed = function (message, data) {
|
||||
exports.methodNotAllowed = function (message, data, allow) {
|
||||
|
||||
return internals.create(405, message, data, exports.methodNotAllowed);
|
||||
const err = internals.create(405, message, data, exports.methodNotAllowed);
|
||||
|
||||
if (typeof allow === 'string') {
|
||||
allow = [allow];
|
||||
}
|
||||
|
||||
if (Array.isArray(allow)) {
|
||||
err.output.headers.Allow = allow.join(', ');
|
||||
}
|
||||
|
||||
return err;
|
||||
};
|
||||
|
||||
|
||||
@ -247,12 +341,25 @@ exports.expectationFailed = function (message, data) {
|
||||
return internals.create(417, message, data, exports.expectationFailed);
|
||||
};
|
||||
|
||||
|
||||
exports.teapot = function (message, data) {
|
||||
|
||||
return internals.create(418, message, data, exports.teapot);
|
||||
};
|
||||
|
||||
|
||||
exports.badData = function (message, data) {
|
||||
|
||||
return internals.create(422, message, data, exports.badData);
|
||||
};
|
||||
|
||||
|
||||
exports.locked = function (message, data) {
|
||||
|
||||
return internals.create(423, message, data, exports.locked);
|
||||
};
|
||||
|
||||
|
||||
exports.preconditionRequired = function (message, data) {
|
||||
|
||||
return internals.create(428, message, data, exports.preconditionRequired);
|
||||
@ -265,6 +372,12 @@ exports.tooManyRequests = function (message, data) {
|
||||
};
|
||||
|
||||
|
||||
exports.illegal = function (message, data) {
|
||||
|
||||
return internals.create(451, message, data, exports.illegal);
|
||||
};
|
||||
|
||||
|
||||
// 5xx Server Errors
|
||||
|
||||
exports.internal = function (message, data, statusCode) {
|
||||
@ -272,12 +385,14 @@ exports.internal = function (message, data, statusCode) {
|
||||
return internals.serverError(message, data, statusCode, exports.internal);
|
||||
};
|
||||
|
||||
|
||||
internals.serverError = function (message, data, statusCode, ctor) {
|
||||
|
||||
var error;
|
||||
let error;
|
||||
if (data instanceof Error) {
|
||||
error = exports.wrap(data, statusCode, message);
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
error = internals.create(statusCode || 500, message, undefined, ctor);
|
||||
error.data = data;
|
||||
}
|
||||
@ -298,9 +413,9 @@ exports.badGateway = function (message, data) {
|
||||
};
|
||||
|
||||
|
||||
exports.serverTimeout = function (message, data) {
|
||||
exports.serverUnavailable = function (message, data) {
|
||||
|
||||
return internals.serverError(message, data, 503, exports.serverTimeout);
|
||||
return internals.serverError(message, data, 503, exports.serverUnavailable);
|
||||
};
|
||||
|
||||
|
||||
@ -312,7 +427,7 @@ exports.gatewayTimeout = function (message, data) {
|
||||
|
||||
exports.badImplementation = function (message, data) {
|
||||
|
||||
var err = internals.serverError(message, data, 500, exports.badImplementation);
|
||||
const err = internals.serverError(message, data, 500, exports.badImplementation);
|
||||
err.isDeveloperError = true;
|
||||
return err;
|
||||
};
|
||||
|
91
node_modules/boom/package.json
generated
vendored
91
node_modules/boom/package.json
generated
vendored
@ -1,67 +1,44 @@
|
||||
{
|
||||
"_args": [
|
||||
[
|
||||
{
|
||||
"raw": "boom@2.x.x",
|
||||
"scope": null,
|
||||
"escapedName": "boom",
|
||||
"name": "boom",
|
||||
"rawSpec": "2.x.x",
|
||||
"spec": ">=2.0.0 <3.0.0",
|
||||
"type": "range"
|
||||
},
|
||||
"/tank/data/SERVER/zoneadm-master/node_modules/hawk"
|
||||
]
|
||||
],
|
||||
"_from": "boom@>=2.0.0 <3.0.0",
|
||||
"_id": "boom@2.10.1",
|
||||
"_inCache": true,
|
||||
"_from": "boom@4.x.x",
|
||||
"_id": "boom@4.3.1",
|
||||
"_inBundle": false,
|
||||
"_integrity": "sha1-T4owBctKfjiJ90kDD9JbluAdLjE=",
|
||||
"_location": "/boom",
|
||||
"_nodeVersion": "0.10.40",
|
||||
"_npmUser": {
|
||||
"name": "arb",
|
||||
"email": "arbretz@gmail.com"
|
||||
},
|
||||
"_npmVersion": "2.11.1",
|
||||
"_phantomChildren": {},
|
||||
"_requested": {
|
||||
"raw": "boom@2.x.x",
|
||||
"scope": null,
|
||||
"escapedName": "boom",
|
||||
"type": "range",
|
||||
"registry": true,
|
||||
"raw": "boom@4.x.x",
|
||||
"name": "boom",
|
||||
"rawSpec": "2.x.x",
|
||||
"spec": ">=2.0.0 <3.0.0",
|
||||
"type": "range"
|
||||
"escapedName": "boom",
|
||||
"rawSpec": "4.x.x",
|
||||
"saveSpec": null,
|
||||
"fetchSpec": "4.x.x"
|
||||
},
|
||||
"_requiredBy": [
|
||||
"/cryptiles",
|
||||
"/hawk"
|
||||
],
|
||||
"_resolved": "https://registry.npmjs.org/boom/-/boom-2.10.1.tgz",
|
||||
"_shasum": "39c8918ceff5799f83f9492a848f625add0c766f",
|
||||
"_shrinkwrap": null,
|
||||
"_spec": "boom@2.x.x",
|
||||
"_where": "/tank/data/SERVER/zoneadm-master/node_modules/hawk",
|
||||
"_resolved": "https://registry.npmjs.org/boom/-/boom-4.3.1.tgz",
|
||||
"_shasum": "4f8a3005cb4a7e3889f749030fd25b96e01d2e31",
|
||||
"_spec": "boom@4.x.x",
|
||||
"_where": "/export/home/matjaz/git/zoneadmin-master/node_modules/hawk",
|
||||
"bugs": {
|
||||
"url": "https://github.com/hapijs/boom/issues"
|
||||
},
|
||||
"bundleDependencies": false,
|
||||
"dependencies": {
|
||||
"hoek": "2.x.x"
|
||||
"hoek": "4.x.x"
|
||||
},
|
||||
"deprecated": false,
|
||||
"description": "HTTP-friendly error objects",
|
||||
"devDependencies": {
|
||||
"code": "1.x.x",
|
||||
"lab": "7.x.x"
|
||||
},
|
||||
"directories": {},
|
||||
"dist": {
|
||||
"shasum": "39c8918ceff5799f83f9492a848f625add0c766f",
|
||||
"tarball": "https://registry.npmjs.org/boom/-/boom-2.10.1.tgz"
|
||||
"code": "4.x.x",
|
||||
"lab": "13.x.x",
|
||||
"markdown-toc": "0.12.x"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=0.10.40"
|
||||
"node": ">=4.0.0"
|
||||
},
|
||||
"gitHead": "ff1a662a86b39426cdd18f4441b112d307a34a6f",
|
||||
"homepage": "https://github.com/hapijs/boom#readme",
|
||||
"keywords": [
|
||||
"error",
|
||||
@ -69,30 +46,16 @@
|
||||
],
|
||||
"license": "BSD-3-Clause",
|
||||
"main": "lib/index.js",
|
||||
"maintainers": [
|
||||
{
|
||||
"name": "hueniverse",
|
||||
"email": "eran@hueniverse.com"
|
||||
},
|
||||
{
|
||||
"name": "wyatt",
|
||||
"email": "wpreul@gmail.com"
|
||||
},
|
||||
{
|
||||
"name": "arb",
|
||||
"email": "arbretz@gmail.com"
|
||||
}
|
||||
],
|
||||
"name": "boom",
|
||||
"optionalDependencies": {},
|
||||
"readme": "ERROR: No README data found!",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git://github.com/hapijs/boom.git"
|
||||
},
|
||||
"scripts": {
|
||||
"test": "lab -a code -t 100 -L",
|
||||
"test-cov-html": "lab -a code -r html -o coverage.html -L"
|
||||
"test": "lab -a code -t 100 -L -v",
|
||||
"test-cov-html": "lab -a code -r html -o coverage.html -L",
|
||||
"toc": "node generate-toc.js",
|
||||
"version": "npm run toc && git add README.md"
|
||||
},
|
||||
"version": "2.10.1"
|
||||
"version": "4.3.1"
|
||||
}
|
||||
|
654
node_modules/boom/test/index.js
generated
vendored
654
node_modules/boom/test/index.js
generated
vendored
@ -1,654 +0,0 @@
|
||||
// Load modules
|
||||
|
||||
var Code = require('code');
|
||||
var Boom = require('../lib');
|
||||
var Lab = require('lab');
|
||||
|
||||
|
||||
// Declare internals
|
||||
|
||||
var internals = {};
|
||||
|
||||
|
||||
// Test shortcuts
|
||||
|
||||
var lab = exports.lab = Lab.script();
|
||||
var describe = lab.describe;
|
||||
var it = lab.it;
|
||||
var expect = Code.expect;
|
||||
|
||||
|
||||
it('returns the same object when already boom', function (done) {
|
||||
|
||||
var error = Boom.badRequest();
|
||||
var wrapped = Boom.wrap(error);
|
||||
expect(error).to.equal(wrapped);
|
||||
done();
|
||||
});
|
||||
|
||||
it('returns an error with info when constructed using another error', function (done) {
|
||||
|
||||
var error = new Error('ka-boom');
|
||||
error.xyz = 123;
|
||||
var err = Boom.wrap(error);
|
||||
expect(err.xyz).to.equal(123);
|
||||
expect(err.message).to.equal('ka-boom');
|
||||
expect(err.output).to.deep.equal({
|
||||
statusCode: 500,
|
||||
payload: {
|
||||
statusCode: 500,
|
||||
error: 'Internal Server Error',
|
||||
message: 'An internal server error occurred'
|
||||
},
|
||||
headers: {}
|
||||
});
|
||||
expect(err.data).to.equal(null);
|
||||
done();
|
||||
});
|
||||
|
||||
it('does not override data when constructed using another error', function (done) {
|
||||
|
||||
var error = new Error('ka-boom');
|
||||
error.data = { useful: 'data' };
|
||||
var err = Boom.wrap(error);
|
||||
expect(err.data).to.equal(error.data);
|
||||
done();
|
||||
});
|
||||
|
||||
it('sets new message when none exists', function (done) {
|
||||
|
||||
var error = new Error();
|
||||
var wrapped = Boom.wrap(error, 400, 'something bad');
|
||||
expect(wrapped.message).to.equal('something bad');
|
||||
done();
|
||||
});
|
||||
|
||||
it('throws when statusCode is not a number', function (done) {
|
||||
|
||||
expect(function () {
|
||||
|
||||
Boom.create('x');
|
||||
}).to.throw('First argument must be a number (400+): x');
|
||||
done();
|
||||
});
|
||||
|
||||
it('will cast a number-string to an integer', function (done) {
|
||||
|
||||
var codes = [
|
||||
{ input: '404', result: 404 },
|
||||
{ input: '404.1', result: 404 },
|
||||
{ input: 400, result: 400 },
|
||||
{ input: 400.123, result: 400 }];
|
||||
for (var i = 0, il = codes.length; i < il; ++i) {
|
||||
var code = codes[i];
|
||||
var err = Boom.create(code.input);
|
||||
expect(err.output.statusCode).to.equal(code.result);
|
||||
}
|
||||
|
||||
done();
|
||||
});
|
||||
|
||||
it('throws when statusCode is not finite', function (done) {
|
||||
|
||||
expect(function () {
|
||||
|
||||
Boom.create(1 / 0);
|
||||
}).to.throw('First argument must be a number (400+): null');
|
||||
done();
|
||||
});
|
||||
|
||||
it('sets error code to unknown', function (done) {
|
||||
|
||||
var err = Boom.create(999);
|
||||
expect(err.output.payload.error).to.equal('Unknown');
|
||||
done();
|
||||
});
|
||||
|
||||
describe('create()', function () {
|
||||
|
||||
it('does not sets null message', function (done) {
|
||||
|
||||
var error = Boom.unauthorized(null);
|
||||
expect(error.output.payload.message).to.not.exist();
|
||||
expect(error.isServer).to.be.false();
|
||||
done();
|
||||
});
|
||||
|
||||
it('sets message and data', function (done) {
|
||||
|
||||
var error = Boom.badRequest('Missing data', { type: 'user' });
|
||||
expect(error.data.type).to.equal('user');
|
||||
expect(error.output.payload.message).to.equal('Missing data');
|
||||
done();
|
||||
});
|
||||
});
|
||||
|
||||
describe('isBoom()', function () {
|
||||
|
||||
it('returns true for Boom object', function (done) {
|
||||
|
||||
expect(Boom.badRequest().isBoom).to.equal(true);
|
||||
done();
|
||||
});
|
||||
|
||||
it('returns false for Error object', function (done) {
|
||||
|
||||
expect((new Error()).isBoom).to.not.exist();
|
||||
done();
|
||||
});
|
||||
});
|
||||
|
||||
describe('badRequest()', function () {
|
||||
|
||||
it('returns a 400 error statusCode', function (done) {
|
||||
|
||||
var error = Boom.badRequest();
|
||||
|
||||
expect(error.output.statusCode).to.equal(400);
|
||||
expect(error.isServer).to.be.false();
|
||||
done();
|
||||
});
|
||||
|
||||
it('sets the message with the passed in message', function (done) {
|
||||
|
||||
expect(Boom.badRequest('my message').message).to.equal('my message');
|
||||
done();
|
||||
});
|
||||
|
||||
it('sets the message to HTTP status if none provided', function (done) {
|
||||
|
||||
expect(Boom.badRequest().message).to.equal('Bad Request');
|
||||
done();
|
||||
});
|
||||
});
|
||||
|
||||
describe('unauthorized()', function () {
|
||||
|
||||
it('returns a 401 error statusCode', function (done) {
|
||||
|
||||
var err = Boom.unauthorized();
|
||||
expect(err.output.statusCode).to.equal(401);
|
||||
expect(err.output.headers).to.deep.equal({});
|
||||
done();
|
||||
});
|
||||
|
||||
it('sets the message with the passed in message', function (done) {
|
||||
|
||||
expect(Boom.unauthorized('my message').message).to.equal('my message');
|
||||
done();
|
||||
});
|
||||
|
||||
it('returns a WWW-Authenticate header when passed a scheme', function (done) {
|
||||
|
||||
var err = Boom.unauthorized('boom', 'Test');
|
||||
expect(err.output.statusCode).to.equal(401);
|
||||
expect(err.output.headers['WWW-Authenticate']).to.equal('Test error="boom"');
|
||||
done();
|
||||
});
|
||||
|
||||
it('returns a WWW-Authenticate header set to the schema array value', function (done) {
|
||||
|
||||
var err = Boom.unauthorized(null, ['Test','one','two']);
|
||||
expect(err.output.statusCode).to.equal(401);
|
||||
expect(err.output.headers['WWW-Authenticate']).to.equal('Test, one, two');
|
||||
done();
|
||||
});
|
||||
|
||||
it('returns a WWW-Authenticate header when passed a scheme and attributes', function (done) {
|
||||
|
||||
var err = Boom.unauthorized('boom', 'Test', { a: 1, b: 'something', c: null, d: 0 });
|
||||
expect(err.output.statusCode).to.equal(401);
|
||||
expect(err.output.headers['WWW-Authenticate']).to.equal('Test a="1", b="something", c="", d="0", error="boom"');
|
||||
expect(err.output.payload.attributes).to.deep.equal({ a: 1, b: 'something', c: '', d: 0, error: 'boom' });
|
||||
done();
|
||||
});
|
||||
|
||||
it('returns a WWW-Authenticate header when passed attributes, missing error', function (done) {
|
||||
|
||||
var err = Boom.unauthorized(null, 'Test', { a: 1, b: 'something', c: null, d: 0 });
|
||||
expect(err.output.statusCode).to.equal(401);
|
||||
expect(err.output.headers['WWW-Authenticate']).to.equal('Test a="1", b="something", c="", d="0"');
|
||||
expect(err.isMissing).to.equal(true);
|
||||
done();
|
||||
});
|
||||
|
||||
it('sets the isMissing flag when error message is empty', function (done) {
|
||||
|
||||
var err = Boom.unauthorized('', 'Basic');
|
||||
expect(err.isMissing).to.equal(true);
|
||||
done();
|
||||
});
|
||||
|
||||
it('does not set the isMissing flag when error message is not empty', function (done) {
|
||||
|
||||
var err = Boom.unauthorized('message', 'Basic');
|
||||
expect(err.isMissing).to.equal(undefined);
|
||||
done();
|
||||
});
|
||||
|
||||
it('sets a WWW-Authenticate when passed as an array', function (done) {
|
||||
|
||||
var err = Boom.unauthorized('message', ['Basic', 'Example e="1"', 'Another x="3", y="4"']);
|
||||
expect(err.output.headers['WWW-Authenticate']).to.equal('Basic, Example e="1", Another x="3", y="4"');
|
||||
done();
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
describe('methodNotAllowed()', function () {
|
||||
|
||||
it('returns a 405 error statusCode', function (done) {
|
||||
|
||||
expect(Boom.methodNotAllowed().output.statusCode).to.equal(405);
|
||||
done();
|
||||
});
|
||||
|
||||
it('sets the message with the passed in message', function (done) {
|
||||
|
||||
expect(Boom.methodNotAllowed('my message').message).to.equal('my message');
|
||||
done();
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
describe('notAcceptable()', function () {
|
||||
|
||||
it('returns a 406 error statusCode', function (done) {
|
||||
|
||||
expect(Boom.notAcceptable().output.statusCode).to.equal(406);
|
||||
done();
|
||||
});
|
||||
|
||||
it('sets the message with the passed in message', function (done) {
|
||||
|
||||
expect(Boom.notAcceptable('my message').message).to.equal('my message');
|
||||
done();
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
describe('proxyAuthRequired()', function () {
|
||||
|
||||
it('returns a 407 error statusCode', function (done) {
|
||||
|
||||
expect(Boom.proxyAuthRequired().output.statusCode).to.equal(407);
|
||||
done();
|
||||
});
|
||||
|
||||
it('sets the message with the passed in message', function (done) {
|
||||
|
||||
expect(Boom.proxyAuthRequired('my message').message).to.equal('my message');
|
||||
done();
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
describe('clientTimeout()', function () {
|
||||
|
||||
it('returns a 408 error statusCode', function (done) {
|
||||
|
||||
expect(Boom.clientTimeout().output.statusCode).to.equal(408);
|
||||
done();
|
||||
});
|
||||
|
||||
it('sets the message with the passed in message', function (done) {
|
||||
|
||||
expect(Boom.clientTimeout('my message').message).to.equal('my message');
|
||||
done();
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
describe('conflict()', function () {
|
||||
|
||||
it('returns a 409 error statusCode', function (done) {
|
||||
|
||||
expect(Boom.conflict().output.statusCode).to.equal(409);
|
||||
done();
|
||||
});
|
||||
|
||||
it('sets the message with the passed in message', function (done) {
|
||||
|
||||
expect(Boom.conflict('my message').message).to.equal('my message');
|
||||
done();
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
describe('resourceGone()', function () {
|
||||
|
||||
it('returns a 410 error statusCode', function (done) {
|
||||
|
||||
expect(Boom.resourceGone().output.statusCode).to.equal(410);
|
||||
done();
|
||||
});
|
||||
|
||||
it('sets the message with the passed in message', function (done) {
|
||||
|
||||
expect(Boom.resourceGone('my message').message).to.equal('my message');
|
||||
done();
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
describe('lengthRequired()', function () {
|
||||
|
||||
it('returns a 411 error statusCode', function (done) {
|
||||
|
||||
expect(Boom.lengthRequired().output.statusCode).to.equal(411);
|
||||
done();
|
||||
});
|
||||
|
||||
it('sets the message with the passed in message', function (done) {
|
||||
|
||||
expect(Boom.lengthRequired('my message').message).to.equal('my message');
|
||||
done();
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
describe('preconditionFailed()', function () {
|
||||
|
||||
it('returns a 412 error statusCode', function (done) {
|
||||
|
||||
expect(Boom.preconditionFailed().output.statusCode).to.equal(412);
|
||||
done();
|
||||
});
|
||||
|
||||
it('sets the message with the passed in message', function (done) {
|
||||
|
||||
expect(Boom.preconditionFailed('my message').message).to.equal('my message');
|
||||
done();
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
describe('entityTooLarge()', function () {
|
||||
|
||||
it('returns a 413 error statusCode', function (done) {
|
||||
|
||||
expect(Boom.entityTooLarge().output.statusCode).to.equal(413);
|
||||
done();
|
||||
});
|
||||
|
||||
it('sets the message with the passed in message', function (done) {
|
||||
|
||||
expect(Boom.entityTooLarge('my message').message).to.equal('my message');
|
||||
done();
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
describe('uriTooLong()', function () {
|
||||
|
||||
it('returns a 414 error statusCode', function (done) {
|
||||
|
||||
expect(Boom.uriTooLong().output.statusCode).to.equal(414);
|
||||
done();
|
||||
});
|
||||
|
||||
it('sets the message with the passed in message', function (done) {
|
||||
|
||||
expect(Boom.uriTooLong('my message').message).to.equal('my message');
|
||||
done();
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
describe('unsupportedMediaType()', function () {
|
||||
|
||||
it('returns a 415 error statusCode', function (done) {
|
||||
|
||||
expect(Boom.unsupportedMediaType().output.statusCode).to.equal(415);
|
||||
done();
|
||||
});
|
||||
|
||||
it('sets the message with the passed in message', function (done) {
|
||||
|
||||
expect(Boom.unsupportedMediaType('my message').message).to.equal('my message');
|
||||
done();
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
describe('rangeNotSatisfiable()', function () {
|
||||
|
||||
it('returns a 416 error statusCode', function (done) {
|
||||
|
||||
expect(Boom.rangeNotSatisfiable().output.statusCode).to.equal(416);
|
||||
done();
|
||||
});
|
||||
|
||||
it('sets the message with the passed in message', function (done) {
|
||||
|
||||
expect(Boom.rangeNotSatisfiable('my message').message).to.equal('my message');
|
||||
done();
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
describe('expectationFailed()', function () {
|
||||
|
||||
it('returns a 417 error statusCode', function (done) {
|
||||
|
||||
expect(Boom.expectationFailed().output.statusCode).to.equal(417);
|
||||
done();
|
||||
});
|
||||
|
||||
it('sets the message with the passed in message', function (done) {
|
||||
|
||||
expect(Boom.expectationFailed('my message').message).to.equal('my message');
|
||||
done();
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
describe('badData()', function () {
|
||||
|
||||
it('returns a 422 error statusCode', function (done) {
|
||||
|
||||
expect(Boom.badData().output.statusCode).to.equal(422);
|
||||
done();
|
||||
});
|
||||
|
||||
it('sets the message with the passed in message', function (done) {
|
||||
|
||||
expect(Boom.badData('my message').message).to.equal('my message');
|
||||
done();
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
describe('preconditionRequired()', function () {
|
||||
|
||||
it('returns a 428 error statusCode', function (done) {
|
||||
|
||||
expect(Boom.preconditionRequired().output.statusCode).to.equal(428);
|
||||
done();
|
||||
});
|
||||
|
||||
it('sets the message with the passed in message', function (done) {
|
||||
|
||||
expect(Boom.preconditionRequired('my message').message).to.equal('my message');
|
||||
done();
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
describe('tooManyRequests()', function () {
|
||||
|
||||
it('returns a 429 error statusCode', function (done) {
|
||||
|
||||
expect(Boom.tooManyRequests().output.statusCode).to.equal(429);
|
||||
done();
|
||||
});
|
||||
|
||||
it('sets the message with the passed-in message', function (done) {
|
||||
|
||||
expect(Boom.tooManyRequests('my message').message).to.equal('my message');
|
||||
done();
|
||||
});
|
||||
});
|
||||
|
||||
describe('serverTimeout()', function () {
|
||||
|
||||
it('returns a 503 error statusCode', function (done) {
|
||||
|
||||
expect(Boom.serverTimeout().output.statusCode).to.equal(503);
|
||||
done();
|
||||
});
|
||||
|
||||
it('sets the message with the passed in message', function (done) {
|
||||
|
||||
expect(Boom.serverTimeout('my message').message).to.equal('my message');
|
||||
done();
|
||||
});
|
||||
});
|
||||
|
||||
describe('forbidden()', function () {
|
||||
|
||||
it('returns a 403 error statusCode', function (done) {
|
||||
|
||||
expect(Boom.forbidden().output.statusCode).to.equal(403);
|
||||
done();
|
||||
});
|
||||
|
||||
it('sets the message with the passed in message', function (done) {
|
||||
|
||||
expect(Boom.forbidden('my message').message).to.equal('my message');
|
||||
done();
|
||||
});
|
||||
});
|
||||
|
||||
describe('notFound()', function () {
|
||||
|
||||
it('returns a 404 error statusCode', function (done) {
|
||||
|
||||
expect(Boom.notFound().output.statusCode).to.equal(404);
|
||||
done();
|
||||
});
|
||||
|
||||
it('sets the message with the passed in message', function (done) {
|
||||
|
||||
expect(Boom.notFound('my message').message).to.equal('my message');
|
||||
done();
|
||||
});
|
||||
});
|
||||
|
||||
describe('internal()', function () {
|
||||
|
||||
it('returns a 500 error statusCode', function (done) {
|
||||
|
||||
expect(Boom.internal().output.statusCode).to.equal(500);
|
||||
done();
|
||||
});
|
||||
|
||||
it('sets the message with the passed in message', function (done) {
|
||||
|
||||
var err = Boom.internal('my message');
|
||||
expect(err.message).to.equal('my message');
|
||||
expect(err.isServer).to.true();
|
||||
expect(err.output.payload.message).to.equal('An internal server error occurred');
|
||||
done();
|
||||
});
|
||||
|
||||
it('passes data on the callback if its passed in', function (done) {
|
||||
|
||||
expect(Boom.internal('my message', { my: 'data' }).data.my).to.equal('data');
|
||||
done();
|
||||
});
|
||||
|
||||
it('returns an error with composite message', function (done) {
|
||||
|
||||
try {
|
||||
JSON.parse('{');
|
||||
}
|
||||
catch (err) {
|
||||
var boom = Boom.internal('Someting bad', err);
|
||||
expect(boom.message).to.equal('Someting bad: Unexpected end of input');
|
||||
expect(boom.isServer).to.be.true();
|
||||
done();
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
describe('notImplemented()', function () {
|
||||
|
||||
it('returns a 501 error statusCode', function (done) {
|
||||
|
||||
expect(Boom.notImplemented().output.statusCode).to.equal(501);
|
||||
done();
|
||||
});
|
||||
|
||||
it('sets the message with the passed in message', function (done) {
|
||||
|
||||
expect(Boom.notImplemented('my message').message).to.equal('my message');
|
||||
done();
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
describe('badGateway()', function () {
|
||||
|
||||
it('returns a 502 error statusCode', function (done) {
|
||||
|
||||
expect(Boom.badGateway().output.statusCode).to.equal(502);
|
||||
done();
|
||||
});
|
||||
|
||||
it('sets the message with the passed in message', function (done) {
|
||||
|
||||
expect(Boom.badGateway('my message').message).to.equal('my message');
|
||||
done();
|
||||
});
|
||||
});
|
||||
|
||||
describe('gatewayTimeout()', function () {
|
||||
|
||||
it('returns a 504 error statusCode', function (done) {
|
||||
|
||||
expect(Boom.gatewayTimeout().output.statusCode).to.equal(504);
|
||||
done();
|
||||
});
|
||||
|
||||
it('sets the message with the passed in message', function (done) {
|
||||
|
||||
expect(Boom.gatewayTimeout('my message').message).to.equal('my message');
|
||||
done();
|
||||
});
|
||||
});
|
||||
|
||||
describe('badImplementation()', function () {
|
||||
|
||||
it('returns a 500 error statusCode', function (done) {
|
||||
|
||||
var err = Boom.badImplementation();
|
||||
expect(err.output.statusCode).to.equal(500);
|
||||
expect(err.isDeveloperError).to.equal(true);
|
||||
expect(err.isServer).to.be.true();
|
||||
done();
|
||||
});
|
||||
});
|
||||
|
||||
describe('stack trace', function () {
|
||||
|
||||
it('should omit lib', function (done) {
|
||||
|
||||
['badRequest', 'unauthorized', 'forbidden', 'notFound', 'methodNotAllowed',
|
||||
'notAcceptable', 'proxyAuthRequired', 'clientTimeout', 'conflict',
|
||||
'resourceGone', 'lengthRequired', 'preconditionFailed', 'entityTooLarge',
|
||||
'uriTooLong', 'unsupportedMediaType', 'rangeNotSatisfiable', 'expectationFailed',
|
||||
'badData', 'preconditionRequired', 'tooManyRequests',
|
||||
|
||||
// 500s
|
||||
'internal', 'notImplemented', 'badGateway', 'serverTimeout', 'gatewayTimeout',
|
||||
'badImplementation'
|
||||
].forEach(function (name) {
|
||||
|
||||
var err = Boom[name]();
|
||||
expect(err.stack).to.not.match(/\/lib\/index\.js/);
|
||||
});
|
||||
|
||||
done();
|
||||
});
|
||||
});
|
1
node_modules/caseless/index.js
generated
vendored
1
node_modules/caseless/index.js
generated
vendored
@ -36,6 +36,7 @@ Caseless.prototype.get = function (name) {
|
||||
}
|
||||
Caseless.prototype.swap = function (name) {
|
||||
var has = this.has(name)
|
||||
if (has === name) return
|
||||
if (!has) throw new Error('There is no header than matches "'+name+'"')
|
||||
this.dict[name] = this.dict[has]
|
||||
delete this.dict[has]
|
||||
|
76
node_modules/caseless/package.json
generated
vendored
76
node_modules/caseless/package.json
generated
vendored
@ -1,46 +1,27 @@
|
||||
{
|
||||
"_args": [
|
||||
[
|
||||
{
|
||||
"raw": "caseless@~0.11.0",
|
||||
"scope": null,
|
||||
"escapedName": "caseless",
|
||||
"name": "caseless",
|
||||
"rawSpec": "~0.11.0",
|
||||
"spec": ">=0.11.0 <0.12.0",
|
||||
"type": "range"
|
||||
},
|
||||
"/tank/data/SERVER/zoneadm-master/node_modules/request"
|
||||
]
|
||||
],
|
||||
"_from": "caseless@>=0.11.0 <0.12.0",
|
||||
"_id": "caseless@0.11.0",
|
||||
"_inCache": true,
|
||||
"_from": "caseless@~0.12.0",
|
||||
"_id": "caseless@0.12.0",
|
||||
"_inBundle": false,
|
||||
"_integrity": "sha1-G2gcIf+EAzyCZUMJBolCDRhxUdw=",
|
||||
"_location": "/caseless",
|
||||
"_nodeVersion": "1.8.1",
|
||||
"_npmUser": {
|
||||
"name": "mikeal",
|
||||
"email": "mikeal.rogers@gmail.com"
|
||||
},
|
||||
"_npmVersion": "2.8.3",
|
||||
"_phantomChildren": {},
|
||||
"_requested": {
|
||||
"raw": "caseless@~0.11.0",
|
||||
"scope": null,
|
||||
"escapedName": "caseless",
|
||||
"type": "range",
|
||||
"registry": true,
|
||||
"raw": "caseless@~0.12.0",
|
||||
"name": "caseless",
|
||||
"rawSpec": "~0.11.0",
|
||||
"spec": ">=0.11.0 <0.12.0",
|
||||
"type": "range"
|
||||
"escapedName": "caseless",
|
||||
"rawSpec": "~0.12.0",
|
||||
"saveSpec": null,
|
||||
"fetchSpec": "~0.12.0"
|
||||
},
|
||||
"_requiredBy": [
|
||||
"/request"
|
||||
],
|
||||
"_resolved": "https://registry.npmjs.org/caseless/-/caseless-0.11.0.tgz",
|
||||
"_shasum": "715b96ea9841593cc33067923f5ec60ebda4f7d7",
|
||||
"_shrinkwrap": null,
|
||||
"_spec": "caseless@~0.11.0",
|
||||
"_where": "/tank/data/SERVER/zoneadm-master/node_modules/request",
|
||||
"_resolved": "https://registry.npmjs.org/caseless/-/caseless-0.12.0.tgz",
|
||||
"_shasum": "1b681c21ff84033c826543090689420d187151dc",
|
||||
"_spec": "caseless@~0.12.0",
|
||||
"_where": "/export/home/matjaz/git/zoneadmin-master/node_modules/request",
|
||||
"author": {
|
||||
"name": "Mikeal Rogers",
|
||||
"email": "mikeal.rogers@gmail.com"
|
||||
@ -48,17 +29,12 @@
|
||||
"bugs": {
|
||||
"url": "https://github.com/mikeal/caseless/issues"
|
||||
},
|
||||
"dependencies": {},
|
||||
"bundleDependencies": false,
|
||||
"deprecated": false,
|
||||
"description": "Caseless object set/get/has, very useful when working with HTTP headers.",
|
||||
"devDependencies": {
|
||||
"tape": "^2.10.2"
|
||||
},
|
||||
"directories": {},
|
||||
"dist": {
|
||||
"shasum": "715b96ea9841593cc33067923f5ec60ebda4f7d7",
|
||||
"tarball": "https://registry.npmjs.org/caseless/-/caseless-0.11.0.tgz"
|
||||
},
|
||||
"gitHead": "c578232a02cc2b46b6da8851caf57fdbfac89ff5",
|
||||
"homepage": "https://github.com/mikeal/caseless#readme",
|
||||
"keywords": [
|
||||
"headers",
|
||||
@ -67,23 +43,7 @@
|
||||
],
|
||||
"license": "Apache-2.0",
|
||||
"main": "index.js",
|
||||
"maintainers": [
|
||||
{
|
||||
"name": "mikeal",
|
||||
"email": "mikeal.rogers@gmail.com"
|
||||
},
|
||||
{
|
||||
"name": "nylen",
|
||||
"email": "jnylen@gmail.com"
|
||||
},
|
||||
{
|
||||
"name": "simov",
|
||||
"email": "simeonvelichkov@gmail.com"
|
||||
}
|
||||
],
|
||||
"name": "caseless",
|
||||
"optionalDependencies": {},
|
||||
"readme": "ERROR: No README data found!",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git+https://github.com/mikeal/caseless.git"
|
||||
@ -92,5 +52,5 @@
|
||||
"test": "node test.js"
|
||||
},
|
||||
"test": "node test.js",
|
||||
"version": "0.11.0"
|
||||
"version": "0.12.0"
|
||||
}
|
||||
|
27
node_modules/caseless/test.js
generated
vendored
27
node_modules/caseless/test.js
generated
vendored
@ -38,3 +38,30 @@ tape('set get has', function (t) {
|
||||
t.equal(c.get('tva'), 'test1')
|
||||
|
||||
})
|
||||
|
||||
tape('swap', function (t) {
|
||||
var headers = {}
|
||||
, c = caseless(headers)
|
||||
;
|
||||
t.plan(4)
|
||||
// No Header to Swap.
|
||||
t.throws(function () {
|
||||
c.swap('content-type')
|
||||
})
|
||||
// Set Header.
|
||||
c.set('content-type', 'application/json')
|
||||
// Swap Header With Itself.
|
||||
c.swap('content-type')
|
||||
// Does Not Delete Itself.
|
||||
t.ok(c.has('content-type'))
|
||||
// Swap Header With a Different Header.
|
||||
c.swap('Content-Type')
|
||||
// Still Has Header.
|
||||
t.ok(c.has('Content-Type'))
|
||||
// Delete Header.
|
||||
c.del('Content-Type')
|
||||
// No Header to Swap.
|
||||
t.throws(function () {
|
||||
c.swap('content-type')
|
||||
})
|
||||
})
|
||||
|
116
node_modules/chalk/index.js
generated
vendored
116
node_modules/chalk/index.js
generated
vendored
@ -1,116 +0,0 @@
|
||||
'use strict';
|
||||
var escapeStringRegexp = require('escape-string-regexp');
|
||||
var ansiStyles = require('ansi-styles');
|
||||
var stripAnsi = require('strip-ansi');
|
||||
var hasAnsi = require('has-ansi');
|
||||
var supportsColor = require('supports-color');
|
||||
var defineProps = Object.defineProperties;
|
||||
var isSimpleWindowsTerm = process.platform === 'win32' && !/^xterm/i.test(process.env.TERM);
|
||||
|
||||
function Chalk(options) {
|
||||
// detect mode if not set manually
|
||||
this.enabled = !options || options.enabled === undefined ? supportsColor : options.enabled;
|
||||
}
|
||||
|
||||
// use bright blue on Windows as the normal blue color is illegible
|
||||
if (isSimpleWindowsTerm) {
|
||||
ansiStyles.blue.open = '\u001b[94m';
|
||||
}
|
||||
|
||||
var styles = (function () {
|
||||
var ret = {};
|
||||
|
||||
Object.keys(ansiStyles).forEach(function (key) {
|
||||
ansiStyles[key].closeRe = new RegExp(escapeStringRegexp(ansiStyles[key].close), 'g');
|
||||
|
||||
ret[key] = {
|
||||
get: function () {
|
||||
return build.call(this, this._styles.concat(key));
|
||||
}
|
||||
};
|
||||
});
|
||||
|
||||
return ret;
|
||||
})();
|
||||
|
||||
var proto = defineProps(function chalk() {}, styles);
|
||||
|
||||
function build(_styles) {
|
||||
var builder = function () {
|
||||
return applyStyle.apply(builder, arguments);
|
||||
};
|
||||
|
||||
builder._styles = _styles;
|
||||
builder.enabled = this.enabled;
|
||||
// __proto__ is used because we must return a function, but there is
|
||||
// no way to create a function with a different prototype.
|
||||
/* eslint-disable no-proto */
|
||||
builder.__proto__ = proto;
|
||||
|
||||
return builder;
|
||||
}
|
||||
|
||||
function applyStyle() {
|
||||
// support varags, but simply cast to string in case there's only one arg
|
||||
var args = arguments;
|
||||
var argsLen = args.length;
|
||||
var str = argsLen !== 0 && String(arguments[0]);
|
||||
|
||||
if (argsLen > 1) {
|
||||
// don't slice `arguments`, it prevents v8 optimizations
|
||||
for (var a = 1; a < argsLen; a++) {
|
||||
str += ' ' + args[a];
|
||||
}
|
||||
}
|
||||
|
||||
if (!this.enabled || !str) {
|
||||
return str;
|
||||
}
|
||||
|
||||
var nestedStyles = this._styles;
|
||||
var i = nestedStyles.length;
|
||||
|
||||
// Turns out that on Windows dimmed gray text becomes invisible in cmd.exe,
|
||||
// see https://github.com/chalk/chalk/issues/58
|
||||
// If we're on Windows and we're dealing with a gray color, temporarily make 'dim' a noop.
|
||||
var originalDim = ansiStyles.dim.open;
|
||||
if (isSimpleWindowsTerm && (nestedStyles.indexOf('gray') !== -1 || nestedStyles.indexOf('grey') !== -1)) {
|
||||
ansiStyles.dim.open = '';
|
||||
}
|
||||
|
||||
while (i--) {
|
||||
var code = ansiStyles[nestedStyles[i]];
|
||||
|
||||
// Replace any instances already present with a re-opening code
|
||||
// otherwise only the part of the string until said closing code
|
||||
// will be colored, and the rest will simply be 'plain'.
|
||||
str = code.open + str.replace(code.closeRe, code.open) + code.close;
|
||||
}
|
||||
|
||||
// Reset the original 'dim' if we changed it to work around the Windows dimmed gray issue.
|
||||
ansiStyles.dim.open = originalDim;
|
||||
|
||||
return str;
|
||||
}
|
||||
|
||||
function init() {
|
||||
var ret = {};
|
||||
|
||||
Object.keys(styles).forEach(function (name) {
|
||||
ret[name] = {
|
||||
get: function () {
|
||||
return build.call(this, [name]);
|
||||
}
|
||||
};
|
||||
});
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
defineProps(Chalk.prototype, init());
|
||||
|
||||
module.exports = new Chalk();
|
||||
module.exports.styles = ansiStyles;
|
||||
module.exports.hasColor = hasAnsi;
|
||||
module.exports.stripColor = stripAnsi;
|
||||
module.exports.supportsColor = supportsColor;
|
21
node_modules/chalk/license
generated
vendored
21
node_modules/chalk/license
generated
vendored
@ -1,21 +0,0 @@
|
||||
The MIT License (MIT)
|
||||
|
||||
Copyright (c) Sindre Sorhus <sindresorhus@gmail.com> (sindresorhus.com)
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in
|
||||
all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
THE SOFTWARE.
|
140
node_modules/chalk/package.json
generated
vendored
140
node_modules/chalk/package.json
generated
vendored
@ -1,140 +0,0 @@
|
||||
{
|
||||
"_args": [
|
||||
[
|
||||
{
|
||||
"raw": "chalk@^1.1.1",
|
||||
"scope": null,
|
||||
"escapedName": "chalk",
|
||||
"name": "chalk",
|
||||
"rawSpec": "^1.1.1",
|
||||
"spec": ">=1.1.1 <2.0.0",
|
||||
"type": "range"
|
||||
},
|
||||
"/tank/data/SERVER/zoneadm-master/node_modules/har-validator"
|
||||
]
|
||||
],
|
||||
"_from": "chalk@>=1.1.1 <2.0.0",
|
||||
"_id": "chalk@1.1.3",
|
||||
"_inCache": true,
|
||||
"_location": "/chalk",
|
||||
"_nodeVersion": "0.10.32",
|
||||
"_npmOperationalInternal": {
|
||||
"host": "packages-12-west.internal.npmjs.com",
|
||||
"tmp": "tmp/chalk-1.1.3.tgz_1459210604109_0.3892582862172276"
|
||||
},
|
||||
"_npmUser": {
|
||||
"name": "qix",
|
||||
"email": "i.am.qix@gmail.com"
|
||||
},
|
||||
"_npmVersion": "2.14.2",
|
||||
"_phantomChildren": {},
|
||||
"_requested": {
|
||||
"raw": "chalk@^1.1.1",
|
||||
"scope": null,
|
||||
"escapedName": "chalk",
|
||||
"name": "chalk",
|
||||
"rawSpec": "^1.1.1",
|
||||
"spec": ">=1.1.1 <2.0.0",
|
||||
"type": "range"
|
||||
},
|
||||
"_requiredBy": [
|
||||
"/har-validator"
|
||||
],
|
||||
"_resolved": "https://registry.npmjs.org/chalk/-/chalk-1.1.3.tgz",
|
||||
"_shasum": "a8115c55e4a702fe4d150abd3872822a7e09fc98",
|
||||
"_shrinkwrap": null,
|
||||
"_spec": "chalk@^1.1.1",
|
||||
"_where": "/tank/data/SERVER/zoneadm-master/node_modules/har-validator",
|
||||
"bugs": {
|
||||
"url": "https://github.com/chalk/chalk/issues"
|
||||
},
|
||||
"dependencies": {
|
||||
"ansi-styles": "^2.2.1",
|
||||
"escape-string-regexp": "^1.0.2",
|
||||
"has-ansi": "^2.0.0",
|
||||
"strip-ansi": "^3.0.0",
|
||||
"supports-color": "^2.0.0"
|
||||
},
|
||||
"description": "Terminal string styling done right. Much color.",
|
||||
"devDependencies": {
|
||||
"coveralls": "^2.11.2",
|
||||
"matcha": "^0.6.0",
|
||||
"mocha": "*",
|
||||
"nyc": "^3.0.0",
|
||||
"require-uncached": "^1.0.2",
|
||||
"resolve-from": "^1.0.0",
|
||||
"semver": "^4.3.3",
|
||||
"xo": "*"
|
||||
},
|
||||
"directories": {},
|
||||
"dist": {
|
||||
"shasum": "a8115c55e4a702fe4d150abd3872822a7e09fc98",
|
||||
"tarball": "https://registry.npmjs.org/chalk/-/chalk-1.1.3.tgz"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=0.10.0"
|
||||
},
|
||||
"files": [
|
||||
"index.js"
|
||||
],
|
||||
"gitHead": "0d8d8c204eb87a4038219131ad4d8369c9f59d24",
|
||||
"homepage": "https://github.com/chalk/chalk#readme",
|
||||
"keywords": [
|
||||
"color",
|
||||
"colour",
|
||||
"colors",
|
||||
"terminal",
|
||||
"console",
|
||||
"cli",
|
||||
"string",
|
||||
"str",
|
||||
"ansi",
|
||||
"style",
|
||||
"styles",
|
||||
"tty",
|
||||
"formatting",
|
||||
"rgb",
|
||||
"256",
|
||||
"shell",
|
||||
"xterm",
|
||||
"log",
|
||||
"logging",
|
||||
"command-line",
|
||||
"text"
|
||||
],
|
||||
"license": "MIT",
|
||||
"maintainers": [
|
||||
{
|
||||
"name": "qix",
|
||||
"email": "i.am.qix@gmail.com"
|
||||
},
|
||||
{
|
||||
"name": "sindresorhus",
|
||||
"email": "sindresorhus@gmail.com"
|
||||
},
|
||||
{
|
||||
"name": "unicorn",
|
||||
"email": "sindresorhus+unicorn@gmail.com"
|
||||
}
|
||||
],
|
||||
"name": "chalk",
|
||||
"optionalDependencies": {},
|
||||
"readme": "ERROR: No README data found!",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git+https://github.com/chalk/chalk.git"
|
||||
},
|
||||
"scripts": {
|
||||
"bench": "matcha benchmark.js",
|
||||
"coverage": "nyc npm test && nyc report",
|
||||
"coveralls": "nyc npm test && nyc report --reporter=text-lcov | coveralls",
|
||||
"test": "xo && mocha"
|
||||
},
|
||||
"version": "1.1.3",
|
||||
"xo": {
|
||||
"envs": [
|
||||
"node",
|
||||
"mocha"
|
||||
]
|
||||
}
|
||||
}
|
213
node_modules/chalk/readme.md
generated
vendored
213
node_modules/chalk/readme.md
generated
vendored
@ -1,213 +0,0 @@
|
||||
<h1 align="center">
|
||||
<br>
|
||||
<br>
|
||||
<img width="360" src="https://cdn.rawgit.com/chalk/chalk/19935d6484811c5e468817f846b7b3d417d7bf4a/logo.svg" alt="chalk">
|
||||
<br>
|
||||
<br>
|
||||
<br>
|
||||
</h1>
|
||||
|
||||
> Terminal string styling done right
|
||||
|
||||
[](https://travis-ci.org/chalk/chalk)
|
||||
[](https://coveralls.io/r/chalk/chalk?branch=master)
|
||||
[](https://www.youtube.com/watch?v=9auOCbH5Ns4)
|
||||
|
||||
|
||||
[colors.js](https://github.com/Marak/colors.js) used to be the most popular string styling module, but it has serious deficiencies like extending `String.prototype` which causes all kinds of [problems](https://github.com/yeoman/yo/issues/68). Although there are other ones, they either do too much or not enough.
|
||||
|
||||
**Chalk is a clean and focused alternative.**
|
||||
|
||||

|
||||
|
||||
|
||||
## Why
|
||||
|
||||
- Highly performant
|
||||
- Doesn't extend `String.prototype`
|
||||
- Expressive API
|
||||
- Ability to nest styles
|
||||
- Clean and focused
|
||||
- Auto-detects color support
|
||||
- Actively maintained
|
||||
- [Used by ~4500 modules](https://www.npmjs.com/browse/depended/chalk) as of July 15, 2015
|
||||
|
||||
|
||||
## Install
|
||||
|
||||
```
|
||||
$ npm install --save chalk
|
||||
```
|
||||
|
||||
|
||||
## Usage
|
||||
|
||||
Chalk comes with an easy to use composable API where you just chain and nest the styles you want.
|
||||
|
||||
```js
|
||||
var chalk = require('chalk');
|
||||
|
||||
// style a string
|
||||
chalk.blue('Hello world!');
|
||||
|
||||
// combine styled and normal strings
|
||||
chalk.blue('Hello') + 'World' + chalk.red('!');
|
||||
|
||||
// compose multiple styles using the chainable API
|
||||
chalk.blue.bgRed.bold('Hello world!');
|
||||
|
||||
// pass in multiple arguments
|
||||
chalk.blue('Hello', 'World!', 'Foo', 'bar', 'biz', 'baz');
|
||||
|
||||
// nest styles
|
||||
chalk.red('Hello', chalk.underline.bgBlue('world') + '!');
|
||||
|
||||
// nest styles of the same type even (color, underline, background)
|
||||
chalk.green(
|
||||
'I am a green line ' +
|
||||
chalk.blue.underline.bold('with a blue substring') +
|
||||
' that becomes green again!'
|
||||
);
|
||||
```
|
||||
|
||||
Easily define your own themes.
|
||||
|
||||
```js
|
||||
var chalk = require('chalk');
|
||||
var error = chalk.bold.red;
|
||||
console.log(error('Error!'));
|
||||
```
|
||||
|
||||
Take advantage of console.log [string substitution](http://nodejs.org/docs/latest/api/console.html#console_console_log_data).
|
||||
|
||||
```js
|
||||
var name = 'Sindre';
|
||||
console.log(chalk.green('Hello %s'), name);
|
||||
//=> Hello Sindre
|
||||
```
|
||||
|
||||
|
||||
## API
|
||||
|
||||
### chalk.`<style>[.<style>...](string, [string...])`
|
||||
|
||||
Example: `chalk.red.bold.underline('Hello', 'world');`
|
||||
|
||||
Chain [styles](#styles) and call the last one as a method with a string argument. Order doesn't matter, and later styles take precedent in case of a conflict. This simply means that `Chalk.red.yellow.green` is equivalent to `Chalk.green`.
|
||||
|
||||
Multiple arguments will be separated by space.
|
||||
|
||||
### chalk.enabled
|
||||
|
||||
Color support is automatically detected, but you can override it by setting the `enabled` property. You should however only do this in your own code as it applies globally to all chalk consumers.
|
||||
|
||||
If you need to change this in a reusable module create a new instance:
|
||||
|
||||
```js
|
||||
var ctx = new chalk.constructor({enabled: false});
|
||||
```
|
||||
|
||||
### chalk.supportsColor
|
||||
|
||||
Detect whether the terminal [supports color](https://github.com/chalk/supports-color). Used internally and handled for you, but exposed for convenience.
|
||||
|
||||
Can be overridden by the user with the flags `--color` and `--no-color`. For situations where using `--color` is not possible, add an environment variable `FORCE_COLOR` with any value to force color. Trumps `--no-color`.
|
||||
|
||||
### chalk.styles
|
||||
|
||||
Exposes the styles as [ANSI escape codes](https://github.com/chalk/ansi-styles).
|
||||
|
||||
Generally not useful, but you might need just the `.open` or `.close` escape code if you're mixing externally styled strings with your own.
|
||||
|
||||
```js
|
||||
var chalk = require('chalk');
|
||||
|
||||
console.log(chalk.styles.red);
|
||||
//=> {open: '\u001b[31m', close: '\u001b[39m'}
|
||||
|
||||
console.log(chalk.styles.red.open + 'Hello' + chalk.styles.red.close);
|
||||
```
|
||||
|
||||
### chalk.hasColor(string)
|
||||
|
||||
Check whether a string [has color](https://github.com/chalk/has-ansi).
|
||||
|
||||
### chalk.stripColor(string)
|
||||
|
||||
[Strip color](https://github.com/chalk/strip-ansi) from a string.
|
||||
|
||||
Can be useful in combination with `.supportsColor` to strip color on externally styled text when it's not supported.
|
||||
|
||||
Example:
|
||||
|
||||
```js
|
||||
var chalk = require('chalk');
|
||||
var styledString = getText();
|
||||
|
||||
if (!chalk.supportsColor) {
|
||||
styledString = chalk.stripColor(styledString);
|
||||
}
|
||||
```
|
||||
|
||||
|
||||
## Styles
|
||||
|
||||
### Modifiers
|
||||
|
||||
- `reset`
|
||||
- `bold`
|
||||
- `dim`
|
||||
- `italic` *(not widely supported)*
|
||||
- `underline`
|
||||
- `inverse`
|
||||
- `hidden`
|
||||
- `strikethrough` *(not widely supported)*
|
||||
|
||||
### Colors
|
||||
|
||||
- `black`
|
||||
- `red`
|
||||
- `green`
|
||||
- `yellow`
|
||||
- `blue` *(on Windows the bright version is used as normal blue is illegible)*
|
||||
- `magenta`
|
||||
- `cyan`
|
||||
- `white`
|
||||
- `gray`
|
||||
|
||||
### Background colors
|
||||
|
||||
- `bgBlack`
|
||||
- `bgRed`
|
||||
- `bgGreen`
|
||||
- `bgYellow`
|
||||
- `bgBlue`
|
||||
- `bgMagenta`
|
||||
- `bgCyan`
|
||||
- `bgWhite`
|
||||
|
||||
|
||||
## 256-colors
|
||||
|
||||
Chalk does not support anything other than the base eight colors, which guarantees it will work on all terminals and systems. Some terminals, specifically `xterm` compliant ones, will support the full range of 8-bit colors. For this the lower level [ansi-256-colors](https://github.com/jbnicolai/ansi-256-colors) package can be used.
|
||||
|
||||
|
||||
## Windows
|
||||
|
||||
If you're on Windows, do yourself a favor and use [`cmder`](http://bliker.github.io/cmder/) instead of `cmd.exe`.
|
||||
|
||||
|
||||
## Related
|
||||
|
||||
- [chalk-cli](https://github.com/chalk/chalk-cli) - CLI for this module
|
||||
- [ansi-styles](https://github.com/chalk/ansi-styles/) - ANSI escape codes for styling strings in the terminal
|
||||
- [supports-color](https://github.com/chalk/supports-color/) - Detect whether a terminal supports color
|
||||
- [strip-ansi](https://github.com/chalk/strip-ansi) - Strip ANSI escape codes
|
||||
- [has-ansi](https://github.com/chalk/has-ansi) - Check if a string has ANSI escape codes
|
||||
- [ansi-regex](https://github.com/chalk/ansi-regex) - Regular expression for matching ANSI escape codes
|
||||
- [wrap-ansi](https://github.com/chalk/wrap-ansi) - Wordwrap a string with ANSI escape codes
|
||||
|
||||
|
||||
## License
|
||||
|
||||
MIT © [Sindre Sorhus](http://sindresorhus.com)
|
65
node_modules/combined-stream/package.json
generated
vendored
65
node_modules/combined-stream/package.json
generated
vendored
@ -1,37 +1,19 @@
|
||||
{
|
||||
"_args": [
|
||||
[
|
||||
{
|
||||
"raw": "combined-stream@~1.0.5",
|
||||
"scope": null,
|
||||
"escapedName": "combined-stream",
|
||||
"name": "combined-stream",
|
||||
"rawSpec": "~1.0.5",
|
||||
"spec": ">=1.0.5 <1.1.0",
|
||||
"type": "range"
|
||||
},
|
||||
"/tank/data/SERVER/zoneadm-master/node_modules/request"
|
||||
]
|
||||
],
|
||||
"_from": "combined-stream@>=1.0.5 <1.1.0",
|
||||
"_from": "combined-stream@~1.0.5",
|
||||
"_id": "combined-stream@1.0.5",
|
||||
"_inCache": true,
|
||||
"_inBundle": false,
|
||||
"_integrity": "sha1-k4NwpXtKUd6ix3wV1cX9+JUWQAk=",
|
||||
"_location": "/combined-stream",
|
||||
"_nodeVersion": "0.12.4",
|
||||
"_npmUser": {
|
||||
"name": "alexindigo",
|
||||
"email": "iam@alexindigo.com"
|
||||
},
|
||||
"_npmVersion": "2.10.1",
|
||||
"_phantomChildren": {},
|
||||
"_requested": {
|
||||
"type": "range",
|
||||
"registry": true,
|
||||
"raw": "combined-stream@~1.0.5",
|
||||
"scope": null,
|
||||
"escapedName": "combined-stream",
|
||||
"name": "combined-stream",
|
||||
"escapedName": "combined-stream",
|
||||
"rawSpec": "~1.0.5",
|
||||
"spec": ">=1.0.5 <1.1.0",
|
||||
"type": "range"
|
||||
"saveSpec": null,
|
||||
"fetchSpec": "~1.0.5"
|
||||
},
|
||||
"_requiredBy": [
|
||||
"/form-data",
|
||||
@ -39,9 +21,8 @@
|
||||
],
|
||||
"_resolved": "https://registry.npmjs.org/combined-stream/-/combined-stream-1.0.5.tgz",
|
||||
"_shasum": "938370a57b4a51dea2c77c15d5c5fdf895164009",
|
||||
"_shrinkwrap": null,
|
||||
"_spec": "combined-stream@~1.0.5",
|
||||
"_where": "/tank/data/SERVER/zoneadm-master/node_modules/request",
|
||||
"_where": "/export/home/matjaz/git/zoneadmin-master/node_modules/request",
|
||||
"author": {
|
||||
"name": "Felix Geisendörfer",
|
||||
"email": "felix@debuggable.com",
|
||||
@ -50,46 +31,22 @@
|
||||
"bugs": {
|
||||
"url": "https://github.com/felixge/node-combined-stream/issues"
|
||||
},
|
||||
"bundleDependencies": false,
|
||||
"dependencies": {
|
||||
"delayed-stream": "~1.0.0"
|
||||
},
|
||||
"deprecated": false,
|
||||
"description": "A stream that emits multiple other streams one after another.",
|
||||
"devDependencies": {
|
||||
"far": "~0.0.7"
|
||||
},
|
||||
"directories": {},
|
||||
"dist": {
|
||||
"shasum": "938370a57b4a51dea2c77c15d5c5fdf895164009",
|
||||
"tarball": "https://registry.npmjs.org/combined-stream/-/combined-stream-1.0.5.tgz"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">= 0.8"
|
||||
},
|
||||
"gitHead": "cfc7b815d090a109bcedb5bb0f6713148d55a6b7",
|
||||
"homepage": "https://github.com/felixge/node-combined-stream",
|
||||
"license": "MIT",
|
||||
"main": "./lib/combined_stream",
|
||||
"maintainers": [
|
||||
{
|
||||
"name": "felixge",
|
||||
"email": "felix@debuggable.com"
|
||||
},
|
||||
{
|
||||
"name": "celer",
|
||||
"email": "dtyree77@gmail.com"
|
||||
},
|
||||
{
|
||||
"name": "alexindigo",
|
||||
"email": "iam@alexindigo.com"
|
||||
},
|
||||
{
|
||||
"name": "apechimp",
|
||||
"email": "apeherder@gmail.com"
|
||||
}
|
||||
],
|
||||
"name": "combined-stream",
|
||||
"optionalDependencies": {},
|
||||
"readme": "ERROR: No README data found!",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git://github.com/felixge/node-combined-stream.git"
|
||||
|
261
node_modules/commander/History.md
generated
vendored
261
node_modules/commander/History.md
generated
vendored
@ -1,261 +0,0 @@
|
||||
|
||||
2.9.0 / 2015-10-13
|
||||
==================
|
||||
|
||||
* Add option `isDefault` to set default subcommand #415 @Qix-
|
||||
* Add callback to allow filtering or post-processing of help text #434 @djulien
|
||||
* Fix `undefined` text in help information close #414 #416 @zhiyelee
|
||||
|
||||
2.8.1 / 2015-04-22
|
||||
==================
|
||||
|
||||
* Back out `support multiline description` Close #396 #397
|
||||
|
||||
2.8.0 / 2015-04-07
|
||||
==================
|
||||
|
||||
* Add `process.execArg` support, execution args like `--harmony` will be passed to sub-commands #387 @DigitalIO @zhiyelee
|
||||
* Fix bug in Git-style sub-commands #372 @zhiyelee
|
||||
* Allow commands to be hidden from help #383 @tonylukasavage
|
||||
* When git-style sub-commands are in use, yet none are called, display help #382 @claylo
|
||||
* Add ability to specify arguments syntax for top-level command #258 @rrthomas
|
||||
* Support multiline descriptions #208 @zxqfox
|
||||
|
||||
2.7.1 / 2015-03-11
|
||||
==================
|
||||
|
||||
* Revert #347 (fix collisions when option and first arg have same name) which causes a bug in #367.
|
||||
|
||||
2.7.0 / 2015-03-09
|
||||
==================
|
||||
|
||||
* Fix git-style bug when installed globally. Close #335 #349 @zhiyelee
|
||||
* Fix collisions when option and first arg have same name. Close #346 #347 @tonylukasavage
|
||||
* Add support for camelCase on `opts()`. Close #353 @nkzawa
|
||||
* Add node.js 0.12 and io.js to travis.yml
|
||||
* Allow RegEx options. #337 @palanik
|
||||
* Fixes exit code when sub-command failing. Close #260 #332 @pirelenito
|
||||
* git-style `bin` files in $PATH make sense. Close #196 #327 @zhiyelee
|
||||
|
||||
2.6.0 / 2014-12-30
|
||||
==================
|
||||
|
||||
* added `Command#allowUnknownOption` method. Close #138 #318 @doozr @zhiyelee
|
||||
* Add application description to the help msg. Close #112 @dalssoft
|
||||
|
||||
2.5.1 / 2014-12-15
|
||||
==================
|
||||
|
||||
* fixed two bugs incurred by variadic arguments. Close #291 @Quentin01 #302 @zhiyelee
|
||||
|
||||
2.5.0 / 2014-10-24
|
||||
==================
|
||||
|
||||
* add support for variadic arguments. Closes #277 @whitlockjc
|
||||
|
||||
2.4.0 / 2014-10-17
|
||||
==================
|
||||
|
||||
* fixed a bug on executing the coercion function of subcommands option. Closes #270
|
||||
* added `Command.prototype.name` to retrieve command name. Closes #264 #266 @tonylukasavage
|
||||
* added `Command.prototype.opts` to retrieve all the options as a simple object of key-value pairs. Closes #262 @tonylukasavage
|
||||
* fixed a bug on subcommand name. Closes #248 @jonathandelgado
|
||||
* fixed function normalize doesn’t honor option terminator. Closes #216 @abbr
|
||||
|
||||
2.3.0 / 2014-07-16
|
||||
==================
|
||||
|
||||
* add command alias'. Closes PR #210
|
||||
* fix: Typos. Closes #99
|
||||
* fix: Unused fs module. Closes #217
|
||||
|
||||
2.2.0 / 2014-03-29
|
||||
==================
|
||||
|
||||
* add passing of previous option value
|
||||
* fix: support subcommands on windows. Closes #142
|
||||
* Now the defaultValue passed as the second argument of the coercion function.
|
||||
|
||||
2.1.0 / 2013-11-21
|
||||
==================
|
||||
|
||||
* add: allow cflag style option params, unit test, fixes #174
|
||||
|
||||
2.0.0 / 2013-07-18
|
||||
==================
|
||||
|
||||
* remove input methods (.prompt, .confirm, etc)
|
||||
|
||||
1.3.2 / 2013-07-18
|
||||
==================
|
||||
|
||||
* add support for sub-commands to co-exist with the original command
|
||||
|
||||
1.3.1 / 2013-07-18
|
||||
==================
|
||||
|
||||
* add quick .runningCommand hack so you can opt-out of other logic when running a sub command
|
||||
|
||||
1.3.0 / 2013-07-09
|
||||
==================
|
||||
|
||||
* add EACCES error handling
|
||||
* fix sub-command --help
|
||||
|
||||
1.2.0 / 2013-06-13
|
||||
==================
|
||||
|
||||
* allow "-" hyphen as an option argument
|
||||
* support for RegExp coercion
|
||||
|
||||
1.1.1 / 2012-11-20
|
||||
==================
|
||||
|
||||
* add more sub-command padding
|
||||
* fix .usage() when args are present. Closes #106
|
||||
|
||||
1.1.0 / 2012-11-16
|
||||
==================
|
||||
|
||||
* add git-style executable subcommand support. Closes #94
|
||||
|
||||
1.0.5 / 2012-10-09
|
||||
==================
|
||||
|
||||
* fix `--name` clobbering. Closes #92
|
||||
* fix examples/help. Closes #89
|
||||
|
||||
1.0.4 / 2012-09-03
|
||||
==================
|
||||
|
||||
* add `outputHelp()` method.
|
||||
|
||||
1.0.3 / 2012-08-30
|
||||
==================
|
||||
|
||||
* remove invalid .version() defaulting
|
||||
|
||||
1.0.2 / 2012-08-24
|
||||
==================
|
||||
|
||||
* add `--foo=bar` support [arv]
|
||||
* fix password on node 0.8.8. Make backward compatible with 0.6 [focusaurus]
|
||||
|
||||
1.0.1 / 2012-08-03
|
||||
==================
|
||||
|
||||
* fix issue #56
|
||||
* fix tty.setRawMode(mode) was moved to tty.ReadStream#setRawMode() (i.e. process.stdin.setRawMode())
|
||||
|
||||
1.0.0 / 2012-07-05
|
||||
==================
|
||||
|
||||
* add support for optional option descriptions
|
||||
* add defaulting of `.version()` to package.json's version
|
||||
|
||||
0.6.1 / 2012-06-01
|
||||
==================
|
||||
|
||||
* Added: append (yes or no) on confirmation
|
||||
* Added: allow node.js v0.7.x
|
||||
|
||||
0.6.0 / 2012-04-10
|
||||
==================
|
||||
|
||||
* Added `.prompt(obj, callback)` support. Closes #49
|
||||
* Added default support to .choose(). Closes #41
|
||||
* Fixed the choice example
|
||||
|
||||
0.5.1 / 2011-12-20
|
||||
==================
|
||||
|
||||
* Fixed `password()` for recent nodes. Closes #36
|
||||
|
||||
0.5.0 / 2011-12-04
|
||||
==================
|
||||
|
||||
* Added sub-command option support [itay]
|
||||
|
||||
0.4.3 / 2011-12-04
|
||||
==================
|
||||
|
||||
* Fixed custom help ordering. Closes #32
|
||||
|
||||
0.4.2 / 2011-11-24
|
||||
==================
|
||||
|
||||
* Added travis support
|
||||
* Fixed: line-buffered input automatically trimmed. Closes #31
|
||||
|
||||
0.4.1 / 2011-11-18
|
||||
==================
|
||||
|
||||
* Removed listening for "close" on --help
|
||||
|
||||
0.4.0 / 2011-11-15
|
||||
==================
|
||||
|
||||
* Added support for `--`. Closes #24
|
||||
|
||||
0.3.3 / 2011-11-14
|
||||
==================
|
||||
|
||||
* Fixed: wait for close event when writing help info [Jerry Hamlet]
|
||||
|
||||
0.3.2 / 2011-11-01
|
||||
==================
|
||||
|
||||
* Fixed long flag definitions with values [felixge]
|
||||
|
||||
0.3.1 / 2011-10-31
|
||||
==================
|
||||
|
||||
* Changed `--version` short flag to `-V` from `-v`
|
||||
* Changed `.version()` so it's configurable [felixge]
|
||||
|
||||
0.3.0 / 2011-10-31
|
||||
==================
|
||||
|
||||
* Added support for long flags only. Closes #18
|
||||
|
||||
0.2.1 / 2011-10-24
|
||||
==================
|
||||
|
||||
* "node": ">= 0.4.x < 0.7.0". Closes #20
|
||||
|
||||
0.2.0 / 2011-09-26
|
||||
==================
|
||||
|
||||
* Allow for defaults that are not just boolean. Default peassignment only occurs for --no-*, optional, and required arguments. [Jim Isaacs]
|
||||
|
||||
0.1.0 / 2011-08-24
|
||||
==================
|
||||
|
||||
* Added support for custom `--help` output
|
||||
|
||||
0.0.5 / 2011-08-18
|
||||
==================
|
||||
|
||||
* Changed: when the user enters nothing prompt for password again
|
||||
* Fixed issue with passwords beginning with numbers [NuckChorris]
|
||||
|
||||
0.0.4 / 2011-08-15
|
||||
==================
|
||||
|
||||
* Fixed `Commander#args`
|
||||
|
||||
0.0.3 / 2011-08-15
|
||||
==================
|
||||
|
||||
* Added default option value support
|
||||
|
||||
0.0.2 / 2011-08-15
|
||||
==================
|
||||
|
||||
* Added mask support to `Command#password(str[, mask], fn)`
|
||||
* Added `Command#password(str, fn)`
|
||||
|
||||
0.0.1 / 2010-01-03
|
||||
==================
|
||||
|
||||
* Initial release
|
22
node_modules/commander/LICENSE
generated
vendored
22
node_modules/commander/LICENSE
generated
vendored
@ -1,22 +0,0 @@
|
||||
(The MIT License)
|
||||
|
||||
Copyright (c) 2011 TJ Holowaychuk <tj@vision-media.ca>
|
||||
|
||||
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.
|
351
node_modules/commander/Readme.md
generated
vendored
351
node_modules/commander/Readme.md
generated
vendored
@ -1,351 +0,0 @@
|
||||
# Commander.js
|
||||
|
||||
|
||||
[](http://travis-ci.org/tj/commander.js)
|
||||
[](https://www.npmjs.org/package/commander)
|
||||
[](https://www.npmjs.org/package/commander)
|
||||
[](https://gitter.im/tj/commander.js?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)
|
||||
|
||||
The complete solution for [node.js](http://nodejs.org) command-line interfaces, inspired by Ruby's [commander](https://github.com/tj/commander).
|
||||
[API documentation](http://tj.github.com/commander.js/)
|
||||
|
||||
|
||||
## Installation
|
||||
|
||||
$ npm install commander
|
||||
|
||||
## Option parsing
|
||||
|
||||
Options with commander are defined with the `.option()` method, also serving as documentation for the options. The example below parses args and options from `process.argv`, leaving remaining args as the `program.args` array which were not consumed by options.
|
||||
|
||||
```js
|
||||
#!/usr/bin/env node
|
||||
|
||||
/**
|
||||
* Module dependencies.
|
||||
*/
|
||||
|
||||
var program = require('commander');
|
||||
|
||||
program
|
||||
.version('0.0.1')
|
||||
.option('-p, --peppers', 'Add peppers')
|
||||
.option('-P, --pineapple', 'Add pineapple')
|
||||
.option('-b, --bbq-sauce', 'Add bbq sauce')
|
||||
.option('-c, --cheese [type]', 'Add the specified type of cheese [marble]', 'marble')
|
||||
.parse(process.argv);
|
||||
|
||||
console.log('you ordered a pizza with:');
|
||||
if (program.peppers) console.log(' - peppers');
|
||||
if (program.pineapple) console.log(' - pineapple');
|
||||
if (program.bbqSauce) console.log(' - bbq');
|
||||
console.log(' - %s cheese', program.cheese);
|
||||
```
|
||||
|
||||
Short flags may be passed as a single arg, for example `-abc` is equivalent to `-a -b -c`. Multi-word options such as "--template-engine" are camel-cased, becoming `program.templateEngine` etc.
|
||||
|
||||
|
||||
## Coercion
|
||||
|
||||
```js
|
||||
function range(val) {
|
||||
return val.split('..').map(Number);
|
||||
}
|
||||
|
||||
function list(val) {
|
||||
return val.split(',');
|
||||
}
|
||||
|
||||
function collect(val, memo) {
|
||||
memo.push(val);
|
||||
return memo;
|
||||
}
|
||||
|
||||
function increaseVerbosity(v, total) {
|
||||
return total + 1;
|
||||
}
|
||||
|
||||
program
|
||||
.version('0.0.1')
|
||||
.usage('[options] <file ...>')
|
||||
.option('-i, --integer <n>', 'An integer argument', parseInt)
|
||||
.option('-f, --float <n>', 'A float argument', parseFloat)
|
||||
.option('-r, --range <a>..<b>', 'A range', range)
|
||||
.option('-l, --list <items>', 'A list', list)
|
||||
.option('-o, --optional [value]', 'An optional value')
|
||||
.option('-c, --collect [value]', 'A repeatable value', collect, [])
|
||||
.option('-v, --verbose', 'A value that can be increased', increaseVerbosity, 0)
|
||||
.parse(process.argv);
|
||||
|
||||
console.log(' int: %j', program.integer);
|
||||
console.log(' float: %j', program.float);
|
||||
console.log(' optional: %j', program.optional);
|
||||
program.range = program.range || [];
|
||||
console.log(' range: %j..%j', program.range[0], program.range[1]);
|
||||
console.log(' list: %j', program.list);
|
||||
console.log(' collect: %j', program.collect);
|
||||
console.log(' verbosity: %j', program.verbose);
|
||||
console.log(' args: %j', program.args);
|
||||
```
|
||||
|
||||
## Regular Expression
|
||||
```js
|
||||
program
|
||||
.version('0.0.1')
|
||||
.option('-s --size <size>', 'Pizza size', /^(large|medium|small)$/i, 'medium')
|
||||
.option('-d --drink [drink]', 'Drink', /^(coke|pepsi|izze)$/i)
|
||||
.parse(process.argv);
|
||||
|
||||
console.log(' size: %j', program.size);
|
||||
console.log(' drink: %j', program.drink);
|
||||
```
|
||||
|
||||
## Variadic arguments
|
||||
|
||||
The last argument of a command can be variadic, and only the last argument. To make an argument variadic you have to
|
||||
append `...` to the argument name. Here is an example:
|
||||
|
||||
```js
|
||||
#!/usr/bin/env node
|
||||
|
||||
/**
|
||||
* Module dependencies.
|
||||
*/
|
||||
|
||||
var program = require('commander');
|
||||
|
||||
program
|
||||
.version('0.0.1')
|
||||
.command('rmdir <dir> [otherDirs...]')
|
||||
.action(function (dir, otherDirs) {
|
||||
console.log('rmdir %s', dir);
|
||||
if (otherDirs) {
|
||||
otherDirs.forEach(function (oDir) {
|
||||
console.log('rmdir %s', oDir);
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
program.parse(process.argv);
|
||||
```
|
||||
|
||||
An `Array` is used for the value of a variadic argument. This applies to `program.args` as well as the argument passed
|
||||
to your action as demonstrated above.
|
||||
|
||||
## Specify the argument syntax
|
||||
|
||||
```js
|
||||
#!/usr/bin/env node
|
||||
|
||||
var program = require('../');
|
||||
|
||||
program
|
||||
.version('0.0.1')
|
||||
.arguments('<cmd> [env]')
|
||||
.action(function (cmd, env) {
|
||||
cmdValue = cmd;
|
||||
envValue = env;
|
||||
});
|
||||
|
||||
program.parse(process.argv);
|
||||
|
||||
if (typeof cmdValue === 'undefined') {
|
||||
console.error('no command given!');
|
||||
process.exit(1);
|
||||
}
|
||||
console.log('command:', cmdValue);
|
||||
console.log('environment:', envValue || "no environment given");
|
||||
```
|
||||
|
||||
## Git-style sub-commands
|
||||
|
||||
```js
|
||||
// file: ./examples/pm
|
||||
var program = require('..');
|
||||
|
||||
program
|
||||
.version('0.0.1')
|
||||
.command('install [name]', 'install one or more packages')
|
||||
.command('search [query]', 'search with optional query')
|
||||
.command('list', 'list packages installed', {isDefault: true})
|
||||
.parse(process.argv);
|
||||
```
|
||||
|
||||
When `.command()` is invoked with a description argument, no `.action(callback)` should be called to handle sub-commands, otherwise there will be an error. This tells commander that you're going to use separate executables for sub-commands, much like `git(1)` and other popular tools.
|
||||
The commander will try to search the executables in the directory of the entry script (like `./examples/pm`) with the name `program-command`, like `pm-install`, `pm-search`.
|
||||
|
||||
Options can be passed with the call to `.command()`. Specifying `true` for `opts.noHelp` will remove the option from the generated help output. Specifying `true` for `opts.isDefault` will run the subcommand if no other subcommand is specified.
|
||||
|
||||
If the program is designed to be installed globally, make sure the executables have proper modes, like `755`.
|
||||
|
||||
### `--harmony`
|
||||
|
||||
You can enable `--harmony` option in two ways:
|
||||
* Use `#! /usr/bin/env node --harmony` in the sub-commands scripts. Note some os version don’t support this pattern.
|
||||
* Use the `--harmony` option when call the command, like `node --harmony examples/pm publish`. The `--harmony` option will be preserved when spawning sub-command process.
|
||||
|
||||
## Automated --help
|
||||
|
||||
The help information is auto-generated based on the information commander already knows about your program, so the following `--help` info is for free:
|
||||
|
||||
```
|
||||
$ ./examples/pizza --help
|
||||
|
||||
Usage: pizza [options]
|
||||
|
||||
An application for pizzas ordering
|
||||
|
||||
Options:
|
||||
|
||||
-h, --help output usage information
|
||||
-V, --version output the version number
|
||||
-p, --peppers Add peppers
|
||||
-P, --pineapple Add pineapple
|
||||
-b, --bbq Add bbq sauce
|
||||
-c, --cheese <type> Add the specified type of cheese [marble]
|
||||
-C, --no-cheese You do not want any cheese
|
||||
|
||||
```
|
||||
|
||||
## Custom help
|
||||
|
||||
You can display arbitrary `-h, --help` information
|
||||
by listening for "--help". Commander will automatically
|
||||
exit once you are done so that the remainder of your program
|
||||
does not execute causing undesired behaviours, for example
|
||||
in the following executable "stuff" will not output when
|
||||
`--help` is used.
|
||||
|
||||
```js
|
||||
#!/usr/bin/env node
|
||||
|
||||
/**
|
||||
* Module dependencies.
|
||||
*/
|
||||
|
||||
var program = require('commander');
|
||||
|
||||
program
|
||||
.version('0.0.1')
|
||||
.option('-f, --foo', 'enable some foo')
|
||||
.option('-b, --bar', 'enable some bar')
|
||||
.option('-B, --baz', 'enable some baz');
|
||||
|
||||
// must be before .parse() since
|
||||
// node's emit() is immediate
|
||||
|
||||
program.on('--help', function(){
|
||||
console.log(' Examples:');
|
||||
console.log('');
|
||||
console.log(' $ custom-help --help');
|
||||
console.log(' $ custom-help -h');
|
||||
console.log('');
|
||||
});
|
||||
|
||||
program.parse(process.argv);
|
||||
|
||||
console.log('stuff');
|
||||
```
|
||||
|
||||
Yields the following help output when `node script-name.js -h` or `node script-name.js --help` are run:
|
||||
|
||||
```
|
||||
|
||||
Usage: custom-help [options]
|
||||
|
||||
Options:
|
||||
|
||||
-h, --help output usage information
|
||||
-V, --version output the version number
|
||||
-f, --foo enable some foo
|
||||
-b, --bar enable some bar
|
||||
-B, --baz enable some baz
|
||||
|
||||
Examples:
|
||||
|
||||
$ custom-help --help
|
||||
$ custom-help -h
|
||||
|
||||
```
|
||||
|
||||
## .outputHelp(cb)
|
||||
|
||||
Output help information without exiting.
|
||||
Optional callback cb allows post-processing of help text before it is displayed.
|
||||
|
||||
If you want to display help by default (e.g. if no command was provided), you can use something like:
|
||||
|
||||
```js
|
||||
var program = require('commander');
|
||||
var colors = require('colors');
|
||||
|
||||
program
|
||||
.version('0.0.1')
|
||||
.command('getstream [url]', 'get stream URL')
|
||||
.parse(process.argv);
|
||||
|
||||
if (!process.argv.slice(2).length) {
|
||||
program.outputHelp(make_red);
|
||||
}
|
||||
|
||||
function make_red(txt) {
|
||||
return colors.red(txt); //display the help text in red on the console
|
||||
}
|
||||
```
|
||||
|
||||
## .help(cb)
|
||||
|
||||
Output help information and exit immediately.
|
||||
Optional callback cb allows post-processing of help text before it is displayed.
|
||||
|
||||
## Examples
|
||||
|
||||
```js
|
||||
var program = require('commander');
|
||||
|
||||
program
|
||||
.version('0.0.1')
|
||||
.option('-C, --chdir <path>', 'change the working directory')
|
||||
.option('-c, --config <path>', 'set config path. defaults to ./deploy.conf')
|
||||
.option('-T, --no-tests', 'ignore test hook')
|
||||
|
||||
program
|
||||
.command('setup [env]')
|
||||
.description('run setup commands for all envs')
|
||||
.option("-s, --setup_mode [mode]", "Which setup mode to use")
|
||||
.action(function(env, options){
|
||||
var mode = options.setup_mode || "normal";
|
||||
env = env || 'all';
|
||||
console.log('setup for %s env(s) with %s mode', env, mode);
|
||||
});
|
||||
|
||||
program
|
||||
.command('exec <cmd>')
|
||||
.alias('ex')
|
||||
.description('execute the given remote cmd')
|
||||
.option("-e, --exec_mode <mode>", "Which exec mode to use")
|
||||
.action(function(cmd, options){
|
||||
console.log('exec "%s" using %s mode', cmd, options.exec_mode);
|
||||
}).on('--help', function() {
|
||||
console.log(' Examples:');
|
||||
console.log();
|
||||
console.log(' $ deploy exec sequential');
|
||||
console.log(' $ deploy exec async');
|
||||
console.log();
|
||||
});
|
||||
|
||||
program
|
||||
.command('*')
|
||||
.action(function(env){
|
||||
console.log('deploying "%s"', env);
|
||||
});
|
||||
|
||||
program.parse(process.argv);
|
||||
```
|
||||
|
||||
More Demos can be found in the [examples](https://github.com/tj/commander.js/tree/master/examples) directory.
|
||||
|
||||
## License
|
||||
|
||||
MIT
|
||||
|
1110
node_modules/commander/index.js
generated
vendored
1110
node_modules/commander/index.js
generated
vendored
File diff suppressed because it is too large
Load Diff
104
node_modules/commander/package.json
generated
vendored
104
node_modules/commander/package.json
generated
vendored
@ -1,104 +0,0 @@
|
||||
{
|
||||
"_args": [
|
||||
[
|
||||
{
|
||||
"raw": "commander@^2.9.0",
|
||||
"scope": null,
|
||||
"escapedName": "commander",
|
||||
"name": "commander",
|
||||
"rawSpec": "^2.9.0",
|
||||
"spec": ">=2.9.0 <3.0.0",
|
||||
"type": "range"
|
||||
},
|
||||
"/tank/data/SERVER/zoneadm-master/node_modules/har-validator"
|
||||
]
|
||||
],
|
||||
"_from": "commander@>=2.9.0 <3.0.0",
|
||||
"_id": "commander@2.9.0",
|
||||
"_inCache": true,
|
||||
"_location": "/commander",
|
||||
"_nodeVersion": "0.12.7",
|
||||
"_npmUser": {
|
||||
"name": "zhiyelee",
|
||||
"email": "zhiyelee@gmail.com"
|
||||
},
|
||||
"_npmVersion": "2.11.3",
|
||||
"_phantomChildren": {},
|
||||
"_requested": {
|
||||
"raw": "commander@^2.9.0",
|
||||
"scope": null,
|
||||
"escapedName": "commander",
|
||||
"name": "commander",
|
||||
"rawSpec": "^2.9.0",
|
||||
"spec": ">=2.9.0 <3.0.0",
|
||||
"type": "range"
|
||||
},
|
||||
"_requiredBy": [
|
||||
"/har-validator"
|
||||
],
|
||||
"_resolved": "https://registry.npmjs.org/commander/-/commander-2.9.0.tgz",
|
||||
"_shasum": "9c99094176e12240cb22d6c5146098400fe0f7d4",
|
||||
"_shrinkwrap": null,
|
||||
"_spec": "commander@^2.9.0",
|
||||
"_where": "/tank/data/SERVER/zoneadm-master/node_modules/har-validator",
|
||||
"author": {
|
||||
"name": "TJ Holowaychuk",
|
||||
"email": "tj@vision-media.ca"
|
||||
},
|
||||
"bugs": {
|
||||
"url": "https://github.com/tj/commander.js/issues"
|
||||
},
|
||||
"dependencies": {
|
||||
"graceful-readlink": ">= 1.0.0"
|
||||
},
|
||||
"description": "the complete solution for node.js command-line programs",
|
||||
"devDependencies": {
|
||||
"should": ">= 0.0.1",
|
||||
"sinon": ">=1.17.1"
|
||||
},
|
||||
"directories": {},
|
||||
"dist": {
|
||||
"shasum": "9c99094176e12240cb22d6c5146098400fe0f7d4",
|
||||
"tarball": "https://registry.npmjs.org/commander/-/commander-2.9.0.tgz"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">= 0.6.x"
|
||||
},
|
||||
"files": [
|
||||
"index.js"
|
||||
],
|
||||
"gitHead": "b2aad7a8471d434593a85306aa73777a526e9f75",
|
||||
"homepage": "https://github.com/tj/commander.js#readme",
|
||||
"keywords": [
|
||||
"command",
|
||||
"option",
|
||||
"parser"
|
||||
],
|
||||
"license": "MIT",
|
||||
"main": "index",
|
||||
"maintainers": [
|
||||
{
|
||||
"name": "tjholowaychuk",
|
||||
"email": "tj@vision-media.ca"
|
||||
},
|
||||
{
|
||||
"name": "somekittens",
|
||||
"email": "rkoutnik@gmail.com"
|
||||
},
|
||||
{
|
||||
"name": "zhiyelee",
|
||||
"email": "zhiyelee@gmail.com"
|
||||
}
|
||||
],
|
||||
"name": "commander",
|
||||
"optionalDependencies": {},
|
||||
"readme": "ERROR: No README data found!",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git+https://github.com/tj/commander.js.git"
|
||||
},
|
||||
"scripts": {
|
||||
"test": "make test"
|
||||
},
|
||||
"version": "2.9.0"
|
||||
}
|
21
node_modules/cryptiles/.npmignore
generated
vendored
21
node_modules/cryptiles/.npmignore
generated
vendored
@ -1,18 +1,3 @@
|
||||
.idea
|
||||
*.iml
|
||||
npm-debug.log
|
||||
dump.rdb
|
||||
node_modules
|
||||
results.tap
|
||||
results.xml
|
||||
npm-shrinkwrap.json
|
||||
config.json
|
||||
.DS_Store
|
||||
*/.DS_Store
|
||||
*/*/.DS_Store
|
||||
._*
|
||||
*/._*
|
||||
*/*/._*
|
||||
coverage.*
|
||||
lib-cov
|
||||
|
||||
*
|
||||
!lib/**
|
||||
!.npmignore
|
||||
|
8
node_modules/cryptiles/.travis.yml
generated
vendored
8
node_modules/cryptiles/.travis.yml
generated
vendored
@ -1,8 +0,0 @@
|
||||
language: node_js
|
||||
|
||||
node_js:
|
||||
- 0.10
|
||||
- 4.0
|
||||
|
||||
sudo: false
|
||||
|
2
node_modules/cryptiles/LICENSE
generated
vendored
2
node_modules/cryptiles/LICENSE
generated
vendored
@ -1,4 +1,4 @@
|
||||
Copyright (c) 2014, Eran Hammer and other contributors.
|
||||
Copyright (c) 2014-2017, Eran Hammer and Project contributors
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
|
3
node_modules/cryptiles/README.md
generated
vendored
Normal file → Executable file
3
node_modules/cryptiles/README.md
generated
vendored
Normal file → Executable file
@ -12,5 +12,8 @@ Lead Maintainer - [C J Silverio](https://github.com/ceejbot)
|
||||
### `randomString(<Number> size)`
|
||||
Returns a cryptographically strong pseudo-random data string. Takes a size argument for the length of the string.
|
||||
|
||||
### `randomDigits(<Number> size)`
|
||||
Returns a cryptographically strong pseudo-random data string consisting of only numerical digits (0-9). Takes a size argument for the length of the string.
|
||||
|
||||
### `fixedTimeComparison(<String> a, <String> b)`
|
||||
Compare two strings using fixed time algorithm (to prevent time-based analysis of MAC digest match). Returns `true` if the strings match, `false` if they differ.
|
||||
|
44
node_modules/cryptiles/lib/index.js
generated
vendored
44
node_modules/cryptiles/lib/index.js
generated
vendored
@ -1,28 +1,50 @@
|
||||
'use strict';
|
||||
|
||||
// Load modules
|
||||
|
||||
var Crypto = require('crypto');
|
||||
var Boom = require('boom');
|
||||
const Crypto = require('crypto');
|
||||
const Boom = require('boom');
|
||||
|
||||
|
||||
// Declare internals
|
||||
|
||||
var internals = {};
|
||||
const internals = {};
|
||||
|
||||
|
||||
// Generate a cryptographically strong pseudo-random data
|
||||
|
||||
exports.randomString = function (size) {
|
||||
|
||||
var buffer = exports.randomBits((size + 1) * 6);
|
||||
const buffer = exports.randomBits((size + 1) * 6);
|
||||
if (buffer instanceof Error) {
|
||||
return buffer;
|
||||
}
|
||||
|
||||
var string = buffer.toString('base64').replace(/\+/g, '-').replace(/\//g, '_').replace(/\=/g, '');
|
||||
const string = buffer.toString('base64').replace(/\+/g, '-').replace(/\//g, '_').replace(/\=/g, '');
|
||||
return string.slice(0, size);
|
||||
};
|
||||
|
||||
|
||||
// Return a random string of digits
|
||||
|
||||
exports.randomDigits = function (size) {
|
||||
|
||||
const buffer = exports.randomBits(size * 8);
|
||||
if (buffer instanceof Error) {
|
||||
return buffer;
|
||||
}
|
||||
|
||||
const digits = [];
|
||||
for (let i = 0; i < buffer.length; ++i) {
|
||||
digits.push(Math.floor(buffer[i] / 25.6));
|
||||
}
|
||||
|
||||
return digits.join('');
|
||||
};
|
||||
|
||||
|
||||
// Generate a buffer of random bits
|
||||
|
||||
exports.randomBits = function (bits) {
|
||||
|
||||
if (!bits ||
|
||||
@ -31,7 +53,7 @@ exports.randomBits = function (bits) {
|
||||
return Boom.internal('Invalid random bits count');
|
||||
}
|
||||
|
||||
var bytes = Math.ceil(bits / 8);
|
||||
const bytes = Math.ceil(bits / 8);
|
||||
try {
|
||||
return Crypto.randomBytes(bytes);
|
||||
}
|
||||
@ -51,18 +73,16 @@ exports.fixedTimeComparison = function (a, b) {
|
||||
return false;
|
||||
}
|
||||
|
||||
var mismatch = (a.length === b.length ? 0 : 1);
|
||||
let mismatch = (a.length === b.length ? 0 : 1);
|
||||
if (mismatch) {
|
||||
b = a;
|
||||
}
|
||||
|
||||
for (var i = 0, il = a.length; i < il; ++i) {
|
||||
var ac = a.charCodeAt(i);
|
||||
var bc = b.charCodeAt(i);
|
||||
for (let i = 0; i < a.length; ++i) {
|
||||
const ac = a.charCodeAt(i);
|
||||
const bc = b.charCodeAt(i);
|
||||
mismatch |= (ac ^ bc);
|
||||
}
|
||||
|
||||
return (mismatch === 0);
|
||||
};
|
||||
|
||||
|
||||
|
81
node_modules/cryptiles/package.json
generated
vendored
81
node_modules/cryptiles/package.json
generated
vendored
@ -1,66 +1,45 @@
|
||||
{
|
||||
"_args": [
|
||||
[
|
||||
{
|
||||
"raw": "cryptiles@2.x.x",
|
||||
"scope": null,
|
||||
"escapedName": "cryptiles",
|
||||
"name": "cryptiles",
|
||||
"rawSpec": "2.x.x",
|
||||
"spec": ">=2.0.0 <3.0.0",
|
||||
"type": "range"
|
||||
},
|
||||
"/tank/data/SERVER/zoneadm-master/node_modules/hawk"
|
||||
]
|
||||
],
|
||||
"_from": "cryptiles@>=2.0.0 <3.0.0",
|
||||
"_id": "cryptiles@2.0.5",
|
||||
"_inCache": true,
|
||||
"_from": "cryptiles@3.x.x",
|
||||
"_id": "cryptiles@3.1.2",
|
||||
"_inBundle": false,
|
||||
"_integrity": "sha1-qJ+7Ig9c4l7FboxKqKT9e1sNKf4=",
|
||||
"_location": "/cryptiles",
|
||||
"_nodeVersion": "4.0.0",
|
||||
"_npmUser": {
|
||||
"name": "hueniverse",
|
||||
"email": "eran@hammer.io"
|
||||
"_phantomChildren": {
|
||||
"hoek": "4.2.0"
|
||||
},
|
||||
"_npmVersion": "2.14.2",
|
||||
"_phantomChildren": {},
|
||||
"_requested": {
|
||||
"raw": "cryptiles@2.x.x",
|
||||
"scope": null,
|
||||
"escapedName": "cryptiles",
|
||||
"type": "range",
|
||||
"registry": true,
|
||||
"raw": "cryptiles@3.x.x",
|
||||
"name": "cryptiles",
|
||||
"rawSpec": "2.x.x",
|
||||
"spec": ">=2.0.0 <3.0.0",
|
||||
"type": "range"
|
||||
"escapedName": "cryptiles",
|
||||
"rawSpec": "3.x.x",
|
||||
"saveSpec": null,
|
||||
"fetchSpec": "3.x.x"
|
||||
},
|
||||
"_requiredBy": [
|
||||
"/hawk"
|
||||
],
|
||||
"_resolved": "https://registry.npmjs.org/cryptiles/-/cryptiles-2.0.5.tgz",
|
||||
"_shasum": "3bdfecdc608147c1c67202fa291e7dca59eaa3b8",
|
||||
"_shrinkwrap": null,
|
||||
"_spec": "cryptiles@2.x.x",
|
||||
"_where": "/tank/data/SERVER/zoneadm-master/node_modules/hawk",
|
||||
"_resolved": "https://registry.npmjs.org/cryptiles/-/cryptiles-3.1.2.tgz",
|
||||
"_shasum": "a89fbb220f5ce25ec56e8c4aa8a4fd7b5b0d29fe",
|
||||
"_spec": "cryptiles@3.x.x",
|
||||
"_where": "/export/home/matjaz/git/zoneadmin-master/node_modules/hawk",
|
||||
"bugs": {
|
||||
"url": "https://github.com/hapijs/cryptiles/issues"
|
||||
},
|
||||
"bundleDependencies": false,
|
||||
"dependencies": {
|
||||
"boom": "2.x.x"
|
||||
"boom": "5.x.x"
|
||||
},
|
||||
"deprecated": false,
|
||||
"description": "General purpose crypto utilities",
|
||||
"devDependencies": {
|
||||
"code": "1.x.x",
|
||||
"lab": "5.x.x"
|
||||
},
|
||||
"directories": {},
|
||||
"dist": {
|
||||
"shasum": "3bdfecdc608147c1c67202fa291e7dca59eaa3b8",
|
||||
"tarball": "https://registry.npmjs.org/cryptiles/-/cryptiles-2.0.5.tgz"
|
||||
"code": "4.x.x",
|
||||
"lab": "13.x.x"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=0.10.40"
|
||||
"node": ">=4.0.0"
|
||||
},
|
||||
"gitHead": "9bc5a852f01cd51e615814e1cb255fe2df810649",
|
||||
"homepage": "https://github.com/hapijs/cryptiles#readme",
|
||||
"keywords": [
|
||||
"cryptography",
|
||||
@ -69,19 +48,7 @@
|
||||
],
|
||||
"license": "BSD-3-Clause",
|
||||
"main": "lib/index.js",
|
||||
"maintainers": [
|
||||
{
|
||||
"name": "hueniverse",
|
||||
"email": "eran@hueniverse.com"
|
||||
},
|
||||
{
|
||||
"name": "ceejbot",
|
||||
"email": "ceejceej@gmail.com"
|
||||
}
|
||||
],
|
||||
"name": "cryptiles",
|
||||
"optionalDependencies": {},
|
||||
"readme": "ERROR: No README data found!",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git://github.com/hapijs/cryptiles.git"
|
||||
@ -90,5 +57,5 @@
|
||||
"test": "lab -a code -t 100 -L",
|
||||
"test-cov-html": "lab -a code -r html -o coverage.html"
|
||||
},
|
||||
"version": "2.0.5"
|
||||
"version": "3.1.2"
|
||||
}
|
||||
|
102
node_modules/cryptiles/test/index.js
generated
vendored
102
node_modules/cryptiles/test/index.js
generated
vendored
@ -1,102 +0,0 @@
|
||||
// Load modules
|
||||
|
||||
var Code = require('code');
|
||||
var Cryptiles = require('..');
|
||||
var Lab = require('lab');
|
||||
|
||||
|
||||
// Declare internals
|
||||
|
||||
var internals = {};
|
||||
|
||||
|
||||
// Test shortcuts
|
||||
|
||||
var lab = exports.lab = Lab.script();
|
||||
var describe = lab.describe;
|
||||
var it = lab.it;
|
||||
var expect = Code.expect;
|
||||
|
||||
|
||||
describe('randomString()', function () {
|
||||
|
||||
it('should generate the right length string', function (done) {
|
||||
|
||||
for (var i = 1; i <= 1000; ++i) {
|
||||
expect(Cryptiles.randomString(i).length).to.equal(i);
|
||||
}
|
||||
|
||||
done();
|
||||
});
|
||||
|
||||
it('returns an error on invalid bits size', function (done) {
|
||||
|
||||
expect(Cryptiles.randomString(99999999999999999999).message).to.match(/Failed generating random bits/);
|
||||
done();
|
||||
});
|
||||
});
|
||||
|
||||
describe('randomBits()', function () {
|
||||
|
||||
it('returns an error on invalid input', function (done) {
|
||||
|
||||
expect(Cryptiles.randomBits(0).message).to.equal('Invalid random bits count');
|
||||
done();
|
||||
});
|
||||
});
|
||||
|
||||
describe('fixedTimeComparison()', function () {
|
||||
|
||||
var a = Cryptiles.randomString(50000);
|
||||
var b = Cryptiles.randomString(150000);
|
||||
|
||||
it('should take the same amount of time comparing different string sizes', function (done) {
|
||||
|
||||
var now = Date.now();
|
||||
Cryptiles.fixedTimeComparison(b, a);
|
||||
var t1 = Date.now() - now;
|
||||
|
||||
now = Date.now();
|
||||
Cryptiles.fixedTimeComparison(b, b);
|
||||
var t2 = Date.now() - now;
|
||||
|
||||
expect(t2 - t1).to.be.within(-20, 20);
|
||||
done();
|
||||
});
|
||||
|
||||
it('should return true for equal strings', function (done) {
|
||||
|
||||
expect(Cryptiles.fixedTimeComparison(a, a)).to.equal(true);
|
||||
done();
|
||||
});
|
||||
|
||||
it('should return false for different strings (size, a < b)', function (done) {
|
||||
|
||||
expect(Cryptiles.fixedTimeComparison(a, a + 'x')).to.equal(false);
|
||||
done();
|
||||
});
|
||||
|
||||
it('should return false for different strings (size, a > b)', function (done) {
|
||||
|
||||
expect(Cryptiles.fixedTimeComparison(a + 'x', a)).to.equal(false);
|
||||
done();
|
||||
});
|
||||
|
||||
it('should return false for different strings (size, a = b)', function (done) {
|
||||
|
||||
expect(Cryptiles.fixedTimeComparison(a + 'x', a + 'y')).to.equal(false);
|
||||
done();
|
||||
});
|
||||
|
||||
it('should return false when not a string', function (done) {
|
||||
|
||||
expect(Cryptiles.fixedTimeComparison('x', null)).to.equal(false);
|
||||
done();
|
||||
});
|
||||
|
||||
it('should return false when not a string (left)', function (done) {
|
||||
|
||||
expect(Cryptiles.fixedTimeComparison(null, 'x')).to.equal(false);
|
||||
done();
|
||||
});
|
||||
});
|
6
node_modules/dashdash/node_modules/assert-plus/AUTHORS
generated
vendored
6
node_modules/dashdash/node_modules/assert-plus/AUTHORS
generated
vendored
@ -1,6 +0,0 @@
|
||||
Dave Eddy <dave@daveeddy.com>
|
||||
Fred Kuo <fred.kuo@joyent.com>
|
||||
Lars-Magnus Skog <ralphtheninja@riseup.net>
|
||||
Mark Cavage <mcavage@gmail.com>
|
||||
Patrick Mooney <pmooney@pfmooney.com>
|
||||
Rob Gulewich <robert.gulewich@joyent.com>
|
14
node_modules/dashdash/node_modules/assert-plus/CHANGES.md
generated
vendored
14
node_modules/dashdash/node_modules/assert-plus/CHANGES.md
generated
vendored
@ -1,14 +0,0 @@
|
||||
# assert-plus Changelog
|
||||
|
||||
## 1.0.0
|
||||
|
||||
- *BREAKING* assert.number (and derivatives) now accept Infinity as valid input
|
||||
- Add assert.finite check. Previous assert.number callers should use this if
|
||||
they expect Infinity inputs to throw.
|
||||
|
||||
## 0.2.0
|
||||
|
||||
- Fix `assert.object(null)` so it throws
|
||||
- Fix optional/arrayOf exports for non-type-of asserts
|
||||
- Add optiona/arrayOf exports for Stream/Date/Regex/uuid
|
||||
- Add basic unit test coverage
|
162
node_modules/dashdash/node_modules/assert-plus/README.md
generated
vendored
162
node_modules/dashdash/node_modules/assert-plus/README.md
generated
vendored
@ -1,162 +0,0 @@
|
||||
# assert-plus
|
||||
|
||||
This library is a super small wrapper over node's assert module that has two
|
||||
things: (1) the ability to disable assertions with the environment variable
|
||||
NODE\_NDEBUG, and (2) some API wrappers for argument testing. Like
|
||||
`assert.string(myArg, 'myArg')`. As a simple example, most of my code looks
|
||||
like this:
|
||||
|
||||
```javascript
|
||||
var assert = require('assert-plus');
|
||||
|
||||
function fooAccount(options, callback) {
|
||||
assert.object(options, 'options');
|
||||
assert.number(options.id, 'options.id');
|
||||
assert.bool(options.isManager, 'options.isManager');
|
||||
assert.string(options.name, 'options.name');
|
||||
assert.arrayOfString(options.email, 'options.email');
|
||||
assert.func(callback, 'callback');
|
||||
|
||||
// Do stuff
|
||||
callback(null, {});
|
||||
}
|
||||
```
|
||||
|
||||
# API
|
||||
|
||||
All methods that *aren't* part of node's core assert API are simply assumed to
|
||||
take an argument, and then a string 'name' that's not a message; `AssertionError`
|
||||
will be thrown if the assertion fails with a message like:
|
||||
|
||||
AssertionError: foo (string) is required
|
||||
at test (/home/mark/work/foo/foo.js:3:9)
|
||||
at Object.<anonymous> (/home/mark/work/foo/foo.js:15:1)
|
||||
at Module._compile (module.js:446:26)
|
||||
at Object..js (module.js:464:10)
|
||||
at Module.load (module.js:353:31)
|
||||
at Function._load (module.js:311:12)
|
||||
at Array.0 (module.js:484:10)
|
||||
at EventEmitter._tickCallback (node.js:190:38)
|
||||
|
||||
from:
|
||||
|
||||
```javascript
|
||||
function test(foo) {
|
||||
assert.string(foo, 'foo');
|
||||
}
|
||||
```
|
||||
|
||||
There you go. You can check that arrays are of a homogeneous type with `Arrayof$Type`:
|
||||
|
||||
```javascript
|
||||
function test(foo) {
|
||||
assert.arrayOfString(foo, 'foo');
|
||||
}
|
||||
```
|
||||
|
||||
You can assert IFF an argument is not `undefined` (i.e., an optional arg):
|
||||
|
||||
```javascript
|
||||
assert.optionalString(foo, 'foo');
|
||||
```
|
||||
|
||||
Lastly, you can opt-out of assertion checking altogether by setting the
|
||||
environment variable `NODE_NDEBUG=1`. This is pseudo-useful if you have
|
||||
lots of assertions, and don't want to pay `typeof ()` taxes to v8 in
|
||||
production. Be advised: The standard functions re-exported from `assert` are
|
||||
also disabled in assert-plus if NDEBUG is specified. Using them directly from
|
||||
the `assert` module avoids this behavior.
|
||||
|
||||
The complete list of APIs is:
|
||||
|
||||
* assert.array
|
||||
* assert.bool
|
||||
* assert.buffer
|
||||
* assert.func
|
||||
* assert.number
|
||||
* assert.finite
|
||||
* assert.object
|
||||
* assert.string
|
||||
* assert.stream
|
||||
* assert.date
|
||||
* assert.regexp
|
||||
* assert.uuid
|
||||
* assert.arrayOfArray
|
||||
* assert.arrayOfBool
|
||||
* assert.arrayOfBuffer
|
||||
* assert.arrayOfFunc
|
||||
* assert.arrayOfNumber
|
||||
* assert.arrayOfFinite
|
||||
* assert.arrayOfObject
|
||||
* assert.arrayOfString
|
||||
* assert.arrayOfStream
|
||||
* assert.arrayOfDate
|
||||
* assert.arrayOfRegexp
|
||||
* assert.arrayOfUuid
|
||||
* assert.optionalArray
|
||||
* assert.optionalBool
|
||||
* assert.optionalBuffer
|
||||
* assert.optionalFunc
|
||||
* assert.optionalNumber
|
||||
* assert.optionalFinite
|
||||
* assert.optionalObject
|
||||
* assert.optionalString
|
||||
* assert.optionalStream
|
||||
* assert.optionalDate
|
||||
* assert.optionalRegexp
|
||||
* assert.optionalUuid
|
||||
* assert.optionalArrayOfArray
|
||||
* assert.optionalArrayOfBool
|
||||
* assert.optionalArrayOfBuffer
|
||||
* assert.optionalArrayOfFunc
|
||||
* assert.optionalArrayOfNumber
|
||||
* assert.optionalArrayOfFinite
|
||||
* assert.optionalArrayOfObject
|
||||
* assert.optionalArrayOfString
|
||||
* assert.optionalArrayOfStream
|
||||
* assert.optionalArrayOfDate
|
||||
* assert.optionalArrayOfRegexp
|
||||
* assert.optionalArrayOfUuid
|
||||
* assert.AssertionError
|
||||
* assert.fail
|
||||
* assert.ok
|
||||
* assert.equal
|
||||
* assert.notEqual
|
||||
* assert.deepEqual
|
||||
* assert.notDeepEqual
|
||||
* assert.strictEqual
|
||||
* assert.notStrictEqual
|
||||
* assert.throws
|
||||
* assert.doesNotThrow
|
||||
* assert.ifError
|
||||
|
||||
# Installation
|
||||
|
||||
npm install assert-plus
|
||||
|
||||
## License
|
||||
|
||||
The MIT License (MIT)
|
||||
Copyright (c) 2012 Mark Cavage
|
||||
|
||||
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.
|
||||
|
||||
## Bugs
|
||||
|
||||
See <https://github.com/mcavage/node-assert-plus/issues>.
|
211
node_modules/dashdash/node_modules/assert-plus/assert.js
generated
vendored
211
node_modules/dashdash/node_modules/assert-plus/assert.js
generated
vendored
@ -1,211 +0,0 @@
|
||||
// Copyright (c) 2012, Mark Cavage. All rights reserved.
|
||||
// Copyright 2015 Joyent, Inc.
|
||||
|
||||
var assert = require('assert');
|
||||
var Stream = require('stream').Stream;
|
||||
var util = require('util');
|
||||
|
||||
|
||||
///--- Globals
|
||||
|
||||
/* JSSTYLED */
|
||||
var UUID_REGEXP = /^[a-fA-F0-9]{8}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{12}$/;
|
||||
|
||||
|
||||
///--- Internal
|
||||
|
||||
function _capitalize(str) {
|
||||
return (str.charAt(0).toUpperCase() + str.slice(1));
|
||||
}
|
||||
|
||||
function _toss(name, expected, oper, arg, actual) {
|
||||
throw new assert.AssertionError({
|
||||
message: util.format('%s (%s) is required', name, expected),
|
||||
actual: (actual === undefined) ? typeof (arg) : actual(arg),
|
||||
expected: expected,
|
||||
operator: oper || '===',
|
||||
stackStartFunction: _toss.caller
|
||||
});
|
||||
}
|
||||
|
||||
function _getClass(arg) {
|
||||
return (Object.prototype.toString.call(arg).slice(8, -1));
|
||||
}
|
||||
|
||||
function noop() {
|
||||
// Why even bother with asserts?
|
||||
}
|
||||
|
||||
|
||||
///--- Exports
|
||||
|
||||
var types = {
|
||||
bool: {
|
||||
check: function (arg) { return typeof (arg) === 'boolean'; }
|
||||
},
|
||||
func: {
|
||||
check: function (arg) { return typeof (arg) === 'function'; }
|
||||
},
|
||||
string: {
|
||||
check: function (arg) { return typeof (arg) === 'string'; }
|
||||
},
|
||||
object: {
|
||||
check: function (arg) {
|
||||
return typeof (arg) === 'object' && arg !== null;
|
||||
}
|
||||
},
|
||||
number: {
|
||||
check: function (arg) {
|
||||
return typeof (arg) === 'number' && !isNaN(arg);
|
||||
}
|
||||
},
|
||||
finite: {
|
||||
check: function (arg) {
|
||||
return typeof (arg) === 'number' && !isNaN(arg) && isFinite(arg);
|
||||
}
|
||||
},
|
||||
buffer: {
|
||||
check: function (arg) { return Buffer.isBuffer(arg); },
|
||||
operator: 'Buffer.isBuffer'
|
||||
},
|
||||
array: {
|
||||
check: function (arg) { return Array.isArray(arg); },
|
||||
operator: 'Array.isArray'
|
||||
},
|
||||
stream: {
|
||||
check: function (arg) { return arg instanceof Stream; },
|
||||
operator: 'instanceof',
|
||||
actual: _getClass
|
||||
},
|
||||
date: {
|
||||
check: function (arg) { return arg instanceof Date; },
|
||||
operator: 'instanceof',
|
||||
actual: _getClass
|
||||
},
|
||||
regexp: {
|
||||
check: function (arg) { return arg instanceof RegExp; },
|
||||
operator: 'instanceof',
|
||||
actual: _getClass
|
||||
},
|
||||
uuid: {
|
||||
check: function (arg) {
|
||||
return typeof (arg) === 'string' && UUID_REGEXP.test(arg);
|
||||
},
|
||||
operator: 'isUUID'
|
||||
}
|
||||
};
|
||||
|
||||
function _setExports(ndebug) {
|
||||
var keys = Object.keys(types);
|
||||
var out;
|
||||
|
||||
/* re-export standard assert */
|
||||
if (process.env.NODE_NDEBUG) {
|
||||
out = noop;
|
||||
} else {
|
||||
out = function (arg, msg) {
|
||||
if (!arg) {
|
||||
_toss(msg, 'true', arg);
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
/* standard checks */
|
||||
keys.forEach(function (k) {
|
||||
if (ndebug) {
|
||||
out[k] = noop;
|
||||
return;
|
||||
}
|
||||
var type = types[k];
|
||||
out[k] = function (arg, msg) {
|
||||
if (!type.check(arg)) {
|
||||
_toss(msg, k, type.operator, arg, type.actual);
|
||||
}
|
||||
};
|
||||
});
|
||||
|
||||
/* optional checks */
|
||||
keys.forEach(function (k) {
|
||||
var name = 'optional' + _capitalize(k);
|
||||
if (ndebug) {
|
||||
out[name] = noop;
|
||||
return;
|
||||
}
|
||||
var type = types[k];
|
||||
out[name] = function (arg, msg) {
|
||||
if (arg === undefined || arg === null) {
|
||||
return;
|
||||
}
|
||||
if (!type.check(arg)) {
|
||||
_toss(msg, k, type.operator, arg, type.actual);
|
||||
}
|
||||
};
|
||||
});
|
||||
|
||||
/* arrayOf checks */
|
||||
keys.forEach(function (k) {
|
||||
var name = 'arrayOf' + _capitalize(k);
|
||||
if (ndebug) {
|
||||
out[name] = noop;
|
||||
return;
|
||||
}
|
||||
var type = types[k];
|
||||
var expected = '[' + k + ']';
|
||||
out[name] = function (arg, msg) {
|
||||
if (!Array.isArray(arg)) {
|
||||
_toss(msg, expected, type.operator, arg, type.actual);
|
||||
}
|
||||
var i;
|
||||
for (i = 0; i < arg.length; i++) {
|
||||
if (!type.check(arg[i])) {
|
||||
_toss(msg, expected, type.operator, arg, type.actual);
|
||||
}
|
||||
}
|
||||
};
|
||||
});
|
||||
|
||||
/* optionalArrayOf checks */
|
||||
keys.forEach(function (k) {
|
||||
var name = 'optionalArrayOf' + _capitalize(k);
|
||||
if (ndebug) {
|
||||
out[name] = noop;
|
||||
return;
|
||||
}
|
||||
var type = types[k];
|
||||
var expected = '[' + k + ']';
|
||||
out[name] = function (arg, msg) {
|
||||
if (arg === undefined || arg === null) {
|
||||
return;
|
||||
}
|
||||
if (!Array.isArray(arg)) {
|
||||
_toss(msg, expected, type.operator, arg, type.actual);
|
||||
}
|
||||
var i;
|
||||
for (i = 0; i < arg.length; i++) {
|
||||
if (!type.check(arg[i])) {
|
||||
_toss(msg, expected, type.operator, arg, type.actual);
|
||||
}
|
||||
}
|
||||
};
|
||||
});
|
||||
|
||||
/* re-export built-in assertions */
|
||||
Object.keys(assert).forEach(function (k) {
|
||||
if (k === 'AssertionError') {
|
||||
out[k] = assert[k];
|
||||
return;
|
||||
}
|
||||
if (ndebug) {
|
||||
out[k] = noop;
|
||||
return;
|
||||
}
|
||||
out[k] = assert[k];
|
||||
});
|
||||
|
||||
/* export ourselves (for unit tests _only_) */
|
||||
out._setExports = _setExports;
|
||||
|
||||
return out;
|
||||
}
|
||||
|
||||
module.exports = _setExports(process.env.NODE_NDEBUG);
|
115
node_modules/dashdash/node_modules/assert-plus/package.json
generated
vendored
115
node_modules/dashdash/node_modules/assert-plus/package.json
generated
vendored
@ -1,115 +0,0 @@
|
||||
{
|
||||
"_args": [
|
||||
[
|
||||
{
|
||||
"raw": "assert-plus@^1.0.0",
|
||||
"scope": null,
|
||||
"escapedName": "assert-plus",
|
||||
"name": "assert-plus",
|
||||
"rawSpec": "^1.0.0",
|
||||
"spec": ">=1.0.0 <2.0.0",
|
||||
"type": "range"
|
||||
},
|
||||
"/tank/data/SERVER/zoneadm-master/node_modules/dashdash"
|
||||
]
|
||||
],
|
||||
"_from": "assert-plus@>=1.0.0 <2.0.0",
|
||||
"_id": "assert-plus@1.0.0",
|
||||
"_inCache": true,
|
||||
"_location": "/dashdash/assert-plus",
|
||||
"_nodeVersion": "0.10.40",
|
||||
"_npmUser": {
|
||||
"name": "pfmooney",
|
||||
"email": "patrick.f.mooney@gmail.com"
|
||||
},
|
||||
"_npmVersion": "3.3.9",
|
||||
"_phantomChildren": {},
|
||||
"_requested": {
|
||||
"raw": "assert-plus@^1.0.0",
|
||||
"scope": null,
|
||||
"escapedName": "assert-plus",
|
||||
"name": "assert-plus",
|
||||
"rawSpec": "^1.0.0",
|
||||
"spec": ">=1.0.0 <2.0.0",
|
||||
"type": "range"
|
||||
},
|
||||
"_requiredBy": [
|
||||
"/dashdash"
|
||||
],
|
||||
"_resolved": "https://registry.npmjs.org/assert-plus/-/assert-plus-1.0.0.tgz",
|
||||
"_shasum": "f12e0f3c5d77b0b1cdd9146942e4e96c1e4dd525",
|
||||
"_shrinkwrap": null,
|
||||
"_spec": "assert-plus@^1.0.0",
|
||||
"_where": "/tank/data/SERVER/zoneadm-master/node_modules/dashdash",
|
||||
"author": {
|
||||
"name": "Mark Cavage",
|
||||
"email": "mcavage@gmail.com"
|
||||
},
|
||||
"bugs": {
|
||||
"url": "https://github.com/mcavage/node-assert-plus/issues"
|
||||
},
|
||||
"contributors": [
|
||||
{
|
||||
"name": "Dave Eddy",
|
||||
"email": "dave@daveeddy.com"
|
||||
},
|
||||
{
|
||||
"name": "Fred Kuo",
|
||||
"email": "fred.kuo@joyent.com"
|
||||
},
|
||||
{
|
||||
"name": "Lars-Magnus Skog",
|
||||
"email": "ralphtheninja@riseup.net"
|
||||
},
|
||||
{
|
||||
"name": "Mark Cavage",
|
||||
"email": "mcavage@gmail.com"
|
||||
},
|
||||
{
|
||||
"name": "Patrick Mooney",
|
||||
"email": "pmooney@pfmooney.com"
|
||||
},
|
||||
{
|
||||
"name": "Rob Gulewich",
|
||||
"email": "robert.gulewich@joyent.com"
|
||||
}
|
||||
],
|
||||
"dependencies": {},
|
||||
"description": "Extra assertions on top of node's assert module",
|
||||
"devDependencies": {
|
||||
"faucet": "0.0.1",
|
||||
"tape": "4.2.2"
|
||||
},
|
||||
"directories": {},
|
||||
"dist": {
|
||||
"shasum": "f12e0f3c5d77b0b1cdd9146942e4e96c1e4dd525",
|
||||
"tarball": "https://registry.npmjs.org/assert-plus/-/assert-plus-1.0.0.tgz"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=0.8"
|
||||
},
|
||||
"homepage": "https://github.com/mcavage/node-assert-plus#readme",
|
||||
"license": "MIT",
|
||||
"main": "./assert.js",
|
||||
"maintainers": [
|
||||
{
|
||||
"name": "mcavage",
|
||||
"email": "mcavage@gmail.com"
|
||||
},
|
||||
{
|
||||
"name": "pfmooney",
|
||||
"email": "patrick.f.mooney@gmail.com"
|
||||
}
|
||||
],
|
||||
"name": "assert-plus",
|
||||
"optionalDependencies": {},
|
||||
"readme": "ERROR: No README data found!",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git+https://github.com/mcavage/node-assert-plus.git"
|
||||
},
|
||||
"scripts": {
|
||||
"test": "tape tests/*.js | ./node_modules/.bin/faucet"
|
||||
},
|
||||
"version": "1.0.0"
|
||||
}
|
80
node_modules/dashdash/package.json
generated
vendored
80
node_modules/dashdash/package.json
generated
vendored
@ -1,50 +1,27 @@
|
||||
{
|
||||
"_args": [
|
||||
[
|
||||
{
|
||||
"raw": "dashdash@^1.12.0",
|
||||
"scope": null,
|
||||
"escapedName": "dashdash",
|
||||
"name": "dashdash",
|
||||
"rawSpec": "^1.12.0",
|
||||
"spec": ">=1.12.0 <2.0.0",
|
||||
"type": "range"
|
||||
},
|
||||
"/tank/data/SERVER/zoneadm-master/node_modules/sshpk"
|
||||
]
|
||||
],
|
||||
"_from": "dashdash@>=1.12.0 <2.0.0",
|
||||
"_from": "dashdash@^1.12.0",
|
||||
"_id": "dashdash@1.14.1",
|
||||
"_inCache": true,
|
||||
"_inBundle": false,
|
||||
"_integrity": "sha1-hTz6D3y+L+1d4gMmuN1YEDX24vA=",
|
||||
"_location": "/dashdash",
|
||||
"_nodeVersion": "4.6.1",
|
||||
"_npmOperationalInternal": {
|
||||
"host": "packages-12-west.internal.npmjs.com",
|
||||
"tmp": "tmp/dashdash-1.14.1.tgz_1479854020349_0.731718891998753"
|
||||
},
|
||||
"_npmUser": {
|
||||
"name": "trentm",
|
||||
"email": "trentm@gmail.com"
|
||||
},
|
||||
"_npmVersion": "2.15.9",
|
||||
"_phantomChildren": {},
|
||||
"_requested": {
|
||||
"type": "range",
|
||||
"registry": true,
|
||||
"raw": "dashdash@^1.12.0",
|
||||
"scope": null,
|
||||
"escapedName": "dashdash",
|
||||
"name": "dashdash",
|
||||
"escapedName": "dashdash",
|
||||
"rawSpec": "^1.12.0",
|
||||
"spec": ">=1.12.0 <2.0.0",
|
||||
"type": "range"
|
||||
"saveSpec": null,
|
||||
"fetchSpec": "^1.12.0"
|
||||
},
|
||||
"_requiredBy": [
|
||||
"/sshpk"
|
||||
],
|
||||
"_resolved": "https://registry.npmjs.org/dashdash/-/dashdash-1.14.1.tgz",
|
||||
"_shasum": "853cfa0f7cbe2fed5de20326b8dd581035f6e2f0",
|
||||
"_shrinkwrap": null,
|
||||
"_spec": "dashdash@^1.12.0",
|
||||
"_where": "/tank/data/SERVER/zoneadm-master/node_modules/sshpk",
|
||||
"_where": "/export/home/matjaz/git/zoneadmin-master/node_modules/sshpk",
|
||||
"author": {
|
||||
"name": "Trent Mick",
|
||||
"email": "trentm@gmail.com",
|
||||
@ -53,45 +30,18 @@
|
||||
"bugs": {
|
||||
"url": "https://github.com/trentm/node-dashdash/issues"
|
||||
},
|
||||
"contributors": [
|
||||
{
|
||||
"name": "Trent Mick",
|
||||
"email": "trentm@gmail.com",
|
||||
"url": "http://trentm.com"
|
||||
},
|
||||
{
|
||||
"name": "Isaac Schlueter",
|
||||
"url": "https://github.com/isaacs"
|
||||
},
|
||||
{
|
||||
"name": "Joshua M. Clulow",
|
||||
"url": "https://github.com/jclulow"
|
||||
},
|
||||
{
|
||||
"name": "Patrick Mooney",
|
||||
"url": "https://github.com/pfmooney"
|
||||
},
|
||||
{
|
||||
"name": "Dave Pacheco",
|
||||
"url": "https://github.com/davepacheco"
|
||||
}
|
||||
],
|
||||
"bundleDependencies": false,
|
||||
"dependencies": {
|
||||
"assert-plus": "^1.0.0"
|
||||
},
|
||||
"deprecated": false,
|
||||
"description": "A light, featureful and explicit option parsing library.",
|
||||
"devDependencies": {
|
||||
"nodeunit": "0.9.x"
|
||||
},
|
||||
"directories": {},
|
||||
"dist": {
|
||||
"shasum": "853cfa0f7cbe2fed5de20326b8dd581035f6e2f0",
|
||||
"tarball": "https://registry.npmjs.org/dashdash/-/dashdash-1.14.1.tgz"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=0.10"
|
||||
},
|
||||
"gitHead": "1dd7379640462a21ca6d92502803de830b4acfa2",
|
||||
"homepage": "https://github.com/trentm/node-dashdash#readme",
|
||||
"keywords": [
|
||||
"option",
|
||||
@ -105,15 +55,7 @@
|
||||
],
|
||||
"license": "MIT",
|
||||
"main": "./lib/dashdash.js",
|
||||
"maintainers": [
|
||||
{
|
||||
"name": "trentm",
|
||||
"email": "trentm@gmail.com"
|
||||
}
|
||||
],
|
||||
"name": "dashdash",
|
||||
"optionalDependencies": {},
|
||||
"readme": "ERROR: No README data found!",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git://github.com/trentm/node-dashdash.git"
|
||||
|
57
node_modules/delayed-stream/package.json
generated
vendored
57
node_modules/delayed-stream/package.json
generated
vendored
@ -1,46 +1,27 @@
|
||||
{
|
||||
"_args": [
|
||||
[
|
||||
{
|
||||
"raw": "delayed-stream@~1.0.0",
|
||||
"scope": null,
|
||||
"escapedName": "delayed-stream",
|
||||
"name": "delayed-stream",
|
||||
"rawSpec": "~1.0.0",
|
||||
"spec": ">=1.0.0 <1.1.0",
|
||||
"type": "range"
|
||||
},
|
||||
"/tank/data/SERVER/zoneadm-master/node_modules/combined-stream"
|
||||
]
|
||||
],
|
||||
"_from": "delayed-stream@>=1.0.0 <1.1.0",
|
||||
"_from": "delayed-stream@~1.0.0",
|
||||
"_id": "delayed-stream@1.0.0",
|
||||
"_inCache": true,
|
||||
"_inBundle": false,
|
||||
"_integrity": "sha1-3zrhmayt+31ECqrgsp4icrJOxhk=",
|
||||
"_location": "/delayed-stream",
|
||||
"_nodeVersion": "1.6.4",
|
||||
"_npmUser": {
|
||||
"name": "apechimp",
|
||||
"email": "apeherder@gmail.com"
|
||||
},
|
||||
"_npmVersion": "2.8.3",
|
||||
"_phantomChildren": {},
|
||||
"_requested": {
|
||||
"type": "range",
|
||||
"registry": true,
|
||||
"raw": "delayed-stream@~1.0.0",
|
||||
"scope": null,
|
||||
"escapedName": "delayed-stream",
|
||||
"name": "delayed-stream",
|
||||
"escapedName": "delayed-stream",
|
||||
"rawSpec": "~1.0.0",
|
||||
"spec": ">=1.0.0 <1.1.0",
|
||||
"type": "range"
|
||||
"saveSpec": null,
|
||||
"fetchSpec": "~1.0.0"
|
||||
},
|
||||
"_requiredBy": [
|
||||
"/combined-stream"
|
||||
],
|
||||
"_resolved": "https://registry.npmjs.org/delayed-stream/-/delayed-stream-1.0.0.tgz",
|
||||
"_shasum": "df3ae199acadfb7d440aaae0b29e2272b24ec619",
|
||||
"_shrinkwrap": null,
|
||||
"_spec": "delayed-stream@~1.0.0",
|
||||
"_where": "/tank/data/SERVER/zoneadm-master/node_modules/combined-stream",
|
||||
"_where": "/export/home/matjaz/git/zoneadmin-master/node_modules/combined-stream",
|
||||
"author": {
|
||||
"name": "Felix Geisendörfer",
|
||||
"email": "felix@debuggable.com",
|
||||
@ -49,6 +30,7 @@
|
||||
"bugs": {
|
||||
"url": "https://github.com/felixge/node-delayed-stream/issues"
|
||||
},
|
||||
"bundleDependencies": false,
|
||||
"contributors": [
|
||||
{
|
||||
"name": "Mike Atkins",
|
||||
@ -56,36 +38,19 @@
|
||||
}
|
||||
],
|
||||
"dependencies": {},
|
||||
"deprecated": false,
|
||||
"description": "Buffers events from a stream until you are ready to handle them.",
|
||||
"devDependencies": {
|
||||
"fake": "0.2.0",
|
||||
"far": "0.0.1"
|
||||
},
|
||||
"directories": {},
|
||||
"dist": {
|
||||
"shasum": "df3ae199acadfb7d440aaae0b29e2272b24ec619",
|
||||
"tarball": "https://registry.npmjs.org/delayed-stream/-/delayed-stream-1.0.0.tgz"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=0.4.0"
|
||||
},
|
||||
"gitHead": "07a9dc99fb8f1a488160026b9ad77493f766fb84",
|
||||
"homepage": "https://github.com/felixge/node-delayed-stream",
|
||||
"license": "MIT",
|
||||
"main": "./lib/delayed_stream",
|
||||
"maintainers": [
|
||||
{
|
||||
"name": "felixge",
|
||||
"email": "felix@debuggable.com"
|
||||
},
|
||||
{
|
||||
"name": "apechimp",
|
||||
"email": "apeherder@gmail.com"
|
||||
}
|
||||
],
|
||||
"name": "delayed-stream",
|
||||
"optionalDependencies": {},
|
||||
"readme": "ERROR: No README data found!",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git://github.com/felixge/node-delayed-stream.git"
|
||||
|
58
node_modules/ecc-jsbn/package.json
generated
vendored
58
node_modules/ecc-jsbn/package.json
generated
vendored
@ -1,46 +1,27 @@
|
||||
{
|
||||
"_args": [
|
||||
[
|
||||
{
|
||||
"raw": "ecc-jsbn@~0.1.1",
|
||||
"scope": null,
|
||||
"escapedName": "ecc-jsbn",
|
||||
"name": "ecc-jsbn",
|
||||
"rawSpec": "~0.1.1",
|
||||
"spec": ">=0.1.1 <0.2.0",
|
||||
"type": "range"
|
||||
},
|
||||
"/tank/data/SERVER/zoneadm-master/node_modules/sshpk"
|
||||
]
|
||||
],
|
||||
"_from": "ecc-jsbn@>=0.1.1 <0.2.0",
|
||||
"_from": "ecc-jsbn@~0.1.1",
|
||||
"_id": "ecc-jsbn@0.1.1",
|
||||
"_inCache": true,
|
||||
"_inBundle": false,
|
||||
"_integrity": "sha1-D8c6ntXw1Tw4GTOYUj735UN3dQU=",
|
||||
"_location": "/ecc-jsbn",
|
||||
"_nodeVersion": "0.12.6",
|
||||
"_npmUser": {
|
||||
"name": "quartzjer",
|
||||
"email": "jeremie@jabber.org"
|
||||
},
|
||||
"_npmVersion": "2.11.2",
|
||||
"_phantomChildren": {},
|
||||
"_requested": {
|
||||
"type": "range",
|
||||
"registry": true,
|
||||
"raw": "ecc-jsbn@~0.1.1",
|
||||
"scope": null,
|
||||
"escapedName": "ecc-jsbn",
|
||||
"name": "ecc-jsbn",
|
||||
"escapedName": "ecc-jsbn",
|
||||
"rawSpec": "~0.1.1",
|
||||
"spec": ">=0.1.1 <0.2.0",
|
||||
"type": "range"
|
||||
"saveSpec": null,
|
||||
"fetchSpec": "~0.1.1"
|
||||
},
|
||||
"_requiredBy": [
|
||||
"/sshpk"
|
||||
],
|
||||
"_resolved": "https://registry.npmjs.org/ecc-jsbn/-/ecc-jsbn-0.1.1.tgz",
|
||||
"_shasum": "0fc73a9ed5f0d53c38193398523ef7e543777505",
|
||||
"_shrinkwrap": null,
|
||||
"_spec": "ecc-jsbn@~0.1.1",
|
||||
"_where": "/tank/data/SERVER/zoneadm-master/node_modules/sshpk",
|
||||
"_where": "/export/home/matjaz/git/zoneadmin-master/node_modules/sshpk",
|
||||
"author": {
|
||||
"name": "Jeremie Miller",
|
||||
"email": "jeremie@jabber.org",
|
||||
@ -49,17 +30,12 @@
|
||||
"bugs": {
|
||||
"url": "https://github.com/quartzjer/ecc-jsbn/issues"
|
||||
},
|
||||
"bundleDependencies": false,
|
||||
"dependencies": {
|
||||
"jsbn": "~0.1.0"
|
||||
},
|
||||
"deprecated": false,
|
||||
"description": "ECC JS code based on JSBN",
|
||||
"devDependencies": {},
|
||||
"directories": {},
|
||||
"dist": {
|
||||
"shasum": "0fc73a9ed5f0d53c38193398523ef7e543777505",
|
||||
"tarball": "https://registry.npmjs.org/ecc-jsbn/-/ecc-jsbn-0.1.1.tgz"
|
||||
},
|
||||
"gitHead": "d35a360352496721030da645e8054f07efc22487",
|
||||
"homepage": "https://github.com/quartzjer/ecc-jsbn",
|
||||
"keywords": [
|
||||
"jsbn",
|
||||
@ -70,21 +46,19 @@
|
||||
"main": "index.js",
|
||||
"maintainers": [
|
||||
{
|
||||
"name": "quartzjer",
|
||||
"email": "jeremie@jabber.org"
|
||||
"name": "Jeremie Miller",
|
||||
"email": "jeremie@jabber.org",
|
||||
"url": "http://jeremie.com/"
|
||||
},
|
||||
{
|
||||
"name": "rynomad",
|
||||
"email": "nomad.ry@gmail.com"
|
||||
"name": "Ryan Bennett",
|
||||
"url": "https://github.com/rynomad"
|
||||
}
|
||||
],
|
||||
"name": "ecc-jsbn",
|
||||
"optionalDependencies": {},
|
||||
"readme": "ERROR: No README data found!",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git+https://github.com/quartzjer/ecc-jsbn.git"
|
||||
},
|
||||
"scripts": {},
|
||||
"version": "0.1.1"
|
||||
}
|
||||
|
5
node_modules/ejs/Jakefile
generated
vendored
5
node_modules/ejs/Jakefile
generated
vendored
@ -1,3 +1,4 @@
|
||||
var fs = require('fs');
|
||||
var execSync = require('child_process').execSync;
|
||||
var exec = function (cmd) {
|
||||
execSync(cmd, {stdio: 'inherit'});
|
||||
@ -40,6 +41,7 @@ task('doc', function (dev) {
|
||||
});
|
||||
|
||||
task('docPublish', ['doc'], function () {
|
||||
fs.writeFileSync('out/CNAME', 'api.ejs.co');
|
||||
console.log('Pushing docs to gh-pages...');
|
||||
exec('./node_modules/.bin/git-directory-deploy --directory out/');
|
||||
console.log('Docs published to gh-pages.');
|
||||
@ -57,8 +59,7 @@ publishTask('ejs', ['build'], function () {
|
||||
'package.json',
|
||||
'ejs.js',
|
||||
'ejs.min.js',
|
||||
'lib/**',
|
||||
'test/**'
|
||||
'lib/**'
|
||||
]);
|
||||
});
|
||||
|
||||
|
16
node_modules/ejs/README.md
generated
vendored
16
node_modules/ejs/README.md
generated
vendored
@ -4,6 +4,7 @@ Embedded JavaScript templates
|
||||
|
||||
[](https://travis-ci.org/mde/ejs)
|
||||
[](https://david-dm.org/mde/ejs?type=dev)
|
||||
[](https://snyk.io/test/npm/ejs)
|
||||
|
||||
## Installation
|
||||
|
||||
@ -162,6 +163,21 @@ If you want to clear the EJS cache, call `ejs.clearCache`. If you're using the
|
||||
LRU cache and need a different limit, simple reset `ejs.cache` to a new instance
|
||||
of the LRU.
|
||||
|
||||
## Custom FileLoader
|
||||
|
||||
The default file loader is `fs.readFileSync`, if you want to customize it, you can set ejs.fileLoader.
|
||||
|
||||
```javascript
|
||||
var ejs = require('ejs');
|
||||
var myFileLoad = function (filePath) {
|
||||
return 'myFileLoad: ' + fs.readFileSync(filePath);
|
||||
};
|
||||
|
||||
ejs.fileLoader = myFileLoad;
|
||||
```
|
||||
|
||||
With this feature, you can preprocess the template before reading it.
|
||||
|
||||
## Layouts
|
||||
|
||||
EJS does not specifically support blocks, but layouts can be implemented by
|
||||
|
253
node_modules/ejs/ejs.js
generated
vendored
253
node_modules/ejs/ejs.js
generated
vendored
@ -20,7 +20,7 @@
|
||||
'use strict';
|
||||
|
||||
/**
|
||||
* @file Embedded JavaScript templating engine.
|
||||
* @file Embedded JavaScript templating engine. {@link http://ejs.co}
|
||||
* @author Matthew Eernisse <mde@fleegix.org>
|
||||
* @author Tiancheng "Timothy" Gu <timothygu99@gmail.com>
|
||||
* @project EJS
|
||||
@ -57,6 +57,10 @@ var _NAME = 'ejs';
|
||||
var _REGEX_STRING = '(<%%|%%>|<%=|<%-|<%_|<%#|<%|%>|-%>|_%>)';
|
||||
var _OPTS = ['delimiter', 'scope', 'context', 'debug', 'compileDebug',
|
||||
'client', '_with', 'rmWhitespace', 'strict', 'filename'];
|
||||
// We don't allow 'cache' option to be passed in the data obj
|
||||
// for the normal `render` call, but this is where Express puts it
|
||||
// so we make an exception for `renderFile`
|
||||
var _OPTS_EXPRESS = _OPTS.concat('cache');
|
||||
var _BOM = /^\uFEFF/;
|
||||
|
||||
/**
|
||||
@ -69,6 +73,15 @@ var _BOM = /^\uFEFF/;
|
||||
|
||||
exports.cache = utils.cache;
|
||||
|
||||
/**
|
||||
* Custom file loader. Useful for template preprocessing or restricting access
|
||||
* to a certain part of the filesystem.
|
||||
*
|
||||
* @type {fileLoader}
|
||||
*/
|
||||
|
||||
exports.fileLoader = fs.readFileSync;
|
||||
|
||||
/**
|
||||
* Name of the object containing the locals.
|
||||
*
|
||||
@ -109,16 +122,36 @@ exports.resolveInclude = function(name, filename, isDir) {
|
||||
* @param {Options} options compilation options
|
||||
* @return {String}
|
||||
*/
|
||||
function getIncludePath(path, options){
|
||||
function getIncludePath(path, options) {
|
||||
var includePath;
|
||||
var filePath;
|
||||
var views = options.views;
|
||||
|
||||
// Abs path
|
||||
if (path.charAt(0) == '/') {
|
||||
includePath = exports.resolveInclude(path.replace(/^\/*/,''), options.root || '/', true);
|
||||
}
|
||||
// Relative paths
|
||||
else {
|
||||
if (!options.filename) {
|
||||
throw new Error('`include` use relative path requires the \'filename\' option.');
|
||||
// Look relative to a passed filename first
|
||||
if (options.filename) {
|
||||
filePath = exports.resolveInclude(path, options.filename);
|
||||
if (fs.existsSync(filePath)) {
|
||||
includePath = filePath;
|
||||
}
|
||||
}
|
||||
// Then look in any views directories
|
||||
if (!includePath) {
|
||||
if (Array.isArray(views) && views.some(function (v) {
|
||||
filePath = exports.resolveInclude(path, v, true);
|
||||
return fs.existsSync(filePath);
|
||||
})) {
|
||||
includePath = filePath;
|
||||
}
|
||||
}
|
||||
if (!includePath) {
|
||||
throw new Error('Could not find include include file.');
|
||||
}
|
||||
includePath = exports.resolveInclude(path, options.filename);
|
||||
}
|
||||
return includePath;
|
||||
}
|
||||
@ -155,7 +188,7 @@ function handleCache(options, template) {
|
||||
return func;
|
||||
}
|
||||
if (!hasTemplate) {
|
||||
template = fs.readFileSync(filename).toString().replace(_BOM, '');
|
||||
template = fileLoader(filename).toString().replace(_BOM, '');
|
||||
}
|
||||
}
|
||||
else if (!hasTemplate) {
|
||||
@ -164,7 +197,7 @@ function handleCache(options, template) {
|
||||
throw new Error('Internal EJS error: no file name or template '
|
||||
+ 'provided');
|
||||
}
|
||||
template = fs.readFileSync(filename).toString().replace(_BOM, '');
|
||||
template = fileLoader(filename).toString().replace(_BOM, '');
|
||||
}
|
||||
func = exports.compile(template, options);
|
||||
if (options.cache) {
|
||||
@ -173,6 +206,41 @@ function handleCache(options, template) {
|
||||
return func;
|
||||
}
|
||||
|
||||
/**
|
||||
* Try calling handleCache with the given options and data and call the
|
||||
* callback with the result. If an error occurs, call the callback with
|
||||
* the error. Used by renderFile().
|
||||
*
|
||||
* @memberof module:ejs-internal
|
||||
* @param {Options} options compilation options
|
||||
* @param {Object} data template data
|
||||
* @param {RenderFileCallback} cb callback
|
||||
* @static
|
||||
*/
|
||||
|
||||
function tryHandleCache(options, data, cb) {
|
||||
var result;
|
||||
try {
|
||||
result = handleCache(options)(data);
|
||||
}
|
||||
catch (err) {
|
||||
return cb(err);
|
||||
}
|
||||
return cb(null, result);
|
||||
}
|
||||
|
||||
/**
|
||||
* fileLoader is independent
|
||||
*
|
||||
* @param {String} filePath ejs file path.
|
||||
* @return {String} The contents of the specified file.
|
||||
* @static
|
||||
*/
|
||||
|
||||
function fileLoader(filePath){
|
||||
return exports.fileLoader(filePath);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the template function.
|
||||
*
|
||||
@ -206,8 +274,8 @@ function includeSource(path, options) {
|
||||
var opts = utils.shallowCopy({}, options);
|
||||
var includePath;
|
||||
var template;
|
||||
includePath = getIncludePath(path,opts);
|
||||
template = fs.readFileSync(includePath).toString().replace(_BOM, '');
|
||||
includePath = getIncludePath(path, opts);
|
||||
template = fileLoader(includePath).toString().replace(_BOM, '');
|
||||
opts.filename = includePath;
|
||||
var templ = new Template(template, opts);
|
||||
templ.generateSource();
|
||||
@ -231,11 +299,11 @@ function includeSource(path, options) {
|
||||
* @static
|
||||
*/
|
||||
|
||||
function rethrow(err, str, flnm, lineno){
|
||||
function rethrow(err, str, flnm, lineno, esc){
|
||||
var lines = str.split('\n');
|
||||
var start = Math.max(lineno - 3, 0);
|
||||
var end = Math.min(lines.length, lineno + 3);
|
||||
var filename = utils.escapeXML(flnm);
|
||||
var filename = esc(flnm); // eslint-disable-line
|
||||
// Error context
|
||||
var context = lines.slice(start, end).map(function (line, i){
|
||||
var curr = i + start + 1;
|
||||
@ -255,7 +323,7 @@ function rethrow(err, str, flnm, lineno){
|
||||
throw err;
|
||||
}
|
||||
|
||||
function stripSemi(str) {
|
||||
function stripSemi(str){
|
||||
return str.replace(/;(\s*$)/, '$1');
|
||||
}
|
||||
|
||||
@ -331,43 +399,43 @@ exports.render = function (template, d, o) {
|
||||
*/
|
||||
|
||||
exports.renderFile = function () {
|
||||
var args = Array.prototype.slice.call(arguments);
|
||||
var filename = args.shift();
|
||||
var cb = args.pop();
|
||||
var data = args.shift() || {};
|
||||
var opts = args.pop() || {};
|
||||
var optsKeys =_OPTS.slice();
|
||||
var result;
|
||||
var filename = arguments[0];
|
||||
var cb = arguments[arguments.length - 1];
|
||||
var opts = {filename: filename};
|
||||
var data;
|
||||
|
||||
// Don't pollute passed in opts obj with new vals
|
||||
opts = utils.shallowCopy({}, opts);
|
||||
if (arguments.length > 2) {
|
||||
data = arguments[1];
|
||||
|
||||
// We don't allow 'cache' option to be passed in the data obj
|
||||
// for the normal `render` call, but this is where Expres puts it
|
||||
// so we make an exception for `renderFile`
|
||||
optsKeys.push('cache');
|
||||
|
||||
// No options object -- if there are optiony names
|
||||
// in the data, copy them to options
|
||||
if (arguments.length == 3) {
|
||||
// Express 4
|
||||
if (data.settings && data.settings['view options']) {
|
||||
utils.shallowCopyFromList(opts, data.settings['view options'], optsKeys);
|
||||
// No options object -- if there are optiony names
|
||||
// in the data, copy them to options
|
||||
if (arguments.length === 3) {
|
||||
// Express 4
|
||||
if (data.settings) {
|
||||
if (data.settings['view options']) {
|
||||
utils.shallowCopyFromList(opts, data.settings['view options'], _OPTS_EXPRESS);
|
||||
}
|
||||
if (data.settings.views) {
|
||||
opts.views = data.settings.views;
|
||||
}
|
||||
}
|
||||
// Express 3 and lower
|
||||
else {
|
||||
utils.shallowCopyFromList(opts, data, _OPTS_EXPRESS);
|
||||
}
|
||||
}
|
||||
// Express 3 and lower
|
||||
else {
|
||||
utils.shallowCopyFromList(opts, data, optsKeys);
|
||||
// Use shallowCopy so we don't pollute passed in opts obj with new vals
|
||||
utils.shallowCopy(opts, arguments[2]);
|
||||
}
|
||||
}
|
||||
opts.filename = filename;
|
||||
|
||||
try {
|
||||
result = handleCache(opts)(data);
|
||||
opts.filename = filename;
|
||||
}
|
||||
catch(err) {
|
||||
return cb(err);
|
||||
else {
|
||||
data = {};
|
||||
}
|
||||
return cb(null, result);
|
||||
|
||||
return tryHandleCache(opts, data, cb);
|
||||
};
|
||||
|
||||
/**
|
||||
@ -400,6 +468,7 @@ function Template(text, opts) {
|
||||
options.rmWhitespace = opts.rmWhitespace;
|
||||
options.root = opts.root;
|
||||
options.localsName = opts.localsName || exports.localsName || _DEFAULT_LOCALS_NAME;
|
||||
options.views = opts.views;
|
||||
|
||||
if (options.strict) {
|
||||
options._with = false;
|
||||
@ -435,7 +504,7 @@ Template.prototype = {
|
||||
var opts = this.opts;
|
||||
var prepended = '';
|
||||
var appended = '';
|
||||
var escape = opts.escapeFunction;
|
||||
var escapeFn = opts.escapeFunction;
|
||||
|
||||
if (!this.source) {
|
||||
this.generateSource();
|
||||
@ -456,19 +525,15 @@ Template.prototype = {
|
||||
+ 'try {' + '\n'
|
||||
+ this.source
|
||||
+ '} catch (e) {' + '\n'
|
||||
+ ' rethrow(e, __lines, __filename, __line);' + '\n'
|
||||
+ ' rethrow(e, __lines, __filename, __line, escapeFn);' + '\n'
|
||||
+ '}' + '\n';
|
||||
}
|
||||
else {
|
||||
src = this.source;
|
||||
}
|
||||
|
||||
if (opts.debug) {
|
||||
console.log(src);
|
||||
}
|
||||
|
||||
if (opts.client) {
|
||||
src = 'escape = escape || ' + escape.toString() + ';' + '\n' + src;
|
||||
src = 'escapeFn = escapeFn || ' + escapeFn.toString() + ';' + '\n' + src;
|
||||
if (opts.compileDebug) {
|
||||
src = 'rethrow = rethrow || ' + rethrow.toString() + ';' + '\n' + src;
|
||||
}
|
||||
@ -477,9 +542,12 @@ Template.prototype = {
|
||||
if (opts.strict) {
|
||||
src = '"use strict";\n' + src;
|
||||
}
|
||||
if (opts.debug) {
|
||||
console.log(src);
|
||||
}
|
||||
|
||||
try {
|
||||
fn = new Function(opts.localsName + ', escape, include, rethrow', src);
|
||||
fn = new Function(opts.localsName + ', escapeFn, include, rethrow', src);
|
||||
}
|
||||
catch(e) {
|
||||
// istanbul ignore else
|
||||
@ -510,7 +578,7 @@ Template.prototype = {
|
||||
}
|
||||
return includeFile(path, opts)(d);
|
||||
};
|
||||
return fn.apply(opts.context, [data || {}, escape, include, rethrow]);
|
||||
return fn.apply(opts.context, [data || {}, escapeFn, include, rethrow]);
|
||||
};
|
||||
returnedFn.dependencies = this.dependencies;
|
||||
return returnedFn;
|
||||
@ -569,7 +637,7 @@ Template.prototype = {
|
||||
+ ' try {' + '\n'
|
||||
+ includeObj.source
|
||||
+ ' } catch (e) {' + '\n'
|
||||
+ ' rethrow(e, __lines, __filename, __line);' + '\n'
|
||||
+ ' rethrow(e, __lines, __filename, __line, escapeFn);' + '\n'
|
||||
+ ' }' + '\n'
|
||||
+ ' ; }).call(this)' + '\n';
|
||||
}else{
|
||||
@ -615,43 +683,43 @@ Template.prototype = {
|
||||
return arr;
|
||||
},
|
||||
|
||||
_addOutput: function (line) {
|
||||
if (this.truncate) {
|
||||
// Only replace single leading linebreak in the line after
|
||||
// -%> tag -- this is the single, trailing linebreak
|
||||
// after the tag that the truncation mode replaces
|
||||
// Handle Win / Unix / old Mac linebreaks -- do the \r\n
|
||||
// combo first in the regex-or
|
||||
line = line.replace(/^(?:\r\n|\r|\n)/, '');
|
||||
this.truncate = false;
|
||||
}
|
||||
else if (this.opts.rmWhitespace) {
|
||||
// rmWhitespace has already removed trailing spaces, just need
|
||||
// to remove linebreaks
|
||||
line = line.replace(/^\n/, '');
|
||||
}
|
||||
if (!line) {
|
||||
return line;
|
||||
}
|
||||
|
||||
// Preserve literal slashes
|
||||
line = line.replace(/\\/g, '\\\\');
|
||||
|
||||
// Convert linebreaks
|
||||
line = line.replace(/\n/g, '\\n');
|
||||
line = line.replace(/\r/g, '\\r');
|
||||
|
||||
// Escape double-quotes
|
||||
// - this will be the delimiter during execution
|
||||
line = line.replace(/"/g, '\\"');
|
||||
this.source += ' ; __append("' + line + '")' + '\n';
|
||||
},
|
||||
|
||||
scanLine: function (line) {
|
||||
var self = this;
|
||||
var d = this.opts.delimiter;
|
||||
var newLineCount = 0;
|
||||
|
||||
function _addOutput() {
|
||||
if (self.truncate) {
|
||||
// Only replace single leading linebreak in the line after
|
||||
// -%> tag -- this is the single, trailing linebreak
|
||||
// after the tag that the truncation mode replaces
|
||||
// Handle Win / Unix / old Mac linebreaks -- do the \r\n
|
||||
// combo first in the regex-or
|
||||
line = line.replace(/^(?:\r\n|\r|\n)/, '');
|
||||
self.truncate = false;
|
||||
}
|
||||
else if (self.opts.rmWhitespace) {
|
||||
// rmWhitespace has already removed trailing spaces, just need
|
||||
// to remove linebreaks
|
||||
line = line.replace(/^\n/, '');
|
||||
}
|
||||
if (!line) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Preserve literal slashes
|
||||
line = line.replace(/\\/g, '\\\\');
|
||||
|
||||
// Convert linebreaks
|
||||
line = line.replace(/\n/g, '\\n');
|
||||
line = line.replace(/\r/g, '\\r');
|
||||
|
||||
// Escape double-quotes
|
||||
// - this will be the delimiter during execution
|
||||
line = line.replace(/"/g, '\\"');
|
||||
self.source += ' ; __append("' + line + '")' + '\n';
|
||||
}
|
||||
|
||||
newLineCount = (line.split('\n').length - 1);
|
||||
|
||||
switch (line) {
|
||||
@ -680,7 +748,7 @@ Template.prototype = {
|
||||
case '-' + d + '>':
|
||||
case '_' + d + '>':
|
||||
if (this.mode == Template.modes.LITERAL) {
|
||||
_addOutput();
|
||||
this._addOutput(line);
|
||||
}
|
||||
|
||||
this.mode = null;
|
||||
@ -705,7 +773,7 @@ Template.prototype = {
|
||||
break;
|
||||
// Exec, esc, and output
|
||||
case Template.modes.ESCAPED:
|
||||
this.source += ' ; __append(escape(' + stripSemi(line) + '))' + '\n';
|
||||
this.source += ' ; __append(escapeFn(' + stripSemi(line) + '))' + '\n';
|
||||
break;
|
||||
// Exec and output
|
||||
case Template.modes.RAW:
|
||||
@ -716,13 +784,13 @@ Template.prototype = {
|
||||
break;
|
||||
// Literal <%% mode, append as raw output
|
||||
case Template.modes.LITERAL:
|
||||
_addOutput();
|
||||
this._addOutput(line);
|
||||
break;
|
||||
}
|
||||
}
|
||||
// In string mode, just add the output
|
||||
else {
|
||||
_addOutput();
|
||||
this._addOutput(line);
|
||||
}
|
||||
}
|
||||
|
||||
@ -767,7 +835,7 @@ if (require.extensions) {
|
||||
filename: filename,
|
||||
client: true
|
||||
};
|
||||
var template = fs.readFileSync(filename).toString();
|
||||
var template = fileLoader(filename).toString();
|
||||
var fn = exports.compile(template, options);
|
||||
module._compile('module.exports = ' + fn.toString() + ';', filename);
|
||||
};
|
||||
@ -934,11 +1002,12 @@ exports.shallowCopy = function (to, from) {
|
||||
* @private
|
||||
*/
|
||||
exports.shallowCopyFromList = function (to, from, list) {
|
||||
list.forEach(function (p) {
|
||||
for (var i = 0; i < list.length; i++) {
|
||||
var p = list[i];
|
||||
if (typeof from[p] != 'undefined') {
|
||||
to[p] = from[p];
|
||||
}
|
||||
});
|
||||
}
|
||||
return to;
|
||||
};
|
||||
|
||||
@ -1384,7 +1453,7 @@ module.exports={
|
||||
"engine",
|
||||
"ejs"
|
||||
],
|
||||
"version": "2.5.4",
|
||||
"version": "2.5.6",
|
||||
"author": "Matthew Eernisse <mde@fleegix.org> (http://fleegix.org)",
|
||||
"contributors": [
|
||||
"Timothy Gu <timothygu99@gmail.com> (https://timothygu.github.io)"
|
||||
@ -1413,7 +1482,7 @@ module.exports={
|
||||
"node": ">=0.10.0"
|
||||
},
|
||||
"scripts": {
|
||||
"test": "mocha",
|
||||
"test": "jake test",
|
||||
"lint": "eslint \"**/*.js\" Jakefile",
|
||||
"coverage": "istanbul cover node_modules/mocha/bin/_mocha",
|
||||
"doc": "jake doc",
|
||||
|
2
node_modules/ejs/ejs.min.js
generated
vendored
2
node_modules/ejs/ejs.min.js
generated
vendored
File diff suppressed because one or more lines are too long
244
node_modules/ejs/lib/ejs.js
generated
vendored
244
node_modules/ejs/lib/ejs.js
generated
vendored
@ -19,7 +19,7 @@
|
||||
'use strict';
|
||||
|
||||
/**
|
||||
* @file Embedded JavaScript templating engine.
|
||||
* @file Embedded JavaScript templating engine. {@link http://ejs.co}
|
||||
* @author Matthew Eernisse <mde@fleegix.org>
|
||||
* @author Tiancheng "Timothy" Gu <timothygu99@gmail.com>
|
||||
* @project EJS
|
||||
@ -56,6 +56,10 @@ var _NAME = 'ejs';
|
||||
var _REGEX_STRING = '(<%%|%%>|<%=|<%-|<%_|<%#|<%|%>|-%>|_%>)';
|
||||
var _OPTS = ['delimiter', 'scope', 'context', 'debug', 'compileDebug',
|
||||
'client', '_with', 'rmWhitespace', 'strict', 'filename'];
|
||||
// We don't allow 'cache' option to be passed in the data obj
|
||||
// for the normal `render` call, but this is where Express puts it
|
||||
// so we make an exception for `renderFile`
|
||||
var _OPTS_EXPRESS = _OPTS.concat('cache');
|
||||
var _BOM = /^\uFEFF/;
|
||||
|
||||
/**
|
||||
@ -68,6 +72,15 @@ var _BOM = /^\uFEFF/;
|
||||
|
||||
exports.cache = utils.cache;
|
||||
|
||||
/**
|
||||
* Custom file loader. Useful for template preprocessing or restricting access
|
||||
* to a certain part of the filesystem.
|
||||
*
|
||||
* @type {fileLoader}
|
||||
*/
|
||||
|
||||
exports.fileLoader = fs.readFileSync;
|
||||
|
||||
/**
|
||||
* Name of the object containing the locals.
|
||||
*
|
||||
@ -108,16 +121,36 @@ exports.resolveInclude = function(name, filename, isDir) {
|
||||
* @param {Options} options compilation options
|
||||
* @return {String}
|
||||
*/
|
||||
function getIncludePath(path, options){
|
||||
function getIncludePath(path, options) {
|
||||
var includePath;
|
||||
var filePath;
|
||||
var views = options.views;
|
||||
|
||||
// Abs path
|
||||
if (path.charAt(0) == '/') {
|
||||
includePath = exports.resolveInclude(path.replace(/^\/*/,''), options.root || '/', true);
|
||||
}
|
||||
// Relative paths
|
||||
else {
|
||||
if (!options.filename) {
|
||||
throw new Error('`include` use relative path requires the \'filename\' option.');
|
||||
// Look relative to a passed filename first
|
||||
if (options.filename) {
|
||||
filePath = exports.resolveInclude(path, options.filename);
|
||||
if (fs.existsSync(filePath)) {
|
||||
includePath = filePath;
|
||||
}
|
||||
}
|
||||
// Then look in any views directories
|
||||
if (!includePath) {
|
||||
if (Array.isArray(views) && views.some(function (v) {
|
||||
filePath = exports.resolveInclude(path, v, true);
|
||||
return fs.existsSync(filePath);
|
||||
})) {
|
||||
includePath = filePath;
|
||||
}
|
||||
}
|
||||
if (!includePath) {
|
||||
throw new Error('Could not find include include file.');
|
||||
}
|
||||
includePath = exports.resolveInclude(path, options.filename);
|
||||
}
|
||||
return includePath;
|
||||
}
|
||||
@ -154,7 +187,7 @@ function handleCache(options, template) {
|
||||
return func;
|
||||
}
|
||||
if (!hasTemplate) {
|
||||
template = fs.readFileSync(filename).toString().replace(_BOM, '');
|
||||
template = fileLoader(filename).toString().replace(_BOM, '');
|
||||
}
|
||||
}
|
||||
else if (!hasTemplate) {
|
||||
@ -163,7 +196,7 @@ function handleCache(options, template) {
|
||||
throw new Error('Internal EJS error: no file name or template '
|
||||
+ 'provided');
|
||||
}
|
||||
template = fs.readFileSync(filename).toString().replace(_BOM, '');
|
||||
template = fileLoader(filename).toString().replace(_BOM, '');
|
||||
}
|
||||
func = exports.compile(template, options);
|
||||
if (options.cache) {
|
||||
@ -172,6 +205,41 @@ function handleCache(options, template) {
|
||||
return func;
|
||||
}
|
||||
|
||||
/**
|
||||
* Try calling handleCache with the given options and data and call the
|
||||
* callback with the result. If an error occurs, call the callback with
|
||||
* the error. Used by renderFile().
|
||||
*
|
||||
* @memberof module:ejs-internal
|
||||
* @param {Options} options compilation options
|
||||
* @param {Object} data template data
|
||||
* @param {RenderFileCallback} cb callback
|
||||
* @static
|
||||
*/
|
||||
|
||||
function tryHandleCache(options, data, cb) {
|
||||
var result;
|
||||
try {
|
||||
result = handleCache(options)(data);
|
||||
}
|
||||
catch (err) {
|
||||
return cb(err);
|
||||
}
|
||||
return cb(null, result);
|
||||
}
|
||||
|
||||
/**
|
||||
* fileLoader is independent
|
||||
*
|
||||
* @param {String} filePath ejs file path.
|
||||
* @return {String} The contents of the specified file.
|
||||
* @static
|
||||
*/
|
||||
|
||||
function fileLoader(filePath){
|
||||
return exports.fileLoader(filePath);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the template function.
|
||||
*
|
||||
@ -205,8 +273,8 @@ function includeSource(path, options) {
|
||||
var opts = utils.shallowCopy({}, options);
|
||||
var includePath;
|
||||
var template;
|
||||
includePath = getIncludePath(path,opts);
|
||||
template = fs.readFileSync(includePath).toString().replace(_BOM, '');
|
||||
includePath = getIncludePath(path, opts);
|
||||
template = fileLoader(includePath).toString().replace(_BOM, '');
|
||||
opts.filename = includePath;
|
||||
var templ = new Template(template, opts);
|
||||
templ.generateSource();
|
||||
@ -230,11 +298,11 @@ function includeSource(path, options) {
|
||||
* @static
|
||||
*/
|
||||
|
||||
function rethrow(err, str, flnm, lineno){
|
||||
function rethrow(err, str, flnm, lineno, esc){
|
||||
var lines = str.split('\n');
|
||||
var start = Math.max(lineno - 3, 0);
|
||||
var end = Math.min(lines.length, lineno + 3);
|
||||
var filename = utils.escapeXML(flnm);
|
||||
var filename = esc(flnm); // eslint-disable-line
|
||||
// Error context
|
||||
var context = lines.slice(start, end).map(function (line, i){
|
||||
var curr = i + start + 1;
|
||||
@ -254,7 +322,7 @@ function rethrow(err, str, flnm, lineno){
|
||||
throw err;
|
||||
}
|
||||
|
||||
function stripSemi(str) {
|
||||
function stripSemi(str){
|
||||
return str.replace(/;(\s*$)/, '$1');
|
||||
}
|
||||
|
||||
@ -330,43 +398,43 @@ exports.render = function (template, d, o) {
|
||||
*/
|
||||
|
||||
exports.renderFile = function () {
|
||||
var args = Array.prototype.slice.call(arguments);
|
||||
var filename = args.shift();
|
||||
var cb = args.pop();
|
||||
var data = args.shift() || {};
|
||||
var opts = args.pop() || {};
|
||||
var optsKeys =_OPTS.slice();
|
||||
var result;
|
||||
var filename = arguments[0];
|
||||
var cb = arguments[arguments.length - 1];
|
||||
var opts = {filename: filename};
|
||||
var data;
|
||||
|
||||
// Don't pollute passed in opts obj with new vals
|
||||
opts = utils.shallowCopy({}, opts);
|
||||
if (arguments.length > 2) {
|
||||
data = arguments[1];
|
||||
|
||||
// We don't allow 'cache' option to be passed in the data obj
|
||||
// for the normal `render` call, but this is where Expres puts it
|
||||
// so we make an exception for `renderFile`
|
||||
optsKeys.push('cache');
|
||||
|
||||
// No options object -- if there are optiony names
|
||||
// in the data, copy them to options
|
||||
if (arguments.length == 3) {
|
||||
// Express 4
|
||||
if (data.settings && data.settings['view options']) {
|
||||
utils.shallowCopyFromList(opts, data.settings['view options'], optsKeys);
|
||||
// No options object -- if there are optiony names
|
||||
// in the data, copy them to options
|
||||
if (arguments.length === 3) {
|
||||
// Express 4
|
||||
if (data.settings) {
|
||||
if (data.settings['view options']) {
|
||||
utils.shallowCopyFromList(opts, data.settings['view options'], _OPTS_EXPRESS);
|
||||
}
|
||||
if (data.settings.views) {
|
||||
opts.views = data.settings.views;
|
||||
}
|
||||
}
|
||||
// Express 3 and lower
|
||||
else {
|
||||
utils.shallowCopyFromList(opts, data, _OPTS_EXPRESS);
|
||||
}
|
||||
}
|
||||
// Express 3 and lower
|
||||
else {
|
||||
utils.shallowCopyFromList(opts, data, optsKeys);
|
||||
// Use shallowCopy so we don't pollute passed in opts obj with new vals
|
||||
utils.shallowCopy(opts, arguments[2]);
|
||||
}
|
||||
}
|
||||
opts.filename = filename;
|
||||
|
||||
try {
|
||||
result = handleCache(opts)(data);
|
||||
opts.filename = filename;
|
||||
}
|
||||
catch(err) {
|
||||
return cb(err);
|
||||
else {
|
||||
data = {};
|
||||
}
|
||||
return cb(null, result);
|
||||
|
||||
return tryHandleCache(opts, data, cb);
|
||||
};
|
||||
|
||||
/**
|
||||
@ -399,6 +467,7 @@ function Template(text, opts) {
|
||||
options.rmWhitespace = opts.rmWhitespace;
|
||||
options.root = opts.root;
|
||||
options.localsName = opts.localsName || exports.localsName || _DEFAULT_LOCALS_NAME;
|
||||
options.views = opts.views;
|
||||
|
||||
if (options.strict) {
|
||||
options._with = false;
|
||||
@ -434,7 +503,7 @@ Template.prototype = {
|
||||
var opts = this.opts;
|
||||
var prepended = '';
|
||||
var appended = '';
|
||||
var escape = opts.escapeFunction;
|
||||
var escapeFn = opts.escapeFunction;
|
||||
|
||||
if (!this.source) {
|
||||
this.generateSource();
|
||||
@ -455,19 +524,15 @@ Template.prototype = {
|
||||
+ 'try {' + '\n'
|
||||
+ this.source
|
||||
+ '} catch (e) {' + '\n'
|
||||
+ ' rethrow(e, __lines, __filename, __line);' + '\n'
|
||||
+ ' rethrow(e, __lines, __filename, __line, escapeFn);' + '\n'
|
||||
+ '}' + '\n';
|
||||
}
|
||||
else {
|
||||
src = this.source;
|
||||
}
|
||||
|
||||
if (opts.debug) {
|
||||
console.log(src);
|
||||
}
|
||||
|
||||
if (opts.client) {
|
||||
src = 'escape = escape || ' + escape.toString() + ';' + '\n' + src;
|
||||
src = 'escapeFn = escapeFn || ' + escapeFn.toString() + ';' + '\n' + src;
|
||||
if (opts.compileDebug) {
|
||||
src = 'rethrow = rethrow || ' + rethrow.toString() + ';' + '\n' + src;
|
||||
}
|
||||
@ -476,9 +541,12 @@ Template.prototype = {
|
||||
if (opts.strict) {
|
||||
src = '"use strict";\n' + src;
|
||||
}
|
||||
if (opts.debug) {
|
||||
console.log(src);
|
||||
}
|
||||
|
||||
try {
|
||||
fn = new Function(opts.localsName + ', escape, include, rethrow', src);
|
||||
fn = new Function(opts.localsName + ', escapeFn, include, rethrow', src);
|
||||
}
|
||||
catch(e) {
|
||||
// istanbul ignore else
|
||||
@ -509,7 +577,7 @@ Template.prototype = {
|
||||
}
|
||||
return includeFile(path, opts)(d);
|
||||
};
|
||||
return fn.apply(opts.context, [data || {}, escape, include, rethrow]);
|
||||
return fn.apply(opts.context, [data || {}, escapeFn, include, rethrow]);
|
||||
};
|
||||
returnedFn.dependencies = this.dependencies;
|
||||
return returnedFn;
|
||||
@ -568,7 +636,7 @@ Template.prototype = {
|
||||
+ ' try {' + '\n'
|
||||
+ includeObj.source
|
||||
+ ' } catch (e) {' + '\n'
|
||||
+ ' rethrow(e, __lines, __filename, __line);' + '\n'
|
||||
+ ' rethrow(e, __lines, __filename, __line, escapeFn);' + '\n'
|
||||
+ ' }' + '\n'
|
||||
+ ' ; }).call(this)' + '\n';
|
||||
}else{
|
||||
@ -614,43 +682,43 @@ Template.prototype = {
|
||||
return arr;
|
||||
},
|
||||
|
||||
_addOutput: function (line) {
|
||||
if (this.truncate) {
|
||||
// Only replace single leading linebreak in the line after
|
||||
// -%> tag -- this is the single, trailing linebreak
|
||||
// after the tag that the truncation mode replaces
|
||||
// Handle Win / Unix / old Mac linebreaks -- do the \r\n
|
||||
// combo first in the regex-or
|
||||
line = line.replace(/^(?:\r\n|\r|\n)/, '');
|
||||
this.truncate = false;
|
||||
}
|
||||
else if (this.opts.rmWhitespace) {
|
||||
// rmWhitespace has already removed trailing spaces, just need
|
||||
// to remove linebreaks
|
||||
line = line.replace(/^\n/, '');
|
||||
}
|
||||
if (!line) {
|
||||
return line;
|
||||
}
|
||||
|
||||
// Preserve literal slashes
|
||||
line = line.replace(/\\/g, '\\\\');
|
||||
|
||||
// Convert linebreaks
|
||||
line = line.replace(/\n/g, '\\n');
|
||||
line = line.replace(/\r/g, '\\r');
|
||||
|
||||
// Escape double-quotes
|
||||
// - this will be the delimiter during execution
|
||||
line = line.replace(/"/g, '\\"');
|
||||
this.source += ' ; __append("' + line + '")' + '\n';
|
||||
},
|
||||
|
||||
scanLine: function (line) {
|
||||
var self = this;
|
||||
var d = this.opts.delimiter;
|
||||
var newLineCount = 0;
|
||||
|
||||
function _addOutput() {
|
||||
if (self.truncate) {
|
||||
// Only replace single leading linebreak in the line after
|
||||
// -%> tag -- this is the single, trailing linebreak
|
||||
// after the tag that the truncation mode replaces
|
||||
// Handle Win / Unix / old Mac linebreaks -- do the \r\n
|
||||
// combo first in the regex-or
|
||||
line = line.replace(/^(?:\r\n|\r|\n)/, '');
|
||||
self.truncate = false;
|
||||
}
|
||||
else if (self.opts.rmWhitespace) {
|
||||
// rmWhitespace has already removed trailing spaces, just need
|
||||
// to remove linebreaks
|
||||
line = line.replace(/^\n/, '');
|
||||
}
|
||||
if (!line) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Preserve literal slashes
|
||||
line = line.replace(/\\/g, '\\\\');
|
||||
|
||||
// Convert linebreaks
|
||||
line = line.replace(/\n/g, '\\n');
|
||||
line = line.replace(/\r/g, '\\r');
|
||||
|
||||
// Escape double-quotes
|
||||
// - this will be the delimiter during execution
|
||||
line = line.replace(/"/g, '\\"');
|
||||
self.source += ' ; __append("' + line + '")' + '\n';
|
||||
}
|
||||
|
||||
newLineCount = (line.split('\n').length - 1);
|
||||
|
||||
switch (line) {
|
||||
@ -679,7 +747,7 @@ Template.prototype = {
|
||||
case '-' + d + '>':
|
||||
case '_' + d + '>':
|
||||
if (this.mode == Template.modes.LITERAL) {
|
||||
_addOutput();
|
||||
this._addOutput(line);
|
||||
}
|
||||
|
||||
this.mode = null;
|
||||
@ -704,7 +772,7 @@ Template.prototype = {
|
||||
break;
|
||||
// Exec, esc, and output
|
||||
case Template.modes.ESCAPED:
|
||||
this.source += ' ; __append(escape(' + stripSemi(line) + '))' + '\n';
|
||||
this.source += ' ; __append(escapeFn(' + stripSemi(line) + '))' + '\n';
|
||||
break;
|
||||
// Exec and output
|
||||
case Template.modes.RAW:
|
||||
@ -715,13 +783,13 @@ Template.prototype = {
|
||||
break;
|
||||
// Literal <%% mode, append as raw output
|
||||
case Template.modes.LITERAL:
|
||||
_addOutput();
|
||||
this._addOutput(line);
|
||||
break;
|
||||
}
|
||||
}
|
||||
// In string mode, just add the output
|
||||
else {
|
||||
_addOutput();
|
||||
this._addOutput(line);
|
||||
}
|
||||
}
|
||||
|
||||
@ -766,7 +834,7 @@ if (require.extensions) {
|
||||
filename: filename,
|
||||
client: true
|
||||
};
|
||||
var template = fs.readFileSync(filename).toString();
|
||||
var template = fileLoader(filename).toString();
|
||||
var fn = exports.compile(template, options);
|
||||
module._compile('module.exports = ' + fn.toString() + ';', filename);
|
||||
};
|
||||
|
5
node_modules/ejs/lib/utils.js
generated
vendored
5
node_modules/ejs/lib/utils.js
generated
vendored
@ -133,11 +133,12 @@ exports.shallowCopy = function (to, from) {
|
||||
* @private
|
||||
*/
|
||||
exports.shallowCopyFromList = function (to, from, list) {
|
||||
list.forEach(function (p) {
|
||||
for (var i = 0; i < list.length; i++) {
|
||||
var p = list[i];
|
||||
if (typeof from[p] != 'undefined') {
|
||||
to[p] = from[p];
|
||||
}
|
||||
});
|
||||
}
|
||||
return to;
|
||||
};
|
||||
|
||||
|
73
node_modules/ejs/package.json
generated
vendored
73
node_modules/ejs/package.json
generated
vendored
@ -1,50 +1,28 @@
|
||||
{
|
||||
"_args": [
|
||||
[
|
||||
{
|
||||
"raw": "ejs@~2.5.2",
|
||||
"scope": null,
|
||||
"escapedName": "ejs",
|
||||
"name": "ejs",
|
||||
"rawSpec": "~2.5.2",
|
||||
"spec": ">=2.5.2 <2.6.0",
|
||||
"type": "range"
|
||||
},
|
||||
"/tank/data/SERVER/zoneadm-master"
|
||||
]
|
||||
],
|
||||
"_from": "ejs@>=2.5.2 <2.6.0",
|
||||
"_id": "ejs@2.5.5",
|
||||
"_inCache": true,
|
||||
"_from": "ejs@2.5.7",
|
||||
"_id": "ejs@2.5.7",
|
||||
"_inBundle": false,
|
||||
"_integrity": "sha1-zIcsFoiArjxxiXYv1f/ACJbJUYo=",
|
||||
"_location": "/ejs",
|
||||
"_nodeVersion": "6.9.1",
|
||||
"_npmOperationalInternal": {
|
||||
"host": "packages-18-east.internal.npmjs.com",
|
||||
"tmp": "tmp/ejs-2.5.5.tgz_1481011535826_0.4493071837350726"
|
||||
},
|
||||
"_npmUser": {
|
||||
"name": "mde",
|
||||
"email": "mde@fleegix.org"
|
||||
},
|
||||
"_npmVersion": "3.10.8",
|
||||
"_phantomChildren": {},
|
||||
"_requested": {
|
||||
"raw": "ejs@~2.5.2",
|
||||
"scope": null,
|
||||
"escapedName": "ejs",
|
||||
"type": "version",
|
||||
"registry": true,
|
||||
"raw": "ejs@2.5.7",
|
||||
"name": "ejs",
|
||||
"rawSpec": "~2.5.2",
|
||||
"spec": ">=2.5.2 <2.6.0",
|
||||
"type": "range"
|
||||
"escapedName": "ejs",
|
||||
"rawSpec": "2.5.7",
|
||||
"saveSpec": null,
|
||||
"fetchSpec": "2.5.7"
|
||||
},
|
||||
"_requiredBy": [
|
||||
"#USER",
|
||||
"/"
|
||||
],
|
||||
"_resolved": "https://registry.npmjs.org/ejs/-/ejs-2.5.5.tgz",
|
||||
"_shasum": "6ef4e954ea7dcf54f66aad2fe7aa421932d9ed77",
|
||||
"_shrinkwrap": null,
|
||||
"_spec": "ejs@~2.5.2",
|
||||
"_where": "/tank/data/SERVER/zoneadm-master",
|
||||
"_resolved": "https://registry.npmjs.org/ejs/-/ejs-2.5.7.tgz",
|
||||
"_shasum": "cc872c168880ae3c7189762fd5ffc00896c9518a",
|
||||
"_spec": "ejs@2.5.7",
|
||||
"_where": "/export/home/matjaz/git/zoneadmin-master",
|
||||
"author": {
|
||||
"name": "Matthew Eernisse",
|
||||
"email": "mde@fleegix.org",
|
||||
@ -53,6 +31,7 @@
|
||||
"bugs": {
|
||||
"url": "https://github.com/mde/ejs/issues"
|
||||
},
|
||||
"bundleDependencies": false,
|
||||
"contributors": [
|
||||
{
|
||||
"name": "Timothy Gu",
|
||||
@ -61,6 +40,7 @@
|
||||
}
|
||||
],
|
||||
"dependencies": {},
|
||||
"deprecated": false,
|
||||
"description": "Embedded JavaScript templates",
|
||||
"devDependencies": {
|
||||
"browserify": "^13.0.1",
|
||||
@ -73,11 +53,6 @@
|
||||
"mocha": "^3.0.2",
|
||||
"uglify-js": "^2.6.2"
|
||||
},
|
||||
"directories": {},
|
||||
"dist": {
|
||||
"shasum": "6ef4e954ea7dcf54f66aad2fe7aa421932d9ed77",
|
||||
"tarball": "https://registry.npmjs.org/ejs/-/ejs-2.5.5.tgz"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=0.10.0"
|
||||
},
|
||||
@ -89,15 +64,7 @@
|
||||
],
|
||||
"license": "Apache-2.0",
|
||||
"main": "./lib/ejs.js",
|
||||
"maintainers": [
|
||||
{
|
||||
"name": "mde",
|
||||
"email": "mde@fleegix.org"
|
||||
}
|
||||
],
|
||||
"name": "ejs",
|
||||
"optionalDependencies": {},
|
||||
"readme": "ERROR: No README data found!",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git://github.com/mde/ejs.git"
|
||||
@ -107,7 +74,7 @@
|
||||
"devdoc": "jake doc[dev]",
|
||||
"doc": "jake doc",
|
||||
"lint": "eslint \"**/*.js\" Jakefile",
|
||||
"test": "mocha"
|
||||
"test": "jake test"
|
||||
},
|
||||
"version": "2.5.5"
|
||||
"version": "2.5.7"
|
||||
}
|
||||
|
994
node_modules/ejs/test/ejs.js
generated
vendored
994
node_modules/ejs/test/ejs.js
generated
vendored
@ -1,994 +0,0 @@
|
||||
/* jshint mocha: true */
|
||||
/* eslint-env node, mocha */
|
||||
|
||||
/**
|
||||
* Module dependencies.
|
||||
*/
|
||||
|
||||
var ejs = require('..');
|
||||
var fs = require('fs');
|
||||
var read = fs.readFileSync;
|
||||
var assert = require('assert');
|
||||
var path = require('path');
|
||||
var LRU = require('lru-cache');
|
||||
|
||||
try {
|
||||
fs.mkdirSync(__dirname + '/tmp');
|
||||
} catch (ex) {
|
||||
if (ex.code !== 'EEXIST') {
|
||||
throw ex;
|
||||
}
|
||||
}
|
||||
|
||||
// From https://gist.github.com/pguillory/729616
|
||||
function hook_stdio(stream, callback) {
|
||||
var old_write = stream.write;
|
||||
|
||||
stream.write = (function() {
|
||||
return function(string, encoding, fd) {
|
||||
callback(string, encoding, fd);
|
||||
};
|
||||
})(stream.write);
|
||||
|
||||
return function() {
|
||||
stream.write = old_write;
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
* Load fixture `name`.
|
||||
*/
|
||||
|
||||
function fixture(name) {
|
||||
return read('test/fixtures/' + name, 'utf8');
|
||||
}
|
||||
|
||||
/**
|
||||
* User fixtures.
|
||||
*/
|
||||
|
||||
var users = [];
|
||||
users.push({name: 'geddy'});
|
||||
users.push({name: 'neil'});
|
||||
users.push({name: 'alex'});
|
||||
|
||||
suite('ejs.compile(str, options)', function () {
|
||||
test('compile to a function', function () {
|
||||
var fn = ejs.compile('<p>yay</p>');
|
||||
assert.equal(fn(), '<p>yay</p>');
|
||||
});
|
||||
|
||||
test('empty input works', function () {
|
||||
var fn = ejs.compile('');
|
||||
assert.equal(fn(), '');
|
||||
});
|
||||
|
||||
test('throw if there are syntax errors', function () {
|
||||
try {
|
||||
ejs.compile(fixture('fail.ejs'));
|
||||
}
|
||||
catch (err) {
|
||||
assert.ok(err.message.indexOf('compiling ejs') > -1);
|
||||
|
||||
try {
|
||||
ejs.compile(fixture('fail.ejs'), {filename: 'fail.ejs'});
|
||||
}
|
||||
catch (err) {
|
||||
assert.ok(err.message.indexOf('fail.ejs') > -1);
|
||||
return;
|
||||
}
|
||||
}
|
||||
throw new Error('no error reported when there should be');
|
||||
});
|
||||
|
||||
test('allow customizing delimiter local var', function () {
|
||||
var fn;
|
||||
fn = ejs.compile('<p><?= name ?></p>', {delimiter: '?'});
|
||||
assert.equal(fn({name: 'geddy'}), '<p>geddy</p>');
|
||||
|
||||
fn = ejs.compile('<p><:= name :></p>', {delimiter: ':'});
|
||||
assert.equal(fn({name: 'geddy'}), '<p>geddy</p>');
|
||||
|
||||
fn = ejs.compile('<p><$= name $></p>', {delimiter: '$'});
|
||||
assert.equal(fn({name: 'geddy'}), '<p>geddy</p>');
|
||||
});
|
||||
|
||||
test('default to using ejs.delimiter', function () {
|
||||
var fn;
|
||||
ejs.delimiter = '&';
|
||||
fn = ejs.compile('<p><&= name &></p>');
|
||||
assert.equal(fn({name: 'geddy'}), '<p>geddy</p>');
|
||||
|
||||
fn = ejs.compile('<p><|= name |></p>', {delimiter: '|'});
|
||||
assert.equal(fn({name: 'geddy'}), '<p>geddy</p>');
|
||||
delete ejs.delimiter;
|
||||
});
|
||||
|
||||
test('have a working client option', function () {
|
||||
var fn;
|
||||
var str;
|
||||
var preFn;
|
||||
fn = ejs.compile('<p><%= foo %></p>', {client: true});
|
||||
str = fn.toString();
|
||||
if (!process.env.running_under_istanbul) {
|
||||
eval('var preFn = ' + str);
|
||||
assert.equal(preFn({foo: 'bar'}), '<p>bar</p>');
|
||||
}
|
||||
});
|
||||
|
||||
test('support client mode without locals', function () {
|
||||
var fn;
|
||||
var str;
|
||||
var preFn;
|
||||
fn = ejs.compile('<p><%= "foo" %></p>', {client: true});
|
||||
str = fn.toString();
|
||||
if (!process.env.running_under_istanbul) {
|
||||
eval('var preFn = ' + str);
|
||||
assert.equal(preFn(), '<p>foo</p>');
|
||||
}
|
||||
});
|
||||
|
||||
test('not include rethrow() in client mode if compileDebug is false', function () {
|
||||
var fn = ejs.compile('<p><%= "foo" %></p>', {
|
||||
client: true,
|
||||
compileDebug: false
|
||||
});
|
||||
// There could be a `rethrow` in the function declaration
|
||||
assert((fn.toString().match(/rethrow/g) || []).length <= 1);
|
||||
});
|
||||
|
||||
test('support custom escape function', function () {
|
||||
var customEscape;
|
||||
var fn;
|
||||
customEscape = function customEscape(str) {
|
||||
return !str ? '' : str.toUpperCase();
|
||||
};
|
||||
fn = ejs.compile('HELLO <%= name %>', {escape: customEscape});
|
||||
assert.equal(fn({name: 'world'}), 'HELLO WORLD');
|
||||
});
|
||||
|
||||
test('support custom escape function in client mode', function () {
|
||||
var customEscape;
|
||||
var fn;
|
||||
var str;
|
||||
customEscape = function customEscape(str) {
|
||||
return !str ? '' : str.toUpperCase();
|
||||
};
|
||||
fn = ejs.compile('HELLO <%= name %>', {escape: customEscape, client: true});
|
||||
str = fn.toString();
|
||||
if (!process.env.running_under_istanbul) {
|
||||
eval('var preFn = ' + str);
|
||||
assert.equal(preFn({name: 'world'}), 'HELLO WORLD'); // eslint-disable-line no-undef
|
||||
}
|
||||
});
|
||||
|
||||
test('strict mode works', function () {
|
||||
assert.equal(ejs.render(fixture('strict.ejs'), {}, {strict: true}), 'true');
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
/* Old API -- remove when this shim goes away */
|
||||
suite('ejs.render(str, dataAndOpts)', function () {
|
||||
test('render the template with data/opts passed together', function () {
|
||||
assert.equal(ejs.render('<p><?= foo ?></p>', {foo: 'yay', delimiter: '?'}),
|
||||
'<p>yay</p>');
|
||||
});
|
||||
|
||||
test('disallow unsafe opts passed along in data', function () {
|
||||
assert.equal(ejs.render('<p><?= locals.foo ?></p>',
|
||||
// localsName should not get reset because it's blacklisted
|
||||
{_with: false, foo: 'yay', delimiter: '?', localsName: '_'}),
|
||||
'<p>yay</p>');
|
||||
});
|
||||
});
|
||||
|
||||
suite('ejs.render(str, data, opts)', function () {
|
||||
test('render the template', function () {
|
||||
assert.equal(ejs.render('<p>yay</p>'), '<p>yay</p>');
|
||||
});
|
||||
|
||||
test('empty input works', function () {
|
||||
assert.equal(ejs.render(''), '');
|
||||
});
|
||||
|
||||
test('undefined renders nothing escaped', function () {
|
||||
assert.equal(ejs.render('<%= undefined %>'), '');
|
||||
});
|
||||
|
||||
test('undefined renders nothing raw', function () {
|
||||
assert.equal(ejs.render('<%- undefined %>'), '');
|
||||
});
|
||||
|
||||
test('null renders nothing escaped', function () {
|
||||
assert.equal(ejs.render('<%= null %>'), '');
|
||||
});
|
||||
|
||||
test('null renders nothing raw', function () {
|
||||
assert.equal(ejs.render('<%- null %>'), '');
|
||||
});
|
||||
|
||||
test('zero-value data item renders something escaped', function () {
|
||||
assert.equal(ejs.render('<%= 0 %>'), '0');
|
||||
});
|
||||
|
||||
test('zero-value data object renders something raw', function () {
|
||||
assert.equal(ejs.render('<%- 0 %>'), '0');
|
||||
});
|
||||
|
||||
test('accept locals', function () {
|
||||
assert.equal(ejs.render('<p><%= name %></p>', {name: 'geddy'}),
|
||||
'<p>geddy</p>');
|
||||
});
|
||||
|
||||
test('accept locals without using with() {}', function () {
|
||||
assert.equal(ejs.render('<p><%= locals.name %></p>', {name: 'geddy'},
|
||||
{_with: false}),
|
||||
'<p>geddy</p>');
|
||||
assert.throws(function() {
|
||||
ejs.render('<p><%= name %></p>', {name: 'geddy'},
|
||||
{_with: false});
|
||||
}, /name is not defined/);
|
||||
});
|
||||
|
||||
test('accept custom name for locals', function () {
|
||||
ejs.localsName = 'it';
|
||||
assert.equal(ejs.render('<p><%= it.name %></p>', {name: 'geddy'},
|
||||
{_with: false}),
|
||||
'<p>geddy</p>');
|
||||
assert.throws(function() {
|
||||
ejs.render('<p><%= name %></p>', {name: 'geddy'},
|
||||
{_with: false});
|
||||
}, /name is not defined/);
|
||||
ejs.localsName = 'locals';
|
||||
});
|
||||
|
||||
test('support caching', function () {
|
||||
var file = __dirname + '/tmp/render.ejs';
|
||||
var options = {cache: true, filename: file};
|
||||
var out = ejs.render('<p>Old</p>', {}, options);
|
||||
var expected = '<p>Old</p>';
|
||||
assert.equal(out, expected);
|
||||
// Assert no change, still in cache
|
||||
out = ejs.render('<p>New</p>', {}, options);
|
||||
assert.equal(out, expected);
|
||||
});
|
||||
|
||||
test('support LRU caching', function () {
|
||||
var oldCache = ejs.cache;
|
||||
var file = __dirname + '/tmp/render.ejs';
|
||||
var options = {cache: true, filename: file};
|
||||
var out;
|
||||
var expected = '<p>Old</p>';
|
||||
|
||||
// Switch to LRU
|
||||
ejs.cache = LRU();
|
||||
|
||||
out = ejs.render('<p>Old</p>', {}, options);
|
||||
assert.equal(out, expected);
|
||||
// Assert no change, still in cache
|
||||
out = ejs.render('<p>New</p>', {}, options);
|
||||
assert.equal(out, expected);
|
||||
|
||||
// Restore system cache
|
||||
ejs.cache = oldCache;
|
||||
});
|
||||
|
||||
test('opts.context', function () {
|
||||
var ctxt = {foo: 'FOO'};
|
||||
var out = ejs.render('<%= this.foo %>', {}, {context: ctxt});
|
||||
assert.equal(out, ctxt.foo);
|
||||
});
|
||||
});
|
||||
|
||||
suite('ejs.renderFile(path, [data], [options], fn)', function () {
|
||||
test('render a file', function(done) {
|
||||
ejs.renderFile('test/fixtures/para.ejs', function(err, html) {
|
||||
if (err) {
|
||||
return done(err);
|
||||
}
|
||||
assert.equal(html, '<p>hey</p>\n');
|
||||
done();
|
||||
});
|
||||
});
|
||||
|
||||
test('accept locals', function(done) {
|
||||
var data = {name: 'fonebone'};
|
||||
var options = {delimiter: '$'};
|
||||
ejs.renderFile('test/fixtures/user.ejs', data, options, function(err, html) {
|
||||
if (err) {
|
||||
return done(err);
|
||||
}
|
||||
assert.equal(html, '<h1>fonebone</h1>\n');
|
||||
done();
|
||||
});
|
||||
});
|
||||
|
||||
test('accept locals without using with() {}', function(done) {
|
||||
var data = {name: 'fonebone'};
|
||||
var options = {delimiter: '$', _with: false};
|
||||
var doneCount = 0;
|
||||
ejs.renderFile('test/fixtures/user-no-with.ejs', data, options, function(err, html) {
|
||||
if (err) {
|
||||
if (doneCount === 2) {
|
||||
return;
|
||||
}
|
||||
doneCount = 2;
|
||||
return done(err);
|
||||
}
|
||||
assert.equal(html, '<h1>fonebone</h1>\n');
|
||||
doneCount++;
|
||||
if (doneCount === 2) {
|
||||
done();
|
||||
}
|
||||
});
|
||||
ejs.renderFile('test/fixtures/user.ejs', data, options, function(err) {
|
||||
if (!err) {
|
||||
if (doneCount === 2) {
|
||||
return;
|
||||
}
|
||||
doneCount = 2;
|
||||
return done(new Error('error not thrown'));
|
||||
}
|
||||
doneCount++;
|
||||
if (doneCount === 2) {
|
||||
done();
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
test('not catch err thrown by callback', function(done) {
|
||||
var data = {name: 'fonebone'};
|
||||
var options = {delimiter: '$'};
|
||||
var counter = 0;
|
||||
|
||||
var d = require('domain').create();
|
||||
d.on('error', function (err) {
|
||||
assert.equal(counter, 1);
|
||||
assert.equal(err.message, 'Exception in callback');
|
||||
done();
|
||||
});
|
||||
d.run(function () {
|
||||
// process.nextTick() needed to work around mochajs/mocha#513
|
||||
//
|
||||
// tl;dr: mocha doesn't support synchronous exception throwing in
|
||||
// domains. Have to make it async. Ticket closed because: "domains are
|
||||
// deprecated :D"
|
||||
process.nextTick(function () {
|
||||
ejs.renderFile('test/fixtures/user.ejs', data, options, function(err) {
|
||||
counter++;
|
||||
if (err) {
|
||||
assert.notEqual(err.message, 'Exception in callback');
|
||||
return done(err);
|
||||
}
|
||||
throw new Error('Exception in callback');
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
test('support caching', function (done) {
|
||||
var expected = '<p>Old</p>';
|
||||
var file = __dirname + '/tmp/renderFile.ejs';
|
||||
var options = {cache: true};
|
||||
fs.writeFileSync(file, '<p>Old</p>');
|
||||
|
||||
ejs.renderFile(file, {}, options, function (err, out) {
|
||||
if (err) {
|
||||
done(err);
|
||||
}
|
||||
fs.writeFileSync(file, '<p>New</p>');
|
||||
assert.equal(out, expected);
|
||||
|
||||
ejs.renderFile(file, {}, options, function (err, out) {
|
||||
if (err) {
|
||||
done(err);
|
||||
}
|
||||
// Assert no change, still in cache
|
||||
assert.equal(out, expected);
|
||||
done();
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
test('opts.context', function (done) {
|
||||
var ctxt = {foo: 'FOO'};
|
||||
ejs.renderFile('test/fixtures/with-context.ejs', {}, {context: ctxt}, function(err, html) {
|
||||
if (err) {
|
||||
return done(err);
|
||||
}
|
||||
assert.equal(html, ctxt.foo + '\n');
|
||||
done();
|
||||
});
|
||||
|
||||
});
|
||||
});
|
||||
|
||||
suite('cache specific', function () {
|
||||
test('`clearCache` work properly', function () {
|
||||
var expected = '<p>Old</p>';
|
||||
var file = __dirname + '/tmp/clearCache.ejs';
|
||||
var options = {cache: true, filename: file};
|
||||
var out = ejs.render('<p>Old</p>', {}, options);
|
||||
assert.equal(out, expected);
|
||||
|
||||
ejs.clearCache();
|
||||
|
||||
expected = '<p>New</p>';
|
||||
out = ejs.render('<p>New</p>', {}, options);
|
||||
assert.equal(out, expected);
|
||||
});
|
||||
|
||||
test('`clearCache` work properly, LRU', function () {
|
||||
var expected = '<p>Old</p>';
|
||||
var oldCache = ejs.cache;
|
||||
var file = __dirname + '/tmp/clearCache.ejs';
|
||||
var options = {cache: true, filename: file};
|
||||
var out;
|
||||
|
||||
ejs.cache = LRU();
|
||||
|
||||
out = ejs.render('<p>Old</p>', {}, options);
|
||||
assert.equal(out, expected);
|
||||
ejs.clearCache();
|
||||
expected = '<p>New</p>';
|
||||
out = ejs.render('<p>New</p>', {}, options);
|
||||
assert.equal(out, expected);
|
||||
|
||||
ejs.cache = oldCache;
|
||||
});
|
||||
|
||||
test('LRU with cache-size 1', function () {
|
||||
var oldCache = ejs.cache;
|
||||
var options;
|
||||
var out;
|
||||
var expected;
|
||||
var file;
|
||||
|
||||
ejs.cache = LRU(1);
|
||||
|
||||
file = __dirname + '/tmp/render1.ejs';
|
||||
options = {cache: true, filename: file};
|
||||
out = ejs.render('<p>File1</p>', {}, options);
|
||||
expected = '<p>File1</p>';
|
||||
assert.equal(out, expected);
|
||||
|
||||
// Same filename, different template, but output
|
||||
// should be the same because cache
|
||||
file = __dirname + '/tmp/render1.ejs';
|
||||
options = {cache: true, filename: file};
|
||||
out = ejs.render('<p>ChangedFile1</p>', {}, options);
|
||||
expected = '<p>File1</p>';
|
||||
assert.equal(out, expected);
|
||||
|
||||
// Different filiename -- output should be different,
|
||||
// and previous cache-entry should be evicted
|
||||
file = __dirname + '/tmp/render2.ejs';
|
||||
options = {cache: true, filename: file};
|
||||
out = ejs.render('<p>File2</p>', {}, options);
|
||||
expected = '<p>File2</p>';
|
||||
assert.equal(out, expected);
|
||||
|
||||
// Entry with first filename should now be out of cache,
|
||||
// results should be different
|
||||
file = __dirname + '/tmp/render1.ejs';
|
||||
options = {cache: true, filename: file};
|
||||
out = ejs.render('<p>ChangedFile1</p>', {}, options);
|
||||
expected = '<p>ChangedFile1</p>';
|
||||
assert.equal(out, expected);
|
||||
|
||||
ejs.cache = oldCache;
|
||||
});
|
||||
});
|
||||
|
||||
suite('<%', function () {
|
||||
test('without semicolons', function () {
|
||||
assert.equal(ejs.render(fixture('no.semicolons.ejs')),
|
||||
fixture('no.semicolons.html'));
|
||||
});
|
||||
});
|
||||
|
||||
suite('<%=', function () {
|
||||
test('should not throw an error with a // comment on the final line', function () {
|
||||
assert.equal(ejs.render('<%=\n// a comment\nname\n// another comment %>', {name: ' <script>'}),
|
||||
'&nbsp;<script>');
|
||||
});
|
||||
|
||||
test('escape &<script>', function () {
|
||||
assert.equal(ejs.render('<%= name %>', {name: ' <script>'}),
|
||||
'&nbsp;<script>');
|
||||
});
|
||||
|
||||
test('should escape \'', function () {
|
||||
assert.equal(ejs.render('<%= name %>', {name: 'The Jones\'s'}),
|
||||
'The Jones's');
|
||||
});
|
||||
|
||||
test('should escape &foo_bar;', function () {
|
||||
assert.equal(ejs.render('<%= name %>', {name: '&foo_bar;'}),
|
||||
'&foo_bar;');
|
||||
});
|
||||
|
||||
test('should accept custom function', function() {
|
||||
|
||||
var customEscape = function customEscape(str) {
|
||||
return !str ? '' : str.toUpperCase();
|
||||
};
|
||||
|
||||
assert.equal(
|
||||
ejs.render('<%= name %>', {name: 'The Jones\'s'}, {escape: customEscape}),
|
||||
'THE JONES\'S'
|
||||
);
|
||||
});
|
||||
});
|
||||
|
||||
suite('<%-', function () {
|
||||
test('should not throw an error with a // comment on the final line', function () {
|
||||
assert.equal(ejs.render('<%-\n// a comment\nname\n// another comment %>', {name: ' <script>'}),
|
||||
' <script>');
|
||||
});
|
||||
|
||||
test('not escape', function () {
|
||||
assert.equal(ejs.render('<%- name %>', {name: '<script>'}),
|
||||
'<script>');
|
||||
});
|
||||
|
||||
test('terminate gracefully if no close tag is found', function () {
|
||||
try {
|
||||
ejs.compile('<h1>oops</h1><%- name ->');
|
||||
throw new Error('Expected parse failure');
|
||||
}
|
||||
catch (err) {
|
||||
assert.ok(err.message.indexOf('Could not find matching close tag for') > -1);
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
suite('%>', function () {
|
||||
test('produce newlines', function () {
|
||||
assert.equal(ejs.render(fixture('newlines.ejs'), {users: users}),
|
||||
fixture('newlines.html'));
|
||||
});
|
||||
test('works with `-%>` interspersed', function () {
|
||||
assert.equal(ejs.render(fixture('newlines.mixed.ejs'), {users: users}),
|
||||
fixture('newlines.mixed.html'));
|
||||
});
|
||||
test('consecutive tags work', function () {
|
||||
assert.equal(ejs.render(fixture('consecutive-tags.ejs')),
|
||||
fixture('consecutive-tags.html'));
|
||||
});
|
||||
});
|
||||
|
||||
suite('-%>', function () {
|
||||
test('not produce newlines', function () {
|
||||
assert.equal(ejs.render(fixture('no.newlines.ejs'), {users: users}),
|
||||
fixture('no.newlines.html'));
|
||||
});
|
||||
test('stack traces work', function () {
|
||||
try {
|
||||
ejs.render(fixture('no.newlines.error.ejs'));
|
||||
}
|
||||
catch (e) {
|
||||
if (e.message.indexOf('>> 4| <%= qdata %>') > -1) {
|
||||
return;
|
||||
}
|
||||
throw e;
|
||||
}
|
||||
throw new Error('Expected ReferenceError');
|
||||
});
|
||||
|
||||
test('works with unix style', function () {
|
||||
var content = '<ul><% -%>\n'
|
||||
+ '<% users.forEach(function(user){ -%>\n'
|
||||
+ '<li><%= user.name -%></li>\n'
|
||||
+ '<% }) -%>\n'
|
||||
+ '</ul><% -%>\n';
|
||||
|
||||
var expectedResult = '<ul><li>geddy</li>\n<li>neil</li>\n<li>alex</li>\n</ul>';
|
||||
var fn;
|
||||
fn = ejs.compile(content);
|
||||
assert.equal(fn({users: users}),
|
||||
expectedResult);
|
||||
});
|
||||
|
||||
test('works with windows style', function () {
|
||||
var content = '<ul><% -%>\r\n'
|
||||
+ '<% users.forEach(function(user){ -%>\r\n'
|
||||
+ '<li><%= user.name -%></li>\r\n'
|
||||
+ '<% }) -%>\r\n'
|
||||
+ '</ul><% -%>\r\n';
|
||||
|
||||
var expectedResult = '<ul><li>geddy</li>\r\n<li>neil</li>\r\n<li>alex</li>\r\n</ul>';
|
||||
var fn;
|
||||
fn = ejs.compile(content);
|
||||
assert.equal(fn({users: users}),
|
||||
expectedResult);
|
||||
});
|
||||
});
|
||||
|
||||
suite('<%%', function () {
|
||||
test('produce literals', function () {
|
||||
assert.equal(ejs.render('<%%- "foo" %>'),
|
||||
'<%- "foo" %>');
|
||||
});
|
||||
test('work without an end tag', function () {
|
||||
assert.equal(ejs.render('<%%'), '<%');
|
||||
assert.equal(ejs.render(fixture('literal.ejs'), {}, {delimiter: ' '}),
|
||||
fixture('literal.html'));
|
||||
});
|
||||
});
|
||||
|
||||
suite('%%>', function () {
|
||||
test('produce literal', function () {
|
||||
assert.equal(ejs.render('%%>'),
|
||||
'%>');
|
||||
assert.equal(ejs.render(' >', {}, {delimiter: ' '}),
|
||||
' >');
|
||||
});
|
||||
});
|
||||
|
||||
suite('<%_ and _%>', function () {
|
||||
test('slurps spaces and tabs', function () {
|
||||
assert.equal(ejs.render(fixture('space-and-tab-slurp.ejs'), {users: users}),
|
||||
fixture('space-and-tab-slurp.html'));
|
||||
});
|
||||
});
|
||||
|
||||
suite('single quotes', function () {
|
||||
test('not mess up the constructed function', function () {
|
||||
assert.equal(ejs.render(fixture('single-quote.ejs')),
|
||||
fixture('single-quote.html'));
|
||||
});
|
||||
});
|
||||
|
||||
suite('double quotes', function () {
|
||||
test('not mess up the constructed function', function () {
|
||||
assert.equal(ejs.render(fixture('double-quote.ejs')),
|
||||
fixture('double-quote.html'));
|
||||
});
|
||||
});
|
||||
|
||||
suite('backslashes', function () {
|
||||
test('escape', function () {
|
||||
assert.equal(ejs.render(fixture('backslash.ejs')),
|
||||
fixture('backslash.html'));
|
||||
});
|
||||
});
|
||||
|
||||
suite('messed up whitespace', function () {
|
||||
test('work', function () {
|
||||
assert.equal(ejs.render(fixture('messed.ejs'), {users: users}),
|
||||
fixture('messed.html'));
|
||||
});
|
||||
});
|
||||
|
||||
suite('exceptions', function () {
|
||||
test('produce useful stack traces', function () {
|
||||
try {
|
||||
ejs.render(fixture('error.ejs'), {}, {filename: 'error.ejs'});
|
||||
}
|
||||
catch (err) {
|
||||
assert.equal(err.path, 'error.ejs');
|
||||
assert.equal(err.stack.split('\n').slice(0, 8).join('\n'), fixture('error.out'));
|
||||
return;
|
||||
}
|
||||
throw new Error('no error reported when there should be');
|
||||
});
|
||||
|
||||
test('not include fancy stack info if compileDebug is false', function () {
|
||||
try {
|
||||
ejs.render(fixture('error.ejs'), {}, {
|
||||
filename: 'error.ejs',
|
||||
compileDebug: false
|
||||
});
|
||||
}
|
||||
catch (err) {
|
||||
assert.ok(!err.path);
|
||||
assert.notEqual(err.stack.split('\n').slice(0, 8).join('\n'), fixture('error.out'));
|
||||
return;
|
||||
}
|
||||
throw new Error('no error reported when there should be');
|
||||
});
|
||||
|
||||
var unhook = null;
|
||||
test('log JS source when debug is set', function (done) {
|
||||
var out = '';
|
||||
var needToExit = false;
|
||||
unhook = hook_stdio(process.stdout, function (str) {
|
||||
out += str;
|
||||
if (needToExit) {
|
||||
return;
|
||||
}
|
||||
if (out.indexOf('__output')) {
|
||||
needToExit = true;
|
||||
unhook();
|
||||
unhook = null;
|
||||
return done();
|
||||
}
|
||||
});
|
||||
ejs.render(fixture('hello-world.ejs'), {}, {debug: true});
|
||||
});
|
||||
teardown(function() {
|
||||
if (!unhook) {
|
||||
return;
|
||||
}
|
||||
unhook();
|
||||
unhook = null;
|
||||
});
|
||||
});
|
||||
|
||||
suite('rmWhitespace', function () {
|
||||
test('works', function () {
|
||||
assert.equal(ejs.render(fixture('rmWhitespace.ejs'), {}, {rmWhitespace: true}),
|
||||
fixture('rmWhitespace.html'));
|
||||
});
|
||||
});
|
||||
|
||||
suite('include()', function () {
|
||||
test('include ejs', function () {
|
||||
var file = 'test/fixtures/include-simple.ejs';
|
||||
assert.equal(ejs.render(fixture('include-simple.ejs'), {}, {filename: file}),
|
||||
fixture('include-simple.html'));
|
||||
});
|
||||
|
||||
test('include ejs fails without `filename`', function () {
|
||||
try {
|
||||
ejs.render(fixture('include-simple.ejs'));
|
||||
}
|
||||
catch (err) {
|
||||
assert.ok(err.message.indexOf('requires the \'filename\' option') > -1);
|
||||
return;
|
||||
}
|
||||
throw new Error('expected inclusion error');
|
||||
});
|
||||
|
||||
test('strips BOM', function () {
|
||||
assert.equal(
|
||||
ejs.render('<%- include("fixtures/includes/bom.ejs") %>',
|
||||
{}, {filename: path.join(__dirname, 'f.ejs')}),
|
||||
'<p>This is a file with BOM.</p>\n');
|
||||
});
|
||||
|
||||
test('include ejs with locals', function () {
|
||||
var file = 'test/fixtures/include.ejs';
|
||||
assert.equal(ejs.render(fixture('include.ejs'), {pets: users}, {filename: file, delimiter: '@'}),
|
||||
fixture('include.html'));
|
||||
});
|
||||
|
||||
test('include ejs with absolute path and locals', function () {
|
||||
var file = 'test/fixtures/include-abspath.ejs';
|
||||
assert.equal(ejs.render(fixture('include-abspath.ejs'),
|
||||
{dir: path.join(__dirname, 'fixtures'), pets: users, path: path},
|
||||
{filename: file, delimiter: '@'}),
|
||||
fixture('include.html'));
|
||||
});
|
||||
|
||||
test('include ejs with set root path', function () {
|
||||
var file = 'test/fixtures/include-root.ejs';
|
||||
var viewsPath = path.join(__dirname, 'fixtures');
|
||||
assert.equal(ejs.render(fixture('include-root.ejs'), {pets: users}, {filename: file, delimiter: '@',root:viewsPath}),
|
||||
fixture('include.html'));
|
||||
});
|
||||
|
||||
test('work when nested', function () {
|
||||
var file = 'test/fixtures/menu.ejs';
|
||||
assert.equal(ejs.render(fixture('menu.ejs'), {pets: users}, {filename: file}),
|
||||
fixture('menu.html'));
|
||||
});
|
||||
|
||||
test('work with a variable path', function () {
|
||||
var file = 'test/fixtures/menu_var.ejs';
|
||||
var includePath = 'includes/menu-item';
|
||||
assert.equal(ejs.render(fixture('menu.ejs'), {pets: users, varPath: includePath}, {filename: file}),
|
||||
fixture('menu.html'));
|
||||
});
|
||||
|
||||
test('include arbitrary files as-is', function () {
|
||||
var file = 'test/fixtures/include.css.ejs';
|
||||
assert.equal(ejs.render(fixture('include.css.ejs'), {pets: users}, {filename: file}),
|
||||
fixture('include.css.html'));
|
||||
});
|
||||
|
||||
test('pass compileDebug to include', function () {
|
||||
var file = 'test/fixtures/include.ejs';
|
||||
var fn;
|
||||
fn = ejs.compile(fixture('include.ejs'), {
|
||||
filename: file,
|
||||
delimiter: '@',
|
||||
compileDebug: false
|
||||
});
|
||||
try {
|
||||
// Render without a required variable reference
|
||||
fn({foo: 'asdf'});
|
||||
}
|
||||
catch(e) {
|
||||
assert.equal(e.message, 'pets is not defined');
|
||||
assert.ok(!e.path);
|
||||
return;
|
||||
}
|
||||
throw new Error('no error reported when there should be');
|
||||
});
|
||||
|
||||
test('is dynamic', function () {
|
||||
fs.writeFileSync(__dirname + '/tmp/include.ejs', '<p>Old</p>');
|
||||
var file = 'test/fixtures/include_cache.ejs';
|
||||
var options = {filename: file};
|
||||
var out = ejs.compile(fixture('include_cache.ejs'), options);
|
||||
assert.equal(out(), '<p>Old</p>\n');
|
||||
|
||||
fs.writeFileSync(__dirname + '/tmp/include.ejs', '<p>New</p>');
|
||||
assert.equal(out(), '<p>New</p>\n');
|
||||
});
|
||||
|
||||
test('support caching', function () {
|
||||
fs.writeFileSync(__dirname + '/tmp/include.ejs', '<p>Old</p>');
|
||||
var file = 'test/fixtures/include_cache.ejs';
|
||||
var options = {cache: true, filename: file};
|
||||
var out = ejs.render(fixture('include_cache.ejs'), {}, options);
|
||||
var expected = fixture('include_cache.html');
|
||||
assert.equal(out, expected);
|
||||
out = ejs.render(fixture('include_cache.ejs'), {}, options);
|
||||
// No change, still in cache
|
||||
assert.equal(out, expected);
|
||||
fs.writeFileSync(__dirname + '/tmp/include.ejs', '<p>New</p>');
|
||||
out = ejs.render(fixture('include_cache.ejs'), {}, options);
|
||||
assert.equal(out, expected);
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
suite('preprocessor include', function () {
|
||||
test('work', function () {
|
||||
var file = 'test/fixtures/include_preprocessor.ejs';
|
||||
assert.equal(ejs.render(fixture('include_preprocessor.ejs'), {pets: users}, {filename: file, delimiter: '@'}),
|
||||
fixture('include_preprocessor.html'));
|
||||
});
|
||||
|
||||
test('no false positives', function () {
|
||||
assert.equal(ejs.render('<% %> include foo <% %>'), ' include foo ');
|
||||
});
|
||||
|
||||
test('fails without `filename`', function () {
|
||||
try {
|
||||
ejs.render(fixture('include_preprocessor.ejs'), {pets: users}, {delimiter: '@'});
|
||||
}
|
||||
catch (err) {
|
||||
assert.ok(err.message.indexOf('requires the \'filename\' option') > -1);
|
||||
return;
|
||||
}
|
||||
throw new Error('expected inclusion error');
|
||||
});
|
||||
|
||||
test('strips BOM', function () {
|
||||
assert.equal(
|
||||
ejs.render('<% include fixtures/includes/bom.ejs %>',
|
||||
{}, {filename: path.join(__dirname, 'f.ejs')}),
|
||||
'<p>This is a file with BOM.</p>\n');
|
||||
});
|
||||
|
||||
test('work when nested', function () {
|
||||
var file = 'test/fixtures/menu_preprocessor.ejs';
|
||||
assert.equal(ejs.render(fixture('menu_preprocessor.ejs'), {pets: users}, {filename: file}),
|
||||
fixture('menu_preprocessor.html'));
|
||||
});
|
||||
|
||||
test('tracks dependency correctly', function () {
|
||||
var file = 'test/fixtures/menu_preprocessor.ejs';
|
||||
var fn = ejs.compile(fixture('menu_preprocessor.ejs'), {filename: file});
|
||||
assert(fn.dependencies.length);
|
||||
});
|
||||
|
||||
test('include arbitrary files as-is', function () {
|
||||
var file = 'test/fixtures/include_preprocessor.css.ejs';
|
||||
assert.equal(ejs.render(fixture('include_preprocessor.css.ejs'), {pets: users}, {filename: file}),
|
||||
fixture('include_preprocessor.css.html'));
|
||||
});
|
||||
|
||||
test('pass compileDebug to include', function () {
|
||||
var file = 'test/fixtures/include_preprocessor.ejs';
|
||||
var fn;
|
||||
fn = ejs.compile(fixture('include_preprocessor.ejs'), {
|
||||
filename: file,
|
||||
delimiter: '@',
|
||||
compileDebug: false
|
||||
});
|
||||
try {
|
||||
// Render without a required variable reference
|
||||
fn({foo: 'asdf'});
|
||||
}
|
||||
catch(e) {
|
||||
assert.equal(e.message, 'pets is not defined');
|
||||
assert.ok(!e.path);
|
||||
return;
|
||||
}
|
||||
throw new Error('no error reported when there should be');
|
||||
});
|
||||
|
||||
test('is static', function () {
|
||||
fs.writeFileSync(__dirname + '/tmp/include_preprocessor.ejs', '<p>Old</p>');
|
||||
var file = 'test/fixtures/include_preprocessor_cache.ejs';
|
||||
var options = {filename: file};
|
||||
var out = ejs.compile(fixture('include_preprocessor_cache.ejs'), options);
|
||||
assert.equal(out(), '<p>Old</p>\n');
|
||||
|
||||
fs.writeFileSync(__dirname + '/tmp/include_preprocessor.ejs', '<p>New</p>');
|
||||
assert.equal(out(), '<p>Old</p>\n');
|
||||
});
|
||||
|
||||
test('support caching', function () {
|
||||
fs.writeFileSync(__dirname + '/tmp/include_preprocessor.ejs', '<p>Old</p>');
|
||||
var file = 'test/fixtures/include_preprocessor_cache.ejs';
|
||||
var options = {cache: true, filename: file};
|
||||
var out = ejs.render(fixture('include_preprocessor_cache.ejs'), {}, options);
|
||||
var expected = fixture('include_preprocessor_cache.html');
|
||||
assert.equal(out, expected);
|
||||
fs.writeFileSync(__dirname + '/tmp/include_preprocessor.ejs', '<p>New</p>');
|
||||
out = ejs.render(fixture('include_preprocessor_cache.ejs'), {}, options);
|
||||
assert.equal(out, expected);
|
||||
});
|
||||
|
||||
test('whitespace slurp and rmWhitespace work', function() {
|
||||
var file = 'test/fixtures/include_preprocessor_line_slurp.ejs';
|
||||
var template = fixture('include_preprocessor_line_slurp.ejs');
|
||||
var expected = fixture('include_preprocessor_line_slurp.html');
|
||||
var options = {rmWhitespace: true, filename: file};
|
||||
assert.equal(ejs.render(template, {}, options),
|
||||
expected);
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
suite('comments', function () {
|
||||
test('fully render with comments removed', function () {
|
||||
assert.equal(ejs.render(fixture('comments.ejs')),
|
||||
fixture('comments.html'));
|
||||
});
|
||||
});
|
||||
|
||||
suite('require', function () {
|
||||
|
||||
// Only works with inline/preprocessor includes
|
||||
test('allow ejs templates to be required as node modules', function () {
|
||||
var file = 'test/fixtures/include_preprocessor.ejs';
|
||||
var template = require(__dirname + '/fixtures/menu_preprocessor.ejs');
|
||||
if (!process.env.running_under_istanbul) {
|
||||
assert.equal(template({filename: file, pets: users}),
|
||||
fixture('menu_preprocessor.html'));
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
suite('examples', function () {
|
||||
function noop () {}
|
||||
fs.readdirSync('examples').forEach(function (f) {
|
||||
if (!/\.js$/.test(f)) {
|
||||
return;
|
||||
}
|
||||
suite(f, function () {
|
||||
test('doesn\'t throw any errors', function () {
|
||||
var stderr = hook_stdio(process.stderr, noop);
|
||||
var stdout = hook_stdio(process.stdout, noop);
|
||||
try {
|
||||
require('../examples/' + f);
|
||||
}
|
||||
catch (ex) {
|
||||
stdout();
|
||||
stderr();
|
||||
throw ex;
|
||||
}
|
||||
stdout();
|
||||
stderr();
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
suite('meta information', function () {
|
||||
test('has a version', function () {
|
||||
assert.strictEqual(ejs.VERSION, require('../package.json').version);
|
||||
});
|
||||
|
||||
test('had a name', function () {
|
||||
assert.strictEqual(ejs.name, 'ejs');
|
||||
});
|
||||
});
|
1
node_modules/ejs/test/fixtures/backslash.ejs
generated
vendored
1
node_modules/ejs/test/fixtures/backslash.ejs
generated
vendored
@ -1 +0,0 @@
|
||||
\foo
|
1
node_modules/ejs/test/fixtures/backslash.html
generated
vendored
1
node_modules/ejs/test/fixtures/backslash.html
generated
vendored
@ -1 +0,0 @@
|
||||
\foo
|
7
node_modules/ejs/test/fixtures/comments.ejs
generated
vendored
7
node_modules/ejs/test/fixtures/comments.ejs
generated
vendored
@ -1,7 +0,0 @@
|
||||
<li><a href="foo"><% // double-slash comment %>foo</li>
|
||||
<li><a href="bar"><% /* C-style comment */ %>bar</li>
|
||||
<li><a href="baz"><% // double-slash comment with newline
|
||||
%>baz</li>
|
||||
<li><a href="qux"><% var x = 'qux'; // double-slash comment @ end of line %><%= x %></li>
|
||||
<li><a href="fee"><%# ERB style comment %>fee</li>
|
||||
<li><a href="bah"><%= 'not a ' + '//' + ' comment' %></a></li>
|
6
node_modules/ejs/test/fixtures/comments.html
generated
vendored
6
node_modules/ejs/test/fixtures/comments.html
generated
vendored
@ -1,6 +0,0 @@
|
||||
<li><a href="foo">foo</li>
|
||||
<li><a href="bar">bar</li>
|
||||
<li><a href="baz">baz</li>
|
||||
<li><a href="qux">qux</li>
|
||||
<li><a href="fee">fee</li>
|
||||
<li><a href="bah">not a // comment</a></li>
|
1
node_modules/ejs/test/fixtures/consecutive-tags.ejs
generated
vendored
1
node_modules/ejs/test/fixtures/consecutive-tags.ejs
generated
vendored
@ -1 +0,0 @@
|
||||
<% var a = 'foo' %><% var b = 'bar' %><%= a %>
|
1
node_modules/ejs/test/fixtures/consecutive-tags.html
generated
vendored
1
node_modules/ejs/test/fixtures/consecutive-tags.html
generated
vendored
@ -1 +0,0 @@
|
||||
foo
|
1
node_modules/ejs/test/fixtures/double-quote.ejs
generated
vendored
1
node_modules/ejs/test/fixtures/double-quote.ejs
generated
vendored
@ -1 +0,0 @@
|
||||
<p><%= "lo" + 'ki' %>'s "wheelchair"</p>
|
1
node_modules/ejs/test/fixtures/double-quote.html
generated
vendored
1
node_modules/ejs/test/fixtures/double-quote.html
generated
vendored
@ -1 +0,0 @@
|
||||
<p>loki's "wheelchair"</p>
|
5
node_modules/ejs/test/fixtures/error.ejs
generated
vendored
5
node_modules/ejs/test/fixtures/error.ejs
generated
vendored
@ -1,5 +0,0 @@
|
||||
<ul>
|
||||
<% if (users) { %>
|
||||
<p>Has users</p>
|
||||
<% } %>
|
||||
</ul>
|
8
node_modules/ejs/test/fixtures/error.out
generated
vendored
8
node_modules/ejs/test/fixtures/error.out
generated
vendored
@ -1,8 +0,0 @@
|
||||
ReferenceError: error.ejs:2
|
||||
1| <ul>
|
||||
>> 2| <% if (users) { %>
|
||||
3| <p>Has users</p>
|
||||
4| <% } %>
|
||||
5| </ul>
|
||||
|
||||
users is not defined
|
1
node_modules/ejs/test/fixtures/fail.ejs
generated
vendored
1
node_modules/ejs/test/fixtures/fail.ejs
generated
vendored
@ -1 +0,0 @@
|
||||
<% function foo() return 'foo'; %>
|
1
node_modules/ejs/test/fixtures/hello-world.ejs
generated
vendored
1
node_modules/ejs/test/fixtures/hello-world.ejs
generated
vendored
@ -1 +0,0 @@
|
||||
<p>Hello world!</p>
|
5
node_modules/ejs/test/fixtures/include-abspath.ejs
generated
vendored
5
node_modules/ejs/test/fixtures/include-abspath.ejs
generated
vendored
@ -1,5 +0,0 @@
|
||||
<ul>
|
||||
<@ pets.forEach(function(pet){ @>
|
||||
<@- include(path.join(dir, 'pet'), {pet: pet}); @>
|
||||
<@ }); @>
|
||||
</ul>
|
1
node_modules/ejs/test/fixtures/include-root.ejs
generated
vendored
1
node_modules/ejs/test/fixtures/include-root.ejs
generated
vendored
@ -1 +0,0 @@
|
||||
<@- include('/include'); @>
|
3
node_modules/ejs/test/fixtures/include-simple.ejs
generated
vendored
3
node_modules/ejs/test/fixtures/include-simple.ejs
generated
vendored
@ -1,3 +0,0 @@
|
||||
<ul>
|
||||
<%- include('hello-world'); %>
|
||||
</ul>
|
4
node_modules/ejs/test/fixtures/include-simple.html
generated
vendored
4
node_modules/ejs/test/fixtures/include-simple.html
generated
vendored
@ -1,4 +0,0 @@
|
||||
<ul>
|
||||
<p>Hello world!</p>
|
||||
|
||||
</ul>
|
1
node_modules/ejs/test/fixtures/include.css.ejs
generated
vendored
1
node_modules/ejs/test/fixtures/include.css.ejs
generated
vendored
@ -1 +0,0 @@
|
||||
<style><%- include('style.css', {value: 'bar'}); %></style>
|
4
node_modules/ejs/test/fixtures/include.css.html
generated
vendored
4
node_modules/ejs/test/fixtures/include.css.html
generated
vendored
@ -1,4 +0,0 @@
|
||||
<style>body {
|
||||
foo: 'bar';
|
||||
}
|
||||
</style>
|
5
node_modules/ejs/test/fixtures/include.ejs
generated
vendored
5
node_modules/ejs/test/fixtures/include.ejs
generated
vendored
@ -1,5 +0,0 @@
|
||||
<ul>
|
||||
<@ pets.forEach(function(pet){ @>
|
||||
<@- include('pet', {pet: pet}); @>
|
||||
<@ }); @>
|
||||
</ul>
|
12
node_modules/ejs/test/fixtures/include.html
generated
vendored
12
node_modules/ejs/test/fixtures/include.html
generated
vendored
@ -1,12 +0,0 @@
|
||||
<ul>
|
||||
|
||||
<li>geddy</li>
|
||||
|
||||
|
||||
<li>neil</li>
|
||||
|
||||
|
||||
<li>alex</li>
|
||||
|
||||
|
||||
</ul>
|
1
node_modules/ejs/test/fixtures/include_cache.ejs
generated
vendored
1
node_modules/ejs/test/fixtures/include_cache.ejs
generated
vendored
@ -1 +0,0 @@
|
||||
<%- include('../tmp/include') %>
|
1
node_modules/ejs/test/fixtures/include_cache.html
generated
vendored
1
node_modules/ejs/test/fixtures/include_cache.html
generated
vendored
@ -1 +0,0 @@
|
||||
<p>Old</p>
|
1
node_modules/ejs/test/fixtures/include_preprocessor.css.ejs
generated
vendored
1
node_modules/ejs/test/fixtures/include_preprocessor.css.ejs
generated
vendored
@ -1 +0,0 @@
|
||||
<style><% var value = 'bar' %><% include style.css %></style>
|
4
node_modules/ejs/test/fixtures/include_preprocessor.css.html
generated
vendored
4
node_modules/ejs/test/fixtures/include_preprocessor.css.html
generated
vendored
@ -1,4 +0,0 @@
|
||||
<style>body {
|
||||
foo: 'bar';
|
||||
}
|
||||
</style>
|
5
node_modules/ejs/test/fixtures/include_preprocessor.ejs
generated
vendored
5
node_modules/ejs/test/fixtures/include_preprocessor.ejs
generated
vendored
@ -1,5 +0,0 @@
|
||||
<ul>
|
||||
<@ pets.forEach(function(pet){ @>
|
||||
<@ include pet @>
|
||||
<@ }) @>
|
||||
</ul>
|
12
node_modules/ejs/test/fixtures/include_preprocessor.html
generated
vendored
12
node_modules/ejs/test/fixtures/include_preprocessor.html
generated
vendored
@ -1,12 +0,0 @@
|
||||
<ul>
|
||||
|
||||
<li>geddy</li>
|
||||
|
||||
|
||||
<li>neil</li>
|
||||
|
||||
|
||||
<li>alex</li>
|
||||
|
||||
|
||||
</ul>
|
1
node_modules/ejs/test/fixtures/include_preprocessor_cache.ejs
generated
vendored
1
node_modules/ejs/test/fixtures/include_preprocessor_cache.ejs
generated
vendored
@ -1 +0,0 @@
|
||||
<%- include ../tmp/include_preprocessor %>
|
1
node_modules/ejs/test/fixtures/include_preprocessor_cache.html
generated
vendored
1
node_modules/ejs/test/fixtures/include_preprocessor_cache.html
generated
vendored
@ -1 +0,0 @@
|
||||
<p>Old</p>
|
1
node_modules/ejs/test/fixtures/include_preprocessor_line_slurp.ejs
generated
vendored
1
node_modules/ejs/test/fixtures/include_preprocessor_line_slurp.ejs
generated
vendored
@ -1 +0,0 @@
|
||||
<% include include_preprocessor_line_slurp_child %>
|
5
node_modules/ejs/test/fixtures/include_preprocessor_line_slurp.html
generated
vendored
5
node_modules/ejs/test/fixtures/include_preprocessor_line_slurp.html
generated
vendored
@ -1,5 +0,0 @@
|
||||
<div>
|
||||
12
|
||||
3
|
||||
45
|
||||
</div>
|
5
node_modules/ejs/test/fixtures/include_preprocessor_line_slurp_child.ejs
generated
vendored
5
node_modules/ejs/test/fixtures/include_preprocessor_line_slurp_child.ejs
generated
vendored
@ -1,5 +0,0 @@
|
||||
<div>
|
||||
1 <%_ if (true) { _%> 2
|
||||
3
|
||||
4 <%_ } _%> 5
|
||||
</div>
|
1
node_modules/ejs/test/fixtures/includes/bom.ejs
generated
vendored
1
node_modules/ejs/test/fixtures/includes/bom.ejs
generated
vendored
@ -1 +0,0 @@
|
||||
<p>This is a file with BOM.</p>
|
1
node_modules/ejs/test/fixtures/includes/menu-item.ejs
generated
vendored
1
node_modules/ejs/test/fixtures/includes/menu-item.ejs
generated
vendored
@ -1 +0,0 @@
|
||||
<li><% include menu/item %></li>
|
1
node_modules/ejs/test/fixtures/includes/menu/item.ejs
generated
vendored
1
node_modules/ejs/test/fixtures/includes/menu/item.ejs
generated
vendored
@ -1 +0,0 @@
|
||||
<a href="/<%= url %>"><%= title %></a>
|
3
node_modules/ejs/test/fixtures/literal.ejs
generated
vendored
3
node_modules/ejs/test/fixtures/literal.ejs
generated
vendored
@ -1,3 +0,0 @@
|
||||
<pre>There should be a space followed by a less-than sign and then two more
|
||||
spaces in the next line:
|
||||
< .</pre>
|
3
node_modules/ejs/test/fixtures/literal.html
generated
vendored
3
node_modules/ejs/test/fixtures/literal.html
generated
vendored
@ -1,3 +0,0 @@
|
||||
<pre>There should be a space followed by a less-than sign and then two more
|
||||
spaces in the next line:
|
||||
< .</pre>
|
15
node_modules/ejs/test/fixtures/menu.ejs
generated
vendored
15
node_modules/ejs/test/fixtures/menu.ejs
generated
vendored
@ -1,15 +0,0 @@
|
||||
<%- include('includes/menu-item', {
|
||||
url: '/foo'
|
||||
, title: 'Foo'
|
||||
}); -%>
|
||||
|
||||
<%- include('includes/menu-item', {
|
||||
url: '/bar'
|
||||
, title: 'Bar'
|
||||
}); -%>
|
||||
|
||||
<%- include('includes/menu-item', {
|
||||
url: '/baz'
|
||||
, title: 'Baz'
|
||||
}); -%>
|
||||
|
9
node_modules/ejs/test/fixtures/menu.html
generated
vendored
9
node_modules/ejs/test/fixtures/menu.html
generated
vendored
@ -1,9 +0,0 @@
|
||||
<li><a href="//foo">Foo</a>
|
||||
</li>
|
||||
|
||||
<li><a href="//bar">Bar</a>
|
||||
</li>
|
||||
|
||||
<li><a href="//baz">Baz</a>
|
||||
</li>
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user