mirror of https://github.com/lukechilds/node.git
Browse Source
PR-URL: https://github.com/nodejs/node/pull/14417 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Teddy Katz <teddy.katz@gmail.com> Reviewed-By: Roman Reiss <me@silverwind.io> Reviewed-By: Refael Ackermann <refack@gmail.com>v6.x
Rich Trott
8 years ago
committed by
Myles Borins
304 changed files with 28501 additions and 15865 deletions
File diff suppressed because it is too large
@ -0,0 +1,48 @@ |
|||
/** |
|||
* @author Toru Nagashima <https://github.com/mysticatea>
|
|||
*/ |
|||
"use strict"; |
|||
|
|||
const espree = require("espree"); |
|||
const Traverser = require("../util/traverser"); |
|||
|
|||
/** |
|||
* Define `start`/`end` properties as throwing error. |
|||
* @param {ASTNode} node The node to define. |
|||
* @returns {void} |
|||
*/ |
|||
function defineStartEndAsError(node) { |
|||
Object.defineProperty(node, "start", { |
|||
get() { |
|||
throw new Error("Use node.range[0] instead of node.start"); |
|||
}, |
|||
configurable: true, |
|||
enumerable: false |
|||
}); |
|||
Object.defineProperty(node, "end", { |
|||
get() { |
|||
throw new Error("Use node.range[1] instead of node.end"); |
|||
}, |
|||
configurable: true, |
|||
enumerable: false |
|||
}); |
|||
} |
|||
|
|||
/** |
|||
* Define `start`/`end` properties of all nodes of the given AST as throwing error. |
|||
* @param {ASTNode} ast The root node to errorize `start`/`end` properties. |
|||
* @returns {void} |
|||
*/ |
|||
function defineStartEndAsErrorInTree(ast) { |
|||
new Traverser().traverse(ast, { enter: defineStartEndAsError }); |
|||
ast.tokens.forEach(defineStartEndAsError); |
|||
ast.comments.forEach(defineStartEndAsError); |
|||
} |
|||
|
|||
module.exports.parse = (code, options) => { |
|||
const ret = espree.parse(code, options); |
|||
|
|||
defineStartEndAsErrorInTree(ret.ast || ret); |
|||
|
|||
return ret; |
|||
}; |
@ -0,0 +1 @@ |
|||
../acorn/bin/acorn |
@ -0,0 +1 @@ |
|||
../esprima/bin/esparse.js |
@ -0,0 +1 @@ |
|||
../esprima/bin/esvalidate.js |
@ -0,0 +1 @@ |
|||
../js-yaml/bin/js-yaml.js |
@ -0,0 +1 @@ |
|||
../mkdirp/bin/cmd.js |
@ -0,0 +1 @@ |
|||
../rimraf/bin.js |
@ -0,0 +1 @@ |
|||
../semver/bin/semver |
@ -0,0 +1 @@ |
|||
../which/bin/which |
@ -0,0 +1 @@ |
|||
../acorn/bin/acorn |
@ -0,0 +1,66 @@ |
|||
{ |
|||
"name": "babel-code-frame", |
|||
"version": "6.22.0", |
|||
"lockfileVersion": 1, |
|||
"requires": true, |
|||
"dependencies": { |
|||
"ansi-regex": { |
|||
"version": "2.1.1", |
|||
"resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-2.1.1.tgz", |
|||
"integrity": "sha1-w7M6te42DYbg5ijwRorn7yfWVN8=" |
|||
}, |
|||
"ansi-styles": { |
|||
"version": "2.2.1", |
|||
"resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-2.2.1.tgz", |
|||
"integrity": "sha1-tDLdM1i2NM914eRmQ2gkBTPB3b4=" |
|||
}, |
|||
"chalk": { |
|||
"version": "1.1.3", |
|||
"resolved": "https://registry.npmjs.org/chalk/-/chalk-1.1.3.tgz", |
|||
"integrity": "sha1-qBFcVeSnAv5NFQq9OHKCKn4J/Jg=", |
|||
"requires": { |
|||
"ansi-styles": "2.2.1", |
|||
"escape-string-regexp": "1.0.5", |
|||
"has-ansi": "2.0.0", |
|||
"strip-ansi": "3.0.1", |
|||
"supports-color": "2.0.0" |
|||
} |
|||
}, |
|||
"escape-string-regexp": { |
|||
"version": "1.0.5", |
|||
"resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-1.0.5.tgz", |
|||
"integrity": "sha1-G2HAViGQqN/2rjuyzwIAyhMLhtQ=" |
|||
}, |
|||
"esutils": { |
|||
"version": "2.0.2", |
|||
"resolved": "https://registry.npmjs.org/esutils/-/esutils-2.0.2.tgz", |
|||
"integrity": "sha1-Cr9PHKpbyx96nYrMbepPqqBLrJs=" |
|||
}, |
|||
"has-ansi": { |
|||
"version": "2.0.0", |
|||
"resolved": "https://registry.npmjs.org/has-ansi/-/has-ansi-2.0.0.tgz", |
|||
"integrity": "sha1-NPUEnOHs3ysGSa8+8k5F7TVBbZE=", |
|||
"requires": { |
|||
"ansi-regex": "2.1.1" |
|||
} |
|||
}, |
|||
"js-tokens": { |
|||
"version": "3.0.2", |
|||
"resolved": "https://registry.npmjs.org/js-tokens/-/js-tokens-3.0.2.tgz", |
|||
"integrity": "sha1-mGbfOVECEw449/mWvOtlRDIJwls=" |
|||
}, |
|||
"strip-ansi": { |
|||
"version": "3.0.1", |
|||
"resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-3.0.1.tgz", |
|||
"integrity": "sha1-ajhfuIU9lS1f8F0Oiq+UJ43GPc8=", |
|||
"requires": { |
|||
"ansi-regex": "2.1.1" |
|||
} |
|||
}, |
|||
"supports-color": { |
|||
"version": "2.0.0", |
|||
"resolved": "https://registry.npmjs.org/supports-color/-/supports-color-2.0.0.tgz", |
|||
"integrity": "sha1-U10EXOa2Nj+kARcIRimZXp3zJMc=" |
|||
} |
|||
} |
|||
} |
@ -1,46 +1,98 @@ |
|||
{ |
|||
"_from": "babel-code-frame@^6.22.0", |
|||
"_id": "babel-code-frame@6.22.0", |
|||
"_inBundle": false, |
|||
"_integrity": "sha1-AnYgvuVnqIwyVhV05/0IAdMxGOQ=", |
|||
"_args": [ |
|||
[ |
|||
{ |
|||
"raw": "babel-code-frame@^6.22.0", |
|||
"scope": null, |
|||
"escapedName": "babel-code-frame", |
|||
"name": "babel-code-frame", |
|||
"rawSpec": "^6.22.0", |
|||
"spec": ">=6.22.0 <7.0.0", |
|||
"type": "range" |
|||
}, |
|||
"/Users/mborins/code/node/v6.x/tools/eslint-tmp/node_modules/eslint" |
|||
] |
|||
], |
|||
"_from": "babel-code-frame@>=6.22.0 <7.0.0", |
|||
"_id": "babel-code-frame@6.26.0", |
|||
"_inCache": true, |
|||
"_location": "/eslint/babel-code-frame", |
|||
"_nodeVersion": "6.9.0", |
|||
"_npmOperationalInternal": { |
|||
"host": "s3://npm-registry-packages", |
|||
"tmp": "tmp/babel-code-frame-6.26.0.tgz_1502898849653_0.8458143274765462" |
|||
}, |
|||
"_npmUser": { |
|||
"name": "hzoo", |
|||
"email": "hi@henryzoo.com" |
|||
}, |
|||
"_npmVersion": "4.6.1", |
|||
"_phantomChildren": {}, |
|||
"_requested": { |
|||
"type": "range", |
|||
"registry": true, |
|||
"raw": "babel-code-frame@^6.22.0", |
|||
"name": "babel-code-frame", |
|||
"scope": null, |
|||
"escapedName": "babel-code-frame", |
|||
"name": "babel-code-frame", |
|||
"rawSpec": "^6.22.0", |
|||
"saveSpec": null, |
|||
"fetchSpec": "^6.22.0" |
|||
"spec": ">=6.22.0 <7.0.0", |
|||
"type": "range" |
|||
}, |
|||
"_requiredBy": [ |
|||
"/eslint" |
|||
], |
|||
"_resolved": "https://registry.npmjs.org/babel-code-frame/-/babel-code-frame-6.22.0.tgz", |
|||
"_shasum": "027620bee567a88c32561574e7fd0801d33118e4", |
|||
"_resolved": "https://registry.npmjs.org/babel-code-frame/-/babel-code-frame-6.26.0.tgz", |
|||
"_shasum": "63fd43f7dc1e3bb7ce35947db8fe369a3f58c74b", |
|||
"_shrinkwrap": null, |
|||
"_spec": "babel-code-frame@^6.22.0", |
|||
"_where": "/Users/trott/io.js/tools/eslint-tmp/node_modules/eslint", |
|||
"_where": "/Users/mborins/code/node/v6.x/tools/eslint-tmp/node_modules/eslint", |
|||
"author": { |
|||
"name": "Sebastian McKenzie", |
|||
"email": "sebmck@gmail.com" |
|||
}, |
|||
"bundleDependencies": false, |
|||
"dependencies": { |
|||
"chalk": "^1.1.0", |
|||
"chalk": "^1.1.3", |
|||
"esutils": "^2.0.2", |
|||
"js-tokens": "^3.0.0" |
|||
"js-tokens": "^3.0.2" |
|||
}, |
|||
"deprecated": false, |
|||
"description": "Generate errors that contain a code frame that point to source locations.", |
|||
"devDependencies": {}, |
|||
"directories": {}, |
|||
"dist": { |
|||
"shasum": "63fd43f7dc1e3bb7ce35947db8fe369a3f58c74b", |
|||
"tarball": "https://registry.npmjs.org/babel-code-frame/-/babel-code-frame-6.26.0.tgz" |
|||
}, |
|||
"homepage": "https://babeljs.io/", |
|||
"license": "MIT", |
|||
"main": "lib/index.js", |
|||
"maintainers": [ |
|||
{ |
|||
"name": "thejameskyle", |
|||
"email": "me@thejameskyle.com" |
|||
}, |
|||
{ |
|||
"name": "sebmck", |
|||
"email": "sebmck@gmail.com" |
|||
}, |
|||
{ |
|||
"name": "danez", |
|||
"email": "daniel@tschinder.de" |
|||
}, |
|||
{ |
|||
"name": "hzoo", |
|||
"email": "hi@henryzoo.com" |
|||
}, |
|||
{ |
|||
"name": "loganfsmyth", |
|||
"email": "loganfsmyth@gmail.com" |
|||
} |
|||
], |
|||
"name": "babel-code-frame", |
|||
"optionalDependencies": {}, |
|||
"readme": "ERROR: No README data found!", |
|||
"repository": { |
|||
"type": "git", |
|||
"url": "https://github.com/babel/babel/tree/master/packages/babel-code-frame" |
|||
}, |
|||
"version": "6.22.0" |
|||
"scripts": {}, |
|||
"version": "6.26.0" |
|||
} |
|||
|
@ -1,8 +1,8 @@ |
|||
The MIT License (MIT) |
|||
Copyright (c) 2015 Dmitry Ivanov |
|||
|
|||
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 MIT License (MIT) |
|||
Copyright (c) 2015 Dmitry Ivanov |
|||
|
|||
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. |
@ -1,11 +1,11 @@ |
|||
A JSON with color names and its values. Based on http://dev.w3.org/csswg/css-color/#named-colors. |
|||
|
|||
[![NPM](https://nodei.co/npm/color-name.png?mini=true)](https://nodei.co/npm/color-name/) |
|||
|
|||
|
|||
```js |
|||
var colors = require('color-name'); |
|||
colors.red //[255,0,0] |
|||
``` |
|||
|
|||
<a href="LICENSE"><img src="https://upload.wikimedia.org/wikipedia/commons/0/0c/MIT_logo.svg" width="120"/></a> |
|||
A JSON with color names and its values. Based on http://dev.w3.org/csswg/css-color/#named-colors. |
|||
|
|||
[![NPM](https://nodei.co/npm/color-name.png?mini=true)](https://nodei.co/npm/color-name/) |
|||
|
|||
|
|||
```js |
|||
var colors = require('color-name'); |
|||
colors.red //[255,0,0] |
|||
``` |
|||
|
|||
<a href="LICENSE"><img src="https://upload.wikimedia.org/wikipedia/commons/0/0c/MIT_logo.svg" width="120"/></a> |
|||
|
@ -1,152 +1,152 @@ |
|||
'use strict' |
|||
|
|||
module.exports = { |
|||
"aliceblue": [240, 248, 255], |
|||
"antiquewhite": [250, 235, 215], |
|||
"aqua": [0, 255, 255], |
|||
"aquamarine": [127, 255, 212], |
|||
"azure": [240, 255, 255], |
|||
"beige": [245, 245, 220], |
|||
"bisque": [255, 228, 196], |
|||
"black": [0, 0, 0], |
|||
"blanchedalmond": [255, 235, 205], |
|||
"blue": [0, 0, 255], |
|||
"blueviolet": [138, 43, 226], |
|||
"brown": [165, 42, 42], |
|||
"burlywood": [222, 184, 135], |
|||
"cadetblue": [95, 158, 160], |
|||
"chartreuse": [127, 255, 0], |
|||
"chocolate": [210, 105, 30], |
|||
"coral": [255, 127, 80], |
|||
"cornflowerblue": [100, 149, 237], |
|||
"cornsilk": [255, 248, 220], |
|||
"crimson": [220, 20, 60], |
|||
"cyan": [0, 255, 255], |
|||
"darkblue": [0, 0, 139], |
|||
"darkcyan": [0, 139, 139], |
|||
"darkgoldenrod": [184, 134, 11], |
|||
"darkgray": [169, 169, 169], |
|||
"darkgreen": [0, 100, 0], |
|||
"darkgrey": [169, 169, 169], |
|||
"darkkhaki": [189, 183, 107], |
|||
"darkmagenta": [139, 0, 139], |
|||
"darkolivegreen": [85, 107, 47], |
|||
"darkorange": [255, 140, 0], |
|||
"darkorchid": [153, 50, 204], |
|||
"darkred": [139, 0, 0], |
|||
"darksalmon": [233, 150, 122], |
|||
"darkseagreen": [143, 188, 143], |
|||
"darkslateblue": [72, 61, 139], |
|||
"darkslategray": [47, 79, 79], |
|||
"darkslategrey": [47, 79, 79], |
|||
"darkturquoise": [0, 206, 209], |
|||
"darkviolet": [148, 0, 211], |
|||
"deeppink": [255, 20, 147], |
|||
"deepskyblue": [0, 191, 255], |
|||
"dimgray": [105, 105, 105], |
|||
"dimgrey": [105, 105, 105], |
|||
"dodgerblue": [30, 144, 255], |
|||
"firebrick": [178, 34, 34], |
|||
"floralwhite": [255, 250, 240], |
|||
"forestgreen": [34, 139, 34], |
|||
"fuchsia": [255, 0, 255], |
|||
"gainsboro": [220, 220, 220], |
|||
"ghostwhite": [248, 248, 255], |
|||
"gold": [255, 215, 0], |
|||
"goldenrod": [218, 165, 32], |
|||
"gray": [128, 128, 128], |
|||
"green": [0, 128, 0], |
|||
"greenyellow": [173, 255, 47], |
|||
"grey": [128, 128, 128], |
|||
"honeydew": [240, 255, 240], |
|||
"hotpink": [255, 105, 180], |
|||
"indianred": [205, 92, 92], |
|||
"indigo": [75, 0, 130], |
|||
"ivory": [255, 255, 240], |
|||
"khaki": [240, 230, 140], |
|||
"lavender": [230, 230, 250], |
|||
"lavenderblush": [255, 240, 245], |
|||
"lawngreen": [124, 252, 0], |
|||
"lemonchiffon": [255, 250, 205], |
|||
"lightblue": [173, 216, 230], |
|||
"lightcoral": [240, 128, 128], |
|||
"lightcyan": [224, 255, 255], |
|||
"lightgoldenrodyellow": [250, 250, 210], |
|||
"lightgray": [211, 211, 211], |
|||
"lightgreen": [144, 238, 144], |
|||
"lightgrey": [211, 211, 211], |
|||
"lightpink": [255, 182, 193], |
|||
"lightsalmon": [255, 160, 122], |
|||
"lightseagreen": [32, 178, 170], |
|||
"lightskyblue": [135, 206, 250], |
|||
"lightslategray": [119, 136, 153], |
|||
"lightslategrey": [119, 136, 153], |
|||
"lightsteelblue": [176, 196, 222], |
|||
"lightyellow": [255, 255, 224], |
|||
"lime": [0, 255, 0], |
|||
"limegreen": [50, 205, 50], |
|||
"linen": [250, 240, 230], |
|||
"magenta": [255, 0, 255], |
|||
"maroon": [128, 0, 0], |
|||
"mediumaquamarine": [102, 205, 170], |
|||
"mediumblue": [0, 0, 205], |
|||
"mediumorchid": [186, 85, 211], |
|||
"mediumpurple": [147, 112, 219], |
|||
"mediumseagreen": [60, 179, 113], |
|||
"mediumslateblue": [123, 104, 238], |
|||
"mediumspringgreen": [0, 250, 154], |
|||
"mediumturquoise": [72, 209, 204], |
|||
"mediumvioletred": [199, 21, 133], |
|||
"midnightblue": [25, 25, 112], |
|||
"mintcream": [245, 255, 250], |
|||
"mistyrose": [255, 228, 225], |
|||
"moccasin": [255, 228, 181], |
|||
"navajowhite": [255, 222, 173], |
|||
"navy": [0, 0, 128], |
|||
"oldlace": [253, 245, 230], |
|||
"olive": [128, 128, 0], |
|||
"olivedrab": [107, 142, 35], |
|||
"orange": [255, 165, 0], |
|||
"orangered": [255, 69, 0], |
|||
"orchid": [218, 112, 214], |
|||
"palegoldenrod": [238, 232, 170], |
|||
"palegreen": [152, 251, 152], |
|||
"paleturquoise": [175, 238, 238], |
|||
"palevioletred": [219, 112, 147], |
|||
"papayawhip": [255, 239, 213], |
|||
"peachpuff": [255, 218, 185], |
|||
"peru": [205, 133, 63], |
|||
"pink": [255, 192, 203], |
|||
"plum": [221, 160, 221], |
|||
"powderblue": [176, 224, 230], |
|||
"purple": [128, 0, 128], |
|||
"rebeccapurple": [102, 51, 153], |
|||
"red": [255, 0, 0], |
|||
"rosybrown": [188, 143, 143], |
|||
"royalblue": [65, 105, 225], |
|||
"saddlebrown": [139, 69, 19], |
|||
"salmon": [250, 128, 114], |
|||
"sandybrown": [244, 164, 96], |
|||
"seagreen": [46, 139, 87], |
|||
"seashell": [255, 245, 238], |
|||
"sienna": [160, 82, 45], |
|||
"silver": [192, 192, 192], |
|||
"skyblue": [135, 206, 235], |
|||
"slateblue": [106, 90, 205], |
|||
"slategray": [112, 128, 144], |
|||
"slategrey": [112, 128, 144], |
|||
"snow": [255, 250, 250], |
|||
"springgreen": [0, 255, 127], |
|||
"steelblue": [70, 130, 180], |
|||
"tan": [210, 180, 140], |
|||
"teal": [0, 128, 128], |
|||
"thistle": [216, 191, 216], |
|||
"tomato": [255, 99, 71], |
|||
"turquoise": [64, 224, 208], |
|||
"violet": [238, 130, 238], |
|||
"wheat": [245, 222, 179], |
|||
"white": [255, 255, 255], |
|||
"whitesmoke": [245, 245, 245], |
|||
"yellow": [255, 255, 0], |
|||
"yellowgreen": [154, 205, 50] |
|||
}; |
|||
'use strict' |
|||
|
|||
module.exports = { |
|||
"aliceblue": [240, 248, 255], |
|||
"antiquewhite": [250, 235, 215], |
|||
"aqua": [0, 255, 255], |
|||
"aquamarine": [127, 255, 212], |
|||
"azure": [240, 255, 255], |
|||
"beige": [245, 245, 220], |
|||
"bisque": [255, 228, 196], |
|||
"black": [0, 0, 0], |
|||
"blanchedalmond": [255, 235, 205], |
|||
"blue": [0, 0, 255], |
|||
"blueviolet": [138, 43, 226], |
|||
"brown": [165, 42, 42], |
|||
"burlywood": [222, 184, 135], |
|||
"cadetblue": [95, 158, 160], |
|||
"chartreuse": [127, 255, 0], |
|||
"chocolate": [210, 105, 30], |
|||
"coral": [255, 127, 80], |
|||
"cornflowerblue": [100, 149, 237], |
|||
"cornsilk": [255, 248, 220], |
|||
"crimson": [220, 20, 60], |
|||
"cyan": [0, 255, 255], |
|||
"darkblue": [0, 0, 139], |
|||
"darkcyan": [0, 139, 139], |
|||
"darkgoldenrod": [184, 134, 11], |
|||
"darkgray": [169, 169, 169], |
|||
"darkgreen": [0, 100, 0], |
|||
"darkgrey": [169, 169, 169], |
|||
"darkkhaki": [189, 183, 107], |
|||
"darkmagenta": [139, 0, 139], |
|||
"darkolivegreen": [85, 107, 47], |
|||
"darkorange": [255, 140, 0], |
|||
"darkorchid": [153, 50, 204], |
|||
"darkred": [139, 0, 0], |
|||
"darksalmon": [233, 150, 122], |
|||
"darkseagreen": [143, 188, 143], |
|||
"darkslateblue": [72, 61, 139], |
|||
"darkslategray": [47, 79, 79], |
|||
"darkslategrey": [47, 79, 79], |
|||
"darkturquoise": [0, 206, 209], |
|||
"darkviolet": [148, 0, 211], |
|||
"deeppink": [255, 20, 147], |
|||
"deepskyblue": [0, 191, 255], |
|||
"dimgray": [105, 105, 105], |
|||
"dimgrey": [105, 105, 105], |
|||
"dodgerblue": [30, 144, 255], |
|||
"firebrick": [178, 34, 34], |
|||
"floralwhite": [255, 250, 240], |
|||
"forestgreen": [34, 139, 34], |
|||
"fuchsia": [255, 0, 255], |
|||
"gainsboro": [220, 220, 220], |
|||
"ghostwhite": [248, 248, 255], |
|||
"gold": [255, 215, 0], |
|||
"goldenrod": [218, 165, 32], |
|||
"gray": [128, 128, 128], |
|||
"green": [0, 128, 0], |
|||
"greenyellow": [173, 255, 47], |
|||
"grey": [128, 128, 128], |
|||
"honeydew": [240, 255, 240], |
|||
"hotpink": [255, 105, 180], |
|||
"indianred": [205, 92, 92], |
|||
"indigo": [75, 0, 130], |
|||
"ivory": [255, 255, 240], |
|||
"khaki": [240, 230, 140], |
|||
"lavender": [230, 230, 250], |
|||
"lavenderblush": [255, 240, 245], |
|||
"lawngreen": [124, 252, 0], |
|||
"lemonchiffon": [255, 250, 205], |
|||
"lightblue": [173, 216, 230], |
|||
"lightcoral": [240, 128, 128], |
|||
"lightcyan": [224, 255, 255], |
|||
"lightgoldenrodyellow": [250, 250, 210], |
|||
"lightgray": [211, 211, 211], |
|||
"lightgreen": [144, 238, 144], |
|||
"lightgrey": [211, 211, 211], |
|||
"lightpink": [255, 182, 193], |
|||
"lightsalmon": [255, 160, 122], |
|||
"lightseagreen": [32, 178, 170], |
|||
"lightskyblue": [135, 206, 250], |
|||
"lightslategray": [119, 136, 153], |
|||
"lightslategrey": [119, 136, 153], |
|||
"lightsteelblue": [176, 196, 222], |
|||
"lightyellow": [255, 255, 224], |
|||
"lime": [0, 255, 0], |
|||
"limegreen": [50, 205, 50], |
|||
"linen": [250, 240, 230], |
|||
"magenta": [255, 0, 255], |
|||
"maroon": [128, 0, 0], |
|||
"mediumaquamarine": [102, 205, 170], |
|||
"mediumblue": [0, 0, 205], |
|||
"mediumorchid": [186, 85, 211], |
|||
"mediumpurple": [147, 112, 219], |
|||
"mediumseagreen": [60, 179, 113], |
|||
"mediumslateblue": [123, 104, 238], |
|||
"mediumspringgreen": [0, 250, 154], |
|||
"mediumturquoise": [72, 209, 204], |
|||
"mediumvioletred": [199, 21, 133], |
|||
"midnightblue": [25, 25, 112], |
|||
"mintcream": [245, 255, 250], |
|||
"mistyrose": [255, 228, 225], |
|||
"moccasin": [255, 228, 181], |
|||
"navajowhite": [255, 222, 173], |
|||
"navy": [0, 0, 128], |
|||
"oldlace": [253, 245, 230], |
|||
"olive": [128, 128, 0], |
|||
"olivedrab": [107, 142, 35], |
|||
"orange": [255, 165, 0], |
|||
"orangered": [255, 69, 0], |
|||
"orchid": [218, 112, 214], |
|||
"palegoldenrod": [238, 232, 170], |
|||
"palegreen": [152, 251, 152], |
|||
"paleturquoise": [175, 238, 238], |
|||
"palevioletred": [219, 112, 147], |
|||
"papayawhip": [255, 239, 213], |
|||
"peachpuff": [255, 218, 185], |
|||
"peru": [205, 133, 63], |
|||
"pink": [255, 192, 203], |
|||
"plum": [221, 160, 221], |
|||
"powderblue": [176, 224, 230], |
|||
"purple": [128, 0, 128], |
|||
"rebeccapurple": [102, 51, 153], |
|||
"red": [255, 0, 0], |
|||
"rosybrown": [188, 143, 143], |
|||
"royalblue": [65, 105, 225], |
|||
"saddlebrown": [139, 69, 19], |
|||
"salmon": [250, 128, 114], |
|||
"sandybrown": [244, 164, 96], |
|||
"seagreen": [46, 139, 87], |
|||
"seashell": [255, 245, 238], |
|||
"sienna": [160, 82, 45], |
|||
"silver": [192, 192, 192], |
|||
"skyblue": [135, 206, 235], |
|||
"slateblue": [106, 90, 205], |
|||
"slategray": [112, 128, 144], |
|||
"slategrey": [112, 128, 144], |
|||
"snow": [255, 250, 250], |
|||
"springgreen": [0, 255, 127], |
|||
"steelblue": [70, 130, 180], |
|||
"tan": [210, 180, 140], |
|||
"teal": [0, 128, 128], |
|||
"thistle": [216, 191, 216], |
|||
"tomato": [255, 99, 71], |
|||
"turquoise": [64, 224, 208], |
|||
"violet": [238, 130, 238], |
|||
"wheat": [245, 222, 179], |
|||
"white": [255, 255, 255], |
|||
"whitesmoke": [245, 245, 245], |
|||
"yellow": [255, 255, 0], |
|||
"yellowgreen": [154, 205, 50] |
|||
}; |
|||
|
@ -0,0 +1,19 @@ |
|||
Copyright (c) 2014 IndigoUnited |
|||
|
|||
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. |
@ -0,0 +1,85 @@ |
|||
# cross-spawn |
|||
|
|||
[![NPM version][npm-image]][npm-url] [![Downloads][downloads-image]][npm-url] [![Build Status][travis-image]][travis-url] [![Build status][appveyor-image]][appveyor-url] [![Dependency status][david-dm-image]][david-dm-url] [![Dev Dependency status][david-dm-dev-image]][david-dm-dev-url] |
|||
|
|||
[npm-url]:https://npmjs.org/package/cross-spawn |
|||
[downloads-image]:http://img.shields.io/npm/dm/cross-spawn.svg |
|||
[npm-image]:http://img.shields.io/npm/v/cross-spawn.svg |
|||
[travis-url]:https://travis-ci.org/IndigoUnited/node-cross-spawn |
|||
[travis-image]:http://img.shields.io/travis/IndigoUnited/node-cross-spawn/master.svg |
|||
[appveyor-url]:https://ci.appveyor.com/project/satazor/node-cross-spawn |
|||
[appveyor-image]:https://img.shields.io/appveyor/ci/satazor/node-cross-spawn/master.svg |
|||
[david-dm-url]:https://david-dm.org/IndigoUnited/node-cross-spawn |
|||
[david-dm-image]:https://img.shields.io/david/IndigoUnited/node-cross-spawn.svg |
|||
[david-dm-dev-url]:https://david-dm.org/IndigoUnited/node-cross-spawn#info=devDependencies |
|||
[david-dm-dev-image]:https://img.shields.io/david/dev/IndigoUnited/node-cross-spawn.svg |
|||
|
|||
A cross platform solution to node's spawn and spawnSync. |
|||
|
|||
|
|||
## Installation |
|||
|
|||
`$ npm install cross-spawn` |
|||
|
|||
If you are using `spawnSync` on node 0.10 or older, you will also need to install `spawn-sync`: |
|||
|
|||
`$ npm install spawn-sync` |
|||
|
|||
|
|||
## Why |
|||
|
|||
Node has issues when using spawn on Windows: |
|||
|
|||
- It ignores [PATHEXT](https://github.com/joyent/node/issues/2318) |
|||
- It does not support [shebangs](http://pt.wikipedia.org/wiki/Shebang) |
|||
- No `options.shell` support on node < v6 |
|||
- It does not allow you to run `del` or `dir` |
|||
|
|||
All these issues are handled correctly by `cross-spawn`. |
|||
There are some known modules, such as [win-spawn](https://github.com/ForbesLindesay/win-spawn), that try to solve this but they are either broken or provide faulty escaping of shell arguments. |
|||
|
|||
|
|||
## Usage |
|||
|
|||
Exactly the same way as node's [`spawn`](https://nodejs.org/api/child_process.html#child_process_child_process_spawn_command_args_options) or [`spawnSync`](https://nodejs.org/api/child_process.html#child_process_child_process_spawnsync_command_args_options), so it's a drop in replacement. |
|||
|
|||
|
|||
```js |
|||
var spawn = require('cross-spawn'); |
|||
|
|||
// Spawn NPM asynchronously |
|||
var child = spawn('npm', ['list', '-g', '-depth', '0'], { stdio: 'inherit' }); |
|||
|
|||
// Spawn NPM synchronously |
|||
var results = spawn.sync('npm', ['list', '-g', '-depth', '0'], { stdio: 'inherit' }); |
|||
``` |
|||
|
|||
|
|||
## Caveats |
|||
|
|||
#### `options.shell` as an alternative to `cross-spawn` |
|||
|
|||
Starting from node v6, `spawn` has a `shell` option that allows you run commands from within a shell. This new option solves most of the problems that `cross-spawn` attempts to solve, but: |
|||
|
|||
- It's not supported in node < v6 |
|||
- It has no support for shebangs on Windows |
|||
- You must manually escape the command and arguments which is very error prone, specially when passing user input |
|||
|
|||
If you are using the `shell` option to spawn a command in a cross platform way, consider using `cross-spawn` instead. You have been warned. |
|||
|
|||
|
|||
#### Shebangs |
|||
|
|||
While `cross-spawn` handles shebangs on Windows, its support is limited: e.g.: it doesn't handle arguments after the path, e.g.: `#!/bin/bash -e`. |
|||
|
|||
Remember to always test your code on Windows! |
|||
|
|||
|
|||
## Tests |
|||
|
|||
`$ npm test` |
|||
|
|||
|
|||
## License |
|||
|
|||
Released under the [MIT License](http://www.opensource.org/licenses/mit-license.php). |
@ -0,0 +1,59 @@ |
|||
'use strict'; |
|||
|
|||
var cp = require('child_process'); |
|||
var parse = require('./lib/parse'); |
|||
var enoent = require('./lib/enoent'); |
|||
|
|||
var cpSpawnSync = cp.spawnSync; |
|||
|
|||
function spawn(command, args, options) { |
|||
var parsed; |
|||
var spawned; |
|||
|
|||
// Parse the arguments
|
|||
parsed = parse(command, args, options); |
|||
|
|||
// Spawn the child process
|
|||
spawned = cp.spawn(parsed.command, parsed.args, parsed.options); |
|||
|
|||
// Hook into child process "exit" event to emit an error if the command
|
|||
// does not exists, see: https://github.com/IndigoUnited/node-cross-spawn/issues/16
|
|||
enoent.hookChildProcess(spawned, parsed); |
|||
|
|||
return spawned; |
|||
} |
|||
|
|||
function spawnSync(command, args, options) { |
|||
var parsed; |
|||
var result; |
|||
|
|||
if (!cpSpawnSync) { |
|||
try { |
|||
cpSpawnSync = require('spawn-sync'); // eslint-disable-line global-require
|
|||
} catch (ex) { |
|||
throw new Error( |
|||
'In order to use spawnSync on node 0.10 or older, you must ' + |
|||
'install spawn-sync:\n\n' + |
|||
' npm install spawn-sync --save' |
|||
); |
|||
} |
|||
} |
|||
|
|||
// Parse the arguments
|
|||
parsed = parse(command, args, options); |
|||
|
|||
// Spawn the child process
|
|||
result = cpSpawnSync(parsed.command, parsed.args, parsed.options); |
|||
|
|||
// Analyze if the command does not exists, see: https://github.com/IndigoUnited/node-cross-spawn/issues/16
|
|||
result.error = result.error || enoent.verifyENOENTSync(result.status, parsed); |
|||
|
|||
return result; |
|||
} |
|||
|
|||
module.exports = spawn; |
|||
module.exports.spawn = spawn; |
|||
module.exports.sync = spawnSync; |
|||
|
|||
module.exports._parse = parse; |
|||
module.exports._enoent = enoent; |
@ -0,0 +1,73 @@ |
|||
'use strict'; |
|||
|
|||
var isWin = process.platform === 'win32'; |
|||
var resolveCommand = require('./util/resolveCommand'); |
|||
|
|||
var isNode10 = process.version.indexOf('v0.10.') === 0; |
|||
|
|||
function notFoundError(command, syscall) { |
|||
var err; |
|||
|
|||
err = new Error(syscall + ' ' + command + ' ENOENT'); |
|||
err.code = err.errno = 'ENOENT'; |
|||
err.syscall = syscall + ' ' + command; |
|||
|
|||
return err; |
|||
} |
|||
|
|||
function hookChildProcess(cp, parsed) { |
|||
var originalEmit; |
|||
|
|||
if (!isWin) { |
|||
return; |
|||
} |
|||
|
|||
originalEmit = cp.emit; |
|||
cp.emit = function (name, arg1) { |
|||
var err; |
|||
|
|||
// If emitting "exit" event and exit code is 1, we need to check if
|
|||
// the command exists and emit an "error" instead
|
|||
// See: https://github.com/IndigoUnited/node-cross-spawn/issues/16
|
|||
if (name === 'exit') { |
|||
err = verifyENOENT(arg1, parsed, 'spawn'); |
|||
|
|||
if (err) { |
|||
return originalEmit.call(cp, 'error', err); |
|||
} |
|||
} |
|||
|
|||
return originalEmit.apply(cp, arguments); |
|||
}; |
|||
} |
|||
|
|||
function verifyENOENT(status, parsed) { |
|||
if (isWin && status === 1 && !parsed.file) { |
|||
return notFoundError(parsed.original, 'spawn'); |
|||
} |
|||
|
|||
return null; |
|||
} |
|||
|
|||
function verifyENOENTSync(status, parsed) { |
|||
if (isWin && status === 1 && !parsed.file) { |
|||
return notFoundError(parsed.original, 'spawnSync'); |
|||
} |
|||
|
|||
// If we are in node 10, then we are using spawn-sync; if it exited
|
|||
// with -1 it probably means that the command does not exist
|
|||
if (isNode10 && status === -1) { |
|||
parsed.file = isWin ? parsed.file : resolveCommand(parsed.original); |
|||
|
|||
if (!parsed.file) { |
|||
return notFoundError(parsed.original, 'spawnSync'); |
|||
} |
|||
} |
|||
|
|||
return null; |
|||
} |
|||
|
|||
module.exports.hookChildProcess = hookChildProcess; |
|||
module.exports.verifyENOENT = verifyENOENT; |
|||
module.exports.verifyENOENTSync = verifyENOENTSync; |
|||
module.exports.notFoundError = notFoundError; |
@ -0,0 +1,113 @@ |
|||
'use strict'; |
|||
|
|||
var resolveCommand = require('./util/resolveCommand'); |
|||
var hasEmptyArgumentBug = require('./util/hasEmptyArgumentBug'); |
|||
var escapeArgument = require('./util/escapeArgument'); |
|||
var escapeCommand = require('./util/escapeCommand'); |
|||
var readShebang = require('./util/readShebang'); |
|||
|
|||
var isWin = process.platform === 'win32'; |
|||
var skipShellRegExp = /\.(?:com|exe)$/i; |
|||
|
|||
// Supported in Node >= 6 and >= 4.8
|
|||
var supportsShellOption = parseInt(process.version.substr(1).split('.')[0], 10) >= 6 || |
|||
parseInt(process.version.substr(1).split('.')[0], 10) === 4 && parseInt(process.version.substr(1).split('.')[1], 10) >= 8; |
|||
|
|||
function parseNonShell(parsed) { |
|||
var shebang; |
|||
var needsShell; |
|||
var applyQuotes; |
|||
|
|||
if (!isWin) { |
|||
return parsed; |
|||
} |
|||
|
|||
// Detect & add support for shebangs
|
|||
parsed.file = resolveCommand(parsed.command); |
|||
parsed.file = parsed.file || resolveCommand(parsed.command, true); |
|||
shebang = parsed.file && readShebang(parsed.file); |
|||
|
|||
if (shebang) { |
|||
parsed.args.unshift(parsed.file); |
|||
parsed.command = shebang; |
|||
needsShell = hasEmptyArgumentBug || !skipShellRegExp.test(resolveCommand(shebang) || resolveCommand(shebang, true)); |
|||
} else { |
|||
needsShell = hasEmptyArgumentBug || !skipShellRegExp.test(parsed.file); |
|||
} |
|||
|
|||
// If a shell is required, use cmd.exe and take care of escaping everything correctly
|
|||
if (needsShell) { |
|||
// Escape command & arguments
|
|||
applyQuotes = (parsed.command !== 'echo'); // Do not quote arguments for the special "echo" command
|
|||
parsed.command = escapeCommand(parsed.command); |
|||
parsed.args = parsed.args.map(function (arg) { |
|||
return escapeArgument(arg, applyQuotes); |
|||
}); |
|||
|
|||
// Make use of cmd.exe
|
|||
parsed.args = ['/d', '/s', '/c', '"' + parsed.command + (parsed.args.length ? ' ' + parsed.args.join(' ') : '') + '"']; |
|||
parsed.command = process.env.comspec || 'cmd.exe'; |
|||
parsed.options.windowsVerbatimArguments = true; // Tell node's spawn that the arguments are already escaped
|
|||
} |
|||
|
|||
return parsed; |
|||
} |
|||
|
|||
function parseShell(parsed) { |
|||
var shellCommand; |
|||
|
|||
// If node supports the shell option, there's no need to mimic its behavior
|
|||
if (supportsShellOption) { |
|||
return parsed; |
|||
} |
|||
|
|||
// Mimic node shell option, see: https://github.com/nodejs/node/blob/b9f6a2dc059a1062776133f3d4fd848c4da7d150/lib/child_process.js#L335
|
|||
shellCommand = [parsed.command].concat(parsed.args).join(' '); |
|||
|
|||
if (isWin) { |
|||
parsed.command = typeof parsed.options.shell === 'string' ? parsed.options.shell : process.env.comspec || 'cmd.exe'; |
|||
parsed.args = ['/d', '/s', '/c', '"' + shellCommand + '"']; |
|||
parsed.options.windowsVerbatimArguments = true; // Tell node's spawn that the arguments are already escaped
|
|||
} else { |
|||
if (typeof parsed.options.shell === 'string') { |
|||
parsed.command = parsed.options.shell; |
|||
} else if (process.platform === 'android') { |
|||
parsed.command = '/system/bin/sh'; |
|||
} else { |
|||
parsed.command = '/bin/sh'; |
|||
} |
|||
|
|||
parsed.args = ['-c', shellCommand]; |
|||
} |
|||
|
|||
return parsed; |
|||
} |
|||
|
|||
// ------------------------------------------------
|
|||
|
|||
function parse(command, args, options) { |
|||
var parsed; |
|||
|
|||
// Normalize arguments, similar to nodejs
|
|||
if (args && !Array.isArray(args)) { |
|||
options = args; |
|||
args = null; |
|||
} |
|||
|
|||
args = args ? args.slice(0) : []; // Clone array to avoid changing the original
|
|||
options = options || {}; |
|||
|
|||
// Build our parsed object
|
|||
parsed = { |
|||
command: command, |
|||
args: args, |
|||
options: options, |
|||
file: undefined, |
|||
original: command, |
|||
}; |
|||
|
|||
// Delegate further parsing to shell or non-shell
|
|||
return options.shell ? parseShell(parsed) : parseNonShell(parsed); |
|||
} |
|||
|
|||
module.exports = parse; |
@ -0,0 +1,30 @@ |
|||
'use strict'; |
|||
|
|||
function escapeArgument(arg, quote) { |
|||
// Convert to string
|
|||
arg = '' + arg; |
|||
|
|||
// If we are not going to quote the argument,
|
|||
// escape shell metacharacters, including double and single quotes:
|
|||
if (!quote) { |
|||
arg = arg.replace(/([()%!^<>&|;,"'\s])/g, '^$1'); |
|||
} else { |
|||
// Sequence of backslashes followed by a double quote:
|
|||
// double up all the backslashes and escape the double quote
|
|||
arg = arg.replace(/(\\*)"/g, '$1$1\\"'); |
|||
|
|||
// Sequence of backslashes followed by the end of the string
|
|||
// (which will become a double quote later):
|
|||
// double up all the backslashes
|
|||
arg = arg.replace(/(\\*)$/, '$1$1'); |
|||
|
|||
// All other backslashes occur literally
|
|||
|
|||
// Quote the whole thing:
|
|||
arg = '"' + arg + '"'; |
|||
} |
|||
|
|||
return arg; |
|||
} |
|||
|
|||
module.exports = escapeArgument; |
@ -0,0 +1,12 @@ |
|||
'use strict'; |
|||
|
|||
var escapeArgument = require('./escapeArgument'); |
|||
|
|||
function escapeCommand(command) { |
|||
// Do not escape if this command is not dangerous..
|
|||
// We do this so that commands like "echo" or "ifconfig" work
|
|||
// Quoting them, will make them unaccessible
|
|||
return /^[a-z0-9_-]+$/i.test(command) ? command : escapeArgument(command, true); |
|||
} |
|||
|
|||
module.exports = escapeCommand; |
@ -0,0 +1,18 @@ |
|||
'use strict'; |
|||
|
|||
// See: https://github.com/IndigoUnited/node-cross-spawn/pull/34#issuecomment-221623455
|
|||
function hasEmptyArgumentBug() { |
|||
var nodeVer; |
|||
|
|||
if (process.platform !== 'win32') { |
|||
return false; |
|||
} |
|||
|
|||
nodeVer = process.version.substr(1).split('.').map(function (num) { |
|||
return parseInt(num, 10); |
|||
}); |
|||
|
|||
return (nodeVer[0] === 0 && nodeVer[1] < 12); |
|||
} |
|||
|
|||
module.exports = hasEmptyArgumentBug(); |
Some files were not shown because too many files changed in this diff
Loading…
Reference in new issue