From: Oscar J. Rodriguez B Date: Wed, 11 Dec 2019 22:12:12 +0000 (-0400) Subject: quitando basura del index X-Git-Url: https://git.josue.xyz/?p=VSoRC%2F.git;a=commitdiff_plain;h=5e96dd57ddd883604e87f62bdddcb111c63a6e1a quitando basura del index --- diff --git a/README.md b/README.md old mode 100644 new mode 100755 diff --git a/Resources in use.md b/Resources in use.md old mode 100644 new mode 100755 diff --git a/img/all_icons.svg b/img/all_icons.svg old mode 100644 new mode 100755 diff --git a/img/cloud.svg b/img/cloud.svg old mode 100644 new mode 100755 diff --git a/img/pc.svg b/img/pc.svg old mode 100644 new mode 100755 diff --git a/img/switch.png b/img/switch.png old mode 100644 new mode 100755 diff --git a/img/switch3.svg b/img/switch3.svg old mode 100644 new mode 100755 diff --git a/img/switchold.svg b/img/switchold.svg old mode 100644 new mode 100755 diff --git a/img/toporouting.png b/img/toporouting.png old mode 100644 new mode 100755 diff --git a/img/toposwitch.png b/img/toposwitch.png old mode 100644 new mode 100755 diff --git a/js/topology/cards.js b/js/topology/cards.js old mode 100644 new mode 100755 diff --git a/js/topology/common.js b/js/topology/common.js old mode 100644 new mode 100755 diff --git a/js/topology/d3.min.js b/js/topology/d3.min.js old mode 100644 new mode 100755 diff --git a/js/topology/flowtables.js b/js/topology/flowtables.js old mode 100644 new mode 100755 diff --git a/js/topology/jquery-3.3.1.min.js b/js/topology/jquery-3.3.1.min.js old mode 100644 new mode 100755 diff --git a/js/topology/main.js b/js/topology/main.js old mode 100644 new mode 100755 diff --git a/js/topology/mainmenu.js b/js/topology/mainmenu.js old mode 100644 new mode 100755 diff --git a/js/topology/modules.js b/js/topology/modules.js old mode 100644 new mode 100755 diff --git a/js/topology/topology.js b/js/topology/topology.js old mode 100644 new mode 100755 diff --git a/node_modules/.bin/static b/node_modules/.bin/static deleted file mode 120000 index 66f6f8a..0000000 --- a/node_modules/.bin/static +++ /dev/null @@ -1 +0,0 @@ -../node-static/bin/cli.js \ No newline at end of file diff --git a/node_modules/.bin/wscat b/node_modules/.bin/wscat deleted file mode 120000 index 5392fc9..0000000 --- a/node_modules/.bin/wscat +++ /dev/null @@ -1 +0,0 @@ -../wscat/bin/wscat \ No newline at end of file diff --git a/node_modules/accepts/package.json b/node_modules/accepts/package.json index e2d6aed..01a08bb 100644 --- a/node_modules/accepts/package.json +++ b/node_modules/accepts/package.json @@ -1,31 +1,35 @@ { - "_from": "accepts@~1.3.7", + "_args": [ + [ + "accepts@1.3.7", + "/home/josuer08/Documents/web" + ] + ], + "_from": "accepts@1.3.7", "_id": "accepts@1.3.7", "_inBundle": false, "_integrity": "sha512-Il80Qs2WjYlJIBNzNkK6KYqlVMTbZLXgHx2oT0pU/fjRHyEp+PEfEPY0R3WCwAGVOtauxh1hOxNgIf5bv7dQpA==", "_location": "/accepts", "_phantomChildren": {}, "_requested": { - "type": "range", + "type": "version", "registry": true, - "raw": "accepts@~1.3.7", + "raw": "accepts@1.3.7", "name": "accepts", "escapedName": "accepts", - "rawSpec": "~1.3.7", + "rawSpec": "1.3.7", "saveSpec": null, - "fetchSpec": "~1.3.7" + "fetchSpec": "1.3.7" }, "_requiredBy": [ "/express" ], "_resolved": "https://registry.npmjs.org/accepts/-/accepts-1.3.7.tgz", - "_shasum": "531bc726517a3b2b41f850021c6cc15eaab507cd", - "_spec": "accepts@~1.3.7", - "_where": "/home/josuer08/Documents/web/node_modules/express", + "_spec": "1.3.7", + "_where": "/home/josuer08/Documents/web", "bugs": { "url": "https://github.com/jshttp/accepts/issues" }, - "bundleDependencies": false, "contributors": [ { "name": "Douglas Christopher Wilson", @@ -41,7 +45,6 @@ "mime-types": "~2.1.24", "negotiator": "0.6.2" }, - "deprecated": false, "description": "Higher-level content negotiation", "devDependencies": { "deep-equal": "1.0.1", diff --git a/node_modules/array-flatten/package.json b/node_modules/array-flatten/package.json index d86873f..5a0fb77 100644 --- a/node_modules/array-flatten/package.json +++ b/node_modules/array-flatten/package.json @@ -1,4 +1,10 @@ { + "_args": [ + [ + "array-flatten@1.1.1", + "/home/josuer08/Documents/web" + ] + ], "_from": "array-flatten@1.1.1", "_id": "array-flatten@1.1.1", "_inBundle": false, @@ -19,9 +25,8 @@ "/express" ], "_resolved": "https://registry.npmjs.org/array-flatten/-/array-flatten-1.1.1.tgz", - "_shasum": "9a5f699051b1e7073328f2a008968b64ea2955d2", - "_spec": "array-flatten@1.1.1", - "_where": "/home/josuer08/Documents/web/node_modules/express", + "_spec": "1.1.1", + "_where": "/home/josuer08/Documents/web", "author": { "name": "Blake Embrey", "email": "hello@blakeembrey.com", @@ -30,8 +35,6 @@ "bugs": { "url": "https://github.com/blakeembrey/array-flatten/issues" }, - "bundleDependencies": false, - "deprecated": false, "description": "Flatten an array of nested arrays into a single flat array", "devDependencies": { "istanbul": "^0.3.13", diff --git a/node_modules/body-parser/package.json b/node_modules/body-parser/package.json index 49bbe73..27248cb 100644 --- a/node_modules/body-parser/package.json +++ b/node_modules/body-parser/package.json @@ -1,4 +1,10 @@ { + "_args": [ + [ + "body-parser@1.19.0", + "/home/josuer08/Documents/web" + ] + ], "_from": "body-parser@1.19.0", "_id": "body-parser@1.19.0", "_inBundle": false, @@ -19,13 +25,11 @@ "/express" ], "_resolved": "https://registry.npmjs.org/body-parser/-/body-parser-1.19.0.tgz", - "_shasum": "96b2709e57c9c4e09a6fd66a8fd979844f69f08a", - "_spec": "body-parser@1.19.0", - "_where": "/home/josuer08/Documents/web/node_modules/express", + "_spec": "1.19.0", + "_where": "/home/josuer08/Documents/web", "bugs": { "url": "https://github.com/expressjs/body-parser/issues" }, - "bundleDependencies": false, "contributors": [ { "name": "Douglas Christopher Wilson", @@ -49,7 +53,6 @@ "raw-body": "2.4.0", "type-is": "~1.6.17" }, - "deprecated": false, "description": "Node.js body parsing middleware", "devDependencies": { "eslint": "5.16.0", diff --git a/node_modules/bytes/package.json b/node_modules/bytes/package.json index 46a61a3..e2753c3 100644 --- a/node_modules/bytes/package.json +++ b/node_modules/bytes/package.json @@ -1,4 +1,10 @@ { + "_args": [ + [ + "bytes@3.1.0", + "/home/josuer08/Documents/web" + ] + ], "_from": "bytes@3.1.0", "_id": "bytes@3.1.0", "_inBundle": false, @@ -20,9 +26,8 @@ "/raw-body" ], "_resolved": "https://registry.npmjs.org/bytes/-/bytes-3.1.0.tgz", - "_shasum": "f6cf7933a360e0588fa9fde85651cdc7f805d1f6", - "_spec": "bytes@3.1.0", - "_where": "/home/josuer08/Documents/web/node_modules/body-parser", + "_spec": "3.1.0", + "_where": "/home/josuer08/Documents/web", "author": { "name": "TJ Holowaychuk", "email": "tj@vision-media.ca", @@ -31,7 +36,6 @@ "bugs": { "url": "https://github.com/visionmedia/bytes.js/issues" }, - "bundleDependencies": false, "contributors": [ { "name": "Jed Watson", @@ -42,7 +46,6 @@ "email": "theo.fidry@gmail.com" } ], - "deprecated": false, "description": "Utility to parse a string bytes to bytes and vice-versa", "devDependencies": { "eslint": "5.12.1", diff --git a/node_modules/content-disposition/package.json b/node_modules/content-disposition/package.json index bd1d7c3..c7a0b7d 100644 --- a/node_modules/content-disposition/package.json +++ b/node_modules/content-disposition/package.json @@ -1,4 +1,10 @@ { + "_args": [ + [ + "content-disposition@0.5.3", + "/home/josuer08/Documents/web" + ] + ], "_from": "content-disposition@0.5.3", "_id": "content-disposition@0.5.3", "_inBundle": false, @@ -19,9 +25,8 @@ "/express" ], "_resolved": "https://registry.npmjs.org/content-disposition/-/content-disposition-0.5.3.tgz", - "_shasum": "e130caf7e7279087c5616c2007d0485698984fbd", - "_spec": "content-disposition@0.5.3", - "_where": "/home/josuer08/Documents/web/node_modules/express", + "_spec": "0.5.3", + "_where": "/home/josuer08/Documents/web", "author": { "name": "Douglas Christopher Wilson", "email": "doug@somethingdoug.com" @@ -29,11 +34,9 @@ "bugs": { "url": "https://github.com/jshttp/content-disposition/issues" }, - "bundleDependencies": false, "dependencies": { "safe-buffer": "5.1.2" }, - "deprecated": false, "description": "Create and parse Content-Disposition header", "devDependencies": { "deep-equal": "1.0.1", diff --git a/node_modules/content-type/package.json b/node_modules/content-type/package.json index 229f6bc..46eff8f 100644 --- a/node_modules/content-type/package.json +++ b/node_modules/content-type/package.json @@ -1,28 +1,33 @@ { - "_from": "content-type@~1.0.4", + "_args": [ + [ + "content-type@1.0.4", + "/home/josuer08/Documents/web" + ] + ], + "_from": "content-type@1.0.4", "_id": "content-type@1.0.4", "_inBundle": false, "_integrity": "sha512-hIP3EEPs8tB9AT1L+NUqtwOAps4mk2Zob89MWXMHjHWg9milF/j4osnnQLXBCBFBk/tvIG/tUc9mOUJiPBhPXA==", "_location": "/content-type", "_phantomChildren": {}, "_requested": { - "type": "range", + "type": "version", "registry": true, - "raw": "content-type@~1.0.4", + "raw": "content-type@1.0.4", "name": "content-type", "escapedName": "content-type", - "rawSpec": "~1.0.4", + "rawSpec": "1.0.4", "saveSpec": null, - "fetchSpec": "~1.0.4" + "fetchSpec": "1.0.4" }, "_requiredBy": [ "/body-parser", "/express" ], "_resolved": "https://registry.npmjs.org/content-type/-/content-type-1.0.4.tgz", - "_shasum": "e138cc75e040c727b1966fe5e5f8c9aee256fe3b", - "_spec": "content-type@~1.0.4", - "_where": "/home/josuer08/Documents/web/node_modules/express", + "_spec": "1.0.4", + "_where": "/home/josuer08/Documents/web", "author": { "name": "Douglas Christopher Wilson", "email": "doug@somethingdoug.com" @@ -30,8 +35,6 @@ "bugs": { "url": "https://github.com/jshttp/content-type/issues" }, - "bundleDependencies": false, - "deprecated": false, "description": "Create and parse HTTP Content-Type header", "devDependencies": { "eslint": "3.19.0", diff --git a/node_modules/cookie-signature/package.json b/node_modules/cookie-signature/package.json index 9edea15..0a1ec75 100644 --- a/node_modules/cookie-signature/package.json +++ b/node_modules/cookie-signature/package.json @@ -1,4 +1,10 @@ { + "_args": [ + [ + "cookie-signature@1.0.6", + "/home/josuer08/Documents/web" + ] + ], "_from": "cookie-signature@1.0.6", "_id": "cookie-signature@1.0.6", "_inBundle": false, @@ -19,9 +25,8 @@ "/express" ], "_resolved": "https://registry.npmjs.org/cookie-signature/-/cookie-signature-1.0.6.tgz", - "_shasum": "e303a882b342cc3ee8ca513a79999734dab3ae2c", - "_spec": "cookie-signature@1.0.6", - "_where": "/home/josuer08/Documents/web/node_modules/express", + "_spec": "1.0.6", + "_where": "/home/josuer08/Documents/web", "author": { "name": "TJ Holowaychuk", "email": "tj@learnboost.com" @@ -29,9 +34,7 @@ "bugs": { "url": "https://github.com/visionmedia/node-cookie-signature/issues" }, - "bundleDependencies": false, "dependencies": {}, - "deprecated": false, "description": "Sign and unsign cookies", "devDependencies": { "mocha": "*", diff --git a/node_modules/cookie/package.json b/node_modules/cookie/package.json index db14cd9..727861d 100644 --- a/node_modules/cookie/package.json +++ b/node_modules/cookie/package.json @@ -1,4 +1,10 @@ { + "_args": [ + [ + "cookie@0.4.0", + "/home/josuer08/Documents/web" + ] + ], "_from": "cookie@0.4.0", "_id": "cookie@0.4.0", "_inBundle": false, @@ -19,9 +25,8 @@ "/express" ], "_resolved": "https://registry.npmjs.org/cookie/-/cookie-0.4.0.tgz", - "_shasum": "beb437e7022b3b6d49019d088665303ebe9c14ba", - "_spec": "cookie@0.4.0", - "_where": "/home/josuer08/Documents/web/node_modules/express", + "_spec": "0.4.0", + "_where": "/home/josuer08/Documents/web", "author": { "name": "Roman Shtylman", "email": "shtylman@gmail.com" @@ -29,14 +34,12 @@ "bugs": { "url": "https://github.com/jshttp/cookie/issues" }, - "bundleDependencies": false, "contributors": [ { "name": "Douglas Christopher Wilson", "email": "doug@somethingdoug.com" } ], - "deprecated": false, "description": "HTTP server cookie parsing and serialization", "devDependencies": { "beautify-benchmark": "0.2.4", diff --git a/node_modules/debug/package.json b/node_modules/debug/package.json index 70b520d..c75243d 100644 --- a/node_modules/debug/package.json +++ b/node_modules/debug/package.json @@ -1,4 +1,10 @@ { + "_args": [ + [ + "debug@2.6.9", + "/home/josuer08/Documents/web" + ] + ], "_from": "debug@2.6.9", "_id": "debug@2.6.9", "_inBundle": false, @@ -22,9 +28,8 @@ "/send" ], "_resolved": "https://registry.npmjs.org/debug/-/debug-2.6.9.tgz", - "_shasum": "5d128515df134ff327e90a4c93f4e077a536341f", - "_spec": "debug@2.6.9", - "_where": "/home/josuer08/Documents/web/node_modules/express", + "_spec": "2.6.9", + "_where": "/home/josuer08/Documents/web", "author": { "name": "TJ Holowaychuk", "email": "tj@vision-media.ca" @@ -33,7 +38,6 @@ "bugs": { "url": "https://github.com/visionmedia/debug/issues" }, - "bundleDependencies": false, "component": { "scripts": { "debug/index.js": "browser.js", @@ -54,7 +58,6 @@ "dependencies": { "ms": "2.0.0" }, - "deprecated": false, "description": "small debugging utility", "devDependencies": { "browserify": "9.0.3", diff --git a/node_modules/depd/package.json b/node_modules/depd/package.json index ae387e6..4f3ac29 100644 --- a/node_modules/depd/package.json +++ b/node_modules/depd/package.json @@ -1,19 +1,25 @@ { - "_from": "depd@~1.1.2", + "_args": [ + [ + "depd@1.1.2", + "/home/josuer08/Documents/web" + ] + ], + "_from": "depd@1.1.2", "_id": "depd@1.1.2", "_inBundle": false, "_integrity": "sha1-m81S4UwJd2PnSbJ0xDRu0uVgtak=", "_location": "/depd", "_phantomChildren": {}, "_requested": { - "type": "range", + "type": "version", "registry": true, - "raw": "depd@~1.1.2", + "raw": "depd@1.1.2", "name": "depd", "escapedName": "depd", - "rawSpec": "~1.1.2", + "rawSpec": "1.1.2", "saveSpec": null, - "fetchSpec": "~1.1.2" + "fetchSpec": "1.1.2" }, "_requiredBy": [ "/body-parser", @@ -22,9 +28,8 @@ "/send" ], "_resolved": "https://registry.npmjs.org/depd/-/depd-1.1.2.tgz", - "_shasum": "9bcd52e14c097763e749b274c4346ed2e560b5a9", - "_spec": "depd@~1.1.2", - "_where": "/home/josuer08/Documents/web/node_modules/express", + "_spec": "1.1.2", + "_where": "/home/josuer08/Documents/web", "author": { "name": "Douglas Christopher Wilson", "email": "doug@somethingdoug.com" @@ -33,8 +38,6 @@ "bugs": { "url": "https://github.com/dougwilson/nodejs-depd/issues" }, - "bundleDependencies": false, - "deprecated": false, "description": "Deprecate all the things", "devDependencies": { "beautify-benchmark": "0.2.4", diff --git a/node_modules/destroy/package.json b/node_modules/destroy/package.json index 4859be7..a378df0 100644 --- a/node_modules/destroy/package.json +++ b/node_modules/destroy/package.json @@ -1,27 +1,32 @@ { - "_from": "destroy@~1.0.4", + "_args": [ + [ + "destroy@1.0.4", + "/home/josuer08/Documents/web" + ] + ], + "_from": "destroy@1.0.4", "_id": "destroy@1.0.4", "_inBundle": false, "_integrity": "sha1-l4hXRCxEdJ5CBmE+N5RiBYJqvYA=", "_location": "/destroy", "_phantomChildren": {}, "_requested": { - "type": "range", + "type": "version", "registry": true, - "raw": "destroy@~1.0.4", + "raw": "destroy@1.0.4", "name": "destroy", "escapedName": "destroy", - "rawSpec": "~1.0.4", + "rawSpec": "1.0.4", "saveSpec": null, - "fetchSpec": "~1.0.4" + "fetchSpec": "1.0.4" }, "_requiredBy": [ "/send" ], "_resolved": "https://registry.npmjs.org/destroy/-/destroy-1.0.4.tgz", - "_shasum": "978857442c44749e4206613e37946205826abd80", - "_spec": "destroy@~1.0.4", - "_where": "/home/josuer08/Documents/web/node_modules/send", + "_spec": "1.0.4", + "_where": "/home/josuer08/Documents/web", "author": { "name": "Jonathan Ong", "email": "me@jongleberry.com", @@ -30,14 +35,12 @@ "bugs": { "url": "https://github.com/stream-utils/destroy/issues" }, - "bundleDependencies": false, "contributors": [ { "name": "Douglas Christopher Wilson", "email": "doug@somethingdoug.com" } ], - "deprecated": false, "description": "destroy a stream if possible", "devDependencies": { "istanbul": "0.4.2", diff --git a/node_modules/ee-first/package.json b/node_modules/ee-first/package.json index 293a75a..99246c8 100644 --- a/node_modules/ee-first/package.json +++ b/node_modules/ee-first/package.json @@ -1,4 +1,10 @@ { + "_args": [ + [ + "ee-first@1.1.1", + "/home/josuer08/Documents/web" + ] + ], "_from": "ee-first@1.1.1", "_id": "ee-first@1.1.1", "_inBundle": false, @@ -19,9 +25,8 @@ "/on-finished" ], "_resolved": "https://registry.npmjs.org/ee-first/-/ee-first-1.1.1.tgz", - "_shasum": "590c61156b0ae2f4f0255732a158b266bc56b21d", - "_spec": "ee-first@1.1.1", - "_where": "/home/josuer08/Documents/web/node_modules/on-finished", + "_spec": "1.1.1", + "_where": "/home/josuer08/Documents/web", "author": { "name": "Jonathan Ong", "email": "me@jongleberry.com", @@ -30,14 +35,12 @@ "bugs": { "url": "https://github.com/jonathanong/ee-first/issues" }, - "bundleDependencies": false, "contributors": [ { "name": "Douglas Christopher Wilson", "email": "doug@somethingdoug.com" } ], - "deprecated": false, "description": "return the first event in a set of ee/event pairs", "devDependencies": { "istanbul": "0.3.9", diff --git a/node_modules/ejs/package.json b/node_modules/ejs/package.json index 2be08d0..2914ca1 100644 --- a/node_modules/ejs/package.json +++ b/node_modules/ejs/package.json @@ -1,27 +1,31 @@ { - "_from": "ejs", + "_args": [ + [ + "ejs@2.6.2", + "/home/josuer08/Documents/web" + ] + ], + "_from": "ejs@2.6.2", "_id": "ejs@2.6.2", "_inBundle": false, "_integrity": "sha512-PcW2a0tyTuPHz3tWyYqtK6r1fZ3gp+3Sop8Ph+ZYN81Ob5rwmbHEzaqs10N3BEsaGTkh/ooniXK+WwszGlc2+Q==", "_location": "/ejs", "_phantomChildren": {}, "_requested": { - "type": "tag", + "type": "version", "registry": true, - "raw": "ejs", + "raw": "ejs@2.6.2", "name": "ejs", "escapedName": "ejs", - "rawSpec": "", + "rawSpec": "2.6.2", "saveSpec": null, - "fetchSpec": "latest" + "fetchSpec": "2.6.2" }, "_requiredBy": [ - "#USER", "/" ], "_resolved": "https://registry.npmjs.org/ejs/-/ejs-2.6.2.tgz", - "_shasum": "3a32c63d1cd16d11266cd4703b14fec4e74ab4f6", - "_spec": "ejs", + "_spec": "2.6.2", "_where": "/home/josuer08/Documents/web", "author": { "name": "Matthew Eernisse", @@ -31,7 +35,6 @@ "bugs": { "url": "https://github.com/mde/ejs/issues" }, - "bundleDependencies": false, "contributors": [ { "name": "Timothy Gu", @@ -40,7 +43,6 @@ } ], "dependencies": {}, - "deprecated": false, "description": "Embedded JavaScript templates", "devDependencies": { "browserify": "^13.1.1", diff --git a/node_modules/encodeurl/package.json b/node_modules/encodeurl/package.json index b2efd54..f1b85f9 100644 --- a/node_modules/encodeurl/package.json +++ b/node_modules/encodeurl/package.json @@ -1,19 +1,25 @@ { - "_from": "encodeurl@~1.0.2", + "_args": [ + [ + "encodeurl@1.0.2", + "/home/josuer08/Documents/web" + ] + ], + "_from": "encodeurl@1.0.2", "_id": "encodeurl@1.0.2", "_inBundle": false, "_integrity": "sha1-rT/0yG7C0CkyL1oCw6mmBslbP1k=", "_location": "/encodeurl", "_phantomChildren": {}, "_requested": { - "type": "range", + "type": "version", "registry": true, - "raw": "encodeurl@~1.0.2", + "raw": "encodeurl@1.0.2", "name": "encodeurl", "escapedName": "encodeurl", - "rawSpec": "~1.0.2", + "rawSpec": "1.0.2", "saveSpec": null, - "fetchSpec": "~1.0.2" + "fetchSpec": "1.0.2" }, "_requiredBy": [ "/express", @@ -22,20 +28,17 @@ "/serve-static" ], "_resolved": "https://registry.npmjs.org/encodeurl/-/encodeurl-1.0.2.tgz", - "_shasum": "ad3ff4c86ec2d029322f5a02c3a9a606c95b3f59", - "_spec": "encodeurl@~1.0.2", - "_where": "/home/josuer08/Documents/web/node_modules/express", + "_spec": "1.0.2", + "_where": "/home/josuer08/Documents/web", "bugs": { "url": "https://github.com/pillarjs/encodeurl/issues" }, - "bundleDependencies": false, "contributors": [ { "name": "Douglas Christopher Wilson", "email": "doug@somethingdoug.com" } ], - "deprecated": false, "description": "Encode a URL to a percent-encoded form, excluding already-encoded sequences", "devDependencies": { "eslint": "3.19.0", diff --git a/node_modules/escape-html/package.json b/node_modules/escape-html/package.json index dc1fa2a..4bc34ae 100644 --- a/node_modules/escape-html/package.json +++ b/node_modules/escape-html/package.json @@ -1,19 +1,25 @@ { - "_from": "escape-html@~1.0.3", + "_args": [ + [ + "escape-html@1.0.3", + "/home/josuer08/Documents/web" + ] + ], + "_from": "escape-html@1.0.3", "_id": "escape-html@1.0.3", "_inBundle": false, "_integrity": "sha1-Aljq5NPQwJdN4cFpGI7wBR0dGYg=", "_location": "/escape-html", "_phantomChildren": {}, "_requested": { - "type": "range", + "type": "version", "registry": true, - "raw": "escape-html@~1.0.3", + "raw": "escape-html@1.0.3", "name": "escape-html", "escapedName": "escape-html", - "rawSpec": "~1.0.3", + "rawSpec": "1.0.3", "saveSpec": null, - "fetchSpec": "~1.0.3" + "fetchSpec": "1.0.3" }, "_requiredBy": [ "/express", @@ -22,14 +28,11 @@ "/serve-static" ], "_resolved": "https://registry.npmjs.org/escape-html/-/escape-html-1.0.3.tgz", - "_shasum": "0258eae4d3d0c0974de1c169188ef0051d1d1988", - "_spec": "escape-html@~1.0.3", - "_where": "/home/josuer08/Documents/web/node_modules/express", + "_spec": "1.0.3", + "_where": "/home/josuer08/Documents/web", "bugs": { "url": "https://github.com/component/escape-html/issues" }, - "bundleDependencies": false, - "deprecated": false, "description": "Escape string for use in HTML", "devDependencies": { "beautify-benchmark": "0.2.4", diff --git a/node_modules/etag/package.json b/node_modules/etag/package.json index 5555f0d..661c663 100644 --- a/node_modules/etag/package.json +++ b/node_modules/etag/package.json @@ -1,32 +1,36 @@ { - "_from": "etag@~1.8.1", + "_args": [ + [ + "etag@1.8.1", + "/home/josuer08/Documents/web" + ] + ], + "_from": "etag@1.8.1", "_id": "etag@1.8.1", "_inBundle": false, "_integrity": "sha1-Qa4u62XvpiJorr/qg6x9eSmbCIc=", "_location": "/etag", "_phantomChildren": {}, "_requested": { - "type": "range", + "type": "version", "registry": true, - "raw": "etag@~1.8.1", + "raw": "etag@1.8.1", "name": "etag", "escapedName": "etag", - "rawSpec": "~1.8.1", + "rawSpec": "1.8.1", "saveSpec": null, - "fetchSpec": "~1.8.1" + "fetchSpec": "1.8.1" }, "_requiredBy": [ "/express", "/send" ], "_resolved": "https://registry.npmjs.org/etag/-/etag-1.8.1.tgz", - "_shasum": "41ae2eeb65efa62268aebfea83ac7d79299b0887", - "_spec": "etag@~1.8.1", - "_where": "/home/josuer08/Documents/web/node_modules/express", + "_spec": "1.8.1", + "_where": "/home/josuer08/Documents/web", "bugs": { "url": "https://github.com/jshttp/etag/issues" }, - "bundleDependencies": false, "contributors": [ { "name": "Douglas Christopher Wilson", @@ -37,7 +41,6 @@ "email": "david.bjorklund@gmail.com" } ], - "deprecated": false, "description": "Create simple HTTP ETags", "devDependencies": { "beautify-benchmark": "0.2.4", diff --git a/node_modules/express-ws/.babelrc b/node_modules/express-ws/.babelrc deleted file mode 100644 index 22e308d..0000000 --- a/node_modules/express-ws/.babelrc +++ /dev/null @@ -1,3 +0,0 @@ -{ - presets: ["es2015"] -} \ No newline at end of file diff --git a/node_modules/express-ws/.editorconfig b/node_modules/express-ws/.editorconfig deleted file mode 100644 index d2a7f03..0000000 --- a/node_modules/express-ws/.editorconfig +++ /dev/null @@ -1,12 +0,0 @@ -root = true - -[*] -indent_style = space -indent_size = 2 -end_of_line = lf -charset = utf-8 -trim_trailing_whitespace = true -insert_final_newline = true - -[*.md] -indent_size = 4 diff --git a/node_modules/express-ws/.eslintrc b/node_modules/express-ws/.eslintrc deleted file mode 100644 index f644a4b..0000000 --- a/node_modules/express-ws/.eslintrc +++ /dev/null @@ -1,7 +0,0 @@ -{ - "extends": "airbnb/base", - "rules": { - "comma-dangle": 0, - "no-param-reassign": 0 - } -} diff --git a/node_modules/express-ws/LICENSE b/node_modules/express-ws/LICENSE deleted file mode 100644 index bcd14ff..0000000 --- a/node_modules/express-ws/LICENSE +++ /dev/null @@ -1,23 +0,0 @@ -Copyright (c) 2016, Henning Morud -All rights reserved. - -Redistribution and use in source and binary forms, with or without -modification, are permitted provided that the following conditions are met: - -* Redistributions of source code must retain the above copyright notice, this - list of conditions and the following disclaimer. - -* 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. - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" -AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE -DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE -FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL -DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR -SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, -OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. diff --git a/node_modules/express-ws/README.md b/node_modules/express-ws/README.md deleted file mode 100644 index 9ade18a..0000000 --- a/node_modules/express-ws/README.md +++ /dev/null @@ -1,111 +0,0 @@ -# express-ws [![Dependency Status](https://snyk.io/test/github/henningm/express-ws/badge.svg)](https://snyk.io/test/github/henningm/express-ws) - -[WebSocket](https://developer.mozilla.org/en-US/docs/Web/API/WebSockets_API) endpoints for [Express](http://expressjs.com/) applications. Lets you define WebSocket endpoints like any other type of route, and applies regular Express middleware. The WebSocket support is implemented with the help of the [ws](https://github.com/websockets/ws) library. - -## Installation - -`npm install --save express-ws` - -## Usage - -__Full documentation can be found in the API section below. This section only shows a brief example.__ - -Add this line to your Express application: - -```javascript -var expressWs = require('express-ws')(app); -``` - -__Important: Make sure to set up the `express-ws` module like above *before* loading or defining your routers!__ Otherwise, `express-ws` won't get a chance to set up support for Express routers, and you might run into an error along the lines of `router.ws is not a function`. - -After setting up `express-ws`, you will be able to add WebSocket routes (almost) the same way you add other routes. The following snippet sets up a simple echo server at `/echo`. The `ws` parameter is an instance of the WebSocket class described [here](https://github.com/websockets/ws/blob/master/doc/ws.md#class-websocket). - -```javascript -app.ws('/echo', function(ws, req) { - ws.on('message', function(msg) { - ws.send(msg); - }); -}); -``` - -It works with routers, too, this time at `/ws-stuff/echo`: - -```javascript -var router = express.Router(); - -router.ws('/echo', function(ws, req) { - ws.on('message', function(msg) { - ws.send(msg); - }); -}); - -app.use("/ws-stuff", router); -``` - -## Full example - -```javascript -var express = require('express'); -var app = express(); -var expressWs = require('express-ws')(app); - -app.use(function (req, res, next) { - console.log('middleware'); - req.testing = 'testing'; - return next(); -}); - -app.get('/', function(req, res, next){ - console.log('get route', req.testing); - res.end(); -}); - -app.ws('/', function(ws, req) { - ws.on('message', function(msg) { - console.log(msg); - }); - console.log('socket', req.testing); -}); - -app.listen(3000); -``` - -## API - -### expressWs(app, *server*, *options*) - -Sets up `express-ws` on the specified `app`. This will modify the global Router prototype for Express as well - see the `leaveRouterUntouched` option for more information on disabling this. - -* __app__: The Express application to set up `express-ws` on. -* __server__: *Optional.* When using a custom `http.Server`, you should pass it in here, so that `express-ws` can use it to set up the WebSocket upgrade handlers. If you don't specify a `server`, you will only be able to use it with the server that is created automatically when you call `app.listen`. -* __options__: *Optional.* An object containing further options. - * __leaveRouterUntouched:__ Set this to `true` to keep `express-ws` from modifying the Router prototype. You will have to manually `applyTo` every Router that you wish to make `.ws` available on, when this is enabled. - * __wsOptions:__ Options object passed to WebSocketServer constructor. Necessary for any ws specific features. - -This function will return a new `express-ws` API object, which will be referred to as `wsInstance` in the rest of the documentation. - -### wsInstance.app - -This property contains the `app` that `express-ws` was set up on. - -### wsInstance.getWss() - -Returns the underlying WebSocket server/handler. You can use `wsInstance.getWss().clients` to obtain a list of all the connected WebSocket clients for this server. - -Note that this list will include *all* clients, not just those for a specific route - this means that it's often *not* a good idea to use this for broadcasts, for example. - -### wsInstance.applyTo(router) - -Sets up `express-ws` on the given `router` (or other Router-like object). You will only need this in two scenarios: - -1. You have enabled `options.leaveRouterUntouched`, or -2. You are using a custom router that is not based on the express.Router prototype. - -In most cases, you won't need this at all. - -## Development - -This module is written in ES6, and uses Babel for compilation. What this means in practice: - -* The source code lives in the `src/` directory. -* After changing this code, make sure to run `npm run build` to compile it. diff --git a/node_modules/express-ws/examples/broadcast.js b/node_modules/express-ws/examples/broadcast.js deleted file mode 100755 index 3d8c606..0000000 --- a/node_modules/express-ws/examples/broadcast.js +++ /dev/null @@ -1,20 +0,0 @@ -var express = require('express'); -var expressWs = require('..') - -var expressWs = expressWs(express()); -var app = expressWs.app; - -app.ws('/a', function(ws, req) { -}); -var aWss = expressWs.getWss('/a'); - -app.ws('/b', function(ws, req) { -}); - -setInterval(function () { - aWss.clients.forEach(function (client) { - client.send('hello'); - }); -}, 5000); - -app.listen(3000) diff --git a/node_modules/express-ws/examples/https.js b/node_modules/express-ws/examples/https.js deleted file mode 100644 index f881fda..0000000 --- a/node_modules/express-ws/examples/https.js +++ /dev/null @@ -1,33 +0,0 @@ -var https = require('https'); -var fs = require('fs'); - -var express = require('express'); -var expressWs = require('..'); - -var options = { - key: fs.readFileSync('key.pem'), - cert: fs.readFileSync('cert.pem') -}; -var app = express(); -var server = https.createServer(options, app); -var expressWs = expressWs(app, server); - -app.use(function (req, res, next) { - console.log('middleware'); - req.testing = 'testing'; - return next(); -}); - -app.get('/', function(req, res, next){ - console.log('get route', req.testing); - res.end(); -}); - -app.ws('/', function(ws, req) { - ws.on('message', function(msg) { - console.log(msg); - }); - console.log('socket', req.testing); -}); - -server.listen(3000) diff --git a/node_modules/express-ws/examples/params.js b/node_modules/express-ws/examples/params.js deleted file mode 100644 index b982a59..0000000 --- a/node_modules/express-ws/examples/params.js +++ /dev/null @@ -1,26 +0,0 @@ -var express = require('express'); -var expressWs = require('..'); - -var expressWs = expressWs(express()); -var app = expressWs.app; - -app.param('world', function (req, res, next, world) { - req.world = world || 'world'; - return next(); -}); - -app.get('/hello/:world', function(req, res, next){ - console.log('hello', req.world); - res.end(); - next(); -}); - -app.ws('/hello/:world', function(ws, req, next) { - ws.on('message', function(msg) { - console.log(msg); - }); - console.log('socket hello', req.world); - next(); -}); - -app.listen(3000) diff --git a/node_modules/express-ws/examples/simple.js b/node_modules/express-ws/examples/simple.js deleted file mode 100755 index d4b1abd..0000000 --- a/node_modules/express-ws/examples/simple.js +++ /dev/null @@ -1,25 +0,0 @@ -var express = require('express'); -var expressWs = require('..'); - -var expressWs = expressWs(express()); -var app = expressWs.app; - -app.use(function (req, res, next) { - console.log('middleware'); - req.testing = 'testing'; - return next(); -}); - -app.get('/', function(req, res, next){ - console.log('get route', req.testing); - res.end(); -}); - -app.ws('/', function(ws, req) { - ws.on('message', function(msg) { - console.log(msg); - }); - console.log('socket', req.testing); -}); - -app.listen(3000) diff --git a/node_modules/express-ws/index.js b/node_modules/express-ws/index.js deleted file mode 100644 index 651c499..0000000 --- a/node_modules/express-ws/index.js +++ /dev/null @@ -1 +0,0 @@ -module.exports = require("./lib").default; diff --git a/node_modules/express-ws/lib/add-ws-method.js b/node_modules/express-ws/lib/add-ws-method.js deleted file mode 100644 index 0ea78ea..0000000 --- a/node_modules/express-ws/lib/add-ws-method.js +++ /dev/null @@ -1,50 +0,0 @@ -'use strict'; - -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports.default = addWsMethod; - -var _wrapMiddleware = require('./wrap-middleware'); - -var _wrapMiddleware2 = _interopRequireDefault(_wrapMiddleware); - -var _websocketUrl = require('./websocket-url'); - -var _websocketUrl2 = _interopRequireDefault(_websocketUrl); - -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } - -function _toConsumableArray(arr) { if (Array.isArray(arr)) { for (var i = 0, arr2 = Array(arr.length); i < arr.length; i++) { arr2[i] = arr[i]; } return arr2; } else { return Array.from(arr); } } - -function addWsMethod(target) { - /* This prevents conflict with other things setting `.ws`. */ - if (target.ws === null || target.ws === undefined) { - target.ws = function addWsRoute(route) { - for (var _len = arguments.length, middlewares = Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) { - middlewares[_key - 1] = arguments[_key]; - } - - var wrappedMiddlewares = middlewares.map(_wrapMiddleware2.default); - - /* We append `/.websocket` to the route path here. Why? To prevent conflicts when - * a non-WebSocket request is made to the same GET route - after all, we are only - * interested in handling WebSocket requests. - * - * Whereas the original `express-ws` prefixed this path segment, we suffix it - - * this makes it possible to let requests propagate through Routers like normal, - * which allows us to specify WebSocket routes on Routers as well \o/! */ - var wsRoute = (0, _websocketUrl2.default)(route); - - /* Here we configure our new GET route. It will never get called by a client - * directly, it's just to let our request propagate internally, so that we can - * leave the regular middleware execution and error handling to Express. */ - this.get.apply(this, _toConsumableArray([wsRoute].concat(wrappedMiddlewares))); - - /* - * Return `this` to allow for chaining: - */ - return this; - }; - } -} \ No newline at end of file diff --git a/node_modules/express-ws/lib/index.js b/node_modules/express-ws/lib/index.js deleted file mode 100644 index 8e3e696..0000000 --- a/node_modules/express-ws/lib/index.js +++ /dev/null @@ -1,110 +0,0 @@ -'use strict'; - -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports.default = expressWs; - -var _http = require('http'); - -var _http2 = _interopRequireDefault(_http); - -var _express = require('express'); - -var _express2 = _interopRequireDefault(_express); - -var _ws = require('ws'); - -var _ws2 = _interopRequireDefault(_ws); - -var _websocketUrl = require('./websocket-url'); - -var _websocketUrl2 = _interopRequireDefault(_websocketUrl); - -var _addWsMethod = require('./add-ws-method'); - -var _addWsMethod2 = _interopRequireDefault(_addWsMethod); - -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } - -function expressWs(app, httpServer) { - var options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {}; - - var server = httpServer; - - if (server === null || server === undefined) { - /* No HTTP server was explicitly provided, create one for our Express application. */ - server = _http2.default.createServer(app); - - app.listen = function serverListen() { - var _server; - - return (_server = server).listen.apply(_server, arguments); - }; - } - - /* Make our custom `.ws` method available directly on the Express application. You should - * really be using Routers, though. */ - (0, _addWsMethod2.default)(app); - - /* Monkeypatch our custom `.ws` method into Express' Router prototype. This makes it possible, - * when using the standard Express Router, to use the `.ws` method without any further calls - * to `makeRouter`. When using a custom router, the use of `makeRouter` may still be necessary. - * - * This approach works, because Express does a strange mixin hack - the Router factory - * function is simultaneously the prototype that gets assigned to the resulting Router - * object. */ - if (!options.leaveRouterUntouched) { - (0, _addWsMethod2.default)(_express2.default.Router); - } - - // allow caller to pass in options to WebSocketServer constructor - var wsOptions = options.wsOptions || {}; - wsOptions.server = server; - var wsServer = new _ws2.default.Server(wsOptions); - - wsServer.on('connection', function (socket, request) { - if ('upgradeReq' in socket) { - request = socket.upgradeReq; - } - - request.ws = socket; - request.wsHandled = false; - - /* By setting this fake `.url` on the request, we ensure that it will end up in the fake - * `.get` handler that we defined above - where the wrapper will then unpack the `.ws` - * property, indicate that the WebSocket has been handled, and call the actual handler. */ - request.url = (0, _websocketUrl2.default)(request.url); - - var dummyResponse = new _http2.default.ServerResponse(request); - - dummyResponse.writeHead = function writeHead(statusCode) { - if (statusCode > 200) { - /* Something in the middleware chain signalled an error. */ - dummyResponse._header = ''; - socket.close(); - } - }; - - app.handle(request, dummyResponse, function () { - if (!request.wsHandled) { - /* There was no matching WebSocket-specific route for this request. We'll close - * the connection, as no endpoint was able to handle the request anyway... */ - socket.close(); - } - }); - }); - - return { - app: app, - getWss: function getWss() { - return wsServer; - }, - applyTo: function applyTo(router) { - (0, _addWsMethod2.default)(router); - } - }; -} /* This module does a lot of monkeypatching, but unfortunately that appears to be the only way to - * accomplish this kind of stuff in Express. - * - * Here be dragons. */ \ No newline at end of file diff --git a/node_modules/express-ws/lib/trailing-slash.js b/node_modules/express-ws/lib/trailing-slash.js deleted file mode 100644 index 04b1a7f..0000000 --- a/node_modules/express-ws/lib/trailing-slash.js +++ /dev/null @@ -1,13 +0,0 @@ -'use strict'; - -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports.default = addTrailingSlash; -function addTrailingSlash(string) { - var suffixed = string; - if (suffixed.charAt(suffixed.length - 1) !== '/') { - suffixed = suffixed + '/'; - } - return suffixed; -} \ No newline at end of file diff --git a/node_modules/express-ws/lib/websocket-url.js b/node_modules/express-ws/lib/websocket-url.js deleted file mode 100644 index b77992e..0000000 --- a/node_modules/express-ws/lib/websocket-url.js +++ /dev/null @@ -1,28 +0,0 @@ -'use strict'; - -Object.defineProperty(exports, "__esModule", { - value: true -}); - -var _slicedToArray = function () { function sliceIterator(arr, i) { var _arr = []; var _n = true; var _d = false; var _e = undefined; try { for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"]) _i["return"](); } finally { if (_d) throw _e; } } return _arr; } return function (arr, i) { if (Array.isArray(arr)) { return arr; } else if (Symbol.iterator in Object(arr)) { return sliceIterator(arr, i); } else { throw new TypeError("Invalid attempt to destructure non-iterable instance"); } }; }(); - -exports.default = websocketUrl; - -var _trailingSlash = require('./trailing-slash'); - -var _trailingSlash2 = _interopRequireDefault(_trailingSlash); - -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } - -/* The following fixes HenningM/express-ws#17, correctly. */ -function websocketUrl(url) { - if (url.indexOf('?') !== -1) { - var _url$split = url.split('?'), - _url$split2 = _slicedToArray(_url$split, 2), - baseUrl = _url$split2[0], - query = _url$split2[1]; - - return (0, _trailingSlash2.default)(baseUrl) + '.websocket?' + query; - } - return (0, _trailingSlash2.default)(url) + '.websocket'; -} \ No newline at end of file diff --git a/node_modules/express-ws/lib/wrap-middleware.js b/node_modules/express-ws/lib/wrap-middleware.js deleted file mode 100644 index 473c704..0000000 --- a/node_modules/express-ws/lib/wrap-middleware.js +++ /dev/null @@ -1,23 +0,0 @@ -"use strict"; - -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports.default = wrapMiddleware; -function wrapMiddleware(middleware) { - return function (req, res, next) { - if (req.ws !== null && req.ws !== undefined) { - req.wsHandled = true; - try { - /* Unpack the `.ws` property and call the actual handler. */ - middleware(req.ws, req, next); - } catch (err) { - /* If an error is thrown, let's send that on to any error handling */ - next(err); - } - } else { - /* This wasn't a WebSocket request, so skip this middleware. */ - next(); - } - }; -} \ No newline at end of file diff --git a/node_modules/express-ws/node_modules/ws/LICENSE b/node_modules/express-ws/node_modules/ws/LICENSE deleted file mode 100644 index a145cd1..0000000 --- a/node_modules/express-ws/node_modules/ws/LICENSE +++ /dev/null @@ -1,21 +0,0 @@ -The MIT License (MIT) - -Copyright (c) 2011 Einar Otto Stangvik - -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. diff --git a/node_modules/express-ws/node_modules/ws/README.md b/node_modules/express-ws/node_modules/ws/README.md deleted file mode 100644 index 3fd9a8c..0000000 --- a/node_modules/express-ws/node_modules/ws/README.md +++ /dev/null @@ -1,417 +0,0 @@ -# ws: a Node.js WebSocket library - -[![Version npm](https://img.shields.io/npm/v/ws.svg)](https://www.npmjs.com/package/ws) -[![Linux Build](https://img.shields.io/travis/websockets/ws/master.svg)](https://travis-ci.org/websockets/ws) -[![Windows Build](https://ci.appveyor.com/api/projects/status/github/websockets/ws?branch=master&svg=true)](https://ci.appveyor.com/project/lpinca/ws) -[![Coverage Status](https://img.shields.io/coveralls/websockets/ws/master.svg)](https://coveralls.io/r/websockets/ws?branch=master) - -ws is a simple to use, blazing fast, and thoroughly tested WebSocket client -and server implementation. - -Passes the quite extensive Autobahn test suite: [server][server-report], -[client][client-report]. - -**Note**: This module does not work in the browser. The client in the docs is a -reference to a back end with the role of a client in the WebSocket -communication. Browser clients must use the native -[`WebSocket`](https://developer.mozilla.org/en-US/docs/Web/API/WebSocket) object. -To make the same code work seamlessly on Node.js and the browser, you can use -one of the many wrappers available on npm, like -[isomorphic-ws](https://github.com/heineiuo/isomorphic-ws). - -## Table of Contents - -* [Protocol support](#protocol-support) -* [Installing](#installing) - + [Opt-in for performance and spec compliance](#opt-in-for-performance-and-spec-compliance) -* [API docs](#api-docs) -* [WebSocket compression](#websocket-compression) -* [Usage examples](#usage-examples) - + [Sending and receiving text data](#sending-and-receiving-text-data) - + [Sending binary data](#sending-binary-data) - + [Simple server](#simple-server) - + [External HTTP/S server](#external-https-server) - + [Multiple servers sharing a single HTTP/S server](#multiple-servers-sharing-a-single-https-server) - + [Server broadcast](#server-broadcast) - + [echo.websocket.org demo](#echowebsocketorg-demo) - + [Other examples](#other-examples) -* [Error handling best practices](#error-handling-best-practices) -* [FAQ](#faq) - + [How to get the IP address of the client?](#how-to-get-the-ip-address-of-the-client) - + [How to detect and close broken connections?](#how-to-detect-and-close-broken-connections) - + [How to connect via a proxy?](#how-to-connect-via-a-proxy) -* [Changelog](#changelog) -* [License](#license) - -## Protocol support - -* **HyBi drafts 07-12** (Use the option `protocolVersion: 8`) -* **HyBi drafts 13-17** (Current default, alternatively option `protocolVersion: 13`) - -## Installing - -``` -npm install --save ws -``` - -### Opt-in for performance and spec compliance - -There are 2 optional modules that can be installed along side with the ws -module. These modules are binary addons which improve certain operations. -Prebuilt binaries are available for the most popular platforms so you don't -necessarily need to have a C++ compiler installed on your machine. - -- `npm install --save-optional bufferutil`: Allows to efficiently perform - operations such as masking and unmasking the data payload of the WebSocket - frames. -- `npm install --save-optional utf-8-validate`: Allows to efficiently check - if a message contains valid UTF-8 as required by the spec. - -## API docs - -See [`/doc/ws.md`](./doc/ws.md) for Node.js-like docs for the ws classes. - -## WebSocket compression - -ws supports the [permessage-deflate extension][permessage-deflate] which -enables the client and server to negotiate a compression algorithm and its -parameters, and then selectively apply it to the data payloads of each -WebSocket message. - -The extension is disabled by default on the server and enabled by default on -the client. It adds a significant overhead in terms of performance and memory -consumption so we suggest to enable it only if it is really needed. - -Note that Node.js has a variety of issues with high-performance compression, -where increased concurrency, especially on Linux, can lead to -[catastrophic memory fragmentation][node-zlib-bug] and slow performance. -If you intend to use permessage-deflate in production, it is worthwhile to set -up a test representative of your workload and ensure Node.js/zlib will handle -it with acceptable performance and memory usage. - -Tuning of permessage-deflate can be done via the options defined below. You can -also use `zlibDeflateOptions` and `zlibInflateOptions`, which is passed directly -into the creation of [raw deflate/inflate streams][node-zlib-deflaterawdocs]. - -See [the docs][ws-server-options] for more options. - -```js -const WebSocket = require('ws'); - -const wss = new WebSocket.Server({ - port: 8080, - perMessageDeflate: { - zlibDeflateOptions: { // See zlib defaults. - chunkSize: 1024, - memLevel: 7, - level: 3, - }, - zlibInflateOptions: { - chunkSize: 10 * 1024 - }, - // Other options settable: - clientNoContextTakeover: true, // Defaults to negotiated value. - serverNoContextTakeover: true, // Defaults to negotiated value. - clientMaxWindowBits: 10, // Defaults to negotiated value. - serverMaxWindowBits: 10, // Defaults to negotiated value. - // Below options specified as default values. - concurrencyLimit: 10, // Limits zlib concurrency for perf. - threshold: 1024, // Size (in bytes) below which messages - // should not be compressed. - } -}); -``` - -The client will only use the extension if it is supported and enabled on the -server. To always disable the extension on the client set the -`perMessageDeflate` option to `false`. - -```js -const WebSocket = require('ws'); - -const ws = new WebSocket('ws://www.host.com/path', { - perMessageDeflate: false -}); -``` - -## Usage examples - -### Sending and receiving text data - -```js -const WebSocket = require('ws'); - -const ws = new WebSocket('ws://www.host.com/path'); - -ws.on('open', function open() { - ws.send('something'); -}); - -ws.on('message', function incoming(data) { - console.log(data); -}); -``` - -### Sending binary data - -```js -const WebSocket = require('ws'); - -const ws = new WebSocket('ws://www.host.com/path'); - -ws.on('open', function open() { - const array = new Float32Array(5); - - for (var i = 0; i < array.length; ++i) { - array[i] = i / 2; - } - - ws.send(array); -}); -``` - -### Simple server - -```js -const WebSocket = require('ws'); - -const wss = new WebSocket.Server({ port: 8080 }); - -wss.on('connection', function connection(ws) { - ws.on('message', function incoming(message) { - console.log('received: %s', message); - }); - - ws.send('something'); -}); -``` - -### External HTTP/S server - -```js -const fs = require('fs'); -const https = require('https'); -const WebSocket = require('ws'); - -const server = new https.createServer({ - cert: fs.readFileSync('/path/to/cert.pem'), - key: fs.readFileSync('/path/to/key.pem') -}); -const wss = new WebSocket.Server({ server }); - -wss.on('connection', function connection(ws) { - ws.on('message', function incoming(message) { - console.log('received: %s', message); - }); - - ws.send('something'); -}); - -server.listen(8080); -``` - -### Multiple servers sharing a single HTTP/S server - -```js -const http = require('http'); -const WebSocket = require('ws'); - -const server = http.createServer(); -const wss1 = new WebSocket.Server({ noServer: true }); -const wss2 = new WebSocket.Server({ noServer: true }); - -wss1.on('connection', function connection(ws) { - // ... -}); - -wss2.on('connection', function connection(ws) { - // ... -}); - -server.on('upgrade', function upgrade(request, socket, head) { - const pathname = url.parse(request.url).pathname; - - if (pathname === '/foo') { - wss1.handleUpgrade(request, socket, head, function done(ws) { - wss1.emit('connection', ws, request); - }); - } else if (pathname === '/bar') { - wss2.handleUpgrade(request, socket, head, function done(ws) { - wss2.emit('connection', ws, request); - }); - } else { - socket.destroy(); - } -}); - -server.listen(8080); -``` - -### Server broadcast - -```js -const WebSocket = require('ws'); - -const wss = new WebSocket.Server({ port: 8080 }); - -// Broadcast to all. -wss.broadcast = function broadcast(data) { - wss.clients.forEach(function each(client) { - if (client.readyState === WebSocket.OPEN) { - client.send(data); - } - }); -}; - -wss.on('connection', function connection(ws) { - ws.on('message', function incoming(data) { - // Broadcast to everyone else. - wss.clients.forEach(function each(client) { - if (client !== ws && client.readyState === WebSocket.OPEN) { - client.send(data); - } - }); - }); -}); -``` - -### echo.websocket.org demo - -```js -const WebSocket = require('ws'); - -const ws = new WebSocket('wss://echo.websocket.org/', { - origin: 'https://websocket.org' -}); - -ws.on('open', function open() { - console.log('connected'); - ws.send(Date.now()); -}); - -ws.on('close', function close() { - console.log('disconnected'); -}); - -ws.on('message', function incoming(data) { - console.log(`Roundtrip time: ${Date.now() - data} ms`); - - setTimeout(function timeout() { - ws.send(Date.now()); - }, 500); -}); -``` - -### Other examples - -For a full example with a browser client communicating with a ws server, see the -examples folder. - -Otherwise, see the test cases. - -## Error handling best practices - -```js -// If the WebSocket is closed before the following send is attempted -ws.send('something'); - -// Errors (both immediate and async write errors) can be detected in an optional -// callback. The callback is also the only way of being notified that data has -// actually been sent. -ws.send('something', function ack(error) { - // If error is not defined, the send has been completed, otherwise the error - // object will indicate what failed. -}); - -// Immediate errors can also be handled with `try...catch`, but **note** that -// since sends are inherently asynchronous, socket write failures will *not* be -// captured when this technique is used. -try { ws.send('something'); } -catch (e) { /* handle error */ } -``` - -## FAQ - -### How to get the IP address of the client? - -The remote IP address can be obtained from the raw socket. - -```js -const WebSocket = require('ws'); - -const wss = new WebSocket.Server({ port: 8080 }); - -wss.on('connection', function connection(ws, req) { - const ip = req.connection.remoteAddress; -}); -``` - -When the server runs behind a proxy like NGINX, the de-facto standard is to use -the `X-Forwarded-For` header. - -```js -wss.on('connection', function connection(ws, req) { - const ip = req.headers['x-forwarded-for'].split(/\s*,\s*/)[0]; -}); -``` - -### How to detect and close broken connections? - -Sometimes the link between the server and the client can be interrupted in a -way that keeps both the server and the client unaware of the broken state of the -connection (e.g. when pulling the cord). - -In these cases ping messages can be used as a means to verify that the remote -endpoint is still responsive. - -```js -const WebSocket = require('ws'); - -const wss = new WebSocket.Server({ port: 8080 }); - -function noop() {} - -function heartbeat() { - this.isAlive = true; -} - -wss.on('connection', function connection(ws) { - ws.isAlive = true; - ws.on('pong', heartbeat); -}); - -const interval = setInterval(function ping() { - wss.clients.forEach(function each(ws) { - if (ws.isAlive === false) return ws.terminate(); - - ws.isAlive = false; - ws.ping(noop); - }); -}, 30000); -``` - -Pong messages are automatically sent in response to ping messages as required -by the spec. - -### How to connect via a proxy? - -Use a custom `http.Agent` implementation like [https-proxy-agent][] or -[socks-proxy-agent][]. - -## Changelog - -We're using the GitHub [releases][changelog] for changelog entries. - -## License - -[MIT](LICENSE) - -[https-proxy-agent]: https://github.com/TooTallNate/node-https-proxy-agent -[socks-proxy-agent]: https://github.com/TooTallNate/node-socks-proxy-agent -[client-report]: http://websockets.github.io/ws/autobahn/clients/ -[server-report]: http://websockets.github.io/ws/autobahn/servers/ -[permessage-deflate]: https://tools.ietf.org/html/rfc7692 -[changelog]: https://github.com/websockets/ws/releases -[node-zlib-bug]: https://github.com/nodejs/node/issues/8871 -[node-zlib-deflaterawdocs]: https://nodejs.org/api/zlib.html#zlib_zlib_createdeflateraw_options -[ws-server-options]: https://github.com/websockets/ws/blob/master/doc/ws.md#new-websocketserveroptions-callback diff --git a/node_modules/express-ws/node_modules/ws/index.js b/node_modules/express-ws/node_modules/ws/index.js deleted file mode 100644 index b8d6be1..0000000 --- a/node_modules/express-ws/node_modules/ws/index.js +++ /dev/null @@ -1,9 +0,0 @@ -'use strict'; - -const WebSocket = require('./lib/websocket'); - -WebSocket.Server = require('./lib/websocket-server'); -WebSocket.Receiver = require('./lib/receiver'); -WebSocket.Sender = require('./lib/sender'); - -module.exports = WebSocket; diff --git a/node_modules/express-ws/node_modules/ws/lib/buffer-util.js b/node_modules/express-ws/node_modules/ws/lib/buffer-util.js deleted file mode 100644 index 6974dd6..0000000 --- a/node_modules/express-ws/node_modules/ws/lib/buffer-util.js +++ /dev/null @@ -1,72 +0,0 @@ -'use strict'; - -/** - * Merges an array of buffers into a new buffer. - * - * @param {Buffer[]} list The array of buffers to concat - * @param {Number} totalLength The total length of buffers in the list - * @return {Buffer} The resulting buffer - * @public - */ -function concat (list, totalLength) { - const target = Buffer.allocUnsafe(totalLength); - var offset = 0; - - for (var i = 0; i < list.length; i++) { - const buf = list[i]; - buf.copy(target, offset); - offset += buf.length; - } - - return target; -} - -/** - * Masks a buffer using the given mask. - * - * @param {Buffer} source The buffer to mask - * @param {Buffer} mask The mask to use - * @param {Buffer} output The buffer where to store the result - * @param {Number} offset The offset at which to start writing - * @param {Number} length The number of bytes to mask. - * @public - */ -function _mask (source, mask, output, offset, length) { - for (var i = 0; i < length; i++) { - output[offset + i] = source[i] ^ mask[i & 3]; - } -} - -/** - * Unmasks a buffer using the given mask. - * - * @param {Buffer} buffer The buffer to unmask - * @param {Buffer} mask The mask to use - * @public - */ -function _unmask (buffer, mask) { - // Required until https://github.com/nodejs/node/issues/9006 is resolved. - const length = buffer.length; - for (var i = 0; i < length; i++) { - buffer[i] ^= mask[i & 3]; - } -} - -try { - const bufferUtil = require('bufferutil'); - const bu = bufferUtil.BufferUtil || bufferUtil; - - module.exports = { - mask (source, mask, output, offset, length) { - if (length < 48) _mask(source, mask, output, offset, length); - else bu.mask(source, mask, output, offset, length); - }, - unmask (buffer, mask) { - if (buffer.length < 32) _unmask(buffer, mask); - else bu.unmask(buffer, mask); - }, - concat - }; -} catch (e) /* istanbul ignore next */ { - module.exports = { concat, mask: _mask, unmask: _unmask }; -} diff --git a/node_modules/express-ws/node_modules/ws/lib/constants.js b/node_modules/express-ws/node_modules/ws/lib/constants.js deleted file mode 100644 index 4082981..0000000 --- a/node_modules/express-ws/node_modules/ws/lib/constants.js +++ /dev/null @@ -1,10 +0,0 @@ -'use strict'; - -module.exports = { - BINARY_TYPES: ['nodebuffer', 'arraybuffer', 'fragments'], - GUID: '258EAFA5-E914-47DA-95CA-C5AB0DC85B11', - kStatusCode: Symbol('status-code'), - kWebSocket: Symbol('websocket'), - EMPTY_BUFFER: Buffer.alloc(0), - NOOP: () => {} -}; diff --git a/node_modules/express-ws/node_modules/ws/lib/event-target.js b/node_modules/express-ws/node_modules/ws/lib/event-target.js deleted file mode 100644 index 574e908..0000000 --- a/node_modules/express-ws/node_modules/ws/lib/event-target.js +++ /dev/null @@ -1,170 +0,0 @@ -'use strict'; - -/** - * Class representing an event. - * - * @private - */ -class Event { - /** - * Create a new `Event`. - * - * @param {String} type The name of the event - * @param {Object} target A reference to the target to which the event was dispatched - */ - constructor (type, target) { - this.target = target; - this.type = type; - } -} - -/** - * Class representing a message event. - * - * @extends Event - * @private - */ -class MessageEvent extends Event { - /** - * Create a new `MessageEvent`. - * - * @param {(String|Buffer|ArrayBuffer|Buffer[])} data The received data - * @param {WebSocket} target A reference to the target to which the event was dispatched - */ - constructor (data, target) { - super('message', target); - - this.data = data; - } -} - -/** - * Class representing a close event. - * - * @extends Event - * @private - */ -class CloseEvent extends Event { - /** - * Create a new `CloseEvent`. - * - * @param {Number} code The status code explaining why the connection is being closed - * @param {String} reason A human-readable string explaining why the connection is closing - * @param {WebSocket} target A reference to the target to which the event was dispatched - */ - constructor (code, reason, target) { - super('close', target); - - this.wasClean = target._closeFrameReceived && target._closeFrameSent; - this.reason = reason; - this.code = code; - } -} - -/** - * Class representing an open event. - * - * @extends Event - * @private - */ -class OpenEvent extends Event { - /** - * Create a new `OpenEvent`. - * - * @param {WebSocket} target A reference to the target to which the event was dispatched - */ - constructor (target) { - super('open', target); - } -} - -/** - * Class representing an error event. - * - * @extends Event - * @private - */ -class ErrorEvent extends Event { - /** - * Create a new `ErrorEvent`. - * - * @param {Object} error The error that generated this event - * @param {WebSocket} target A reference to the target to which the event was dispatched - */ - constructor (error, target) { - super('error', target); - - this.message = error.message; - this.error = error; - } -} - -/** - * This provides methods for emulating the `EventTarget` interface. It's not - * meant to be used directly. - * - * @mixin - */ -const EventTarget = { - /** - * Register an event listener. - * - * @param {String} method A string representing the event type to listen for - * @param {Function} listener The listener to add - * @public - */ - addEventListener (method, listener) { - if (typeof listener !== 'function') return; - - function onMessage (data) { - listener.call(this, new MessageEvent(data, this)); - } - - function onClose (code, message) { - listener.call(this, new CloseEvent(code, message, this)); - } - - function onError (error) { - listener.call(this, new ErrorEvent(error, this)); - } - - function onOpen () { - listener.call(this, new OpenEvent(this)); - } - - if (method === 'message') { - onMessage._listener = listener; - this.on(method, onMessage); - } else if (method === 'close') { - onClose._listener = listener; - this.on(method, onClose); - } else if (method === 'error') { - onError._listener = listener; - this.on(method, onError); - } else if (method === 'open') { - onOpen._listener = listener; - this.on(method, onOpen); - } else { - this.on(method, listener); - } - }, - - /** - * Remove an event listener. - * - * @param {String} method A string representing the event type to remove - * @param {Function} listener The listener to remove - * @public - */ - removeEventListener (method, listener) { - const listeners = this.listeners(method); - - for (var i = 0; i < listeners.length; i++) { - if (listeners[i] === listener || listeners[i]._listener === listener) { - this.removeListener(method, listeners[i]); - } - } - } -}; - -module.exports = EventTarget; diff --git a/node_modules/express-ws/node_modules/ws/lib/extension.js b/node_modules/express-ws/node_modules/ws/lib/extension.js deleted file mode 100644 index 3f48d75..0000000 --- a/node_modules/express-ws/node_modules/ws/lib/extension.js +++ /dev/null @@ -1,211 +0,0 @@ -'use strict'; - -// -// Allowed token characters: -// -// '!', '#', '$', '%', '&', ''', '*', '+', '-', -// '.', 0-9, A-Z, '^', '_', '`', a-z, '|', '~' -// -// tokenChars[32] === 0 // ' ' -// tokenChars[33] === 1 // '!' -// tokenChars[34] === 0 // '"' -// ... -// -const tokenChars = [ - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 0 - 15 - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 16 - 31 - 0, 1, 0, 1, 1, 1, 1, 1, 0, 0, 1, 1, 0, 1, 1, 0, // 32 - 47 - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, // 48 - 63 - 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, // 64 - 79 - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 1, 1, // 80 - 95 - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, // 96 - 111 - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 0, 1, 0 // 112 - 127 -]; - -/** - * Adds an offer to the map of extension offers or a parameter to the map of - * parameters. - * - * @param {Object} dest The map of extension offers or parameters - * @param {String} name The extension or parameter name - * @param {(Object|Boolean|String)} elem The extension parameters or the - * parameter value - * @private - */ -function push (dest, name, elem) { - if (Object.prototype.hasOwnProperty.call(dest, name)) dest[name].push(elem); - else dest[name] = [elem]; -} - -/** - * Parses the `Sec-WebSocket-Extensions` header into an object. - * - * @param {String} header The field value of the header - * @return {Object} The parsed object - * @public - */ -function parse (header) { - const offers = {}; - - if (header === undefined || header === '') return offers; - - var params = {}; - var mustUnescape = false; - var isEscaping = false; - var inQuotes = false; - var extensionName; - var paramName; - var start = -1; - var end = -1; - - for (var i = 0; i < header.length; i++) { - const code = header.charCodeAt(i); - - if (extensionName === undefined) { - if (end === -1 && tokenChars[code] === 1) { - if (start === -1) start = i; - } else if (code === 0x20/* ' ' */|| code === 0x09/* '\t' */) { - if (end === -1 && start !== -1) end = i; - } else if (code === 0x3b/* ';' */ || code === 0x2c/* ',' */) { - if (start === -1) { - throw new SyntaxError(`Unexpected character at index ${i}`); - } - - if (end === -1) end = i; - const name = header.slice(start, end); - if (code === 0x2c) { - push(offers, name, params); - params = {}; - } else { - extensionName = name; - } - - start = end = -1; - } else { - throw new SyntaxError(`Unexpected character at index ${i}`); - } - } else if (paramName === undefined) { - if (end === -1 && tokenChars[code] === 1) { - if (start === -1) start = i; - } else if (code === 0x20 || code === 0x09) { - if (end === -1 && start !== -1) end = i; - } else if (code === 0x3b || code === 0x2c) { - if (start === -1) { - throw new SyntaxError(`Unexpected character at index ${i}`); - } - - if (end === -1) end = i; - push(params, header.slice(start, end), true); - if (code === 0x2c) { - push(offers, extensionName, params); - params = {}; - extensionName = undefined; - } - - start = end = -1; - } else if (code === 0x3d/* '=' */&& start !== -1 && end === -1) { - paramName = header.slice(start, i); - start = end = -1; - } else { - throw new SyntaxError(`Unexpected character at index ${i}`); - } - } else { - // - // The value of a quoted-string after unescaping must conform to the - // token ABNF, so only token characters are valid. - // Ref: https://tools.ietf.org/html/rfc6455#section-9.1 - // - if (isEscaping) { - if (tokenChars[code] !== 1) { - throw new SyntaxError(`Unexpected character at index ${i}`); - } - if (start === -1) start = i; - else if (!mustUnescape) mustUnescape = true; - isEscaping = false; - } else if (inQuotes) { - if (tokenChars[code] === 1) { - if (start === -1) start = i; - } else if (code === 0x22/* '"' */ && start !== -1) { - inQuotes = false; - end = i; - } else if (code === 0x5c/* '\' */) { - isEscaping = true; - } else { - throw new SyntaxError(`Unexpected character at index ${i}`); - } - } else if (code === 0x22 && header.charCodeAt(i - 1) === 0x3d) { - inQuotes = true; - } else if (end === -1 && tokenChars[code] === 1) { - if (start === -1) start = i; - } else if (start !== -1 && (code === 0x20 || code === 0x09)) { - if (end === -1) end = i; - } else if (code === 0x3b || code === 0x2c) { - if (start === -1) { - throw new SyntaxError(`Unexpected character at index ${i}`); - } - - if (end === -1) end = i; - var value = header.slice(start, end); - if (mustUnescape) { - value = value.replace(/\\/g, ''); - mustUnescape = false; - } - push(params, paramName, value); - if (code === 0x2c) { - push(offers, extensionName, params); - params = {}; - extensionName = undefined; - } - - paramName = undefined; - start = end = -1; - } else { - throw new SyntaxError(`Unexpected character at index ${i}`); - } - } - } - - if (start === -1 || inQuotes) { - throw new SyntaxError('Unexpected end of input'); - } - - if (end === -1) end = i; - const token = header.slice(start, end); - if (extensionName === undefined) { - push(offers, token, {}); - } else { - if (paramName === undefined) { - push(params, token, true); - } else if (mustUnescape) { - push(params, paramName, token.replace(/\\/g, '')); - } else { - push(params, paramName, token); - } - push(offers, extensionName, params); - } - - return offers; -} - -/** - * Builds the `Sec-WebSocket-Extensions` header field value. - * - * @param {Object} extensions The map of extensions and parameters to format - * @return {String} A string representing the given object - * @public - */ -function format (extensions) { - return Object.keys(extensions).map((extension) => { - var configurations = extensions[extension]; - if (!Array.isArray(configurations)) configurations = [configurations]; - return configurations.map((params) => { - return [extension].concat(Object.keys(params).map((k) => { - var values = params[k]; - if (!Array.isArray(values)) values = [values]; - return values.map((v) => v === true ? k : `${k}=${v}`).join('; '); - })).join('; '); - }).join(', '); - }).join(', '); -} - -module.exports = { format, parse }; diff --git a/node_modules/express-ws/node_modules/ws/lib/permessage-deflate.js b/node_modules/express-ws/node_modules/ws/lib/permessage-deflate.js deleted file mode 100644 index 0d54f03..0000000 --- a/node_modules/express-ws/node_modules/ws/lib/permessage-deflate.js +++ /dev/null @@ -1,516 +0,0 @@ -'use strict'; - -const Limiter = require('async-limiter'); -const zlib = require('zlib'); - -const bufferUtil = require('./buffer-util'); -const constants = require('./constants'); - -const TRAILER = Buffer.from([0x00, 0x00, 0xff, 0xff]); -const EMPTY_BLOCK = Buffer.from([0x00]); - -const kPerMessageDeflate = Symbol('permessage-deflate'); -const kWriteInProgress = Symbol('write-in-progress'); -const kPendingClose = Symbol('pending-close'); -const kTotalLength = Symbol('total-length'); -const kCallback = Symbol('callback'); -const kBuffers = Symbol('buffers'); -const kError = Symbol('error'); - -// -// We limit zlib concurrency, which prevents severe memory fragmentation -// as documented in https://github.com/nodejs/node/issues/8871#issuecomment-250915913 -// and https://github.com/websockets/ws/issues/1202 -// -// Intentionally global; it's the global thread pool that's an issue. -// -let zlibLimiter; - -/** - * permessage-deflate implementation. - */ -class PerMessageDeflate { - /** - * Creates a PerMessageDeflate instance. - * - * @param {Object} options Configuration options - * @param {Boolean} options.serverNoContextTakeover Request/accept disabling - * of server context takeover - * @param {Boolean} options.clientNoContextTakeover Advertise/acknowledge - * disabling of client context takeover - * @param {(Boolean|Number)} options.serverMaxWindowBits Request/confirm the - * use of a custom server window size - * @param {(Boolean|Number)} options.clientMaxWindowBits Advertise support - * for, or request, a custom client window size - * @param {Object} options.zlibDeflateOptions Options to pass to zlib on deflate - * @param {Object} options.zlibInflateOptions Options to pass to zlib on inflate - * @param {Number} options.threshold Size (in bytes) below which messages - * should not be compressed - * @param {Number} options.concurrencyLimit The number of concurrent calls to - * zlib - * @param {Boolean} isServer Create the instance in either server or client - * mode - * @param {Number} maxPayload The maximum allowed message length - */ - constructor (options, isServer, maxPayload) { - this._maxPayload = maxPayload | 0; - this._options = options || {}; - this._threshold = this._options.threshold !== undefined - ? this._options.threshold - : 1024; - this._isServer = !!isServer; - this._deflate = null; - this._inflate = null; - - this.params = null; - - if (!zlibLimiter) { - const concurrency = this._options.concurrencyLimit !== undefined - ? this._options.concurrencyLimit - : 10; - zlibLimiter = new Limiter({ concurrency }); - } - } - - /** - * @type {String} - */ - static get extensionName () { - return 'permessage-deflate'; - } - - /** - * Create an extension negotiation offer. - * - * @return {Object} Extension parameters - * @public - */ - offer () { - const params = {}; - - if (this._options.serverNoContextTakeover) { - params.server_no_context_takeover = true; - } - if (this._options.clientNoContextTakeover) { - params.client_no_context_takeover = true; - } - if (this._options.serverMaxWindowBits) { - params.server_max_window_bits = this._options.serverMaxWindowBits; - } - if (this._options.clientMaxWindowBits) { - params.client_max_window_bits = this._options.clientMaxWindowBits; - } else if (this._options.clientMaxWindowBits == null) { - params.client_max_window_bits = true; - } - - return params; - } - - /** - * Accept an extension negotiation offer/response. - * - * @param {Array} configurations The extension negotiation offers/reponse - * @return {Object} Accepted configuration - * @public - */ - accept (configurations) { - configurations = this.normalizeParams(configurations); - - this.params = this._isServer - ? this.acceptAsServer(configurations) - : this.acceptAsClient(configurations); - - return this.params; - } - - /** - * Releases all resources used by the extension. - * - * @public - */ - cleanup () { - if (this._inflate) { - if (this._inflate[kWriteInProgress]) { - this._inflate[kPendingClose] = true; - } else { - this._inflate.close(); - this._inflate = null; - } - } - if (this._deflate) { - if (this._deflate[kWriteInProgress]) { - this._deflate[kPendingClose] = true; - } else { - this._deflate.close(); - this._deflate = null; - } - } - } - - /** - * Accept an extension negotiation offer. - * - * @param {Array} offers The extension negotiation offers - * @return {Object} Accepted configuration - * @private - */ - acceptAsServer (offers) { - const opts = this._options; - const accepted = offers.find((params) => { - if ( - (opts.serverNoContextTakeover === false && - params.server_no_context_takeover) || - (params.server_max_window_bits && - (opts.serverMaxWindowBits === false || - (typeof opts.serverMaxWindowBits === 'number' && - opts.serverMaxWindowBits > params.server_max_window_bits))) || - (typeof opts.clientMaxWindowBits === 'number' && - !params.client_max_window_bits) - ) { - return false; - } - - return true; - }); - - if (!accepted) { - throw new Error('None of the extension offers can be accepted'); - } - - if (opts.serverNoContextTakeover) { - accepted.server_no_context_takeover = true; - } - if (opts.clientNoContextTakeover) { - accepted.client_no_context_takeover = true; - } - if (typeof opts.serverMaxWindowBits === 'number') { - accepted.server_max_window_bits = opts.serverMaxWindowBits; - } - if (typeof opts.clientMaxWindowBits === 'number') { - accepted.client_max_window_bits = opts.clientMaxWindowBits; - } else if ( - accepted.client_max_window_bits === true || - opts.clientMaxWindowBits === false - ) { - delete accepted.client_max_window_bits; - } - - return accepted; - } - - /** - * Accept the extension negotiation response. - * - * @param {Array} response The extension negotiation response - * @return {Object} Accepted configuration - * @private - */ - acceptAsClient (response) { - const params = response[0]; - - if ( - this._options.clientNoContextTakeover === false && - params.client_no_context_takeover - ) { - throw new Error('Unexpected parameter "client_no_context_takeover"'); - } - - if (!params.client_max_window_bits) { - if (typeof this._options.clientMaxWindowBits === 'number') { - params.client_max_window_bits = this._options.clientMaxWindowBits; - } - } else if ( - this._options.clientMaxWindowBits === false || - (typeof this._options.clientMaxWindowBits === 'number' && - params.client_max_window_bits > this._options.clientMaxWindowBits) - ) { - throw new Error( - 'Unexpected or invalid parameter "client_max_window_bits"' - ); - } - - return params; - } - - /** - * Normalize parameters. - * - * @param {Array} configurations The extension negotiation offers/reponse - * @return {Array} The offers/response with normalized parameters - * @private - */ - normalizeParams (configurations) { - configurations.forEach((params) => { - Object.keys(params).forEach((key) => { - var value = params[key]; - - if (value.length > 1) { - throw new Error(`Parameter "${key}" must have only a single value`); - } - - value = value[0]; - - if (key === 'client_max_window_bits') { - if (value !== true) { - const num = +value; - if (!Number.isInteger(num) || num < 8 || num > 15) { - throw new TypeError( - `Invalid value for parameter "${key}": ${value}` - ); - } - value = num; - } else if (!this._isServer) { - throw new TypeError( - `Invalid value for parameter "${key}": ${value}` - ); - } - } else if (key === 'server_max_window_bits') { - const num = +value; - if (!Number.isInteger(num) || num < 8 || num > 15) { - throw new TypeError( - `Invalid value for parameter "${key}": ${value}` - ); - } - value = num; - } else if ( - key === 'client_no_context_takeover' || - key === 'server_no_context_takeover' - ) { - if (value !== true) { - throw new TypeError( - `Invalid value for parameter "${key}": ${value}` - ); - } - } else { - throw new Error(`Unknown parameter "${key}"`); - } - - params[key] = value; - }); - }); - - return configurations; - } - - /** - * Decompress data. Concurrency limited by async-limiter. - * - * @param {Buffer} data Compressed data - * @param {Boolean} fin Specifies whether or not this is the last fragment - * @param {Function} callback Callback - * @public - */ - decompress (data, fin, callback) { - zlibLimiter.push((done) => { - this._decompress(data, fin, (err, result) => { - done(); - callback(err, result); - }); - }); - } - - /** - * Compress data. Concurrency limited by async-limiter. - * - * @param {Buffer} data Data to compress - * @param {Boolean} fin Specifies whether or not this is the last fragment - * @param {Function} callback Callback - * @public - */ - compress (data, fin, callback) { - zlibLimiter.push((done) => { - this._compress(data, fin, (err, result) => { - done(); - callback(err, result); - }); - }); - } - - /** - * Decompress data. - * - * @param {Buffer} data Compressed data - * @param {Boolean} fin Specifies whether or not this is the last fragment - * @param {Function} callback Callback - * @private - */ - _decompress (data, fin, callback) { - const endpoint = this._isServer ? 'client' : 'server'; - - if (!this._inflate) { - const key = `${endpoint}_max_window_bits`; - const windowBits = typeof this.params[key] !== 'number' - ? zlib.Z_DEFAULT_WINDOWBITS - : this.params[key]; - - this._inflate = zlib.createInflateRaw( - Object.assign({}, this._options.zlibInflateOptions, { windowBits }) - ); - this._inflate[kPerMessageDeflate] = this; - this._inflate[kTotalLength] = 0; - this._inflate[kBuffers] = []; - this._inflate.on('error', inflateOnError); - this._inflate.on('data', inflateOnData); - } - - this._inflate[kCallback] = callback; - this._inflate[kWriteInProgress] = true; - - this._inflate.write(data); - if (fin) this._inflate.write(TRAILER); - - this._inflate.flush(() => { - const err = this._inflate[kError]; - - if (err) { - this._inflate.close(); - this._inflate = null; - callback(err); - return; - } - - const data = bufferUtil.concat( - this._inflate[kBuffers], - this._inflate[kTotalLength] - ); - - if ( - (fin && this.params[`${endpoint}_no_context_takeover`]) || - this._inflate[kPendingClose] - ) { - this._inflate.close(); - this._inflate = null; - } else { - this._inflate[kWriteInProgress] = false; - this._inflate[kTotalLength] = 0; - this._inflate[kBuffers] = []; - } - - callback(null, data); - }); - } - - /** - * Compress data. - * - * @param {Buffer} data Data to compress - * @param {Boolean} fin Specifies whether or not this is the last fragment - * @param {Function} callback Callback - * @private - */ - _compress (data, fin, callback) { - if (!data || data.length === 0) { - process.nextTick(callback, null, EMPTY_BLOCK); - return; - } - - const endpoint = this._isServer ? 'server' : 'client'; - - if (!this._deflate) { - const key = `${endpoint}_max_window_bits`; - const windowBits = typeof this.params[key] !== 'number' - ? zlib.Z_DEFAULT_WINDOWBITS - : this.params[key]; - - this._deflate = zlib.createDeflateRaw( - Object.assign( - // TODO deprecate memLevel/level and recommend zlibDeflateOptions instead - { - memLevel: this._options.memLevel, - level: this._options.level - }, - this._options.zlibDeflateOptions, - { windowBits } - ) - ); - - this._deflate[kTotalLength] = 0; - this._deflate[kBuffers] = []; - - // - // `zlib.DeflateRaw` emits an `'error'` event only when an attempt to use - // it is made after it has already been closed. This cannot happen here, - // so we only add a listener for the `'data'` event. - // - this._deflate.on('data', deflateOnData); - } - - this._deflate[kWriteInProgress] = true; - - this._deflate.write(data); - this._deflate.flush(zlib.Z_SYNC_FLUSH, () => { - var data = bufferUtil.concat( - this._deflate[kBuffers], - this._deflate[kTotalLength] - ); - - if (fin) data = data.slice(0, data.length - 4); - - if ( - (fin && this.params[`${endpoint}_no_context_takeover`]) || - this._deflate[kPendingClose] - ) { - this._deflate.close(); - this._deflate = null; - } else { - this._deflate[kWriteInProgress] = false; - this._deflate[kTotalLength] = 0; - this._deflate[kBuffers] = []; - } - - callback(null, data); - }); - } -} - -module.exports = PerMessageDeflate; - -/** - * The listener of the `zlib.DeflateRaw` stream `'data'` event. - * - * @param {Buffer} chunk A chunk of data - * @private - */ -function deflateOnData (chunk) { - this[kBuffers].push(chunk); - this[kTotalLength] += chunk.length; -} - -/** - * The listener of the `zlib.InflateRaw` stream `'data'` event. - * - * @param {Buffer} chunk A chunk of data - * @private - */ -function inflateOnData (chunk) { - this[kTotalLength] += chunk.length; - - if ( - this[kPerMessageDeflate]._maxPayload < 1 || - this[kTotalLength] <= this[kPerMessageDeflate]._maxPayload - ) { - this[kBuffers].push(chunk); - return; - } - - this[kError] = new RangeError('Max payload size exceeded'); - this[kError][constants.kStatusCode] = 1009; - this.removeListener('data', inflateOnData); - this.reset(); -} - -/** - * The listener of the `zlib.InflateRaw` stream `'error'` event. - * - * @param {Error} err The emitted error - * @private - */ -function inflateOnError (err) { - // - // There is no need to call `Zlib#close()` as the handle is automatically - // closed when an error is emitted. - // - this[kPerMessageDeflate]._inflate = null; - err[constants.kStatusCode] = 1007; - this[kCallback](err); -} diff --git a/node_modules/express-ws/node_modules/ws/lib/receiver.js b/node_modules/express-ws/node_modules/ws/lib/receiver.js deleted file mode 100644 index 81dc0bf..0000000 --- a/node_modules/express-ws/node_modules/ws/lib/receiver.js +++ /dev/null @@ -1,513 +0,0 @@ -'use strict'; - -const stream = require('stream'); - -const PerMessageDeflate = require('./permessage-deflate'); -const bufferUtil = require('./buffer-util'); -const validation = require('./validation'); -const constants = require('./constants'); - -const GET_INFO = 0; -const GET_PAYLOAD_LENGTH_16 = 1; -const GET_PAYLOAD_LENGTH_64 = 2; -const GET_MASK = 3; -const GET_DATA = 4; -const INFLATING = 5; - -/** - * HyBi Receiver implementation. - * - * @extends stream.Writable - */ -class Receiver extends stream.Writable { - /** - * Creates a Receiver instance. - * - * @param {String} binaryType The type for binary data - * @param {Object} extensions An object containing the negotiated extensions - * @param {Number} maxPayload The maximum allowed message length - */ - constructor (binaryType, extensions, maxPayload) { - super(); - - this._binaryType = binaryType || constants.BINARY_TYPES[0]; - this[constants.kWebSocket] = undefined; - this._extensions = extensions || {}; - this._maxPayload = maxPayload | 0; - - this._bufferedBytes = 0; - this._buffers = []; - - this._compressed = false; - this._payloadLength = 0; - this._mask = undefined; - this._fragmented = 0; - this._masked = false; - this._fin = false; - this._opcode = 0; - - this._totalPayloadLength = 0; - this._messageLength = 0; - this._fragments = []; - - this._state = GET_INFO; - this._loop = false; - } - - /** - * Implements `Writable.prototype._write()`. - * - * @param {Buffer} chunk The chunk of data to write - * @param {String} encoding The character encoding of `chunk` - * @param {Function} cb Callback - */ - _write (chunk, encoding, cb) { - if (this._opcode === 0x08) return cb(); - - this._bufferedBytes += chunk.length; - this._buffers.push(chunk); - this.startLoop(cb); - } - - /** - * Consumes `n` bytes from the buffered data. - * - * @param {Number} n The number of bytes to consume - * @return {Buffer} The consumed bytes - * @private - */ - consume (n) { - this._bufferedBytes -= n; - - if (n === this._buffers[0].length) return this._buffers.shift(); - - if (n < this._buffers[0].length) { - const buf = this._buffers[0]; - this._buffers[0] = buf.slice(n); - return buf.slice(0, n); - } - - const dst = Buffer.allocUnsafe(n); - - do { - const buf = this._buffers[0]; - - if (n >= buf.length) { - this._buffers.shift().copy(dst, dst.length - n); - } else { - buf.copy(dst, dst.length - n, 0, n); - this._buffers[0] = buf.slice(n); - } - - n -= buf.length; - } while (n > 0); - - return dst; - } - - /** - * Starts the parsing loop. - * - * @param {Function} cb Callback - * @private - */ - startLoop (cb) { - var err; - this._loop = true; - - do { - switch (this._state) { - case GET_INFO: - err = this.getInfo(); - break; - case GET_PAYLOAD_LENGTH_16: - err = this.getPayloadLength16(); - break; - case GET_PAYLOAD_LENGTH_64: - err = this.getPayloadLength64(); - break; - case GET_MASK: - this.getMask(); - break; - case GET_DATA: - err = this.getData(cb); - break; - default: // `INFLATING` - this._loop = false; - return; - } - } while (this._loop); - - cb(err); - } - - /** - * Reads the first two bytes of a frame. - * - * @return {(RangeError|undefined)} A possible error - * @private - */ - getInfo () { - if (this._bufferedBytes < 2) { - this._loop = false; - return; - } - - const buf = this.consume(2); - - if ((buf[0] & 0x30) !== 0x00) { - this._loop = false; - return error(RangeError, 'RSV2 and RSV3 must be clear', true, 1002); - } - - const compressed = (buf[0] & 0x40) === 0x40; - - if (compressed && !this._extensions[PerMessageDeflate.extensionName]) { - this._loop = false; - return error(RangeError, 'RSV1 must be clear', true, 1002); - } - - this._fin = (buf[0] & 0x80) === 0x80; - this._opcode = buf[0] & 0x0f; - this._payloadLength = buf[1] & 0x7f; - - if (this._opcode === 0x00) { - if (compressed) { - this._loop = false; - return error(RangeError, 'RSV1 must be clear', true, 1002); - } - - if (!this._fragmented) { - this._loop = false; - return error(RangeError, 'invalid opcode 0', true, 1002); - } - - this._opcode = this._fragmented; - } else if (this._opcode === 0x01 || this._opcode === 0x02) { - if (this._fragmented) { - this._loop = false; - return error(RangeError, `invalid opcode ${this._opcode}`, true, 1002); - } - - this._compressed = compressed; - } else if (this._opcode > 0x07 && this._opcode < 0x0b) { - if (!this._fin) { - this._loop = false; - return error(RangeError, 'FIN must be set', true, 1002); - } - - if (compressed) { - this._loop = false; - return error(RangeError, 'RSV1 must be clear', true, 1002); - } - - if (this._payloadLength > 0x7d) { - this._loop = false; - return error( - RangeError, - `invalid payload length ${this._payloadLength}`, - true, - 1002 - ); - } - } else { - this._loop = false; - return error(RangeError, `invalid opcode ${this._opcode}`, true, 1002); - } - - if (!this._fin && !this._fragmented) this._fragmented = this._opcode; - this._masked = (buf[1] & 0x80) === 0x80; - - if (this._payloadLength === 126) this._state = GET_PAYLOAD_LENGTH_16; - else if (this._payloadLength === 127) this._state = GET_PAYLOAD_LENGTH_64; - else return this.haveLength(); - } - - /** - * Gets extended payload length (7+16). - * - * @return {(RangeError|undefined)} A possible error - * @private - */ - getPayloadLength16 () { - if (this._bufferedBytes < 2) { - this._loop = false; - return; - } - - this._payloadLength = this.consume(2).readUInt16BE(0); - return this.haveLength(); - } - - /** - * Gets extended payload length (7+64). - * - * @return {(RangeError|undefined)} A possible error - * @private - */ - getPayloadLength64 () { - if (this._bufferedBytes < 8) { - this._loop = false; - return; - } - - const buf = this.consume(8); - const num = buf.readUInt32BE(0); - - // - // The maximum safe integer in JavaScript is 2^53 - 1. An error is returned - // if payload length is greater than this number. - // - if (num > Math.pow(2, 53 - 32) - 1) { - this._loop = false; - return error( - RangeError, - 'Unsupported WebSocket frame: payload length > 2^53 - 1', - false, - 1009 - ); - } - - this._payloadLength = num * Math.pow(2, 32) + buf.readUInt32BE(4); - return this.haveLength(); - } - - /** - * Payload length has been read. - * - * @return {(RangeError|undefined)} A possible error - * @private - */ - haveLength () { - if (this._payloadLength && this._opcode < 0x08) { - this._totalPayloadLength += this._payloadLength; - if (this._totalPayloadLength > this._maxPayload && this._maxPayload > 0) { - this._loop = false; - return error(RangeError, 'Max payload size exceeded', false, 1009); - } - } - - if (this._masked) this._state = GET_MASK; - else this._state = GET_DATA; - } - - /** - * Reads mask bytes. - * - * @private - */ - getMask () { - if (this._bufferedBytes < 4) { - this._loop = false; - return; - } - - this._mask = this.consume(4); - this._state = GET_DATA; - } - - /** - * Reads data bytes. - * - * @param {Function} cb Callback - * @return {(Error|RangeError|undefined)} A possible error - * @private - */ - getData (cb) { - var data = constants.EMPTY_BUFFER; - - if (this._payloadLength) { - if (this._bufferedBytes < this._payloadLength) { - this._loop = false; - return; - } - - data = this.consume(this._payloadLength); - if (this._masked) bufferUtil.unmask(data, this._mask); - } - - if (this._opcode > 0x07) return this.controlMessage(data); - - if (this._compressed) { - this._state = INFLATING; - this.decompress(data, cb); - return; - } - - if (data.length) { - // - // This message is not compressed so its lenght is the sum of the payload - // length of all fragments. - // - this._messageLength = this._totalPayloadLength; - this._fragments.push(data); - } - - return this.dataMessage(); - } - - /** - * Decompresses data. - * - * @param {Buffer} data Compressed data - * @param {Function} cb Callback - * @private - */ - decompress (data, cb) { - const perMessageDeflate = this._extensions[PerMessageDeflate.extensionName]; - - perMessageDeflate.decompress(data, this._fin, (err, buf) => { - if (err) return cb(err); - - if (buf.length) { - this._messageLength += buf.length; - if (this._messageLength > this._maxPayload && this._maxPayload > 0) { - return cb(error(RangeError, 'Max payload size exceeded', false, 1009)); - } - - this._fragments.push(buf); - } - - const er = this.dataMessage(); - if (er) return cb(er); - - this.startLoop(cb); - }); - } - - /** - * Handles a data message. - * - * @return {(Error|undefined)} A possible error - * @private - */ - dataMessage () { - if (this._fin) { - const messageLength = this._messageLength; - const fragments = this._fragments; - - this._totalPayloadLength = 0; - this._messageLength = 0; - this._fragmented = 0; - this._fragments = []; - - if (this._opcode === 2) { - var data; - - if (this._binaryType === 'nodebuffer') { - data = toBuffer(fragments, messageLength); - } else if (this._binaryType === 'arraybuffer') { - data = toArrayBuffer(toBuffer(fragments, messageLength)); - } else { - data = fragments; - } - - this.emit('message', data); - } else { - const buf = toBuffer(fragments, messageLength); - - if (!validation.isValidUTF8(buf)) { - this._loop = false; - return error(Error, 'invalid UTF-8 sequence', true, 1007); - } - - this.emit('message', buf.toString()); - } - } - - this._state = GET_INFO; - } - - /** - * Handles a control message. - * - * @param {Buffer} data Data to handle - * @return {(Error|RangeError|undefined)} A possible error - * @private - */ - controlMessage (data) { - if (this._opcode === 0x08) { - this._loop = false; - - if (data.length === 0) { - this.emit('conclude', 1005, ''); - this.end(); - } else if (data.length === 1) { - return error(RangeError, 'invalid payload length 1', true, 1002); - } else { - const code = data.readUInt16BE(0); - - if (!validation.isValidStatusCode(code)) { - return error(RangeError, `invalid status code ${code}`, true, 1002); - } - - const buf = data.slice(2); - - if (!validation.isValidUTF8(buf)) { - return error(Error, 'invalid UTF-8 sequence', true, 1007); - } - - this.emit('conclude', code, buf.toString()); - this.end(); - } - - return; - } - - if (this._opcode === 0x09) this.emit('ping', data); - else this.emit('pong', data); - - this._state = GET_INFO; - } -} - -module.exports = Receiver; - -/** - * Builds an error object. - * - * @param {(Error|RangeError)} ErrorCtor The error constructor - * @param {String} message The error message - * @param {Boolean} prefix Specifies whether or not to add a default prefix to - * `message` - * @param {Number} statusCode The status code - * @return {(Error|RangeError)} The error - * @private - */ -function error (ErrorCtor, message, prefix, statusCode) { - const err = new ErrorCtor( - prefix ? `Invalid WebSocket frame: ${message}` : message - ); - - Error.captureStackTrace(err, error); - err[constants.kStatusCode] = statusCode; - return err; -} - -/** - * Makes a buffer from a list of fragments. - * - * @param {Buffer[]} fragments The list of fragments composing the message - * @param {Number} messageLength The length of the message - * @return {Buffer} - * @private - */ -function toBuffer (fragments, messageLength) { - if (fragments.length === 1) return fragments[0]; - if (fragments.length > 1) return bufferUtil.concat(fragments, messageLength); - return constants.EMPTY_BUFFER; -} - -/** - * Converts a buffer to an `ArrayBuffer`. - * - * @param {Buffer} The buffer to convert - * @return {ArrayBuffer} Converted buffer - */ -function toArrayBuffer (buf) { - if (buf.byteOffset === 0 && buf.byteLength === buf.buffer.byteLength) { - return buf.buffer; - } - - return buf.buffer.slice(buf.byteOffset, buf.byteOffset + buf.byteLength); -} diff --git a/node_modules/express-ws/node_modules/ws/lib/sender.js b/node_modules/express-ws/node_modules/ws/lib/sender.js deleted file mode 100644 index 060e553..0000000 --- a/node_modules/express-ws/node_modules/ws/lib/sender.js +++ /dev/null @@ -1,401 +0,0 @@ -'use strict'; - -const crypto = require('crypto'); - -const PerMessageDeflate = require('./permessage-deflate'); -const bufferUtil = require('./buffer-util'); -const validation = require('./validation'); -const constants = require('./constants'); - -/** - * HyBi Sender implementation. - */ -class Sender { - /** - * Creates a Sender instance. - * - * @param {net.Socket} socket The connection socket - * @param {Object} extensions An object containing the negotiated extensions - */ - constructor (socket, extensions) { - this._extensions = extensions || {}; - this._socket = socket; - - this._firstFragment = true; - this._compress = false; - - this._bufferedBytes = 0; - this._deflating = false; - this._queue = []; - } - - /** - * Frames a piece of data according to the HyBi WebSocket protocol. - * - * @param {Buffer} data The data to frame - * @param {Object} options Options object - * @param {Number} options.opcode The opcode - * @param {Boolean} options.readOnly Specifies whether `data` can be modified - * @param {Boolean} options.fin Specifies whether or not to set the FIN bit - * @param {Boolean} options.mask Specifies whether or not to mask `data` - * @param {Boolean} options.rsv1 Specifies whether or not to set the RSV1 bit - * @return {Buffer[]} The framed data as a list of `Buffer` instances - * @public - */ - static frame (data, options) { - const merge = data.length < 1024 || (options.mask && options.readOnly); - var offset = options.mask ? 6 : 2; - var payloadLength = data.length; - - if (data.length >= 65536) { - offset += 8; - payloadLength = 127; - } else if (data.length > 125) { - offset += 2; - payloadLength = 126; - } - - const target = Buffer.allocUnsafe(merge ? data.length + offset : offset); - - target[0] = options.fin ? options.opcode | 0x80 : options.opcode; - if (options.rsv1) target[0] |= 0x40; - - if (payloadLength === 126) { - target.writeUInt16BE(data.length, 2); - } else if (payloadLength === 127) { - target.writeUInt32BE(0, 2); - target.writeUInt32BE(data.length, 6); - } - - if (!options.mask) { - target[1] = payloadLength; - if (merge) { - data.copy(target, offset); - return [target]; - } - - return [target, data]; - } - - const mask = crypto.randomBytes(4); - - target[1] = payloadLength | 0x80; - target[offset - 4] = mask[0]; - target[offset - 3] = mask[1]; - target[offset - 2] = mask[2]; - target[offset - 1] = mask[3]; - - if (merge) { - bufferUtil.mask(data, mask, target, offset, data.length); - return [target]; - } - - bufferUtil.mask(data, mask, data, 0, data.length); - return [target, data]; - } - - /** - * Sends a close message to the other peer. - * - * @param {(Number|undefined)} code The status code component of the body - * @param {String} data The message component of the body - * @param {Boolean} mask Specifies whether or not to mask the message - * @param {Function} cb Callback - * @public - */ - close (code, data, mask, cb) { - var buf; - - if (code === undefined) { - buf = constants.EMPTY_BUFFER; - } else if (typeof code !== 'number' || !validation.isValidStatusCode(code)) { - throw new TypeError('First argument must be a valid error code number'); - } else if (data === undefined || data === '') { - buf = Buffer.allocUnsafe(2); - buf.writeUInt16BE(code, 0); - } else { - buf = Buffer.allocUnsafe(2 + Buffer.byteLength(data)); - buf.writeUInt16BE(code, 0); - buf.write(data, 2); - } - - if (this._deflating) { - this.enqueue([this.doClose, buf, mask, cb]); - } else { - this.doClose(buf, mask, cb); - } - } - - /** - * Frames and sends a close message. - * - * @param {Buffer} data The message to send - * @param {Boolean} mask Specifies whether or not to mask `data` - * @param {Function} cb Callback - * @private - */ - doClose (data, mask, cb) { - this.sendFrame(Sender.frame(data, { - fin: true, - rsv1: false, - opcode: 0x08, - mask, - readOnly: false - }), cb); - } - - /** - * Sends a ping message to the other peer. - * - * @param {*} data The message to send - * @param {Boolean} mask Specifies whether or not to mask `data` - * @param {Function} cb Callback - * @public - */ - ping (data, mask, cb) { - var readOnly = true; - - if (!Buffer.isBuffer(data)) { - if (data instanceof ArrayBuffer) { - data = Buffer.from(data); - } else if (ArrayBuffer.isView(data)) { - data = viewToBuffer(data); - } else { - data = Buffer.from(data); - readOnly = false; - } - } - - if (this._deflating) { - this.enqueue([this.doPing, data, mask, readOnly, cb]); - } else { - this.doPing(data, mask, readOnly, cb); - } - } - - /** - * Frames and sends a ping message. - * - * @param {*} data The message to send - * @param {Boolean} mask Specifies whether or not to mask `data` - * @param {Boolean} readOnly Specifies whether `data` can be modified - * @param {Function} cb Callback - * @private - */ - doPing (data, mask, readOnly, cb) { - this.sendFrame(Sender.frame(data, { - fin: true, - rsv1: false, - opcode: 0x09, - mask, - readOnly - }), cb); - } - - /** - * Sends a pong message to the other peer. - * - * @param {*} data The message to send - * @param {Boolean} mask Specifies whether or not to mask `data` - * @param {Function} cb Callback - * @public - */ - pong (data, mask, cb) { - var readOnly = true; - - if (!Buffer.isBuffer(data)) { - if (data instanceof ArrayBuffer) { - data = Buffer.from(data); - } else if (ArrayBuffer.isView(data)) { - data = viewToBuffer(data); - } else { - data = Buffer.from(data); - readOnly = false; - } - } - - if (this._deflating) { - this.enqueue([this.doPong, data, mask, readOnly, cb]); - } else { - this.doPong(data, mask, readOnly, cb); - } - } - - /** - * Frames and sends a pong message. - * - * @param {*} data The message to send - * @param {Boolean} mask Specifies whether or not to mask `data` - * @param {Boolean} readOnly Specifies whether `data` can be modified - * @param {Function} cb Callback - * @private - */ - doPong (data, mask, readOnly, cb) { - this.sendFrame(Sender.frame(data, { - fin: true, - rsv1: false, - opcode: 0x0a, - mask, - readOnly - }), cb); - } - - /** - * Sends a data message to the other peer. - * - * @param {*} data The message to send - * @param {Object} options Options object - * @param {Boolean} options.compress Specifies whether or not to compress `data` - * @param {Boolean} options.binary Specifies whether `data` is binary or text - * @param {Boolean} options.fin Specifies whether the fragment is the last one - * @param {Boolean} options.mask Specifies whether or not to mask `data` - * @param {Function} cb Callback - * @public - */ - send (data, options, cb) { - var opcode = options.binary ? 2 : 1; - var rsv1 = options.compress; - var readOnly = true; - - if (!Buffer.isBuffer(data)) { - if (data instanceof ArrayBuffer) { - data = Buffer.from(data); - } else if (ArrayBuffer.isView(data)) { - data = viewToBuffer(data); - } else { - data = Buffer.from(data); - readOnly = false; - } - } - - const perMessageDeflate = this._extensions[PerMessageDeflate.extensionName]; - - if (this._firstFragment) { - this._firstFragment = false; - if (rsv1 && perMessageDeflate) { - rsv1 = data.length >= perMessageDeflate._threshold; - } - this._compress = rsv1; - } else { - rsv1 = false; - opcode = 0; - } - - if (options.fin) this._firstFragment = true; - - if (perMessageDeflate) { - const opts = { - fin: options.fin, - rsv1, - opcode, - mask: options.mask, - readOnly - }; - - if (this._deflating) { - this.enqueue([this.dispatch, data, this._compress, opts, cb]); - } else { - this.dispatch(data, this._compress, opts, cb); - } - } else { - this.sendFrame(Sender.frame(data, { - fin: options.fin, - rsv1: false, - opcode, - mask: options.mask, - readOnly - }), cb); - } - } - - /** - * Dispatches a data message. - * - * @param {Buffer} data The message to send - * @param {Boolean} compress Specifies whether or not to compress `data` - * @param {Object} options Options object - * @param {Number} options.opcode The opcode - * @param {Boolean} options.readOnly Specifies whether `data` can be modified - * @param {Boolean} options.fin Specifies whether or not to set the FIN bit - * @param {Boolean} options.mask Specifies whether or not to mask `data` - * @param {Boolean} options.rsv1 Specifies whether or not to set the RSV1 bit - * @param {Function} cb Callback - * @private - */ - dispatch (data, compress, options, cb) { - if (!compress) { - this.sendFrame(Sender.frame(data, options), cb); - return; - } - - const perMessageDeflate = this._extensions[PerMessageDeflate.extensionName]; - - this._deflating = true; - perMessageDeflate.compress(data, options.fin, (_, buf) => { - options.readOnly = false; - this.sendFrame(Sender.frame(buf, options), cb); - this._deflating = false; - this.dequeue(); - }); - } - - /** - * Executes queued send operations. - * - * @private - */ - dequeue () { - while (!this._deflating && this._queue.length) { - const params = this._queue.shift(); - - this._bufferedBytes -= params[1].length; - params[0].apply(this, params.slice(1)); - } - } - - /** - * Enqueues a send operation. - * - * @param {Array} params Send operation parameters. - * @private - */ - enqueue (params) { - this._bufferedBytes += params[1].length; - this._queue.push(params); - } - - /** - * Sends a frame. - * - * @param {Buffer[]} list The frame to send - * @param {Function} cb Callback - * @private - */ - sendFrame (list, cb) { - if (list.length === 2) { - this._socket.write(list[0]); - this._socket.write(list[1], cb); - } else { - this._socket.write(list[0], cb); - } - } -} - -module.exports = Sender; - -/** - * Converts an `ArrayBuffer` view into a buffer. - * - * @param {(DataView|TypedArray)} view The view to convert - * @return {Buffer} Converted view - * @private - */ -function viewToBuffer (view) { - const buf = Buffer.from(view.buffer); - - if (view.byteLength !== view.buffer.byteLength) { - return buf.slice(view.byteOffset, view.byteOffset + view.byteLength); - } - - return buf; -} diff --git a/node_modules/express-ws/node_modules/ws/lib/validation.js b/node_modules/express-ws/node_modules/ws/lib/validation.js deleted file mode 100644 index 06269fc..0000000 --- a/node_modules/express-ws/node_modules/ws/lib/validation.js +++ /dev/null @@ -1,29 +0,0 @@ -'use strict'; - -try { - const isValidUTF8 = require('utf-8-validate'); - - exports.isValidUTF8 = typeof isValidUTF8 === 'object' - ? isValidUTF8.Validation.isValidUTF8 // utf-8-validate@<3.0.0 - : isValidUTF8; -} catch (e) /* istanbul ignore next */ { - exports.isValidUTF8 = () => true; -} - -/** - * Checks if a status code is allowed in a close frame. - * - * @param {Number} code The status code - * @return {Boolean} `true` if the status code is valid, else `false` - * @public - */ -exports.isValidStatusCode = (code) => { - return ( - (code >= 1000 && - code <= 1013 && - code !== 1004 && - code !== 1005 && - code !== 1006) || - (code >= 3000 && code <= 4999) - ); -}; diff --git a/node_modules/express-ws/node_modules/ws/lib/websocket-server.js b/node_modules/express-ws/node_modules/ws/lib/websocket-server.js deleted file mode 100644 index 70513ed..0000000 --- a/node_modules/express-ws/node_modules/ws/lib/websocket-server.js +++ /dev/null @@ -1,357 +0,0 @@ -'use strict'; - -const EventEmitter = require('events'); -const crypto = require('crypto'); -const http = require('http'); -const url = require('url'); - -const PerMessageDeflate = require('./permessage-deflate'); -const extension = require('./extension'); -const constants = require('./constants'); -const WebSocket = require('./websocket'); - -/** - * Class representing a WebSocket server. - * - * @extends EventEmitter - */ -class WebSocketServer extends EventEmitter { - /** - * Create a `WebSocketServer` instance. - * - * @param {Object} options Configuration options - * @param {String} options.host The hostname where to bind the server - * @param {Number} options.port The port where to bind the server - * @param {http.Server} options.server A pre-created HTTP/S server to use - * @param {Function} options.verifyClient An hook to reject connections - * @param {Function} options.handleProtocols An hook to handle protocols - * @param {String} options.path Accept only connections matching this path - * @param {Boolean} options.noServer Enable no server mode - * @param {Boolean} options.clientTracking Specifies whether or not to track clients - * @param {(Boolean|Object)} options.perMessageDeflate Enable/disable permessage-deflate - * @param {Number} options.maxPayload The maximum allowed message size - * @param {Function} callback A listener for the `listening` event - */ - constructor (options, callback) { - super(); - - options = Object.assign({ - maxPayload: 100 * 1024 * 1024, - perMessageDeflate: false, - handleProtocols: null, - clientTracking: true, - verifyClient: null, - noServer: false, - backlog: null, // use default (511 as implemented in net.js) - server: null, - host: null, - path: null, - port: null - }, options); - - if (options.port == null && !options.server && !options.noServer) { - throw new TypeError( - 'One of the "port", "server", or "noServer" options must be specified' - ); - } - - if (options.port != null) { - this._server = http.createServer((req, res) => { - const body = http.STATUS_CODES[426]; - - res.writeHead(426, { - 'Content-Length': body.length, - 'Content-Type': 'text/plain' - }); - res.end(body); - }); - this._server.listen(options.port, options.host, options.backlog, callback); - } else if (options.server) { - this._server = options.server; - } - - if (this._server) { - this._removeListeners = addListeners(this._server, { - listening: this.emit.bind(this, 'listening'), - error: this.emit.bind(this, 'error'), - upgrade: (req, socket, head) => { - this.handleUpgrade(req, socket, head, (ws) => { - this.emit('connection', ws, req); - }); - } - }); - } - - if (options.perMessageDeflate === true) options.perMessageDeflate = {}; - if (options.clientTracking) this.clients = new Set(); - this.options = options; - } - - /** - * Returns the bound address, the address family name, and port of the server - * as reported by the operating system if listening on an IP socket. - * If the server is listening on a pipe or UNIX domain socket, the name is - * returned as a string. - * - * @return {(Object|String|null)} The address of the server - * @public - */ - address () { - if (this.options.noServer) { - throw new Error('The server is operating in "noServer" mode'); - } - - if (!this._server) return null; - return this._server.address(); - } - - /** - * Close the server. - * - * @param {Function} cb Callback - * @public - */ - close (cb) { - // - // Terminate all associated clients. - // - if (this.clients) { - for (const client of this.clients) client.terminate(); - } - - const server = this._server; - - if (server) { - this._removeListeners(); - this._removeListeners = this._server = null; - - // - // Close the http server if it was internally created. - // - if (this.options.port != null) return server.close(cb); - } - - if (cb) cb(); - } - - /** - * See if a given request should be handled by this server instance. - * - * @param {http.IncomingMessage} req Request object to inspect - * @return {Boolean} `true` if the request is valid, else `false` - * @public - */ - shouldHandle (req) { - if (this.options.path && url.parse(req.url).pathname !== this.options.path) { - return false; - } - - return true; - } - - /** - * Handle a HTTP Upgrade request. - * - * @param {http.IncomingMessage} req The request object - * @param {net.Socket} socket The network socket between the server and client - * @param {Buffer} head The first packet of the upgraded stream - * @param {Function} cb Callback - * @public - */ - handleUpgrade (req, socket, head, cb) { - socket.on('error', socketOnError); - - const version = +req.headers['sec-websocket-version']; - const extensions = {}; - - if ( - req.method !== 'GET' || req.headers.upgrade.toLowerCase() !== 'websocket' || - !req.headers['sec-websocket-key'] || (version !== 8 && version !== 13) || - !this.shouldHandle(req) - ) { - return abortHandshake(socket, 400); - } - - if (this.options.perMessageDeflate) { - const perMessageDeflate = new PerMessageDeflate( - this.options.perMessageDeflate, - true, - this.options.maxPayload - ); - - try { - const offers = extension.parse( - req.headers['sec-websocket-extensions'] - ); - - if (offers[PerMessageDeflate.extensionName]) { - perMessageDeflate.accept(offers[PerMessageDeflate.extensionName]); - extensions[PerMessageDeflate.extensionName] = perMessageDeflate; - } - } catch (err) { - return abortHandshake(socket, 400); - } - } - - // - // Optionally call external client verification handler. - // - if (this.options.verifyClient) { - const info = { - origin: req.headers[`${version === 8 ? 'sec-websocket-origin' : 'origin'}`], - secure: !!(req.connection.authorized || req.connection.encrypted), - req - }; - - if (this.options.verifyClient.length === 2) { - this.options.verifyClient(info, (verified, code, message, headers) => { - if (!verified) { - return abortHandshake(socket, code || 401, message, headers); - } - - this.completeUpgrade(extensions, req, socket, head, cb); - }); - return; - } - - if (!this.options.verifyClient(info)) return abortHandshake(socket, 401); - } - - this.completeUpgrade(extensions, req, socket, head, cb); - } - - /** - * Upgrade the connection to WebSocket. - * - * @param {Object} extensions The accepted extensions - * @param {http.IncomingMessage} req The request object - * @param {net.Socket} socket The network socket between the server and client - * @param {Buffer} head The first packet of the upgraded stream - * @param {Function} cb Callback - * @private - */ - completeUpgrade (extensions, req, socket, head, cb) { - // - // Destroy the socket if the client has already sent a FIN packet. - // - if (!socket.readable || !socket.writable) return socket.destroy(); - - const key = crypto.createHash('sha1') - .update(req.headers['sec-websocket-key'] + constants.GUID, 'binary') - .digest('base64'); - - const headers = [ - 'HTTP/1.1 101 Switching Protocols', - 'Upgrade: websocket', - 'Connection: Upgrade', - `Sec-WebSocket-Accept: ${key}` - ]; - - const ws = new WebSocket(null); - var protocol = req.headers['sec-websocket-protocol']; - - if (protocol) { - protocol = protocol.trim().split(/ *, */); - - // - // Optionally call external protocol selection handler. - // - if (this.options.handleProtocols) { - protocol = this.options.handleProtocols(protocol, req); - } else { - protocol = protocol[0]; - } - - if (protocol) { - headers.push(`Sec-WebSocket-Protocol: ${protocol}`); - ws.protocol = protocol; - } - } - - if (extensions[PerMessageDeflate.extensionName]) { - const params = extensions[PerMessageDeflate.extensionName].params; - const value = extension.format({ - [PerMessageDeflate.extensionName]: [params] - }); - headers.push(`Sec-WebSocket-Extensions: ${value}`); - ws._extensions = extensions; - } - - // - // Allow external modification/inspection of handshake headers. - // - this.emit('headers', headers, req); - - socket.write(headers.concat('\r\n').join('\r\n')); - socket.removeListener('error', socketOnError); - - ws.setSocket(socket, head, this.options.maxPayload); - - if (this.clients) { - this.clients.add(ws); - ws.on('close', () => this.clients.delete(ws)); - } - - cb(ws); - } -} - -module.exports = WebSocketServer; - -/** - * Add event listeners on an `EventEmitter` using a map of - * pairs. - * - * @param {EventEmitter} server The event emitter - * @param {Object.} map The listeners to add - * @return {Function} A function that will remove the added listeners when called - * @private - */ -function addListeners (server, map) { - for (const event of Object.keys(map)) server.on(event, map[event]); - - return function removeListeners () { - for (const event of Object.keys(map)) { - server.removeListener(event, map[event]); - } - }; -} - -/** - * Handle premature socket errors. - * - * @private - */ -function socketOnError () { - this.destroy(); -} - -/** - * Close the connection when preconditions are not fulfilled. - * - * @param {net.Socket} socket The socket of the upgrade request - * @param {Number} code The HTTP response status code - * @param {String} [message] The HTTP response body - * @param {Object} [headers] Additional HTTP response headers - * @private - */ -function abortHandshake (socket, code, message, headers) { - if (socket.writable) { - message = message || http.STATUS_CODES[code]; - headers = Object.assign({ - 'Connection': 'close', - 'Content-type': 'text/html', - 'Content-Length': Buffer.byteLength(message) - }, headers); - - socket.write( - `HTTP/1.1 ${code} ${http.STATUS_CODES[code]}\r\n` + - Object.keys(headers).map(h => `${h}: ${headers[h]}`).join('\r\n') + - '\r\n\r\n' + - message - ); - } - - socket.removeListener('error', socketOnError); - socket.destroy(); -} diff --git a/node_modules/express-ws/node_modules/ws/lib/websocket.js b/node_modules/express-ws/node_modules/ws/lib/websocket.js deleted file mode 100644 index f2bdf0d..0000000 --- a/node_modules/express-ws/node_modules/ws/lib/websocket.js +++ /dev/null @@ -1,828 +0,0 @@ -'use strict'; - -const EventEmitter = require('events'); -const crypto = require('crypto'); -const https = require('https'); -const http = require('http'); -const net = require('net'); -const tls = require('tls'); -const url = require('url'); - -const PerMessageDeflate = require('./permessage-deflate'); -const EventTarget = require('./event-target'); -const extension = require('./extension'); -const constants = require('./constants'); -const Receiver = require('./receiver'); -const Sender = require('./sender'); - -const readyStates = ['CONNECTING', 'OPEN', 'CLOSING', 'CLOSED']; -const kWebSocket = constants.kWebSocket; -const protocolVersions = [8, 13]; -const closeTimeout = 30 * 1000; // Allow 30 seconds to terminate the connection cleanly. - -/** - * Class representing a WebSocket. - * - * @extends EventEmitter - */ -class WebSocket extends EventEmitter { - /** - * Create a new `WebSocket`. - * - * @param {(String|url.Url|url.URL)} address The URL to which to connect - * @param {(String|String[])} protocols The subprotocols - * @param {Object} options Connection options - */ - constructor (address, protocols, options) { - super(); - - this.readyState = WebSocket.CONNECTING; - this.protocol = ''; - - this._binaryType = constants.BINARY_TYPES[0]; - this._closeFrameReceived = false; - this._closeFrameSent = false; - this._closeMessage = ''; - this._closeTimer = null; - this._closeCode = 1006; - this._extensions = {}; - this._isServer = true; - this._receiver = null; - this._sender = null; - this._socket = null; - - if (address !== null) { - if (Array.isArray(protocols)) { - protocols = protocols.join(', '); - } else if (typeof protocols === 'object' && protocols !== null) { - options = protocols; - protocols = undefined; - } - - initAsClient.call(this, address, protocols, options); - } - } - - get CONNECTING () { return WebSocket.CONNECTING; } - get CLOSING () { return WebSocket.CLOSING; } - get CLOSED () { return WebSocket.CLOSED; } - get OPEN () { return WebSocket.OPEN; } - - /** - * This deviates from the WHATWG interface since ws doesn't support the required - * default "blob" type (instead we define a custom "nodebuffer" type). - * - * @type {String} - */ - get binaryType () { - return this._binaryType; - } - - set binaryType (type) { - if (constants.BINARY_TYPES.indexOf(type) < 0) return; - - this._binaryType = type; - - // - // Allow to change `binaryType` on the fly. - // - if (this._receiver) this._receiver._binaryType = type; - } - - /** - * @type {Number} - */ - get bufferedAmount () { - if (!this._socket) return 0; - - // - // `socket.bufferSize` is `undefined` if the socket is closed. - // - return (this._socket.bufferSize || 0) + this._sender._bufferedBytes; - } - - /** - * @type {String} - */ - get extensions () { - return Object.keys(this._extensions).join(); - } - - /** - * Set up the socket and the internal resources. - * - * @param {net.Socket} socket The network socket between the server and client - * @param {Buffer} head The first packet of the upgraded stream - * @param {Number} maxPayload The maximum allowed message size - * @private - */ - setSocket (socket, head, maxPayload) { - const receiver = new Receiver( - this._binaryType, - this._extensions, - maxPayload - ); - - this._sender = new Sender(socket, this._extensions); - this._receiver = receiver; - this._socket = socket; - - receiver[kWebSocket] = this; - socket[kWebSocket] = this; - - receiver.on('conclude', receiverOnConclude); - receiver.on('drain', receiverOnDrain); - receiver.on('error', receiverOnError); - receiver.on('message', receiverOnMessage); - receiver.on('ping', receiverOnPing); - receiver.on('pong', receiverOnPong); - - socket.setTimeout(0); - socket.setNoDelay(); - - if (head.length > 0) socket.unshift(head); - - socket.on('close', socketOnClose); - socket.on('data', socketOnData); - socket.on('end', socketOnEnd); - socket.on('error', socketOnError); - - this.readyState = WebSocket.OPEN; - this.emit('open'); - } - - /** - * Emit the `'close'` event. - * - * @private - */ - emitClose () { - this.readyState = WebSocket.CLOSED; - - if (!this._socket) { - this.emit('close', this._closeCode, this._closeMessage); - return; - } - - if (this._extensions[PerMessageDeflate.extensionName]) { - this._extensions[PerMessageDeflate.extensionName].cleanup(); - } - - this._receiver.removeAllListeners(); - this.emit('close', this._closeCode, this._closeMessage); - } - - /** - * Start a closing handshake. - * - * +----------+ +-----------+ +----------+ - * - - -|ws.close()|-->|close frame|-->|ws.close()|- - - - * | +----------+ +-----------+ +----------+ | - * +----------+ +-----------+ | - * CLOSING |ws.close()|<--|close frame|<--+-----+ CLOSING - * +----------+ +-----------+ | - * | | | +---+ | - * +------------------------+-->|fin| - - - - - * | +---+ | +---+ - * - - - - -|fin|<---------------------+ - * +---+ - * - * @param {Number} code Status code explaining why the connection is closing - * @param {String} data A string explaining why the connection is closing - * @public - */ - close (code, data) { - if (this.readyState === WebSocket.CLOSED) return; - if (this.readyState === WebSocket.CONNECTING) { - const msg = 'WebSocket was closed before the connection was established'; - return abortHandshake(this, this._req, msg); - } - - if (this.readyState === WebSocket.CLOSING) { - if (this._closeFrameSent && this._closeFrameReceived) this._socket.end(); - return; - } - - this.readyState = WebSocket.CLOSING; - this._sender.close(code, data, !this._isServer, (err) => { - // - // This error is handled by the `'error'` listener on the socket. We only - // want to know if the close frame has been sent here. - // - if (err) return; - - this._closeFrameSent = true; - - if (this._socket.writable) { - if (this._closeFrameReceived) this._socket.end(); - - // - // Ensure that the connection is closed even if the closing handshake - // fails. - // - this._closeTimer = setTimeout( - this._socket.destroy.bind(this._socket), - closeTimeout - ); - } - }); - } - - /** - * Send a ping. - * - * @param {*} data The data to send - * @param {Boolean} mask Indicates whether or not to mask `data` - * @param {Function} cb Callback which is executed when the ping is sent - * @public - */ - ping (data, mask, cb) { - if (typeof data === 'function') { - cb = data; - data = mask = undefined; - } else if (typeof mask === 'function') { - cb = mask; - mask = undefined; - } - - if (this.readyState !== WebSocket.OPEN) { - const err = new Error( - `WebSocket is not open: readyState ${this.readyState} ` + - `(${readyStates[this.readyState]})` - ); - - if (cb) return cb(err); - throw err; - } - - if (typeof data === 'number') data = data.toString(); - if (mask === undefined) mask = !this._isServer; - this._sender.ping(data || constants.EMPTY_BUFFER, mask, cb); - } - - /** - * Send a pong. - * - * @param {*} data The data to send - * @param {Boolean} mask Indicates whether or not to mask `data` - * @param {Function} cb Callback which is executed when the pong is sent - * @public - */ - pong (data, mask, cb) { - if (typeof data === 'function') { - cb = data; - data = mask = undefined; - } else if (typeof mask === 'function') { - cb = mask; - mask = undefined; - } - - if (this.readyState !== WebSocket.OPEN) { - const err = new Error( - `WebSocket is not open: readyState ${this.readyState} ` + - `(${readyStates[this.readyState]})` - ); - - if (cb) return cb(err); - throw err; - } - - if (typeof data === 'number') data = data.toString(); - if (mask === undefined) mask = !this._isServer; - this._sender.pong(data || constants.EMPTY_BUFFER, mask, cb); - } - - /** - * Send a data message. - * - * @param {*} data The message to send - * @param {Object} options Options object - * @param {Boolean} options.compress Specifies whether or not to compress `data` - * @param {Boolean} options.binary Specifies whether `data` is binary or text - * @param {Boolean} options.fin Specifies whether the fragment is the last one - * @param {Boolean} options.mask Specifies whether or not to mask `data` - * @param {Function} cb Callback which is executed when data is written out - * @public - */ - send (data, options, cb) { - if (typeof options === 'function') { - cb = options; - options = {}; - } - - if (this.readyState !== WebSocket.OPEN) { - const err = new Error( - `WebSocket is not open: readyState ${this.readyState} ` + - `(${readyStates[this.readyState]})` - ); - - if (cb) return cb(err); - throw err; - } - - if (typeof data === 'number') data = data.toString(); - - const opts = Object.assign({ - binary: typeof data !== 'string', - mask: !this._isServer, - compress: true, - fin: true - }, options); - - if (!this._extensions[PerMessageDeflate.extensionName]) { - opts.compress = false; - } - - this._sender.send(data || constants.EMPTY_BUFFER, opts, cb); - } - - /** - * Forcibly close the connection. - * - * @public - */ - terminate () { - if (this.readyState === WebSocket.CLOSED) return; - if (this.readyState === WebSocket.CONNECTING) { - const msg = 'WebSocket was closed before the connection was established'; - return abortHandshake(this, this._req, msg); - } - - if (this._socket) { - this.readyState = WebSocket.CLOSING; - this._socket.destroy(); - } - } -} - -readyStates.forEach((readyState, i) => { - WebSocket[readyStates[i]] = i; -}); - -// -// Add the `onopen`, `onerror`, `onclose`, and `onmessage` attributes. -// See https://html.spec.whatwg.org/multipage/comms.html#the-websocket-interface -// -['open', 'error', 'close', 'message'].forEach((method) => { - Object.defineProperty(WebSocket.prototype, `on${method}`, { - /** - * Return the listener of the event. - * - * @return {(Function|undefined)} The event listener or `undefined` - * @public - */ - get () { - const listeners = this.listeners(method); - for (var i = 0; i < listeners.length; i++) { - if (listeners[i]._listener) return listeners[i]._listener; - } - }, - /** - * Add a listener for the event. - * - * @param {Function} listener The listener to add - * @public - */ - set (listener) { - const listeners = this.listeners(method); - for (var i = 0; i < listeners.length; i++) { - // - // Remove only the listeners added via `addEventListener`. - // - if (listeners[i]._listener) this.removeListener(method, listeners[i]); - } - this.addEventListener(method, listener); - } - }); -}); - -WebSocket.prototype.addEventListener = EventTarget.addEventListener; -WebSocket.prototype.removeEventListener = EventTarget.removeEventListener; - -module.exports = WebSocket; - -/** - * Initialize a WebSocket client. - * - * @param {(String|url.Url|url.URL)} address The URL to which to connect - * @param {String} protocols The subprotocols - * @param {Object} options Connection options - * @param {(Boolean|Object)} options.perMessageDeflate Enable/disable permessage-deflate - * @param {Number} options.handshakeTimeout Timeout in milliseconds for the handshake request - * @param {Number} options.protocolVersion Value of the `Sec-WebSocket-Version` header - * @param {String} options.origin Value of the `Origin` or `Sec-WebSocket-Origin` header - * @private - */ -function initAsClient (address, protocols, options) { - options = Object.assign({ - protocolVersion: protocolVersions[1], - perMessageDeflate: true - }, options, { - createConnection: undefined, - socketPath: undefined, - hostname: undefined, - protocol: undefined, - timeout: undefined, - method: undefined, - auth: undefined, - host: undefined, - path: undefined, - port: undefined - }); - - if (protocolVersions.indexOf(options.protocolVersion) === -1) { - throw new RangeError( - `Unsupported protocol version: ${options.protocolVersion} ` + - `(supported versions: ${protocolVersions.join(', ')})` - ); - } - - this._isServer = false; - - var parsedUrl; - - if (typeof address === 'object' && address.href !== undefined) { - parsedUrl = address; - this.url = address.href; - } else { - parsedUrl = url.parse(address); - this.url = address; - } - - const isUnixSocket = parsedUrl.protocol === 'ws+unix:'; - - if (!parsedUrl.host && (!isUnixSocket || !parsedUrl.pathname)) { - throw new Error(`Invalid URL: ${this.url}`); - } - - const isSecure = parsedUrl.protocol === 'wss:' || parsedUrl.protocol === 'https:'; - const key = crypto.randomBytes(16).toString('base64'); - const httpObj = isSecure ? https : http; - const path = parsedUrl.search - ? `${parsedUrl.pathname || '/'}${parsedUrl.search}` - : parsedUrl.pathname || '/'; - var perMessageDeflate; - - options.createConnection = isSecure ? tlsConnect : netConnect; - options.port = parsedUrl.port || (isSecure ? 443 : 80); - options.host = parsedUrl.hostname.startsWith('[') - ? parsedUrl.hostname.slice(1, -1) - : parsedUrl.hostname; - options.headers = Object.assign({ - 'Sec-WebSocket-Version': options.protocolVersion, - 'Sec-WebSocket-Key': key, - 'Connection': 'Upgrade', - 'Upgrade': 'websocket' - }, options.headers); - options.path = path; - - if (options.perMessageDeflate) { - perMessageDeflate = new PerMessageDeflate( - options.perMessageDeflate !== true ? options.perMessageDeflate : {}, - false - ); - options.headers['Sec-WebSocket-Extensions'] = extension.format({ - [PerMessageDeflate.extensionName]: perMessageDeflate.offer() - }); - } - if (protocols) { - options.headers['Sec-WebSocket-Protocol'] = protocols; - } - if (options.origin) { - if (options.protocolVersion < 13) { - options.headers['Sec-WebSocket-Origin'] = options.origin; - } else { - options.headers.Origin = options.origin; - } - } - if (parsedUrl.auth) { - options.auth = parsedUrl.auth; - } else if (parsedUrl.username || parsedUrl.password) { - options.auth = `${parsedUrl.username}:${parsedUrl.password}`; - } - - if (isUnixSocket) { - const parts = path.split(':'); - - if (options.agent == null && process.versions.modules < 57) { - // - // Setting `socketPath` in conjunction with `createConnection` without an - // agent throws an error on Node.js < 8. Work around the issue by using a - // different property. - // - options._socketPath = parts[0]; - } else { - options.socketPath = parts[0]; - } - - options.path = parts[1]; - } - - var req = this._req = httpObj.get(options); - - if (options.handshakeTimeout) { - req.setTimeout( - options.handshakeTimeout, - () => abortHandshake(this, req, 'Opening handshake has timed out') - ); - } - - req.on('error', (err) => { - if (this._req.aborted) return; - - req = this._req = null; - this.readyState = WebSocket.CLOSING; - this.emit('error', err); - this.emitClose(); - }); - - req.on('response', (res) => { - if (this.emit('unexpected-response', req, res)) return; - - abortHandshake(this, req, `Unexpected server response: ${res.statusCode}`); - }); - - req.on('upgrade', (res, socket, head) => { - this.emit('upgrade', res); - - // - // The user may have closed the connection from a listener of the `upgrade` - // event. - // - if (this.readyState !== WebSocket.CONNECTING) return; - - req = this._req = null; - - const digest = crypto.createHash('sha1') - .update(key + constants.GUID, 'binary') - .digest('base64'); - - if (res.headers['sec-websocket-accept'] !== digest) { - abortHandshake(this, socket, 'Invalid Sec-WebSocket-Accept header'); - return; - } - - const serverProt = res.headers['sec-websocket-protocol']; - const protList = (protocols || '').split(/, */); - var protError; - - if (!protocols && serverProt) { - protError = 'Server sent a subprotocol but none was requested'; - } else if (protocols && !serverProt) { - protError = 'Server sent no subprotocol'; - } else if (serverProt && protList.indexOf(serverProt) === -1) { - protError = 'Server sent an invalid subprotocol'; - } - - if (protError) { - abortHandshake(this, socket, protError); - return; - } - - if (serverProt) this.protocol = serverProt; - - if (perMessageDeflate) { - try { - const extensions = extension.parse( - res.headers['sec-websocket-extensions'] - ); - - if (extensions[PerMessageDeflate.extensionName]) { - perMessageDeflate.accept( - extensions[PerMessageDeflate.extensionName] - ); - this._extensions[PerMessageDeflate.extensionName] = perMessageDeflate; - } - } catch (err) { - abortHandshake(this, socket, 'Invalid Sec-WebSocket-Extensions header'); - return; - } - } - - this.setSocket(socket, head, 0); - }); -} - -/** - * Create a `net.Socket` and initiate a connection. - * - * @param {Object} options Connection options - * @return {net.Socket} The newly created socket used to start the connection - * @private - */ -function netConnect (options) { - options.path = options.socketPath || options._socketPath || undefined; - return net.connect(options); -} - -/** - * Create a `tls.TLSSocket` and initiate a connection. - * - * @param {Object} options Connection options - * @return {tls.TLSSocket} The newly created socket used to start the connection - * @private - */ -function tlsConnect (options) { - options.path = options.socketPath || options._socketPath || undefined; - options.servername = options.servername || options.host; - return tls.connect(options); -} - -/** - * Abort the handshake and emit an error. - * - * @param {WebSocket} websocket The WebSocket instance - * @param {(http.ClientRequest|net.Socket)} stream The request to abort or the - * socket to destroy - * @param {String} message The error message - * @private - */ -function abortHandshake (websocket, stream, message) { - websocket.readyState = WebSocket.CLOSING; - - const err = new Error(message); - Error.captureStackTrace(err, abortHandshake); - - if (stream.setHeader) { - stream.abort(); - stream.once('abort', websocket.emitClose.bind(websocket)); - websocket.emit('error', err); - } else { - stream.destroy(err); - stream.once('error', websocket.emit.bind(websocket, 'error')); - stream.once('close', websocket.emitClose.bind(websocket)); - } -} - -/** - * The listener of the `Receiver` `'conclude'` event. - * - * @param {Number} code The status code - * @param {String} reason The reason for closing - * @private - */ -function receiverOnConclude (code, reason) { - const websocket = this[kWebSocket]; - - websocket._socket.removeListener('data', socketOnData); - websocket._socket.resume(); - - websocket._closeFrameReceived = true; - websocket._closeMessage = reason; - websocket._closeCode = code; - - if (code === 1005) websocket.close(); - else websocket.close(code, reason); -} - -/** - * The listener of the `Receiver` `'drain'` event. - * - * @private - */ -function receiverOnDrain () { - this[kWebSocket]._socket.resume(); -} - -/** - * The listener of the `Receiver` `'error'` event. - * - * @param {(RangeError|Error)} err The emitted error - * @private - */ -function receiverOnError (err) { - const websocket = this[kWebSocket]; - - websocket._socket.removeListener('data', socketOnData); - - websocket.readyState = WebSocket.CLOSING; - websocket._closeCode = err[constants.kStatusCode]; - websocket.emit('error', err); - websocket._socket.destroy(); -} - -/** - * The listener of the `Receiver` `'finish'` event. - * - * @private - */ -function receiverOnFinish () { - this[kWebSocket].emitClose(); -} - -/** - * The listener of the `Receiver` `'message'` event. - * - * @param {(String|Buffer|ArrayBuffer|Buffer[])} data The message - * @private - */ -function receiverOnMessage (data) { - this[kWebSocket].emit('message', data); -} - -/** - * The listener of the `Receiver` `'ping'` event. - * - * @param {Buffer} data The data included in the ping frame - * @private - */ -function receiverOnPing (data) { - const websocket = this[kWebSocket]; - - websocket.pong(data, !websocket._isServer, constants.NOOP); - websocket.emit('ping', data); -} - -/** - * The listener of the `Receiver` `'pong'` event. - * - * @param {Buffer} data The data included in the pong frame - * @private - */ -function receiverOnPong (data) { - this[kWebSocket].emit('pong', data); -} - -/** - * The listener of the `net.Socket` `'close'` event. - * - * @private - */ -function socketOnClose () { - const websocket = this[kWebSocket]; - - this.removeListener('close', socketOnClose); - this.removeListener('end', socketOnEnd); - - websocket.readyState = WebSocket.CLOSING; - - // - // The close frame might not have been received or the `'end'` event emitted, - // for example, if the socket was destroyed due to an error. Ensure that the - // `receiver` stream is closed after writing any remaining buffered data to - // it. If the readable side of the socket is in flowing mode then there is no - // buffered data as everything has been already written and `readable.read()` - // will return `null`. If instead, the socket is paused, any possible buffered - // data will be read as a single chunk and emitted synchronously in a single - // `'data'` event. - // - websocket._socket.read(); - websocket._receiver.end(); - - this.removeListener('data', socketOnData); - this[kWebSocket] = undefined; - - clearTimeout(websocket._closeTimer); - - if ( - websocket._receiver._writableState.finished || - websocket._receiver._writableState.errorEmitted - ) { - websocket.emitClose(); - } else { - websocket._receiver.on('error', receiverOnFinish); - websocket._receiver.on('finish', receiverOnFinish); - } -} - -/** - * The listener of the `net.Socket` `'data'` event. - * - * @param {Buffer} chunk A chunk of data - * @private - */ -function socketOnData (chunk) { - if (!this[kWebSocket]._receiver.write(chunk)) { - this.pause(); - } -} - -/** - * The listener of the `net.Socket` `'end'` event. - * - * @private - */ -function socketOnEnd () { - const websocket = this[kWebSocket]; - - websocket.readyState = WebSocket.CLOSING; - websocket._receiver.end(); - this.end(); -} - -/** - * The listener of the `net.Socket` `'error'` event. - * - * @private - */ -function socketOnError () { - const websocket = this[kWebSocket]; - - this.removeListener('error', socketOnError); - this.on('error', constants.NOOP); - - if (websocket) { - websocket.readyState = WebSocket.CLOSING; - this.destroy(); - } -} diff --git a/node_modules/express-ws/node_modules/ws/node_modules/async-limiter/.eslintignore b/node_modules/express-ws/node_modules/ws/node_modules/async-limiter/.eslintignore deleted file mode 100644 index e1661e5..0000000 --- a/node_modules/express-ws/node_modules/ws/node_modules/async-limiter/.eslintignore +++ /dev/null @@ -1,2 +0,0 @@ -coverage -.nyc_output \ No newline at end of file diff --git a/node_modules/express-ws/node_modules/ws/node_modules/async-limiter/.nycrc b/node_modules/express-ws/node_modules/ws/node_modules/async-limiter/.nycrc deleted file mode 100644 index 874c1de..0000000 --- a/node_modules/express-ws/node_modules/ws/node_modules/async-limiter/.nycrc +++ /dev/null @@ -1,10 +0,0 @@ -{ - "check-coverage": false, - "lines": 99, - "statements": 99, - "functions": 99, - "branches": 99, - "include": [ - "index.js" - ] -} \ No newline at end of file diff --git a/node_modules/express-ws/node_modules/ws/node_modules/async-limiter/.travis.yml b/node_modules/express-ws/node_modules/ws/node_modules/async-limiter/.travis.yml deleted file mode 100644 index 37026e2..0000000 --- a/node_modules/express-ws/node_modules/ws/node_modules/async-limiter/.travis.yml +++ /dev/null @@ -1,9 +0,0 @@ -language: node_js -node_js: - - "6" - - "8" - - "10" - - "node" -script: npm run travis -cache: - yarn: true diff --git a/node_modules/express-ws/node_modules/ws/node_modules/async-limiter/LICENSE b/node_modules/express-ws/node_modules/ws/node_modules/async-limiter/LICENSE deleted file mode 100644 index 9c91fb2..0000000 --- a/node_modules/express-ws/node_modules/ws/node_modules/async-limiter/LICENSE +++ /dev/null @@ -1,8 +0,0 @@ -The MIT License (MIT) -Copyright (c) 2017 Samuel Reed - -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. diff --git a/node_modules/express-ws/node_modules/ws/node_modules/async-limiter/index.js b/node_modules/express-ws/node_modules/ws/node_modules/async-limiter/index.js deleted file mode 100644 index c9bd2f9..0000000 --- a/node_modules/express-ws/node_modules/ws/node_modules/async-limiter/index.js +++ /dev/null @@ -1,67 +0,0 @@ -'use strict'; - -function Queue(options) { - if (!(this instanceof Queue)) { - return new Queue(options); - } - - options = options || {}; - this.concurrency = options.concurrency || Infinity; - this.pending = 0; - this.jobs = []; - this.cbs = []; - this._done = done.bind(this); -} - -var arrayAddMethods = [ - 'push', - 'unshift', - 'splice' -]; - -arrayAddMethods.forEach(function(method) { - Queue.prototype[method] = function() { - var methodResult = Array.prototype[method].apply(this.jobs, arguments); - this._run(); - return methodResult; - }; -}); - -Object.defineProperty(Queue.prototype, 'length', { - get: function() { - return this.pending + this.jobs.length; - } -}); - -Queue.prototype._run = function() { - if (this.pending === this.concurrency) { - return; - } - if (this.jobs.length) { - var job = this.jobs.shift(); - this.pending++; - job(this._done); - this._run(); - } - - if (this.pending === 0) { - while (this.cbs.length !== 0) { - var cb = this.cbs.pop(); - process.nextTick(cb); - } - } -}; - -Queue.prototype.onDone = function(cb) { - if (typeof cb === 'function') { - this.cbs.push(cb); - this._run(); - } -}; - -function done() { - this.pending--; - this._run(); -} - -module.exports = Queue; diff --git a/node_modules/express-ws/node_modules/ws/node_modules/async-limiter/package.json b/node_modules/express-ws/node_modules/ws/node_modules/async-limiter/package.json deleted file mode 100644 index da445ff..0000000 --- a/node_modules/express-ws/node_modules/ws/node_modules/async-limiter/package.json +++ /dev/null @@ -1,76 +0,0 @@ -{ - "name": "async-limiter", - "version": "1.0.1", - "description": "asynchronous function queue with adjustable concurrency", - "keywords": [ - "throttle", - "async", - "limiter", - "asynchronous", - "job", - "task", - "concurrency", - "concurrent" - ], - "dependencies": {}, - "devDependencies": { - "coveralls": "^3.0.3", - "eslint": "^5.16.0", - "eslint-plugin-mocha": "^5.3.0", - "intelli-espower-loader": "^1.0.1", - "mocha": "^6.1.4", - "nyc": "^14.1.1", - "power-assert": "^1.6.1" - }, - "scripts": { - "test": "mocha --require intelli-espower-loader test/", - "travis": "npm run lint && npm run test", - "coverage": "nyc npm test && nyc report --reporter=text-lcov | coveralls", - "example": "node example", - "lint": "eslint ." - }, - "repository": { - "type": "git", - "url": "git+https://github.com/strml/async-limiter.git" - }, - "author": { - "name": "Samuel Reed" - }, - "license": "MIT", - "gitHead": "f3bb66f26e69a5747a6483e32c775a02632020ee", - "bugs": { - "url": "https://github.com/strml/async-limiter/issues" - }, - "homepage": "https://github.com/strml/async-limiter#readme", - "_id": "async-limiter@1.0.1", - "_nodeVersion": "10.16.0", - "_npmVersion": "6.9.0", - "dist": { - "integrity": "sha512-csOlWGAcRFJaI6m+F2WKdnMKr4HhdhFVBk0H/QbJFMCr+uO2kwohwXQPxw/9OCxp05r5ghVBFSyioixx3gfkNQ==", - "shasum": "dd379e94f0db8310b08291f9d64c3209766617fd", - "tarball": "https://registry.npmjs.org/async-limiter/-/async-limiter-1.0.1.tgz", - "fileCount": 7, - "unpackedSize": 6900, - "npm-signature": "-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJdRFo5CRA9TVsSAnZWagAAE8EP/AoamQTvsA8uUcSUKc4L\nL7rKbbH4m5Cv1Z7qeBXLV3KJHI+dhn/mKU2hOpnXHgks5Az4ELlOX9O1vo9j\nLYtN8ZMGEkMIx+k7OcVexaXLcK9ALliEMNoNy4cIVc+exBS4eKFPmaEx5DmD\nNf+eCG6jkA9WY/kYSmFnus7C0B7d2PMdmtBZKdzWya9PAB5BYEoz3/GYhJZG\nEFYHmWKtMDB6LMSZ0FSXwABV6QXWn5kk3fXaPX1NtMHLw+QCT/sWt+0cOnIE\nak2s8WOry7Fsx5wXQmKbd8854LC+yVT1f7RR7eBhKAlTk74nwfNDr84UBJIr\n+0G0RdgISOzLghtRFu3SqYKynXTjdlycZG9vvcHW9oPGI2ZiC2cHuiqc4+K7\ndYX1HGQICjflTmb+RR0vGNXiy3v6YBWgpItdeziPO2K+0uN6SJr1BidQ8oKI\nd49psu/xNvMhdwOo19+/Bt7n7nT4uzej8K7uQO81BJC0ITeNfaC/z9M/4VOg\nFuixwvvzfs+/RABxzXKZqOMVlAnAb4U/PBcliklyUBeZ62PDkqnBxdrOekf5\nacstUU3K5bAaBV8taKHEa1+tqYUjVEcaolDDKgmO0dxD9FlKAMlhck9ildO7\nnjODiNgcSMUlMmHGUZCEvjSt1YptntzC0DHwxWUjszaR4p0Iz0c0AyOYGH7T\nRewy\r\n=MPQY\r\n-----END PGP SIGNATURE-----\r\n" - }, - "maintainers": [ - { - "name": "strml", - "email": "samuel.trace.reed@gmail.com" - } - ], - "_npmUser": { - "name": "strml", - "email": "samuel.trace.reed@gmail.com" - }, - "directories": {}, - "_npmOperationalInternal": { - "host": "s3://npm-registry-packages", - "tmp": "tmp/async-limiter_1.0.1_1564760633070_0.6974331182093105" - }, - "_hasShrinkwrap": false, - "_shasum": "dd379e94f0db8310b08291f9d64c3209766617fd", - "_from": "async-limiter@~1.0.0", - "_resolved": "https://registry.npmjs.org/async-limiter/-/async-limiter-1.0.1.tgz", - "readme": "ERROR: No README data found!" -} diff --git a/node_modules/express-ws/node_modules/ws/node_modules/async-limiter/readme.md b/node_modules/express-ws/node_modules/ws/node_modules/async-limiter/readme.md deleted file mode 100644 index fcaa22f..0000000 --- a/node_modules/express-ws/node_modules/ws/node_modules/async-limiter/readme.md +++ /dev/null @@ -1,132 +0,0 @@ -# Async-Limiter - -A module for limiting concurrent asynchronous actions in flight. Forked from [queue](https://github.com/jessetane/queue). - -[![npm](http://img.shields.io/npm/v/async-limiter.svg?style=flat-square)](http://www.npmjs.org/async-limiter) -[![tests](https://img.shields.io/travis/STRML/async-limiter.svg?style=flat-square&branch=master)](https://travis-ci.org/STRML/async-limiter) -[![coverage](https://img.shields.io/coveralls/STRML/async-limiter.svg?style=flat-square&branch=master)](https://coveralls.io/r/STRML/async-limiter) - -This module exports a class `Limiter` that implements some of the `Array` API. -Pass async functions (ones that accept a callback or return a promise) to an instance's additive array methods. - -## Motivation - -Certain functions, like `zlib`, have [undesirable behavior](https://github.com/nodejs/node/issues/8871#issuecomment-250915913) when -run at infinite concurrency. - -In this case, it is actually faster, and takes far less memory, to limit concurrency. - -This module should do the absolute minimum work necessary to queue up functions. PRs are welcome that would -make this module faster or lighter, but new functionality is not desired. - -Style should confirm to nodejs/node style. - -## Example - -``` javascript -var Limiter = require('async-limiter') - -var t = new Limiter({concurrency: 2}); -var results = [] - -// add jobs using the familiar Array API -t.push(function (cb) { - results.push('two') - cb() -}) - -t.push( - function (cb) { - results.push('four') - cb() - }, - function (cb) { - results.push('five') - cb() - } -) - -t.unshift(function (cb) { - results.push('one') - cb() -}) - -t.splice(2, 0, function (cb) { - results.push('three') - cb() -}) - -// Jobs run automatically. If you want a callback when all are done, -// call 'onDone()'. -t.onDone(function () { - console.log('all done:', results) -}) -``` - -## Zlib Example - -```js -const zlib = require('zlib'); -const Limiter = require('async-limiter'); - -const message = {some: "data"}; -const payload = new Buffer(JSON.stringify(message)); - -// Try with different concurrency values to see how this actually -// slows significantly with higher concurrency! -// -// 5: 1398.607ms -// 10: 1375.668ms -// Infinity: 4423.300ms -// -const t = new Limiter({concurrency: 5}); -function deflate(payload, cb) { - t.push(function(done) { - zlib.deflate(payload, function(err, buffer) { - done(); - cb(err, buffer); - }); - }); -} - -console.time('deflate'); -for(let i = 0; i < 30000; ++i) { - deflate(payload, function (err, buffer) {}); -} -t.onDone(function() { - console.timeEnd('deflate'); -}); -``` - -## Install - -`npm install async-limiter` - -## Test - -`npm test` - -## API - -### `var t = new Limiter([opts])` -Constructor. `opts` may contain inital values for: -* `t.concurrency` - -## Instance methods - -### `t.onDone(fn)` -`fn` will be called once and only once, when the queue is empty. - -## Instance methods mixed in from `Array` -Mozilla has docs on how these methods work [here](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array). -### `t.push(element1, ..., elementN)` -### `t.unshift(element1, ..., elementN)` -### `t.splice(index , howMany[, element1[, ...[, elementN]]])` - -## Properties -### `t.concurrency` -Max number of jobs the queue should process concurrently, defaults to `Infinity`. - -### `t.length` -Jobs pending + jobs to process (readonly). - diff --git a/node_modules/express-ws/node_modules/ws/package.json b/node_modules/express-ws/node_modules/ws/package.json deleted file mode 100644 index ac4ae73..0000000 --- a/node_modules/express-ws/node_modules/ws/package.json +++ /dev/null @@ -1,97 +0,0 @@ -{ - "name": "ws", - "version": "5.2.2", - "description": "Simple to use, blazing fast and thoroughly tested websocket client and server for Node.js", - "keywords": [ - "HyBi", - "Push", - "RFC-6455", - "WebSocket", - "WebSockets", - "real-time" - ], - "homepage": "https://github.com/websockets/ws", - "bugs": { - "url": "https://github.com/websockets/ws/issues" - }, - "repository": { - "type": "git", - "url": "git+https://github.com/websockets/ws.git" - }, - "author": { - "name": "Einar Otto Stangvik", - "email": "einaros@gmail.com", - "url": "http://2x.io" - }, - "license": "MIT", - "main": "index.js", - "files": [ - "index.js", - "lib" - ], - "scripts": { - "test": "eslint . && nyc --reporter=html --reporter=text mocha test/*.test.js", - "integration": "eslint . && mocha test/*.integration.js", - "lint": "eslint ." - }, - "dependencies": { - "async-limiter": "~1.0.0" - }, - "devDependencies": { - "benchmark": "~2.1.2", - "bufferutil": "~3.0.0", - "eslint": "~4.19.0", - "eslint-config-standard": "~11.0.0", - "eslint-plugin-import": "~2.12.0", - "eslint-plugin-node": "~6.0.0", - "eslint-plugin-promise": "~3.8.0", - "eslint-plugin-standard": "~3.0.0", - "mocha": "~5.2.0", - "nyc": "~12.0.2", - "utf-8-validate": "~4.0.0" - }, - "gitHead": "5d55e52529167c25f4fec35cb4753294e75bf9f2", - "_id": "ws@5.2.2", - "_npmVersion": "6.1.0", - "_nodeVersion": "10.6.0", - "_npmUser": { - "name": "lpinca", - "email": "luigipinca@gmail.com" - }, - "dist": { - "integrity": "sha512-jaHFD6PFv6UgoIVda6qZllptQsMlDEJkTQcybzzXDYM1XO9Y8em691FGMPmM46WGyLU4z9KMgQN+qrux/nhlHA==", - "shasum": "dffef14866b8e8dc9133582514d1befaf96e980f", - "tarball": "https://registry.npmjs.org/ws/-/ws-5.2.2.tgz", - "fileCount": 14, - "unpackedSize": 99219, - "npm-signature": "-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJbRmFaCRA9TVsSAnZWagAAZH0P/iB0EIYIHqFAJznwT4el\n8xU2FN/na7yK3k+nV0cNYD+gKdOcTphij2IJGnQBM8hG4SlPBf+NBqy7/VBo\na3cmV3Rat395nmI3lhTgb9EDMFgYRQty3ORS3KAf2KEpFFA4QlTjOttjYsCq\nZN/j3GMnsnH47RxToPE9wTyC8d+cgIfdQHLN1k+5YaN5OtBCyKIXGbl+QJli\n2YLGAU1mp+yM+CF8CV+q6aodokoF/89D8LnJ7N5LjIgYGHTohB9c/fY/7v/5\nQLqd35RTo8OXMfiujUy2EhyGP5SyiTUzttAmXuSOxG3KQTtzss0dHMBxFeXJ\nO6ZDh124WW1VJYhdPKwfaHwszfmB6a95K2Gmu7xtvlq48qMq6Rfi9WQ1/rlc\nYyeyXAX1a/ykbEza4mm9oPfZpkPKSYM4s4fYufxyG3sAz3vKaOy4MQNA6gOC\n49sJBGT7kdTlPgHuE832t9T+J8ByCGNl/o2zJDDYLq6RLZqtgaSqAWtIBaFe\neW/yEVklhm2InF8e1yAiHg4au/6OKf4PFfKpcjdKvDbMZO8fFm6VDRYqFlI5\nnF2XzxK7p86sIe+YeFqVAzc4kMGcvYzrD7RhA25n+NBbjHaYChCLibgEDG7E\n2gqUv1T9BU2ihq845gapZ9h1b7/dpfqOKZCf5kvMxZLjp/rL8msRRPd4GIw9\nPXXp\r\n=QnaD\r\n-----END PGP SIGNATURE-----\r\n" - }, - "maintainers": [ - { - "name": "3rdeden", - "email": "npm@3rd-Eden.com" - }, - { - "name": "einaros", - "email": "einaros@gmail.com" - }, - { - "name": "lpinca", - "email": "luigipinca@gmail.com" - }, - { - "name": "v1", - "email": "npm@3rd-Eden.com" - } - ], - "directories": {}, - "_npmOperationalInternal": { - "host": "s3://npm-registry-packages", - "tmp": "tmp/ws_5.2.2_1531339098131_0.05866997625683701" - }, - "_hasShrinkwrap": false, - "_shasum": "dffef14866b8e8dc9133582514d1befaf96e980f", - "_from": "ws@^5.2.0", - "_resolved": "https://registry.npmjs.org/ws/-/ws-5.2.2.tgz", - "readme": "ERROR: No README data found!" -} diff --git a/node_modules/express-ws/package.json b/node_modules/express-ws/package.json deleted file mode 100644 index 413730a..0000000 --- a/node_modules/express-ws/package.json +++ /dev/null @@ -1,104 +0,0 @@ -{ - "name": "express-ws", - "version": "4.0.0", - "description": "WebSocket endpoints for Express applications", - "main": "index.js", - "scripts": { - "prepublish": "npm run build", - "build": "babel src/ -d lib/", - "lint": "eslint src/" - }, - "author": { - "name": "Henning Morud", - "email": "henning@morud.org" - }, - "contributors": [ - { - "name": "Jesús Leganés Combarro", - "email": "piranna@gmail.com" - }, - { - "name": "Sven Slootweg", - "email": "admin@cryto.net" - }, - { - "name": "Andrew Phillips", - "email": "theasp@gmail.com" - }, - { - "name": "Nicholas Schell", - "email": "nschell@gmail.com" - }, - { - "name": "Max Truxa", - "email": "dev@maxtruxa.com" - }, - { - "name": "Kræn Hansen", - "email": "mail@kraenhansen.dk" - } - ], - "license": "BSD-2-Clause", - "dependencies": { - "ws": "^5.2.0" - }, - "peerDependencies": { - "express": "^4.0.0 || ^5.0.0-alpha.1" - }, - "engines": { - "node": ">=4.5.0" - }, - "directories": { - "example": "examples" - }, - "repository": { - "type": "git", - "url": "git+https://github.com/HenningM/express-ws.git" - }, - "keywords": [ - "express", - "ws", - "websocket" - ], - "bugs": { - "url": "https://github.com/HenningM/express-ws/issues" - }, - "homepage": "https://github.com/HenningM/express-ws", - "devDependencies": { - "babel-cli": "^6.26.0", - "babel-preset-es2015": "^6.5.0", - "eslint": "^4.19.0", - "eslint-config-airbnb": "^14.1.0", - "eslint-plugin-import": "^2.12.0", - "express": "^5.0.0-alpha.6" - }, - "gitHead": "11928f260bcb4f4897879bf09c8abe32ca4c65f2", - "_id": "express-ws@4.0.0", - "_npmVersion": "6.0.1", - "_nodeVersion": "6.3.1", - "_npmUser": { - "name": "henningm", - "email": "henning@morud.org" - }, - "dist": { - "integrity": "sha512-KEyUw8AwRET2iFjFsI1EJQrJ/fHeGiJtgpYgEWG3yDv4l/To/m3a2GaYfeGyB3lsWdvbesjF5XCMx+SVBgAAYw==", - "shasum": "dabd8dc974516418902a41fe6e30ed949b4d36c4", - "tarball": "https://registry.npmjs.org/express-ws/-/express-ws-4.0.0.tgz", - "fileCount": 16, - "unpackedSize": 17428, - "npm-signature": "-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJbF/vpCRA9TVsSAnZWagAAPO8P/RH99Dr1f8tCRufhH3kz\n+pXjAyHACRzttVW4rKmiBSYNFqOPEJSeQ/iGvbRHEjQc/rBeC14u33OgyHa3\nhiOSY9RNe1AjvenhgfjfH6dreLsE6M7otNgDHGvGwwxKRwGxN4ak/YsyY4zP\nemOzZSCVACHICn+KFm+U+PFxecDEeszssnmhoPw6oEi6Sx0KT83N5NW5j4Wu\nRZpUbpaS8WzsKYlZAOjKvplBFnrQFgM357JkG2rWu7ONH6b+roSRu1eEFwxt\nUaYSNc2VvAXvhhX0nkEV1SeUvdBUOOEBmnF9o2tjubxshDt3ORzouonsXS0s\nAkZf0jmDkE9Ka9Kh/rb3YAGLxLVRE/1ttc7u6sytmgVubvzEa9ds83y9VMrO\nyu6uVvPt10CncdJaGX4wM8WLv9wxDK7onC3spKuqm8NQ1+6Z25cQN+YZ6C1m\n1mcGIdzWf4kS+J4ZIDImRwYYfrORnGNyaOv44OCFeTsM/o5wChFtUZmQyCFW\ncNvmdfw3udBUWswfLucM+wGlJCzJSqmteypzNvbR2gaV7EG9/pqGgVCSbEBH\nsWdzZoUuTP6FCfhnS7ngxLBQd6CCT9dEUGqmQT+Vh5Wynq2/sAtlcnz5ilWk\nbMt3pL4GapVu3kYwXuOqn9jU+EiI3qtk8GnUbLO+uVru4hoP+rsxsjVOx888\nwaBD\r\n=FGXN\r\n-----END PGP SIGNATURE-----\r\n" - }, - "maintainers": [ - { - "name": "henningm", - "email": "henning@morud.org" - } - ], - "_npmOperationalInternal": { - "host": "s3://npm-registry-packages", - "tmp": "tmp/express-ws_4.0.0_1528298471882_0.5274698752380893" - }, - "_shasum": "dabd8dc974516418902a41fe6e30ed949b4d36c4", - "_from": "express-ws@", - "_resolved": "https://registry.npmjs.org/express-ws/-/express-ws-4.0.0.tgz" -} diff --git a/node_modules/express/package.json b/node_modules/express/package.json index 3652003..02fa4ff 100644 --- a/node_modules/express/package.json +++ b/node_modules/express/package.json @@ -1,27 +1,31 @@ { - "_from": "express", + "_args": [ + [ + "express@4.17.1", + "/home/josuer08/Documents/web" + ] + ], + "_from": "express@4.17.1", "_id": "express@4.17.1", "_inBundle": false, "_integrity": "sha512-mHJ9O79RqluphRrcw2X/GTh3k9tVv8YcoyY4Kkh4WDMUYKRZUq0h1o0w2rrrxBqM7VoeUVqgb27xlEMXTnYt4g==", "_location": "/express", "_phantomChildren": {}, "_requested": { - "type": "tag", + "type": "version", "registry": true, - "raw": "express", + "raw": "express@4.17.1", "name": "express", "escapedName": "express", - "rawSpec": "", + "rawSpec": "4.17.1", "saveSpec": null, - "fetchSpec": "latest" + "fetchSpec": "4.17.1" }, "_requiredBy": [ - "#USER", "/" ], "_resolved": "https://registry.npmjs.org/express/-/express-4.17.1.tgz", - "_shasum": "4491fc38605cf51f8629d39c2b5d026f98a4c134", - "_spec": "express", + "_spec": "4.17.1", "_where": "/home/josuer08/Documents/web", "author": { "name": "TJ Holowaychuk", @@ -30,7 +34,6 @@ "bugs": { "url": "https://github.com/expressjs/express/issues" }, - "bundleDependencies": false, "contributors": [ { "name": "Aaron Heckmann", @@ -93,7 +96,6 @@ "utils-merge": "1.0.1", "vary": "~1.1.2" }, - "deprecated": false, "description": "Fast, unopinionated, minimalist web framework", "devDependencies": { "after": "0.8.2", diff --git a/node_modules/finalhandler/package.json b/node_modules/finalhandler/package.json index 0103bc8..88699b6 100644 --- a/node_modules/finalhandler/package.json +++ b/node_modules/finalhandler/package.json @@ -1,27 +1,32 @@ { - "_from": "finalhandler@~1.1.2", + "_args": [ + [ + "finalhandler@1.1.2", + "/home/josuer08/Documents/web" + ] + ], + "_from": "finalhandler@1.1.2", "_id": "finalhandler@1.1.2", "_inBundle": false, "_integrity": "sha512-aAWcW57uxVNrQZqFXjITpW3sIUQmHGG3qSb9mUah9MgMC4NeWhNOlNjXEYq3HjRAvL6arUviZGGJsBg6z0zsWA==", "_location": "/finalhandler", "_phantomChildren": {}, "_requested": { - "type": "range", + "type": "version", "registry": true, - "raw": "finalhandler@~1.1.2", + "raw": "finalhandler@1.1.2", "name": "finalhandler", "escapedName": "finalhandler", - "rawSpec": "~1.1.2", + "rawSpec": "1.1.2", "saveSpec": null, - "fetchSpec": "~1.1.2" + "fetchSpec": "1.1.2" }, "_requiredBy": [ "/express" ], "_resolved": "https://registry.npmjs.org/finalhandler/-/finalhandler-1.1.2.tgz", - "_shasum": "b7e7d000ffd11938d0fdb053506f6ebabe9f587d", - "_spec": "finalhandler@~1.1.2", - "_where": "/home/josuer08/Documents/web/node_modules/express", + "_spec": "1.1.2", + "_where": "/home/josuer08/Documents/web", "author": { "name": "Douglas Christopher Wilson", "email": "doug@somethingdoug.com" @@ -29,7 +34,6 @@ "bugs": { "url": "https://github.com/pillarjs/finalhandler/issues" }, - "bundleDependencies": false, "dependencies": { "debug": "2.6.9", "encodeurl": "~1.0.2", @@ -39,7 +43,6 @@ "statuses": "~1.5.0", "unpipe": "~1.0.0" }, - "deprecated": false, "description": "Node.js final http responder", "devDependencies": { "eslint": "5.16.0", diff --git a/node_modules/forwarded/package.json b/node_modules/forwarded/package.json index 89ae401..eba2b60 100644 --- a/node_modules/forwarded/package.json +++ b/node_modules/forwarded/package.json @@ -1,38 +1,41 @@ { - "_from": "forwarded@~0.1.2", + "_args": [ + [ + "forwarded@0.1.2", + "/home/josuer08/Documents/web" + ] + ], + "_from": "forwarded@0.1.2", "_id": "forwarded@0.1.2", "_inBundle": false, "_integrity": "sha1-mMI9qxF1ZXuMBXPozszZGw/xjIQ=", "_location": "/forwarded", "_phantomChildren": {}, "_requested": { - "type": "range", + "type": "version", "registry": true, - "raw": "forwarded@~0.1.2", + "raw": "forwarded@0.1.2", "name": "forwarded", "escapedName": "forwarded", - "rawSpec": "~0.1.2", + "rawSpec": "0.1.2", "saveSpec": null, - "fetchSpec": "~0.1.2" + "fetchSpec": "0.1.2" }, "_requiredBy": [ "/proxy-addr" ], "_resolved": "https://registry.npmjs.org/forwarded/-/forwarded-0.1.2.tgz", - "_shasum": "98c23dab1175657b8c0573e8ceccd91b0ff18c84", - "_spec": "forwarded@~0.1.2", - "_where": "/home/josuer08/Documents/web/node_modules/proxy-addr", + "_spec": "0.1.2", + "_where": "/home/josuer08/Documents/web", "bugs": { "url": "https://github.com/jshttp/forwarded/issues" }, - "bundleDependencies": false, "contributors": [ { "name": "Douglas Christopher Wilson", "email": "doug@somethingdoug.com" } ], - "deprecated": false, "description": "Parse HTTP X-Forwarded-For header", "devDependencies": { "beautify-benchmark": "0.2.4", diff --git a/node_modules/fresh/package.json b/node_modules/fresh/package.json index 8bb712a..3f274d9 100644 --- a/node_modules/fresh/package.json +++ b/node_modules/fresh/package.json @@ -1,4 +1,10 @@ { + "_args": [ + [ + "fresh@0.5.2", + "/home/josuer08/Documents/web" + ] + ], "_from": "fresh@0.5.2", "_id": "fresh@0.5.2", "_inBundle": false, @@ -20,9 +26,8 @@ "/send" ], "_resolved": "https://registry.npmjs.org/fresh/-/fresh-0.5.2.tgz", - "_shasum": "3d8cadd90d976569fa835ab1f8e4b23a105605a7", - "_spec": "fresh@0.5.2", - "_where": "/home/josuer08/Documents/web/node_modules/express", + "_spec": "0.5.2", + "_where": "/home/josuer08/Documents/web", "author": { "name": "TJ Holowaychuk", "email": "tj@vision-media.ca", @@ -31,7 +36,6 @@ "bugs": { "url": "https://github.com/jshttp/fresh/issues" }, - "bundleDependencies": false, "contributors": [ { "name": "Douglas Christopher Wilson", @@ -43,7 +47,6 @@ "url": "http://jongleberry.com" } ], - "deprecated": false, "description": "HTTP response freshness testing", "devDependencies": { "beautify-benchmark": "0.2.4", diff --git a/node_modules/http-errors/package.json b/node_modules/http-errors/package.json index 44a7d9c..38047b9 100644 --- a/node_modules/http-errors/package.json +++ b/node_modules/http-errors/package.json @@ -1,4 +1,10 @@ { + "_args": [ + [ + "http-errors@1.7.2", + "/home/josuer08/Documents/web" + ] + ], "_from": "http-errors@1.7.2", "_id": "http-errors@1.7.2", "_inBundle": false, @@ -21,9 +27,8 @@ "/send" ], "_resolved": "https://registry.npmjs.org/http-errors/-/http-errors-1.7.2.tgz", - "_shasum": "4f5029cf13239f31036e5b2e55292bcfbcc85c8f", - "_spec": "http-errors@1.7.2", - "_where": "/home/josuer08/Documents/web/node_modules/body-parser", + "_spec": "1.7.2", + "_where": "/home/josuer08/Documents/web", "author": { "name": "Jonathan Ong", "email": "me@jongleberry.com", @@ -32,7 +37,6 @@ "bugs": { "url": "https://github.com/jshttp/http-errors/issues" }, - "bundleDependencies": false, "contributors": [ { "name": "Alan Plum", @@ -50,7 +54,6 @@ "statuses": ">= 1.5.0 < 2", "toidentifier": "1.0.0" }, - "deprecated": false, "description": "Create HTTP error objects", "devDependencies": { "eslint": "5.13.0", diff --git a/node_modules/iconv-lite/package.json b/node_modules/iconv-lite/package.json index 931f5c0..823a848 100644 --- a/node_modules/iconv-lite/package.json +++ b/node_modules/iconv-lite/package.json @@ -1,4 +1,10 @@ { + "_args": [ + [ + "iconv-lite@0.4.24", + "/home/josuer08/Documents/web" + ] + ], "_from": "iconv-lite@0.4.24", "_id": "iconv-lite@0.4.24", "_inBundle": false, @@ -20,9 +26,8 @@ "/raw-body" ], "_resolved": "https://registry.npmjs.org/iconv-lite/-/iconv-lite-0.4.24.tgz", - "_shasum": "2022b4b25fbddc21d2f524974a474aafe733908b", - "_spec": "iconv-lite@0.4.24", - "_where": "/home/josuer08/Documents/web/node_modules/body-parser", + "_spec": "0.4.24", + "_where": "/home/josuer08/Documents/web", "author": { "name": "Alexander Shtuchkin", "email": "ashtuchkin@gmail.com" @@ -34,11 +39,9 @@ "bugs": { "url": "https://github.com/ashtuchkin/iconv-lite/issues" }, - "bundleDependencies": false, "dependencies": { "safer-buffer": ">= 2.1.2 < 3" }, - "deprecated": false, "description": "Convert character encodings in pure javascript.", "devDependencies": { "async": "*", diff --git a/node_modules/inherits/package.json b/node_modules/inherits/package.json index 050a308..0a3d60c 100644 --- a/node_modules/inherits/package.json +++ b/node_modules/inherits/package.json @@ -1,4 +1,10 @@ { + "_args": [ + [ + "inherits@2.0.3", + "/home/josuer08/Documents/web" + ] + ], "_from": "inherits@2.0.3", "_id": "inherits@2.0.3", "_inBundle": false, @@ -19,15 +25,12 @@ "/http-errors" ], "_resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.3.tgz", - "_shasum": "633c2c83e3da42a502f52466022480f4208261de", - "_spec": "inherits@2.0.3", - "_where": "/home/josuer08/Documents/web/node_modules/http-errors", + "_spec": "2.0.3", + "_where": "/home/josuer08/Documents/web", "browser": "./inherits_browser.js", "bugs": { "url": "https://github.com/isaacs/inherits/issues" }, - "bundleDependencies": false, - "deprecated": false, "description": "Browser-friendly inheritance fully compatible with standard node.js inherits()", "devDependencies": { "tap": "^7.1.0" diff --git a/node_modules/ipaddr.js/package.json b/node_modules/ipaddr.js/package.json index d859191..0e64faf 100644 --- a/node_modules/ipaddr.js/package.json +++ b/node_modules/ipaddr.js/package.json @@ -1,4 +1,10 @@ { + "_args": [ + [ + "ipaddr.js@1.9.0", + "/home/josuer08/Documents/web" + ] + ], "_from": "ipaddr.js@1.9.0", "_id": "ipaddr.js@1.9.0", "_inBundle": false, @@ -19,9 +25,8 @@ "/proxy-addr" ], "_resolved": "https://registry.npmjs.org/ipaddr.js/-/ipaddr.js-1.9.0.tgz", - "_shasum": "37df74e430a0e47550fe54a2defe30d8acd95f65", - "_spec": "ipaddr.js@1.9.0", - "_where": "/home/josuer08/Documents/web/node_modules/proxy-addr", + "_spec": "1.9.0", + "_where": "/home/josuer08/Documents/web", "author": { "name": "whitequark", "email": "whitequark@whitequark.org" @@ -29,9 +34,7 @@ "bugs": { "url": "https://github.com/whitequark/ipaddr.js/issues" }, - "bundleDependencies": false, "dependencies": {}, - "deprecated": false, "description": "A library for manipulating IPv4 and IPv6 addresses in JavaScript.", "devDependencies": { "coffee-script": "~1.12.6", diff --git a/node_modules/media-typer/package.json b/node_modules/media-typer/package.json index 3c6e9a6..1458cb0 100644 --- a/node_modules/media-typer/package.json +++ b/node_modules/media-typer/package.json @@ -1,4 +1,10 @@ { + "_args": [ + [ + "media-typer@0.3.0", + "/home/josuer08/Documents/web" + ] + ], "_from": "media-typer@0.3.0", "_id": "media-typer@0.3.0", "_inBundle": false, @@ -19,9 +25,8 @@ "/type-is" ], "_resolved": "https://registry.npmjs.org/media-typer/-/media-typer-0.3.0.tgz", - "_shasum": "8710d7af0aa626f8fffa1ce00168545263255748", - "_spec": "media-typer@0.3.0", - "_where": "/home/josuer08/Documents/web/node_modules/type-is", + "_spec": "0.3.0", + "_where": "/home/josuer08/Documents/web", "author": { "name": "Douglas Christopher Wilson", "email": "doug@somethingdoug.com" @@ -29,8 +34,6 @@ "bugs": { "url": "https://github.com/jshttp/media-typer/issues" }, - "bundleDependencies": false, - "deprecated": false, "description": "Simple RFC 6838 media type parser and formatter", "devDependencies": { "istanbul": "0.3.2", diff --git a/node_modules/merge-descriptors/package.json b/node_modules/merge-descriptors/package.json index 7395032..68c18c6 100644 --- a/node_modules/merge-descriptors/package.json +++ b/node_modules/merge-descriptors/package.json @@ -1,4 +1,10 @@ { + "_args": [ + [ + "merge-descriptors@1.0.1", + "/home/josuer08/Documents/web" + ] + ], "_from": "merge-descriptors@1.0.1", "_id": "merge-descriptors@1.0.1", "_inBundle": false, @@ -19,9 +25,8 @@ "/express" ], "_resolved": "https://registry.npmjs.org/merge-descriptors/-/merge-descriptors-1.0.1.tgz", - "_shasum": "b00aaa556dd8b44568150ec9d1b953f3f90cbb61", - "_spec": "merge-descriptors@1.0.1", - "_where": "/home/josuer08/Documents/web/node_modules/express", + "_spec": "1.0.1", + "_where": "/home/josuer08/Documents/web", "author": { "name": "Jonathan Ong", "email": "me@jongleberry.com", @@ -30,7 +35,6 @@ "bugs": { "url": "https://github.com/component/merge-descriptors/issues" }, - "bundleDependencies": false, "contributors": [ { "name": "Douglas Christopher Wilson", @@ -41,7 +45,6 @@ "email": "grabbou@gmail.com" } ], - "deprecated": false, "description": "Merge objects using descriptors", "devDependencies": { "istanbul": "0.4.1", diff --git a/node_modules/methods/package.json b/node_modules/methods/package.json index e44823e..4c3c596 100644 --- a/node_modules/methods/package.json +++ b/node_modules/methods/package.json @@ -1,34 +1,38 @@ { - "_from": "methods@~1.1.2", + "_args": [ + [ + "methods@1.1.2", + "/home/josuer08/Documents/web" + ] + ], + "_from": "methods@1.1.2", "_id": "methods@1.1.2", "_inBundle": false, "_integrity": "sha1-VSmk1nZUE07cxSZmVoNbD4Ua/O4=", "_location": "/methods", "_phantomChildren": {}, "_requested": { - "type": "range", + "type": "version", "registry": true, - "raw": "methods@~1.1.2", + "raw": "methods@1.1.2", "name": "methods", "escapedName": "methods", - "rawSpec": "~1.1.2", + "rawSpec": "1.1.2", "saveSpec": null, - "fetchSpec": "~1.1.2" + "fetchSpec": "1.1.2" }, "_requiredBy": [ "/express" ], "_resolved": "https://registry.npmjs.org/methods/-/methods-1.1.2.tgz", - "_shasum": "5529a4d67654134edcc5266656835b0f851afcee", - "_spec": "methods@~1.1.2", - "_where": "/home/josuer08/Documents/web/node_modules/express", + "_spec": "1.1.2", + "_where": "/home/josuer08/Documents/web", "browser": { "http": false }, "bugs": { "url": "https://github.com/jshttp/methods/issues" }, - "bundleDependencies": false, "contributors": [ { "name": "Douglas Christopher Wilson", @@ -45,7 +49,6 @@ "url": "http://tjholowaychuk.com" } ], - "deprecated": false, "description": "HTTP methods that node supports", "devDependencies": { "istanbul": "0.4.1", diff --git a/node_modules/mime-db/package.json b/node_modules/mime-db/package.json index 5c6e993..d29191f 100644 --- a/node_modules/mime-db/package.json +++ b/node_modules/mime-db/package.json @@ -1,4 +1,10 @@ { + "_args": [ + [ + "mime-db@1.40.0", + "/home/josuer08/Documents/web" + ] + ], "_from": "mime-db@1.40.0", "_id": "mime-db@1.40.0", "_inBundle": false, @@ -19,13 +25,11 @@ "/mime-types" ], "_resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.40.0.tgz", - "_shasum": "a65057e998db090f732a68f6c276d387d4126c32", - "_spec": "mime-db@1.40.0", - "_where": "/home/josuer08/Documents/web/node_modules/mime-types", + "_spec": "1.40.0", + "_where": "/home/josuer08/Documents/web", "bugs": { "url": "https://github.com/jshttp/mime-db/issues" }, - "bundleDependencies": false, "contributors": [ { "name": "Douglas Christopher Wilson", @@ -42,7 +46,6 @@ "url": "http://github.com/broofa" } ], - "deprecated": false, "description": "Media Type Database", "devDependencies": { "bluebird": "3.5.4", diff --git a/node_modules/mime-types/package.json b/node_modules/mime-types/package.json index 72fae55..8689b36 100644 --- a/node_modules/mime-types/package.json +++ b/node_modules/mime-types/package.json @@ -1,32 +1,36 @@ { - "_from": "mime-types@~2.1.24", + "_args": [ + [ + "mime-types@2.1.24", + "/home/josuer08/Documents/web" + ] + ], + "_from": "mime-types@2.1.24", "_id": "mime-types@2.1.24", "_inBundle": false, "_integrity": "sha512-WaFHS3MCl5fapm3oLxU4eYDw77IQM2ACcxQ9RIxfaC3ooc6PFuBMGZZsYpvoXS5D5QTWPieo1jjLdAm3TBP3cQ==", "_location": "/mime-types", "_phantomChildren": {}, "_requested": { - "type": "range", + "type": "version", "registry": true, - "raw": "mime-types@~2.1.24", + "raw": "mime-types@2.1.24", "name": "mime-types", "escapedName": "mime-types", - "rawSpec": "~2.1.24", + "rawSpec": "2.1.24", "saveSpec": null, - "fetchSpec": "~2.1.24" + "fetchSpec": "2.1.24" }, "_requiredBy": [ "/accepts", "/type-is" ], "_resolved": "https://registry.npmjs.org/mime-types/-/mime-types-2.1.24.tgz", - "_shasum": "b6f8d0b3e951efb77dedeca194cff6d16f676f81", - "_spec": "mime-types@~2.1.24", - "_where": "/home/josuer08/Documents/web/node_modules/accepts", + "_spec": "2.1.24", + "_where": "/home/josuer08/Documents/web", "bugs": { "url": "https://github.com/jshttp/mime-types/issues" }, - "bundleDependencies": false, "contributors": [ { "name": "Douglas Christopher Wilson", @@ -46,7 +50,6 @@ "dependencies": { "mime-db": "1.40.0" }, - "deprecated": false, "description": "The ultimate javascript content-type utility.", "devDependencies": { "eslint": "5.16.0", diff --git a/node_modules/mime/package.json b/node_modules/mime/package.json index 6805efe..1f50ec2 100644 --- a/node_modules/mime/package.json +++ b/node_modules/mime/package.json @@ -1,4 +1,10 @@ { + "_args": [ + [ + "mime@1.6.0", + "/home/josuer08/Documents/web" + ] + ], "_from": "mime@1.6.0", "_id": "mime@1.6.0", "_inBundle": false, @@ -19,9 +25,8 @@ "/send" ], "_resolved": "https://registry.npmjs.org/mime/-/mime-1.6.0.tgz", - "_shasum": "32cd9e5c64553bd58d19a568af452acff04981b1", - "_spec": "mime@1.6.0", - "_where": "/home/josuer08/Documents/web/node_modules/send", + "_spec": "1.6.0", + "_where": "/home/josuer08/Documents/web", "author": { "name": "Robert Kieffer", "email": "robert@broofa.com", @@ -33,7 +38,6 @@ "bugs": { "url": "https://github.com/broofa/node-mime/issues" }, - "bundleDependencies": false, "contributors": [ { "name": "Benjamin Thomas", @@ -42,7 +46,6 @@ } ], "dependencies": {}, - "deprecated": false, "description": "A comprehensive library for mime-type mapping", "devDependencies": { "github-release-notes": "0.13.1", diff --git a/node_modules/ms/package.json b/node_modules/ms/package.json index a5362f4..2cb6b68 100644 --- a/node_modules/ms/package.json +++ b/node_modules/ms/package.json @@ -1,4 +1,10 @@ { + "_args": [ + [ + "ms@2.0.0", + "/home/josuer08/Documents/web" + ] + ], "_from": "ms@2.0.0", "_id": "ms@2.0.0", "_inBundle": false, @@ -19,14 +25,11 @@ "/debug" ], "_resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz", - "_shasum": "5608aeadfc00be6c2901df5f9861788de0d597c8", - "_spec": "ms@2.0.0", - "_where": "/home/josuer08/Documents/web/node_modules/debug", + "_spec": "2.0.0", + "_where": "/home/josuer08/Documents/web", "bugs": { "url": "https://github.com/zeit/ms/issues" }, - "bundleDependencies": false, - "deprecated": false, "description": "Tiny milisecond conversion utility", "devDependencies": { "eslint": "3.19.0", diff --git a/node_modules/negotiator/package.json b/node_modules/negotiator/package.json index 0bc9633..056a9d2 100644 --- a/node_modules/negotiator/package.json +++ b/node_modules/negotiator/package.json @@ -1,4 +1,10 @@ { + "_args": [ + [ + "negotiator@0.6.2", + "/home/josuer08/Documents/web" + ] + ], "_from": "negotiator@0.6.2", "_id": "negotiator@0.6.2", "_inBundle": false, @@ -19,13 +25,11 @@ "/accepts" ], "_resolved": "https://registry.npmjs.org/negotiator/-/negotiator-0.6.2.tgz", - "_shasum": "feacf7ccf525a77ae9634436a64883ffeca346fb", - "_spec": "negotiator@0.6.2", - "_where": "/home/josuer08/Documents/web/node_modules/accepts", + "_spec": "0.6.2", + "_where": "/home/josuer08/Documents/web", "bugs": { "url": "https://github.com/jshttp/negotiator/issues" }, - "bundleDependencies": false, "contributors": [ { "name": "Douglas Christopher Wilson", @@ -41,7 +45,6 @@ "url": "http://blog.izs.me/" } ], - "deprecated": false, "description": "HTTP content negotiation", "devDependencies": { "eslint": "5.16.0", diff --git a/node_modules/node-pty/LICENSE b/node_modules/node-pty/LICENSE deleted file mode 100644 index 22f780d..0000000 --- a/node_modules/node-pty/LICENSE +++ /dev/null @@ -1,69 +0,0 @@ -Copyright (c) 2012-2015, Christopher Jeffrey (https://github.com/chjj/) - -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. - - - -The MIT License (MIT) - -Copyright (c) 2016, Daniel Imms (http://www.growingwiththeweb.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. - - - -MIT License - -Copyright (c) 2018 - present Microsoft Corporation - -All rights reserved. - -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. diff --git a/node_modules/node-pty/README.md b/node_modules/node-pty/README.md deleted file mode 100644 index a36bba3..0000000 --- a/node_modules/node-pty/README.md +++ /dev/null @@ -1,146 +0,0 @@ -# node-pty - -[![Build Status](https://dev.azure.com/vscode/node-pty/_apis/build/status/Microsoft.node-pty)](https://dev.azure.com/vscode/node-pty/_build/latest?definitionId=11) - -`forkpty(3)` bindings for node.js. This allows you to fork processes with pseudoterminal file descriptors. It returns a terminal object which allows reads and writes. - -This is useful for: - -- Writing a terminal emulator (eg. via [xterm.js](https://github.com/sourcelair/xterm.js)). -- Getting certain programs to *think* you're a terminal, such as when you need a program to send you control sequences. - -`node-pty` supports Linux, macOS and Windows. Windows support is possible by utilizing the [Windows conpty API](https://blogs.msdn.microsoft.com/commandline/2018/08/02/windows-command-line-introducing-the-windows-pseudo-console-conpty/) on Windows 1809+ and the [winpty](https://github.com/rprichard/winpty) library in older version. - -## Real-world Uses - -`node-pty` powers many different terminal emulators, including: - -- [Microsoft Visual Studio Code](https://code.visualstudio.com) -- [Hyper](https://hyper.is/) -- [Upterm](https://github.com/railsware/upterm) -- [Script Runner](https://github.com/ioquatix/script-runner) for Atom. -- [Theia](https://github.com/theia-ide/theia) -- [FreeMAN](https://github.com/matthew-matvei/freeman) file manager -- [atom-xterm](https://atom.io/packages/atom-xterm) - Atom plugin for providing terminals inside your Atom workspace. -- [Termination](https://atom.io/packages/termination) - Another Atom plugin that provides terminals inside your Atom workspace. -- [electerm](https://github.com/electerm/electerm) Terminal/ssh/sftp client(linux, mac, win). -- [Extraterm](http://extraterm.org/) -- [Wetty](https://github.com/krishnasrinivas/wetty) Browser based Terminal over HTTP and HTTPS - -Do you use node-pty in your application as well? Please open a [Pull Request](https://github.com/Tyriar/node-pty/pulls) to include it here. We would love to have it in our list. - -## Example Usage - -```js -var os = require('os'); -var pty = require('node-pty'); - -var shell = os.platform() === 'win32' ? 'powershell.exe' : 'bash'; - -var ptyProcess = pty.spawn(shell, [], { - name: 'xterm-color', - cols: 80, - rows: 30, - cwd: process.env.HOME, - env: process.env -}); - -ptyProcess.on('data', function(data) { - process.stdout.write(data); -}); - -ptyProcess.write('ls\r'); -ptyProcess.resize(100, 40); -ptyProcess.write('ls\r'); -``` - -## Building - -```bash -# Install dependencies and build C++ -npm install -# Compile TypeScript -> JavaScript -npm run tsc -``` - -## Dependencies - -### Linux/Ubuntu - -``` -sudo apt install -y make python build-essential -``` - -The following are also needed: - -- Node.JS 10+ - -### Windows - -`npm install` requires some tools to be present in the system like Python and C++ compiler. Windows users can easily install them by running the following command in PowerShell as administrator. For more information see https://github.com/felixrieseberg/windows-build-tools: - -```sh -npm install --global --production windows-build-tools -``` - -The following are also needed: - -- [Windows SDK](https://developer.microsoft.com/en-us/windows/downloads/windows-10-sdk) - only the "Desktop C++ Apps" components are needed to be installed -- Node.JS 10+ - -## Debugging - -[The wiki](https://github.com/Microsoft/node-pty/wiki/Debugging) contains instructions for debugging node-pty. - -## Security - -All processes launched from node-pty will launch at the same permission level of the parent process. Take care particularly when using node-pty inside a server that's accessible on the internet. We recommend launching the pty inside a container to protect your host machine. - -## Thread Safety - -Note that node-pty is not thread safe so running it across multiple worker threads in node.js could cause issues. - -## Flow Control - -Automatic flow control can be enabled by either providing `handleFlowControl = true` in the constructor options or setting it later on: - -```js -const PAUSE = '\x13'; // XOFF -const RESUME = '\x11'; // XON - -const ptyProcess = pty.spawn(shell, [], {handleFlowControl: true}); - -// flow control in action -ptyProcess.write(PAUSE); // pty will block and pause the slave program -... -ptyProcess.write(RESUME); // pty will enter flow mode and resume the slave program - -// temporarily disable/re-enable flow control -ptyProcess.handleFlowControl = false; -... -ptyProcess.handleFlowControl = true; -``` - -By default `PAUSE` and `RESUME` are XON/XOFF control codes (as shown above). To avoid conflicts in environments that use these control codes for different purposes the messages can be customized as `flowControlPause: string` and `flowControlResume: string` in the constructor options. `PAUSE` and `RESUME` are not passed to the underlying pseudoterminal if flow control is enabled. - -## Troubleshooting - -### Powershell gives error 8009001d - -> Internal Windows PowerShell error. Loading managed Windows PowerShell failed with error 8009001d. - -This happens when PowerShell is launched with no `SystemRoot` environment variable present. - -### ConnectNamedPipe failed: Windows error 232 - -This error can occur due to anti-virus software intercepting winpty from creating a pty. To workaround this you can exclude this file from your anti-virus scanning `node-pty\build\Release\winpty-agent.exe` - -## pty.js - -This project is forked from [chjj/pty.js](https://github.com/chjj/pty.js) with the primary goals being to provide better support for later Node.JS versions and Windows. - -## License - -Copyright (c) 2012-2015, Christopher Jeffrey (MIT License).
-Copyright (c) 2016, Daniel Imms (MIT License).
-Copyright (c) 2018, Microsoft Corporation (MIT License). diff --git a/node_modules/node-pty/binding.gyp b/node_modules/node-pty/binding.gyp deleted file mode 100644 index dac085f..0000000 --- a/node_modules/node-pty/binding.gyp +++ /dev/null @@ -1,85 +0,0 @@ -{ - 'conditions': [ - ['OS=="win"', { - 'targets': [ - { - 'target_name': 'conpty', - 'include_dirs' : [ - '> $(depfile) -# Add extra rules as in (2). -# We remove slashes and replace spaces with new lines; -# remove blank lines; -# delete the first line and append a colon to the remaining lines. -sed -e 's|\\||' -e 'y| |\n|' $(depfile).raw |\ - grep -v '^$$' |\ - sed -e 1d -e 's|$$|:|' \ - >> $(depfile) -rm $(depfile).raw -endef - -# Command definitions: -# - cmd_foo is the actual command to run; -# - quiet_cmd_foo is the brief-output summary of the command. - -quiet_cmd_cc = CC($(TOOLSET)) $@ -cmd_cc = $(CC.$(TOOLSET)) $(GYP_CFLAGS) $(DEPFLAGS) $(CFLAGS.$(TOOLSET)) -c -o $@ $< - -quiet_cmd_cxx = CXX($(TOOLSET)) $@ -cmd_cxx = $(CXX.$(TOOLSET)) $(GYP_CXXFLAGS) $(DEPFLAGS) $(CXXFLAGS.$(TOOLSET)) -c -o $@ $< - -quiet_cmd_touch = TOUCH $@ -cmd_touch = touch $@ - -quiet_cmd_copy = COPY $@ -# send stderr to /dev/null to ignore messages when linking directories. -cmd_copy = ln -f "$<" "$@" 2>/dev/null || (rm -rf "$@" && cp -af "$<" "$@") - -quiet_cmd_alink = AR($(TOOLSET)) $@ -cmd_alink = rm -f $@ && $(AR.$(TOOLSET)) crs $@ $(filter %.o,$^) - -quiet_cmd_alink_thin = AR($(TOOLSET)) $@ -cmd_alink_thin = rm -f $@ && $(AR.$(TOOLSET)) crsT $@ $(filter %.o,$^) - -# Due to circular dependencies between libraries :(, we wrap the -# special "figure out circular dependencies" flags around the entire -# input list during linking. -quiet_cmd_link = LINK($(TOOLSET)) $@ -cmd_link = $(LINK.$(TOOLSET)) $(GYP_LDFLAGS) $(LDFLAGS.$(TOOLSET)) -o $@ -Wl,--start-group $(LD_INPUTS) -Wl,--end-group $(LIBS) - -# We support two kinds of shared objects (.so): -# 1) shared_library, which is just bundling together many dependent libraries -# into a link line. -# 2) loadable_module, which is generating a module intended for dlopen(). -# -# They differ only slightly: -# In the former case, we want to package all dependent code into the .so. -# In the latter case, we want to package just the API exposed by the -# outermost module. -# This means shared_library uses --whole-archive, while loadable_module doesn't. -# (Note that --whole-archive is incompatible with the --start-group used in -# normal linking.) - -# Other shared-object link notes: -# - Set SONAME to the library filename so our binaries don't reference -# the local, absolute paths used on the link command-line. -quiet_cmd_solink = SOLINK($(TOOLSET)) $@ -cmd_solink = $(LINK.$(TOOLSET)) -shared $(GYP_LDFLAGS) $(LDFLAGS.$(TOOLSET)) -Wl,-soname=$(@F) -o $@ -Wl,--whole-archive $(LD_INPUTS) -Wl,--no-whole-archive $(LIBS) - -quiet_cmd_solink_module = SOLINK_MODULE($(TOOLSET)) $@ -cmd_solink_module = $(LINK.$(TOOLSET)) -shared $(GYP_LDFLAGS) $(LDFLAGS.$(TOOLSET)) -Wl,-soname=$(@F) -o $@ -Wl,--start-group $(filter-out FORCE_DO_CMD, $^) -Wl,--end-group $(LIBS) - - -# Define an escape_quotes function to escape single quotes. -# This allows us to handle quotes properly as long as we always use -# use single quotes and escape_quotes. -escape_quotes = $(subst ','\'',$(1)) -# This comment is here just to include a ' to unconfuse syntax highlighting. -# Define an escape_vars function to escape '$' variable syntax. -# This allows us to read/write command lines with shell variables (e.g. -# $LD_LIBRARY_PATH), without triggering make substitution. -escape_vars = $(subst $$,$$$$,$(1)) -# Helper that expands to a shell command to echo a string exactly as it is in -# make. This uses printf instead of echo because printf's behaviour with respect -# to escape sequences is more portable than echo's across different shells -# (e.g., dash, bash). -exact_echo = printf '%s\n' '$(call escape_quotes,$(1))' - -# Helper to compare the command we're about to run against the command -# we logged the last time we ran the command. Produces an empty -# string (false) when the commands match. -# Tricky point: Make has no string-equality test function. -# The kernel uses the following, but it seems like it would have false -# positives, where one string reordered its arguments. -# arg_check = $(strip $(filter-out $(cmd_$(1)), $(cmd_$@)) \ -# $(filter-out $(cmd_$@), $(cmd_$(1)))) -# We instead substitute each for the empty string into the other, and -# say they're equal if both substitutions produce the empty string. -# .d files contain ? instead of spaces, take that into account. -command_changed = $(or $(subst $(cmd_$(1)),,$(cmd_$(call replace_spaces,$@))),\ - $(subst $(cmd_$(call replace_spaces,$@)),,$(cmd_$(1)))) - -# Helper that is non-empty when a prerequisite changes. -# Normally make does this implicitly, but we force rules to always run -# so we can check their command lines. -# $? -- new prerequisites -# $| -- order-only dependencies -prereq_changed = $(filter-out FORCE_DO_CMD,$(filter-out $|,$?)) - -# Helper that executes all postbuilds until one fails. -define do_postbuilds - @E=0;\ - for p in $(POSTBUILDS); do\ - eval $$p;\ - E=$$?;\ - if [ $$E -ne 0 ]; then\ - break;\ - fi;\ - done;\ - if [ $$E -ne 0 ]; then\ - rm -rf "$@";\ - exit $$E;\ - fi -endef - -# do_cmd: run a command via the above cmd_foo names, if necessary. -# Should always run for a given target to handle command-line changes. -# Second argument, if non-zero, makes it do asm/C/C++ dependency munging. -# Third argument, if non-zero, makes it do POSTBUILDS processing. -# Note: We intentionally do NOT call dirx for depfile, since it contains ? for -# spaces already and dirx strips the ? characters. -define do_cmd -$(if $(or $(command_changed),$(prereq_changed)), - @$(call exact_echo, $($(quiet)cmd_$(1))) - @mkdir -p "$(call dirx,$@)" "$(dir $(depfile))" - $(if $(findstring flock,$(word 1,$(cmd_$1))), - @$(cmd_$(1)) - @echo " $(quiet_cmd_$(1)): Finished", - @$(cmd_$(1)) - ) - @$(call exact_echo,$(call escape_vars,cmd_$(call replace_spaces,$@) := $(cmd_$(1)))) > $(depfile) - @$(if $(2),$(fixup_dep)) - $(if $(and $(3), $(POSTBUILDS)), - $(call do_postbuilds) - ) -) -endef - -# Declare the "all" target first so it is the default, -# even though we don't have the deps yet. -.PHONY: all -all: - -# make looks for ways to re-generate included makefiles, but in our case, we -# don't have a direct way. Explicitly telling make that it has nothing to do -# for them makes it go faster. -%.d: ; - -# Use FORCE_DO_CMD to force a target to run. Should be coupled with -# do_cmd. -.PHONY: FORCE_DO_CMD -FORCE_DO_CMD: - -TOOLSET := target -# Suffix rules, putting all outputs into $(obj). -$(obj).$(TOOLSET)/%.o: $(srcdir)/%.c FORCE_DO_CMD - @$(call do_cmd,cc,1) -$(obj).$(TOOLSET)/%.o: $(srcdir)/%.cc FORCE_DO_CMD - @$(call do_cmd,cxx,1) -$(obj).$(TOOLSET)/%.o: $(srcdir)/%.cpp FORCE_DO_CMD - @$(call do_cmd,cxx,1) -$(obj).$(TOOLSET)/%.o: $(srcdir)/%.cxx FORCE_DO_CMD - @$(call do_cmd,cxx,1) -$(obj).$(TOOLSET)/%.o: $(srcdir)/%.S FORCE_DO_CMD - @$(call do_cmd,cc,1) -$(obj).$(TOOLSET)/%.o: $(srcdir)/%.s FORCE_DO_CMD - @$(call do_cmd,cc,1) - -# Try building from generated source, too. -$(obj).$(TOOLSET)/%.o: $(obj).$(TOOLSET)/%.c FORCE_DO_CMD - @$(call do_cmd,cc,1) -$(obj).$(TOOLSET)/%.o: $(obj).$(TOOLSET)/%.cc FORCE_DO_CMD - @$(call do_cmd,cxx,1) -$(obj).$(TOOLSET)/%.o: $(obj).$(TOOLSET)/%.cpp FORCE_DO_CMD - @$(call do_cmd,cxx,1) -$(obj).$(TOOLSET)/%.o: $(obj).$(TOOLSET)/%.cxx FORCE_DO_CMD - @$(call do_cmd,cxx,1) -$(obj).$(TOOLSET)/%.o: $(obj).$(TOOLSET)/%.S FORCE_DO_CMD - @$(call do_cmd,cc,1) -$(obj).$(TOOLSET)/%.o: $(obj).$(TOOLSET)/%.s FORCE_DO_CMD - @$(call do_cmd,cc,1) - -$(obj).$(TOOLSET)/%.o: $(obj)/%.c FORCE_DO_CMD - @$(call do_cmd,cc,1) -$(obj).$(TOOLSET)/%.o: $(obj)/%.cc FORCE_DO_CMD - @$(call do_cmd,cxx,1) -$(obj).$(TOOLSET)/%.o: $(obj)/%.cpp FORCE_DO_CMD - @$(call do_cmd,cxx,1) -$(obj).$(TOOLSET)/%.o: $(obj)/%.cxx FORCE_DO_CMD - @$(call do_cmd,cxx,1) -$(obj).$(TOOLSET)/%.o: $(obj)/%.S FORCE_DO_CMD - @$(call do_cmd,cc,1) -$(obj).$(TOOLSET)/%.o: $(obj)/%.s FORCE_DO_CMD - @$(call do_cmd,cc,1) - - -ifeq ($(strip $(foreach prefix,$(NO_LOAD),\ - $(findstring $(join ^,$(prefix)),\ - $(join ^,pty.target.mk)))),) - include pty.target.mk -endif - -quiet_cmd_regen_makefile = ACTION Regenerating $@ -cmd_regen_makefile = cd $(srcdir); /usr/share/node-gyp/gyp/gyp_main.py -fmake --ignore-environment "--toplevel-dir=." -I/home/pi/VSoRC/node_modules/node-pty/build/config.gypi -I/usr/share/node-gyp/addon.gypi -I/usr/include/nodejs/common.gypi "--depth=." "-Goutput_dir=." "--generator-output=build" "-Dlibrary=shared_library" "-Dvisibility=default" "-Dnode_root_dir=/usr/include/nodejs" "-Dnode_gyp_dir=/usr/share/node-gyp" "-Dnode_lib_file=node.lib" "-Dmodule_root_dir=/home/pi/VSoRC/node_modules/node-pty" binding.gyp -Makefile: $(srcdir)/../../../../../usr/include/nodejs/common.gypi $(srcdir)/build/config.gypi $(srcdir)/binding.gyp $(srcdir)/../../../../../usr/share/node-gyp/addon.gypi - $(call do_cmd,regen_makefile) - -# "all" is a concatenation of the "all" targets from all the included -# sub-makefiles. This is just here to clarify. -all: - -# Add in dependency-tracking rules. $(all_deps) is the list of every single -# target in our tree. Only consider the ones with .d (dependency) info: -d_files := $(wildcard $(foreach f,$(all_deps),$(depsdir)/$(f).d)) -ifneq ($(d_files),) - include $(d_files) -endif diff --git a/node_modules/node-pty/build/Release/pty.node b/node_modules/node-pty/build/Release/pty.node deleted file mode 100755 index 9dd15cf..0000000 Binary files a/node_modules/node-pty/build/Release/pty.node and /dev/null differ diff --git a/node_modules/node-pty/build/binding.Makefile b/node_modules/node-pty/build/binding.Makefile deleted file mode 100644 index 059b76f..0000000 --- a/node_modules/node-pty/build/binding.Makefile +++ /dev/null @@ -1,6 +0,0 @@ -# This file is generated by gyp; do not edit. - -export builddir_name ?= ./build/. -.PHONY: all -all: - $(MAKE) pty diff --git a/node_modules/node-pty/build/config.gypi b/node_modules/node-pty/build/config.gypi deleted file mode 100644 index cf372b9..0000000 --- a/node_modules/node-pty/build/config.gypi +++ /dev/null @@ -1,151 +0,0 @@ -# Do not edit. File was generated by node-gyp's "configure" step -{ - "target_defaults": { - "cflags": [], - "default_configuration": "Release", - "defines": [], - "include_dirs": [], - "libraries": [] - }, - "variables": { - "arm_float_abi": "hard", - "arm_fpu": "vfp", - "arm_thumb": 0, - "arm_version": "6", - "asan": 0, - "coverage": "false", - "debug_devtools": "node", - "debug_http2": "false", - "debug_nghttp2": "false", - "force_dynamic_crt": 0, - "host_arch": "arm", - "icu_gyp_path": "tools/icu/icu-system.gyp", - "icu_small": "false", - "llvm_version": 0, - "node_byteorder": "little", - "node_enable_d8": "false", - "node_enable_v8_vtunejit": "false", - "node_install_npm": "false", - "node_module_version": 57, - "node_no_browser_globals": "false", - "node_prefix": "/usr", - "node_release_urlbase": "", - "node_shared": "false", - "node_shared_cares": "true", - "node_shared_http_parser": "true", - "node_shared_libuv": "true", - "node_shared_nghttp2": "false", - "node_shared_openssl": "true", - "node_shared_zlib": "true", - "node_tag": "", - "node_use_bundled_v8": "true", - "node_use_dtrace": "false", - "node_use_etw": "false", - "node_use_lttng": "false", - "node_use_openssl": "true", - "node_use_perfctr": "false", - "node_use_v8_platform": "true", - "node_without_node_options": "false", - "openssl_fips": "", - "openssl_no_asm": 0, - "shlib_suffix": "so.57", - "target_arch": "arm", - "uv_parent_path": "/deps/uv/", - "uv_use_dtrace": "false", - "v8_enable_gdbjit": 0, - "v8_enable_i18n_support": 1, - "v8_enable_inspector": 1, - "v8_no_strict_aliasing": 1, - "v8_optimized_debug": 0, - "v8_promise_internal_field_count": 1, - "v8_random_seed": 0, - "v8_trace_maps": 0, - "v8_use_snapshot": "false", - "want_separate_host_toolset": 0, - "nodedir": "/usr/include/nodejs", - "copy_dev_lib": "true", - "standalone_static_library": 1, - "cache_lock_stale": "60000", - "sign_git_tag": "", - "user_agent": "npm/1.4.21 node/v8.11.1 linux arm", - "always_auth": "", - "bin_links": "true", - "key": "", - "description": "true", - "fetch_retries": "2", - "heading": "npm", - "user": "", - "force": "", - "cache_min": "10", - "init_license": "ISC", - "editor": "vi", - "rollback": "true", - "cache_max": "Infinity", - "userconfig": "/home/pi/.npmrc", - "engine_strict": "", - "init_author_name": "", - "init_author_url": "", - "tmp": "/tmp", - "depth": "Infinity", - "save_dev": "", - "usage": "", - "https_proxy": "", - "onload_script": "", - "rebuild_bundle": "true", - "save_bundle": "", - "shell": "/bin/bash", - "prefix": "/usr/local", - "registry": "https://registry.npmjs.org/", - "__DO_NOT_MODIFY_THIS_FILE___use__etc_npmrc_instead_": "true", - "browser": "", - "cache_lock_wait": "10000", - "save_optional": "", - "searchopts": "", - "versions": "", - "cache": "/home/pi/.npm", - "ignore_scripts": "", - "searchsort": "name", - "version": "", - "local_address": "", - "viewer": "man", - "color": "true", - "fetch_retry_mintimeout": "10000", - "umask": "18", - "fetch_retry_maxtimeout": "60000", - "message": "%s", - "ca": "", - "cert": "", - "global": "", - "link": "", - "save": "", - "unicode": "true", - "long": "", - "production": "", - "unsafe_perm": "true", - "node_version": "8.11.1", - "tag": "latest", - "git_tag_version": "true", - "shrinkwrap": "true", - "fetch_retry_factor": "10", - "npat": "", - "proprietary_attribs": "true", - "save_exact": "", - "strict_ssl": "true", - "username": "", - "globalconfig": "/etc/npmrc", - "dev": "", - "init_module": "/home/pi/.npm-init.js", - "parseable": "", - "globalignorefile": "/etc/npmignore", - "cache_lock_retries": "10", - "save_prefix": "^", - "group": "1000", - "init_author_email": "", - "searchexclude": "", - "git": "git", - "optional": "true", - "email": "", - "json": "", - "spin": "true" - } -} diff --git a/node_modules/node-pty/build/pty.target.mk b/node_modules/node-pty/build/pty.target.mk deleted file mode 100644 index 528472f..0000000 --- a/node_modules/node-pty/build/pty.target.mk +++ /dev/null @@ -1,140 +0,0 @@ -# This file is generated by gyp; do not edit. - -TOOLSET := target -TARGET := pty -DEFS_Debug := \ - '-DNODE_GYP_MODULE_NAME=pty' \ - '-DUSING_UV_SHARED=1' \ - '-DUSING_V8_SHARED=1' \ - '-DV8_DEPRECATION_WARNINGS=1' \ - '-D_LARGEFILE_SOURCE' \ - '-D_FILE_OFFSET_BITS=64' \ - '-DBUILDING_NODE_EXTENSION' \ - '-DDEBUG' \ - '-D_DEBUG' \ - '-DV8_ENABLE_CHECKS' - -# Flags passed to all source files. -CFLAGS_Debug := \ - -fPIC \ - -pthread \ - -Wall \ - -Wextra \ - -Wno-unused-parameter \ - -g \ - -O0 - -# Flags passed to only C files. -CFLAGS_C_Debug := - -# Flags passed to only C++ files. -CFLAGS_CC_Debug := \ - -fno-rtti \ - -fno-exceptions \ - -std=gnu++0x - -INCS_Debug := \ - -I/usr/include/nodejs/include/node \ - -I/usr/include/nodejs/src \ - -I/usr/include/nodejs/deps/uv/include \ - -I/usr/include/nodejs/deps/v8/include \ - -I$(srcdir)/node_modules/nan - -DEFS_Release := \ - '-DNODE_GYP_MODULE_NAME=pty' \ - '-DUSING_UV_SHARED=1' \ - '-DUSING_V8_SHARED=1' \ - '-DV8_DEPRECATION_WARNINGS=1' \ - '-D_LARGEFILE_SOURCE' \ - '-D_FILE_OFFSET_BITS=64' \ - '-DBUILDING_NODE_EXTENSION' - -# Flags passed to all source files. -CFLAGS_Release := \ - -fPIC \ - -pthread \ - -Wall \ - -Wextra \ - -Wno-unused-parameter \ - -O3 \ - -fno-omit-frame-pointer - -# Flags passed to only C files. -CFLAGS_C_Release := - -# Flags passed to only C++ files. -CFLAGS_CC_Release := \ - -fno-rtti \ - -fno-exceptions \ - -std=gnu++0x - -INCS_Release := \ - -I/usr/include/nodejs/include/node \ - -I/usr/include/nodejs/src \ - -I/usr/include/nodejs/deps/uv/include \ - -I/usr/include/nodejs/deps/v8/include \ - -I$(srcdir)/node_modules/nan - -OBJS := \ - $(obj).target/$(TARGET)/src/unix/pty.o - -# Add to the list of files we specially track dependencies for. -all_deps += $(OBJS) - -# CFLAGS et al overrides must be target-local. -# See "Target-specific Variable Values" in the GNU Make manual. -$(OBJS): TOOLSET := $(TOOLSET) -$(OBJS): GYP_CFLAGS := $(DEFS_$(BUILDTYPE)) $(INCS_$(BUILDTYPE)) $(CFLAGS_$(BUILDTYPE)) $(CFLAGS_C_$(BUILDTYPE)) -$(OBJS): GYP_CXXFLAGS := $(DEFS_$(BUILDTYPE)) $(INCS_$(BUILDTYPE)) $(CFLAGS_$(BUILDTYPE)) $(CFLAGS_CC_$(BUILDTYPE)) - -# Suffix rules, putting all outputs into $(obj). - -$(obj).$(TOOLSET)/$(TARGET)/%.o: $(srcdir)/%.cc FORCE_DO_CMD - @$(call do_cmd,cxx,1) - -# Try building from generated source, too. - -$(obj).$(TOOLSET)/$(TARGET)/%.o: $(obj).$(TOOLSET)/%.cc FORCE_DO_CMD - @$(call do_cmd,cxx,1) - -$(obj).$(TOOLSET)/$(TARGET)/%.o: $(obj)/%.cc FORCE_DO_CMD - @$(call do_cmd,cxx,1) - -# End of this set of suffix rules -### Rules for final target. -LDFLAGS_Debug := \ - -pthread \ - -rdynamic - -LDFLAGS_Release := \ - -pthread \ - -rdynamic - -LIBS := \ - -lutil - -$(obj).target/pty.node: GYP_LDFLAGS := $(LDFLAGS_$(BUILDTYPE)) -$(obj).target/pty.node: LIBS := $(LIBS) -$(obj).target/pty.node: TOOLSET := $(TOOLSET) -$(obj).target/pty.node: $(OBJS) FORCE_DO_CMD - $(call do_cmd,solink_module) - -all_deps += $(obj).target/pty.node -# Add target alias -.PHONY: pty -pty: $(builddir)/pty.node - -# Copy this to the executable output path. -$(builddir)/pty.node: TOOLSET := $(TOOLSET) -$(builddir)/pty.node: $(obj).target/pty.node FORCE_DO_CMD - $(call do_cmd,copy) - -all_deps += $(builddir)/pty.node -# Short alias for building this executable. -.PHONY: pty.node -pty.node: $(obj).target/pty.node $(builddir)/pty.node - -# Add executable to "all" target. -.PHONY: all -all: $(builddir)/pty.node - diff --git a/node_modules/node-pty/deps/.editorconfig b/node_modules/node-pty/deps/.editorconfig deleted file mode 100644 index 8a39199..0000000 --- a/node_modules/node-pty/deps/.editorconfig +++ /dev/null @@ -1,2 +0,0 @@ -# Have editor config ignore this directory -root = true diff --git a/node_modules/node-pty/deps/winpty/.drone.yml b/node_modules/node-pty/deps/winpty/.drone.yml deleted file mode 100644 index 63d853f..0000000 --- a/node_modules/node-pty/deps/winpty/.drone.yml +++ /dev/null @@ -1,17 +0,0 @@ -# Build configure for https://www.tea-ci.org (fork of Drone CI with Msys2 support) -build: - image: teaci/msys$$arch - pull: true - shell: msys$$arch - commands: - - pacman -S --needed --noconfirm --noprogressbar mingw-w64-cross-gcc mingw-w64-cross-crt-git - - ./configure - - make - - make tests - - build/trivial_test.exe - - mintty --log - --exec build/winpty.exe cmd /c ver | grep Windows - -matrix: - arch: - - 64 - - 32 diff --git a/node_modules/node-pty/deps/winpty/.gitattributes b/node_modules/node-pty/deps/winpty/.gitattributes deleted file mode 100644 index 36d4c60..0000000 --- a/node_modules/node-pty/deps/winpty/.gitattributes +++ /dev/null @@ -1,19 +0,0 @@ -* text=auto -*.bat text eol=crlf -*.c text -*.cc text -*.gyp text -*.gypi text -*.h text -*.ps1 text eol=crlf -*.rst text -*.sh text -*.txt text -.gitignore text -.gitattributes text -Makefile text -configure text - -*.sh eol=lf -configure eol=lf -VERSION.txt eol=lf diff --git a/node_modules/node-pty/deps/winpty/.gitignore b/node_modules/node-pty/deps/winpty/.gitignore deleted file mode 100644 index 89e60bd..0000000 --- a/node_modules/node-pty/deps/winpty/.gitignore +++ /dev/null @@ -1,15 +0,0 @@ -*.sln -*.suo -*.vcxproj -*.vcxproj.filters -*.pyc -winpty.sdf -winpty.opensdf -/config.mk -/build -/build-gyp -/build-libpty -/ship/packages -/src/Default -/src/Release -/src/gen diff --git a/node_modules/node-pty/deps/winpty/LICENSE b/node_modules/node-pty/deps/winpty/LICENSE deleted file mode 100644 index 246fbe0..0000000 --- a/node_modules/node-pty/deps/winpty/LICENSE +++ /dev/null @@ -1,21 +0,0 @@ -The MIT License (MIT) - -Copyright (c) 2011-2016 Ryan Prichard - -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. diff --git a/node_modules/node-pty/deps/winpty/Makefile b/node_modules/node-pty/deps/winpty/Makefile deleted file mode 100644 index 8b3d0ae..0000000 --- a/node_modules/node-pty/deps/winpty/Makefile +++ /dev/null @@ -1,166 +0,0 @@ -# Copyright (c) 2011-2015 Ryan Prichard -# -# 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. - -# Use make -n to see the actual command-lines make would run. - -# The default "make install" prefix is /usr/local. Pass PREFIX= on the -# command-line to override the default. - -.SECONDEXPANSION : - -.PHONY : default -default : all - -PREFIX := /usr/local -UNIX_ADAPTER_EXE := winpty.exe -MINGW_ENABLE_CXX11_FLAG := -std=c++11 -USE_PCH := 1 - -COMMON_CXXFLAGS := -UNIX_CXXFLAGS := -MINGW_CXXFLAGS := -MINGW_LDFLAGS := -UNIX_LDFLAGS := - -# Include config.mk but complain if it hasn't been created yet. -ifeq "$(wildcard config.mk)" "" - $(error config.mk does not exist. Please run ./configure) -endif -include config.mk - -COMMON_CXXFLAGS += \ - -MMD -Wall \ - -DUNICODE \ - -D_UNICODE \ - -D_WIN32_WINNT=0x0501 \ - -Ibuild/gen - -UNIX_CXXFLAGS += \ - $(COMMON_CXXFLAGS) - -MINGW_CXXFLAGS += \ - $(COMMON_CXXFLAGS) \ - -O2 \ - $(MINGW_ENABLE_CXX11_FLAG) - -MINGW_LDFLAGS += -static -static-libgcc -static-libstdc++ -UNIX_LDFLAGS += $(UNIX_LDFLAGS_STATIC) - -ifeq "$(USE_PCH)" "1" -MINGW_CXXFLAGS += -include build/mingw/PrecompiledHeader.h -PCH_DEP := build/mingw/PrecompiledHeader.h.gch -else -PCH_DEP := -endif - -build/gen/GenVersion.h : VERSION.txt $(COMMIT_HASH_DEP) | $$(@D)/.mkdir - $(info Updating build/gen/GenVersion.h) - @echo "const char GenVersion_Version[] = \"$(shell cat VERSION.txt | tr -d '\r\n')\";" > build/gen/GenVersion.h - @echo "const char GenVersion_Commit[] = \"$(COMMIT_HASH)\";" >> build/gen/GenVersion.h - -build/mingw/PrecompiledHeader.h : src/shared/PrecompiledHeader.h | $$(@D)/.mkdir - $(info Copying $< to $@) - @cp $< $@ - -build/mingw/PrecompiledHeader.h.gch : build/mingw/PrecompiledHeader.h | $$(@D)/.mkdir - $(info Compiling $<) - @$(MINGW_CXX) $(MINGW_CXXFLAGS) -c -o $@ $< - --include build/mingw/PrecompiledHeader.h.d - -define def_unix_target -build/$1/%.o : src/%.cc | $$$$(@D)/.mkdir - $$(info Compiling $$<) - @$$(UNIX_CXX) $$(UNIX_CXXFLAGS) $2 -I src/include -c -o $$@ $$< -endef - -define def_mingw_target -build/$1/%.o : src/%.cc $$(PCH_DEP) | $$$$(@D)/.mkdir - $$(info Compiling $$<) - @$$(MINGW_CXX) $$(MINGW_CXXFLAGS) $2 -I src/include -c -o $$@ $$< -endef - -include src/subdir.mk - -.PHONY : all -all : $(ALL_TARGETS) - -.PHONY : tests -tests : $(TEST_PROGRAMS) - -.PHONY : install-bin -install-bin : all - mkdir -p $(PREFIX)/bin - install -m 755 -p -s build/$(UNIX_ADAPTER_EXE) $(PREFIX)/bin - install -m 755 -p -s build/winpty.dll $(PREFIX)/bin - install -m 755 -p -s build/winpty-agent.exe $(PREFIX)/bin - -.PHONY : install-debugserver -install-debugserver : all - mkdir -p $(PREFIX)/bin - install -m 755 -p -s build/winpty-debugserver.exe $(PREFIX)/bin - -.PHONY : install-lib -install-lib : all - mkdir -p $(PREFIX)/lib - install -m 644 -p build/winpty.lib $(PREFIX)/lib - -.PHONY : install-doc -install-doc : - mkdir -p $(PREFIX)/share/doc/winpty - install -m 644 -p LICENSE $(PREFIX)/share/doc/winpty - install -m 644 -p README.md $(PREFIX)/share/doc/winpty - install -m 644 -p RELEASES.md $(PREFIX)/share/doc/winpty - -.PHONY : install-include -install-include : - mkdir -p $(PREFIX)/include/winpty - install -m 644 -p src/include/winpty.h $(PREFIX)/include/winpty - install -m 644 -p src/include/winpty_constants.h $(PREFIX)/include/winpty - -.PHONY : install -install : \ - install-bin \ - install-debugserver \ - install-lib \ - install-doc \ - install-include - -.PHONY : clean -clean : - rm -fr build - -.PHONY : clean-msvc -clean-msvc : - rm -fr src/Default src/Release src/.vs src/gen - rm -f src/*.vcxproj src/*.vcxproj.filters src/*.sln src/*.sdf - -.PHONY : distclean -distclean : clean - rm -f config.mk - -.PRECIOUS : %.mkdir -%.mkdir : - $(info Creating directory $(dir $@)) - @mkdir -p $(dir $@) - @touch $@ - -src/%.h : - @echo "Missing header file $@ (stale dependency file?)" diff --git a/node_modules/node-pty/deps/winpty/README.md b/node_modules/node-pty/deps/winpty/README.md deleted file mode 100644 index a6520fc..0000000 --- a/node_modules/node-pty/deps/winpty/README.md +++ /dev/null @@ -1,151 +0,0 @@ -# winpty - -[![Build Status](https://tea-ci.org/api/badges/rprichard/winpty/status.svg)](https://tea-ci.org/rprichard/winpty) - -winpty is a Windows software package providing an interface similar to a Unix -pty-master for communicating with Windows console programs. The package -consists of a library (libwinpty) and a tool for Cygwin and MSYS for running -Windows console programs in a Cygwin/MSYS pty. - -The software works by starting the `winpty-agent.exe` process with a new, -hidden console window, which bridges between the console API and terminal -input/output escape codes. It polls the hidden console's screen buffer for -changes and generates a corresponding stream of output. - -The Unix adapter allows running Windows console programs (e.g. CMD, PowerShell, -IronPython, etc.) under `mintty` or Cygwin's `sshd` with -properly-functioning input (e.g. arrow and function keys) and output (e.g. line -buffering). The library could be also useful for writing a non-Cygwin SSH -server. - -## Supported Windows versions - -winpty runs on Windows XP through Windows 10, including server versions. It -can be compiled into either 32-bit or 64-bit binaries. - -## Cygwin/MSYS adapter (`winpty.exe`) - -### Prerequisites - -You need the following to build winpty: - -* A Cygwin or MSYS installation -* GNU make -* A MinGW g++ toolchain capable of compiling C++11 code to build `winpty.dll` - and `winpty-agent.exe` -* A g++ toolchain targeting Cygwin or MSYS to build `winpty.exe` - -Winpty requires two g++ toolchains as it is split into two parts. The -`winpty.dll` and `winpty-agent.exe` binaries interface with the native -Windows command prompt window so they are compiled with the native MinGW -toolchain. The `winpty.exe` binary interfaces with the MSYS/Cygwin terminal so -it is compiled with the MSYS/Cygwin toolchain. - -MinGW appears to be split into two distributions -- MinGW (creates 32-bit -binaries) and MinGW-w64 (creates both 32-bit and 64-bit binaries). Either -one is generally acceptable. - -#### Cygwin packages - -The default g++ compiler for Cygwin targets Cygwin itself, but Cygwin also -packages MinGW-w64 compilers. As of this writing, the necessary packages are: - -* Either `mingw64-i686-gcc-g++` or `mingw64-x86_64-gcc-g++`. Select the - appropriate compiler for your CPU architecture. -* `gcc-g++` -* `make` - -As of this writing (2016-01-23), only the MinGW-w64 compiler is acceptable. -The MinGW compiler (e.g. from the `mingw-gcc-g++` package) is no longer -maintained and is too buggy. - -#### MSYS packages - -For the original MSYS, use the `mingw-get` tool (MinGW Installation Manager), -and select at least these components: - -* `mingw-developer-toolkit` -* `mingw32-base` -* `mingw32-gcc-g++` -* `msys-base` -* `msys-system-builder` - -When running `./configure`, make sure that `mingw32-g++` is in your -`PATH`. It will be in the `C:\MinGW\bin` directory. - -#### MSYS2 packages - -For MSYS2, use `pacman` and install at least these packages: - -* `msys/gcc` -* `mingw32/mingw-w64-i686-gcc` or `mingw64/mingw-w64-x86_64-gcc`. Select - the appropriate compiler for your CPU architecture. -* `make` - -MSYS2 provides three start menu shortcuts for starting MSYS2: - -* MinGW-w64 Win32 Shell -* MinGW-w64 Win64 Shell -* MSYS2 Shell - -To build winpty, use the MinGW-w64 {Win32,Win64} shortcut of the architecture -matching MSYS2. These shortcuts will put the g++ compiler from the -`{mingw32,mingw64}/mingw-w64-{i686,x86_64}-gcc` packages into the `PATH`. - -Alternatively, instead of installing `mingw32/mingw-w64-i686-gcc` or -`mingw64/mingw-w64-x86_64-gcc`, install the `mingw-w64-cross-gcc` and -`mingw-w64-cross-crt-git` packages. These packages install cross-compilers -into `/opt/bin`, and then any of the three shortcuts will work. - -### Building the Unix adapter - -In the project directory, run `./configure`, then `make`, then `make install`. -By default, winpty is installed into `/usr/local`. Pass `PREFIX=` to -`make install` to override this default. - -### Using the Unix adapter - -To run a Windows console program in `mintty` or Cygwin `sshd`, prepend -`winpty` to the command-line: - - $ winpty powershell - Windows PowerShell - Copyright (C) 2009 Microsoft Corporation. All rights reserved. - - PS C:\rprichard\proj\winpty> 10 + 20 - 30 - PS C:\rprichard\proj\winpty> exit - -## Embedding winpty / MSVC compilation - -See `src/include/winpty.h` for the prototypes of functions exported by -`winpty.dll`. - -Only the `winpty.exe` binary uses Cygwin; all the other binaries work without -it and can be compiled with either MinGW or MSVC. To compile using MSVC, -download gyp and run `gyp -I configurations.gypi` in the `src` subdirectory. -This will generate a `winpty.sln` and associated project files. See the -`src/winpty.gyp` and `src/configurations.gypi` files for notes on dealing with -MSVC versions and different architectures. - -Compiling winpty with MSVC currently requires MSVC 2013 or newer. - -## Debugging winpty - -winpty comes with a tool for collecting timestamped debugging output. To use -it: - -1. Run `winpty-debugserver.exe` on the same computer as winpty. -2. Set the `WINPTY_DEBUG` environment variable to `trace` for the - `winpty.exe` process and/or the process using `libwinpty.dll`. - -winpty also recognizes a `WINPTY_SHOW_CONSOLE` environment variable. Set it -to 1 to prevent winpty from hiding the console window. - -## Copyright - -This project is distributed under the MIT license (see the `LICENSE` file in -the project root). - -By submitting a pull request for this project, you agree to license your -contribution under the MIT license to this project. diff --git a/node_modules/node-pty/deps/winpty/RELEASES.md b/node_modules/node-pty/deps/winpty/RELEASES.md deleted file mode 100644 index 768cdf9..0000000 --- a/node_modules/node-pty/deps/winpty/RELEASES.md +++ /dev/null @@ -1,280 +0,0 @@ -# Next Version - -Input handling changes: - - * Improve Ctrl-C handling with programs that use unprocessed input. (e.g. - Ctrl-C now cancels input with PowerShell on Windows 10.) - [#116](https://github.com/rprichard/winpty/issues/116) - * Fix a theoretical issue with input event ordering. - [#117](https://github.com/rprichard/winpty/issues/117) - * Ctrl/Shift+{Arrow,Home,End} keys now work with IntelliJ. - [#118](https://github.com/rprichard/winpty/issues/118) - -# Version 0.4.3 (2017-05-17) - -Input handling changes: - - * winpty sets `ENHANCED_KEY` for arrow and navigation keys. This fixes an - issue with the Ruby REPL. - [#99](https://github.com/rprichard/winpty/issues/99) - * AltGr keys are handled better now. - [#109](https://github.com/rprichard/winpty/issues/109) - * In `ENABLE_VIRTUAL_TERMINAL_INPUT` mode, when typing Home/End with a - modifier (e.g. Ctrl), winpty now generates an H/F escape sequence like - `^[[1;5F` rather than a 1/4 escape like `^[[4;5~`. - [#114](https://github.com/rprichard/winpty/issues/114) - -Resizing and scraping fixes: - - * winpty now synthesizes a `WINDOW_BUFFER_SIZE_EVENT` event after resizing - the console to better propagate window size changes to console programs. - In particular, this affects WSL and Cygwin. - [#110](https://github.com/rprichard/winpty/issues/110) - * Better handling of resizing for certain full-screen programs, like - WSL less. - [#112](https://github.com/rprichard/winpty/issues/112) - * Hide the cursor if it's currently outside the console window. This change - fixes an issue with Far Manager. - [#113](https://github.com/rprichard/winpty/issues/113) - * winpty now avoids using console fonts smaller than 5px high to improve - half-vs-full-width character handling. See - https://github.com/Microsoft/vscode/issues/19665. - [b4db322010](https://github.com/rprichard/winpty/commit/b4db322010d2d897e6c496fefc4f0ecc9b84c2f3) - -Cygwin/MSYS adapter fix: - - * The way the `winpty` Cygwin/MSYS2 adapter searches for the program to - launch changed. It now resolves symlinks and searches the PATH explicitly. - [#81](https://github.com/rprichard/winpty/issues/81) - [#98](https://github.com/rprichard/winpty/issues/98) - -This release does not include binaries for the old MSYS1 project anymore. -MSYS2 will continue to be supported. See -https://github.com/rprichard/winpty/issues/97. - -# Version 0.4.2 (2017-01-18) - -This release improves WSL support (i.e. Bash-on-Windows): - - * winpty generates more correct input escape sequences for WSL programs that - enable an alternate input mode using DECCKM. This bug affected arrow keys - and Home/End in WSL programs such as `vim`, `mc`, and `less`. - [#90](https://github.com/rprichard/winpty/issues/90) - * winpty now recognizes the `COMMON_LVB_REVERSE_VIDEO` and - `COMMON_LVB_UNDERSCORE` text attributes. The Windows console uses these - attributes to implement the SGR.4(Underline) and SGR.7(Negative) modes in - its VT handling. This change affects WSL pager status bars, man pages, etc. - -The build system no longer has a "version suffix" mechanism, so passing -`VERSION_SUFFIX=` to make or `-D VERSION_SUFFIX=` to gyp now -has no effect. AFAIK, the mechanism was never used publicly. -[67a34b6c03](https://github.com/rprichard/winpty/commit/67a34b6c03557a5c2e0a2bdd502c2210921d8f3e) - -# Version 0.4.1 (2017-01-03) - -Bug fixes: - - * This version fixes a bug where the `winpty-agent.exe` process could read - past the end of a buffer. - [#94](https://github.com/rprichard/winpty/issues/94) - -# Version 0.4.0 (2016-06-28) - -The winpty library has a new API that should be easier for embedding. -[880c00c69e](https://github.com/rprichard/winpty/commit/880c00c69eeca73643ddb576f02c5badbec81f56) - -User-visible changes: - - * winpty now automatically puts the terminal into mouse mode when it detects - that the console has left QuickEdit mode. The `--mouse` option still forces - the terminal into mouse mode. In principle, an option could be added to - suppress terminal mode, but hopefully it won't be necessary. There is a - script in the `misc` subdirectory, `misc/ConinMode.ps1`, that can change - the QuickEdit mode from the command-line. - * winpty now passes keyboard escapes to `bash.exe` in the Windows Subsystem - for Linux. - [#82](https://github.com/rprichard/winpty/issues/82) - -Bug fixes: - - * By default, `winpty.dll` avoids calling `SetProcessWindowStation` within - the calling process. - [#58](https://github.com/rprichard/winpty/issues/58) - * Fixed an uninitialized memory bug that could have crashed winpty. - [#80](https://github.com/rprichard/winpty/issues/80) - * winpty now works better with very large and very small terminal windows. - It resizes the console font according to the number of columns. - [#61](https://github.com/rprichard/winpty/issues/61) - * winpty no longer uses Mark to freeze the console on Windows 10. The Mark - command could interfere with the cursor position, corrupting the data in - the screen buffer. - [#79](https://github.com/rprichard/winpty/issues/79) - -# Version 0.3.0 (2016-05-20) - -User-visible changes: - - * The UNIX adapter is renamed from `console.exe` to `winpty.exe` to be - consistent with MSYS2. The name `winpty.exe` is less likely to conflict - with another program and is easier to search for online (e.g. for someone - unfamiliar with winpty). - * The UNIX adapter now clears the `TERM` variable. - [#43](https://github.com/rprichard/winpty/issues/43) - * An escape character appearing in a console screen buffer cell is converted - to a '?'. - [#47](https://github.com/rprichard/winpty/issues/47) - -Bug fixes: - - * A major bug affecting XP users was fixed. - [#67](https://github.com/rprichard/winpty/issues/67) - * Fixed an incompatibility with ConEmu where winpty hung if ConEmu's - "Process 'start'" feature was enabled. - [#70](https://github.com/rprichard/winpty/issues/70) - * Fixed a bug where `cmd.exe` sometimes printed the message, - `Not enough storage is available to process this command.`. - [#74](https://github.com/rprichard/winpty/issues/74) - -Many changes internally: - - * The codebase is switched from C++03 to C++11 and uses exceptions internally. - No exceptions are thrown across the C APIs defined in `winpty.h`. - * This version drops support for the original MinGW compiler packaged with - Cygwin (`i686-pc-mingw32-g++`). The MinGW-w64 compiler is still supported, - as is the MinGW distributed at mingw.org. Compiling with MSVC now requires - MSVC 2013 or newer. Windows XP is still supported. - [ec3eae8df5](https://github.com/rprichard/winpty/commit/ec3eae8df5bbbb36d7628d168b0815638d122f37) - * Pipe security is improved. winpty works harder to produce unique pipe names - and includes a random component in the name. winpty secures pipes with a - DACL that prevents arbitrary users from connecting to its pipes. winpty now - passes `PIPE_REJECT_REMOTE_CLIENTS` on Vista and up, and it verifies that - the pipe client PID is correct, again on Vista and up. When connecting to a - named pipe, winpty uses the `SECURITY_IDENTIFICATION` flag to restrict - impersonation. Previous versions *should* still be secure. - * `winpty-debugserver.exe` now has an `--everyone` flag that allows capturing - debug output from other users. - * The code now compiles cleanly with MSVC's "Security Development Lifecycle" - (`/SDL`) checks enabled. - -# Version 0.2.2 (2016-02-25) - -Minor bug fixes and enhancements: - - * Fix a bug that generated spurious mouse input records when an incomplete - mouse escape sequence was seen. - * Fix a buffer overflow bug in `winpty-debugserver.exe` affecting messages of - exactly 4096 bytes. - * For MSVC builds, add a `src/configurations.gypi` file that can be included - on the gyp command-line to enable 32-bit and 64-bit builds. - * `winpty-agent --show-input` mode: Flush stdout after each line. - * Makefile builds: generate a `build/winpty.lib` import library to accompany - `build/winpty.dll`. - -# Version 0.2.1 (2015-12-19) - - * The main project source was moved into a `src` directory for better code - organization and to fix - [#51](https://github.com/rprichard/winpty/issues/51). - * winpty recognizes many more escape sequences, including: - * putty/rxvt's F1-F4 keys - [#40](https://github.com/rprichard/winpty/issues/40) - * the Linux virtual console's F1-F5 keys - * the "application numpad" keys (e.g. enabled with DECPAM) - * Fixed handling of Shift-Alt-O and Alt-[. - * Added support for mouse input. The UNIX adapter has a `--mouse` argument - that puts the terminal into mouse mode, but the agent recognizes mouse - input even without the argument. The agent recognizes double-clicks using - Windows' double-click interval setting (i.e. GetDoubleClickTime). - [#57](https://github.com/rprichard/winpty/issues/57) - -Changes to debugging interfaces: - - * The `WINPTY_DEBUG` variable is now a comma-separated list. The old - behavior (i.e. tracing) is enabled with `WINPTY_DEBUG=trace`. - * The UNIX adapter program now has a `--showkey` argument that dumps input - bytes. - * The `winpty-agent.exe` program has a `--show-input` argument that dumps - `INPUT_RECORD` records. (It omits mouse events unless `--with-mouse` is - also specified.) The agent also responds to `WINPTY_DEBUG=trace,input`, - which logs input bytes and synthesized console events, and it responds to - `WINPTY_DEBUG=trace,dump_input_map`, which dumps the internal table of - escape sequences. - -# Version 0.2.0 (2015-11-13) - -No changes to the API, but many small changes to the implementation. The big -changes include: - - * Support for 64-bit Cygwin and MSYS2 - * Support for Windows 10 - * Better Unicode support (especially East Asian languages) - -Details: - - * The `configure` script recognizes 64-bit Cygwin and MSYS2 environments and - selects the appropriate compiler. - * winpty works much better with the upgraded console in Windows 10. The - `conhost.exe` hang can still occur, but only with certain programs, and - is much less likely to occur. With the new console, use Mark instead of - SelectAll, for better performance. - [#31](https://github.com/rprichard/winpty/issues/31) - [#30](https://github.com/rprichard/winpty/issues/30) - [#53](https://github.com/rprichard/winpty/issues/53) - * The UNIX adapter now calls `setlocale(LC_ALL, "")` to set the locale. - * Improved Unicode support. When a console is started with an East Asian code - page, winpty now chooses an East Asian font rather than Consolas / Lucida - Console. Selecting the right font helps synchronize character widths - between the console and terminal. (It's not perfect, though.) - [#41](https://github.com/rprichard/winpty/issues/41) - * winpty now more-or-less works with programs that change the screen buffer - or resize the original screen buffer. If the screen buffer height changes, - winpty switches to a "direct mode", where it makes no effort to track - scrolling. In direct mode, it merely syncs snapshots of the console to the - terminal. Caveats: - * Changing the screen buffer (i.e. `SetConsoleActiveScreenBuffer`) - breaks winpty on Windows 7. This problem can eventually be mitigated, - but never completely fixed, due to Windows 7 bugginess. - * Resizing the original screen buffer can hang `conhost.exe` on Windows 10. - Enabling the legacy console is a workaround. - * If a program changes the screen buffer and then exits, relying on the OS - to restore the original screen buffer, that restoration probably will not - happen with winpty. winpty's behavior can probably be improved here. - * Improved color handling: - * DkGray-on-Black text was previously hiddenly completely. Now it is - output as DkGray, with a fallback to LtGray on terminals that don't - recognize the intense colors. - [#39](https://github.com/rprichard/winpty/issues/39). - * The console is always initialized to LtGray-on-Black, regardless of the - user setting, which matches the console color heuristic, which translates - LtGray-on-Black to "reset SGR parameters." - * Shift-Tab is recognized correctly now. - [#19](https://github.com/rprichard/winpty/issues/19) - * Add a `--version` argument to `winpty-agent.exe` and the UNIX adapter. The - argument reports the nominal version (i.e. the `VERSION.txt`) file, with a - "VERSION_SUFFIX" appended (defaulted to `-dev`), and a git commit hash, if - the `git` command successfully reports a hash during the build. The `git` - command is invoked by either `make` or `gyp`. - * The agent now combines `ReadConsoleOutputW` calls when it polls the console - buffer for changes, which may slightly reduce its CPU overhead. - [#44](https://github.com/rprichard/winpty/issues/44). - * A `gyp` file is added to help compile with MSVC. - * The code can now be compiled as C++11 code, though it isn't by default. - [bde8922e08](https://github.com/rprichard/winpty/commit/bde8922e08c3638e01ecc7b581b676c314163e3c) - * If winpty can't create a new window station, it charges ahead rather than - aborting. This situation might happen if winpty were started from an SSH - session. - * Debugging improvements: - * `WINPTYDBG` is renamed to `WINPTY_DEBUG`, and a new `WINPTY_SHOW_CONSOLE` - variable keeps the underlying console visible. - * A `winpty-debugserver.exe` program is built and shipped by default. It - collects the trace output enabled with `WINPTY_DEBUG`. - * The `Makefile` build of winpty now compiles `winpty-agent.exe` and - `winpty.dll` with -O2. - -# Version 0.1.1 (2012-07-28) - -Minor bugfix release. - -# Version 0.1 (2012-04-17) - -Initial release. diff --git a/node_modules/node-pty/deps/winpty/VERSION.txt b/node_modules/node-pty/deps/winpty/VERSION.txt deleted file mode 100644 index 5d47ff8..0000000 --- a/node_modules/node-pty/deps/winpty/VERSION.txt +++ /dev/null @@ -1 +0,0 @@ -0.4.4-dev diff --git a/node_modules/node-pty/deps/winpty/configure b/node_modules/node-pty/deps/winpty/configure deleted file mode 100644 index 6d37d65..0000000 --- a/node_modules/node-pty/deps/winpty/configure +++ /dev/null @@ -1,167 +0,0 @@ -#!/bin/bash -# -# Copyright (c) 2011-2015 Ryan Prichard -# -# 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. - -# -# findTool(desc, commandList) -# -# Searches commandLine for the first command in the PATH and returns it. -# Prints an error and aborts the script if no match is found. -# -FINDTOOL_OUT="" -function findTool { - DESC=$1 - OPTIONS=$2 - for CMD in ${OPTIONS}; do - if (which $CMD &>/dev/null) then - echo "Found $DESC: $CMD" - FINDTOOL_OUT="$CMD" - return - fi - done - echo "Error: could not find $DESC. One of these should be in your PATH:" - for CMD in ${OPTIONS}; do - echo " * $CMD" - done - exit 1 -} - -IS_CYGWIN=0 -IS_MSYS1=0 -IS_MSYS2=0 - -# Link parts of the Cygwin binary statically to aid in redistribution? The -# binary still links dynamically against the main DLL. The MinGW binaries are -# also statically linked and therefore depend only on Windows DLLs. I started -# linking the Cygwin/MSYS binary statically, because G++ 4.7 changed the -# Windows C++ ABI. -UNIX_LDFLAGS_STATIC='-static -static-libgcc -static-libstdc++' - -# Detect the environment -- Cygwin or MSYS. -case $(uname -s) in - CYGWIN*) - echo 'uname -s identifies a Cygwin environment.' - IS_CYGWIN=1 - case $(uname -m) in - i686) - echo 'uname -m identifies an i686 environment.' - UNIX_CXX=i686-pc-cygwin-g++ - MINGW_CXX=i686-w64-mingw32-g++ - ;; - x86_64) - echo 'uname -m identifies an x86_64 environment.' - UNIX_CXX=x86_64-pc-cygwin-g++ - MINGW_CXX=x86_64-w64-mingw32-g++ - ;; - *) - echo 'Error: uname -m did not match either i686 or x86_64.' - exit 1 - ;; - esac - ;; - MSYS*|MINGW*) - # MSYS2 notes: - # - MSYS2 offers two shortcuts to open an environment: - # - MinGW-w64 Win32 Shell. This env reports a `uname -s` of - # MINGW32_NT-6.1 on 32-bit Win7. The MinGW-w64 compiler - # (i686-w64-mingw32-g++.exe) is in the PATH. - # - MSYS2 Shell. `uname -s` instead reports MSYS_NT-6.1. - # The i686-w64-mingw32-g++ compiler is not in the PATH. - # - MSYS2 appears to use MinGW-w64, not the older mingw.org. - # MSYS notes: - # - `uname -s` is always MINGW32_NT-6.1 on Win7. - echo 'uname -s identifies an MSYS/MSYS2 environment.' - case $(uname -m) in - i686) - echo 'uname -m identifies an i686 environment.' - UNIX_CXX=i686-pc-msys-g++ - if echo "$(uname -r)" | grep '^1[.]' > /dev/null; then - # The MSYS-targeting compiler for the original 32-bit-only - # MSYS does not recognize the -static-libstdc++ flag, and - # it does not work with -static, because it tries to link - # statically with the core MSYS library and fails. - # - # Distinguish between the two using the major version - # number of `uname -r`: - # - # MSYS uname -r: 1.0.18(0.48/3/2) - # MSYS2 uname -r: 2.0.0(0.284/5/3) - # - # This is suboptimal because MSYS2 is not actually the - # second version of MSYS--it's a brand-new fork of Cygwin. - # - IS_MSYS1=1 - UNIX_LDFLAGS_STATIC= - MINGW_CXX=mingw32-g++ - else - IS_MSYS2=1 - MINGW_CXX=i686-w64-mingw32-g++.exe - fi - ;; - x86_64) - echo 'uname -m identifies an x86_64 environment.' - IS_MSYS2=1 - UNIX_CXX=x86_64-pc-msys-g++ - MINGW_CXX=x86_64-w64-mingw32-g++ - ;; - *) - echo 'Error: uname -m did not match either i686 or x86_64.' - exit 1 - ;; - esac - ;; - *) - echo 'Error: uname -s did not match either CYGWIN* or MINGW*.' - exit 1 - ;; -esac - -# Search the PATH and pick the first match. -findTool "Cygwin/MSYS G++ compiler" "$UNIX_CXX" -UNIX_CXX=$FINDTOOL_OUT -findTool "MinGW G++ compiler" "$MINGW_CXX" -MINGW_CXX=$FINDTOOL_OUT - -# Write config files. -echo Writing config.mk -echo UNIX_CXX=$UNIX_CXX > config.mk -echo UNIX_LDFLAGS_STATIC=$UNIX_LDFLAGS_STATIC >> config.mk -echo MINGW_CXX=$MINGW_CXX >> config.mk - -if test $IS_MSYS1 = 1; then - echo UNIX_CXXFLAGS += -DWINPTY_TARGET_MSYS1 >> config.mk - # The MSYS1 MinGW compiler has a bug that prevents inclusion of algorithm - # and math.h in normal C++11 mode. The workaround is to enable the gnu++11 - # mode instead. The bug was fixed on 2015-07-31, but as of 2016-02-26, the - # fix apparently hasn't been released. See - # http://ehc.ac/p/mingw/bugs/2250/. - echo MINGW_ENABLE_CXX11_FLAG := -std=gnu++11 >> config.mk -fi - -if test -d .git -a -f .git/HEAD -a -f .git/index && git rev-parse HEAD >&/dev/null; then - echo "Commit info: git" - echo 'COMMIT_HASH = $(shell git rev-parse HEAD)' >> config.mk - echo 'COMMIT_HASH_DEP := config.mk .git/HEAD .git/index' >> config.mk -else - echo "Commit info: none" - echo 'COMMIT_HASH := none' >> config.mk - echo 'COMMIT_HASH_DEP := config.mk' >> config.mk -fi diff --git a/node_modules/node-pty/deps/winpty/misc/.gitignore b/node_modules/node-pty/deps/winpty/misc/.gitignore deleted file mode 100644 index 2375164..0000000 --- a/node_modules/node-pty/deps/winpty/misc/.gitignore +++ /dev/null @@ -1,2 +0,0 @@ -*.exe -UnixEcho \ No newline at end of file diff --git a/node_modules/node-pty/deps/winpty/misc/BufferResizeTests.cc b/node_modules/node-pty/deps/winpty/misc/BufferResizeTests.cc deleted file mode 100644 index a5bb074..0000000 --- a/node_modules/node-pty/deps/winpty/misc/BufferResizeTests.cc +++ /dev/null @@ -1,90 +0,0 @@ -#include -#include - -#include "TestUtil.cc" - -void dumpInfoToTrace() { - CONSOLE_SCREEN_BUFFER_INFO info; - assert(GetConsoleScreenBufferInfo(GetStdHandle(STD_OUTPUT_HANDLE), &info)); - trace("win=(%d,%d,%d,%d)", - (int)info.srWindow.Left, - (int)info.srWindow.Top, - (int)info.srWindow.Right, - (int)info.srWindow.Bottom); - trace("buf=(%d,%d)", - (int)info.dwSize.X, - (int)info.dwSize.Y); - trace("cur=(%d,%d)", - (int)info.dwCursorPosition.X, - (int)info.dwCursorPosition.Y); -} - -int main(int argc, char *argv[]) { - if (argc == 1) { - startChildProcess(L"CHILD"); - return 0; - } - - setWindowPos(0, 0, 1, 1); - - if (false) { - // Reducing the buffer height can move the window up. - setBufferSize(80, 25); - setWindowPos(0, 20, 80, 5); - Sleep(2000); - setBufferSize(80, 10); - } - - if (false) { - // Reducing the buffer height moves the window up and the buffer - // contents up too. - setBufferSize(80, 25); - setWindowPos(0, 20, 80, 5); - setCursorPos(0, 20); - printf("TEST1\nTEST2\nTEST3\nTEST4\n"); - fflush(stdout); - Sleep(2000); - setBufferSize(80, 10); - } - - if (false) { - // Reducing the buffer width can move the window left. - setBufferSize(80, 25); - setWindowPos(40, 0, 40, 25); - Sleep(2000); - setBufferSize(60, 25); - } - - if (false) { - // Sometimes the buffer contents are shifted up; sometimes they're - // shifted down. It seems to depend on the cursor position? - - // setBufferSize(80, 25); - // setWindowPos(0, 20, 80, 5); - // setCursorPos(0, 20); - // printf("TESTa\nTESTb\nTESTc\nTESTd\nTESTe"); - // fflush(stdout); - // setCursorPos(0, 0); - // printf("TEST1\nTEST2\nTEST3\nTEST4\nTEST5"); - // fflush(stdout); - // setCursorPos(0, 24); - // Sleep(5000); - // setBufferSize(80, 24); - - setBufferSize(80, 20); - setWindowPos(0, 10, 80, 10); - setCursorPos(0, 18); - - printf("TEST1\nTEST2"); - fflush(stdout); - setCursorPos(0, 18); - - Sleep(2000); - setBufferSize(80, 18); - } - - dumpInfoToTrace(); - Sleep(30000); - - return 0; -} diff --git a/node_modules/node-pty/deps/winpty/misc/ChangeScreenBuffer.cc b/node_modules/node-pty/deps/winpty/misc/ChangeScreenBuffer.cc deleted file mode 100644 index 701a2cb..0000000 --- a/node_modules/node-pty/deps/winpty/misc/ChangeScreenBuffer.cc +++ /dev/null @@ -1,53 +0,0 @@ -// A test program for CreateConsoleScreenBuffer / SetConsoleActiveScreenBuffer -// - -#include -#include -#include -#include -#include - -#include "TestUtil.cc" - -int main() -{ - HANDLE origBuffer = GetStdHandle(STD_OUTPUT_HANDLE); - HANDLE childBuffer = CreateConsoleScreenBuffer( - GENERIC_READ | GENERIC_WRITE, - FILE_SHARE_READ | FILE_SHARE_WRITE, - NULL, CONSOLE_TEXTMODE_BUFFER, NULL); - - SetConsoleActiveScreenBuffer(childBuffer); - - while (true) { - char buf[1024]; - CONSOLE_SCREEN_BUFFER_INFO info; - - assert(GetConsoleScreenBufferInfo(origBuffer, &info)); - trace("child.size=(%d,%d)", (int)info.dwSize.X, (int)info.dwSize.Y); - trace("child.cursor=(%d,%d)", (int)info.dwCursorPosition.X, (int)info.dwCursorPosition.Y); - trace("child.window=(%d,%d,%d,%d)", - (int)info.srWindow.Left, (int)info.srWindow.Top, - (int)info.srWindow.Right, (int)info.srWindow.Bottom); - trace("child.maxSize=(%d,%d)", (int)info.dwMaximumWindowSize.X, (int)info.dwMaximumWindowSize.Y); - - int ch = getch(); - sprintf(buf, "%02x\n", ch); - DWORD actual = 0; - WriteFile(childBuffer, buf, strlen(buf), &actual, NULL); - if (ch == 0x1b/*ESC*/ || ch == 0x03/*CTRL-C*/) - break; - - if (ch == 'b') { - setBufferSize(origBuffer, 40, 25); - } else if (ch == 'w') { - setWindowPos(origBuffer, 1, 1, 38, 23); - } else if (ch == 'c') { - setCursorPos(origBuffer, 10, 10); - } - } - - SetConsoleActiveScreenBuffer(origBuffer); - - return 0; -} diff --git a/node_modules/node-pty/deps/winpty/misc/ClearConsole.cc b/node_modules/node-pty/deps/winpty/misc/ClearConsole.cc deleted file mode 100644 index f95f8c8..0000000 --- a/node_modules/node-pty/deps/winpty/misc/ClearConsole.cc +++ /dev/null @@ -1,72 +0,0 @@ -/* - * Demonstrates that console clearing sets each cell's character to SP, not - * NUL, and it sets the attribute of each cell to the current text attribute. - * - * This confirms the MSDN instruction in the "Clearing the Screen" article. - * https://msdn.microsoft.com/en-us/library/windows/desktop/ms682022(v=vs.85).aspx - * It advises using GetConsoleScreenBufferInfo to get the current text - * attribute, then FillConsoleOutputCharacter and FillConsoleOutputAttribute to - * write to the console buffer. - */ - -#include - -#include -#include -#include - -#include "TestUtil.cc" - -int main(int argc, char *argv[]) { - if (argc == 1) { - startChildProcess(L"CHILD"); - return 0; - } - - const HANDLE conout = GetStdHandle(STD_OUTPUT_HANDLE); - - SetConsoleTextAttribute(conout, 0x24); - system("cls"); - - setWindowPos(0, 0, 1, 1); - setBufferSize(80, 25); - setWindowPos(0, 0, 80, 25); - - CHAR_INFO buf; - COORD bufSize = { 1, 1 }; - COORD bufCoord = { 0, 0 }; - SMALL_RECT rect = { 5, 5, 5, 5 }; - BOOL ret; - DWORD actual; - COORD writeCoord = { 5, 5 }; - - // After cls, each cell's character is a space, and its attributes are the - // default text attributes. - ret = ReadConsoleOutputW(conout, &buf, bufSize, bufCoord, &rect); - assert(ret && buf.Char.UnicodeChar == L' ' && buf.Attributes == 0x24); - - // Nevertheless, it is possible to change a cell to NUL. - ret = FillConsoleOutputCharacterW(conout, L'\0', 1, writeCoord, &actual); - assert(ret && actual == 1); - ret = ReadConsoleOutputW(conout, &buf, bufSize, bufCoord, &rect); - assert(ret && buf.Char.UnicodeChar == L'\0' && buf.Attributes == 0x24); - - // As well as a 0 attribute. (As one would expect, the cell is - // black-on-black.) - ret = FillConsoleOutputAttribute(conout, 0, 1, writeCoord, &actual); - assert(ret && actual == 1); - ret = ReadConsoleOutputW(conout, &buf, bufSize, bufCoord, &rect); - assert(ret && buf.Char.UnicodeChar == L'\0' && buf.Attributes == 0); - ret = FillConsoleOutputCharacterW(conout, L'X', 1, writeCoord, &actual); - assert(ret && actual == 1); - ret = ReadConsoleOutputW(conout, &buf, bufSize, bufCoord, &rect); - assert(ret && buf.Char.UnicodeChar == L'X' && buf.Attributes == 0); - - // The 'X' is invisible. - countDown(3); - - ret = FillConsoleOutputAttribute(conout, 0x42, 1, writeCoord, &actual); - assert(ret && actual == 1); - - countDown(5); -} diff --git a/node_modules/node-pty/deps/winpty/misc/ConinMode.cc b/node_modules/node-pty/deps/winpty/misc/ConinMode.cc deleted file mode 100644 index 1e1428d..0000000 --- a/node_modules/node-pty/deps/winpty/misc/ConinMode.cc +++ /dev/null @@ -1,117 +0,0 @@ -#include - -#include -#include -#include - -#include -#include - -static HANDLE getConin() { - HANDLE conin = GetStdHandle(STD_INPUT_HANDLE); - if (conin == INVALID_HANDLE_VALUE) { - fprintf(stderr, "error: cannot get stdin\n"); - exit(1); - } - return conin; -} - -static DWORD getConsoleMode() { - DWORD mode = 0; - if (!GetConsoleMode(getConin(), &mode)) { - fprintf(stderr, "error: GetConsoleMode failed (is stdin a console?)\n"); - exit(1); - } - return mode; -} - -static void setConsoleMode(DWORD mode) { - if (!SetConsoleMode(getConin(), mode)) { - fprintf(stderr, "error: SetConsoleMode failed (is stdin a console?)\n"); - exit(1); - } -} - -static long parseInt(const std::string &s) { - errno = 0; - char *endptr = nullptr; - long result = strtol(s.c_str(), &endptr, 0); - if (errno != 0 || !endptr || *endptr != '\0') { - fprintf(stderr, "error: could not parse integral argument '%s'\n", s.c_str()); - exit(1); - } - return result; -} - -static void usage() { - printf("Usage: ConinMode [verb] [options]\n"); - printf("Verbs:\n"); - printf(" [info] Dumps info about mode flags.\n"); - printf(" get Prints the mode DWORD.\n"); - printf(" set VALUE Sets the mode to VALUE, which can be decimal, hex, or octal.\n"); - printf(" set VALUE MASK\n"); - printf(" Same as `set VALUE`, but only alters the bits in MASK.\n"); - exit(1); -} - -struct { - const char *name; - DWORD value; -} kInputFlags[] = { - "ENABLE_PROCESSED_INPUT", ENABLE_PROCESSED_INPUT, // 0x0001 - "ENABLE_LINE_INPUT", ENABLE_LINE_INPUT, // 0x0002 - "ENABLE_ECHO_INPUT", ENABLE_ECHO_INPUT, // 0x0004 - "ENABLE_WINDOW_INPUT", ENABLE_WINDOW_INPUT, // 0x0008 - "ENABLE_MOUSE_INPUT", ENABLE_MOUSE_INPUT, // 0x0010 - "ENABLE_INSERT_MODE", ENABLE_INSERT_MODE, // 0x0020 - "ENABLE_QUICK_EDIT_MODE", ENABLE_QUICK_EDIT_MODE, // 0x0040 - "ENABLE_EXTENDED_FLAGS", ENABLE_EXTENDED_FLAGS, // 0x0080 - "ENABLE_VIRTUAL_TERMINAL_INPUT", 0x0200/*ENABLE_VIRTUAL_TERMINAL_INPUT*/, // 0x0200 -}; - -int main(int argc, char *argv[]) { - std::vector args; - for (size_t i = 1; i < argc; ++i) { - args.push_back(argv[i]); - } - - if (args.empty() || args.size() == 1 && args[0] == "info") { - DWORD mode = getConsoleMode(); - printf("mode: 0x%lx\n", mode); - for (const auto &flag : kInputFlags) { - printf("%-29s 0x%04lx %s\n", flag.name, flag.value, flag.value & mode ? "ON" : "off"); - mode &= ~flag.value; - } - for (int i = 0; i < 32; ++i) { - if (mode & (1u << i)) { - printf("Unrecognized flag: %04x\n", (1u << i)); - } - } - return 0; - } - - const auto verb = args[0]; - - if (verb == "set") { - if (args.size() == 2) { - const DWORD newMode = parseInt(args[1]); - setConsoleMode(newMode); - } else if (args.size() == 3) { - const DWORD mode = parseInt(args[1]); - const DWORD mask = parseInt(args[2]); - const int newMode = (getConsoleMode() & ~mask) | (mode & mask); - setConsoleMode(newMode); - } else { - usage(); - } - } else if (verb == "get") { - if (args.size() != 1) { - usage(); - } - printf("0x%lx\n", getConsoleMode()); - } else { - usage(); - } - - return 0; -} diff --git a/node_modules/node-pty/deps/winpty/misc/ConinMode.ps1 b/node_modules/node-pty/deps/winpty/misc/ConinMode.ps1 deleted file mode 100644 index ecfe8f0..0000000 --- a/node_modules/node-pty/deps/winpty/misc/ConinMode.ps1 +++ /dev/null @@ -1,116 +0,0 @@ -# -# PowerShell script for controlling the console QuickEdit and InsertMode flags. -# -# Turn QuickEdit off to interact with mouse-driven console programs. -# -# Usage: -# -# powershell .\ConinMode.ps1 [Options] -# -# Options: -# -QuickEdit [on/off] -# -InsertMode [on/off] -# -Mode [integer] -# - -param ( - [ValidateSet("on", "off")][string] $QuickEdit, - [ValidateSet("on", "off")][string] $InsertMode, - [int] $Mode -) - -$signature = @' -[DllImport("kernel32.dll", SetLastError = true)] -public static extern IntPtr GetStdHandle(int nStdHandle); - -[DllImport("kernel32.dll", SetLastError = true)] -public static extern uint GetConsoleMode( - IntPtr hConsoleHandle, - out uint lpMode); - -[DllImport("kernel32.dll", SetLastError = true)] -public static extern uint SetConsoleMode( - IntPtr hConsoleHandle, - uint dwMode); - -public const int STD_INPUT_HANDLE = -10; -public const int ENABLE_INSERT_MODE = 0x0020; -public const int ENABLE_QUICK_EDIT_MODE = 0x0040; -public const int ENABLE_EXTENDED_FLAGS = 0x0080; -'@ - -$WinAPI = Add-Type -MemberDefinition $signature ` - -Name WinAPI -Namespace ConinModeScript ` - -PassThru - -function GetConIn { - $ret = $WinAPI::GetStdHandle($WinAPI::STD_INPUT_HANDLE) - if ($ret -eq -1) { - throw "error: cannot get stdin" - } - return $ret -} - -function GetConsoleMode { - $conin = GetConIn - $mode = 0 - $ret = $WinAPI::GetConsoleMode($conin, [ref]$mode) - if ($ret -eq 0) { - throw "GetConsoleMode failed (is stdin a console?)" - } - return $mode -} - -function SetConsoleMode($mode) { - $conin = GetConIn - $ret = $WinAPI::SetConsoleMode($conin, $mode) - if ($ret -eq 0) { - throw "SetConsoleMode failed (is stdin a console?)" - } -} - -$oldMode = GetConsoleMode -$newMode = $oldMode -$doingSomething = $false - -if ($PSBoundParameters.ContainsKey("Mode")) { - $newMode = $Mode - $doingSomething = $true -} - -if ($QuickEdit + $InsertMode -ne "") { - if (!($newMode -band $WinAPI::ENABLE_EXTENDED_FLAGS)) { - # We can't enable an extended flag without overwriting the existing - # QuickEdit/InsertMode flags. AFAICT, there is no way to query their - # existing values, so at least we can choose sensible defaults. - $newMode = $newMode -bor $WinAPI::ENABLE_EXTENDED_FLAGS - $newMode = $newMode -bor $WinAPI::ENABLE_QUICK_EDIT_MODE - $newMode = $newMode -bor $WinAPI::ENABLE_INSERT_MODE - $doingSomething = $true - } -} - -if ($QuickEdit -eq "on") { - $newMode = $newMode -bor $WinAPI::ENABLE_QUICK_EDIT_MODE - $doingSomething = $true -} elseif ($QuickEdit -eq "off") { - $newMode = $newMode -band (-bnot $WinAPI::ENABLE_QUICK_EDIT_MODE) - $doingSomething = $true -} - -if ($InsertMode -eq "on") { - $newMode = $newMode -bor $WinAPI::ENABLE_INSERT_MODE - $doingSomething = $true -} elseif ($InsertMode -eq "off") { - $newMode = $newMode -band (-bnot $WinAPI::ENABLE_INSERT_MODE) - $doingSomething = $true -} - -if ($doingSomething) { - echo "old mode: $oldMode" - SetConsoleMode $newMode - $newMode = GetConsoleMode - echo "new mode: $newMode" -} else { - echo "mode: $oldMode" -} diff --git a/node_modules/node-pty/deps/winpty/misc/ConoutMode.cc b/node_modules/node-pty/deps/winpty/misc/ConoutMode.cc deleted file mode 100644 index 100e0c7..0000000 --- a/node_modules/node-pty/deps/winpty/misc/ConoutMode.cc +++ /dev/null @@ -1,113 +0,0 @@ -#include - -#include -#include -#include - -#include -#include - -static HANDLE getConout() { - HANDLE conout = GetStdHandle(STD_OUTPUT_HANDLE); - if (conout == INVALID_HANDLE_VALUE) { - fprintf(stderr, "error: cannot get stdout\n"); - exit(1); - } - return conout; -} - -static DWORD getConsoleMode() { - DWORD mode = 0; - if (!GetConsoleMode(getConout(), &mode)) { - fprintf(stderr, "error: GetConsoleMode failed (is stdout a console?)\n"); - exit(1); - } - return mode; -} - -static void setConsoleMode(DWORD mode) { - if (!SetConsoleMode(getConout(), mode)) { - fprintf(stderr, "error: SetConsoleMode failed (is stdout a console?)\n"); - exit(1); - } -} - -static long parseInt(const std::string &s) { - errno = 0; - char *endptr = nullptr; - long result = strtol(s.c_str(), &endptr, 0); - if (errno != 0 || !endptr || *endptr != '\0') { - fprintf(stderr, "error: could not parse integral argument '%s'\n", s.c_str()); - exit(1); - } - return result; -} - -static void usage() { - printf("Usage: ConoutMode [verb] [options]\n"); - printf("Verbs:\n"); - printf(" [info] Dumps info about mode flags.\n"); - printf(" get Prints the mode DWORD.\n"); - printf(" set VALUE Sets the mode to VALUE, which can be decimal, hex, or octal.\n"); - printf(" set VALUE MASK\n"); - printf(" Same as `set VALUE`, but only alters the bits in MASK.\n"); - exit(1); -} - -struct { - const char *name; - DWORD value; -} kOutputFlags[] = { - "ENABLE_PROCESSED_OUTPUT", ENABLE_PROCESSED_OUTPUT, // 0x0001 - "ENABLE_WRAP_AT_EOL_OUTPUT", ENABLE_WRAP_AT_EOL_OUTPUT, // 0x0002 - "ENABLE_VIRTUAL_TERMINAL_PROCESSING", 0x0004/*ENABLE_VIRTUAL_TERMINAL_PROCESSING*/, // 0x0004 - "DISABLE_NEWLINE_AUTO_RETURN", 0x0008/*DISABLE_NEWLINE_AUTO_RETURN*/, // 0x0008 - "ENABLE_LVB_GRID_WORLDWIDE", 0x0010/*ENABLE_LVB_GRID_WORLDWIDE*/, //0x0010 -}; - -int main(int argc, char *argv[]) { - std::vector args; - for (size_t i = 1; i < argc; ++i) { - args.push_back(argv[i]); - } - - if (args.empty() || args.size() == 1 && args[0] == "info") { - DWORD mode = getConsoleMode(); - printf("mode: 0x%lx\n", mode); - for (const auto &flag : kOutputFlags) { - printf("%-34s 0x%04lx %s\n", flag.name, flag.value, flag.value & mode ? "ON" : "off"); - mode &= ~flag.value; - } - for (int i = 0; i < 32; ++i) { - if (mode & (1u << i)) { - printf("Unrecognized flag: %04x\n", (1u << i)); - } - } - return 0; - } - - const auto verb = args[0]; - - if (verb == "set") { - if (args.size() == 2) { - const DWORD newMode = parseInt(args[1]); - setConsoleMode(newMode); - } else if (args.size() == 3) { - const DWORD mode = parseInt(args[1]); - const DWORD mask = parseInt(args[2]); - const int newMode = (getConsoleMode() & ~mask) | (mode & mask); - setConsoleMode(newMode); - } else { - usage(); - } - } else if (verb == "get") { - if (args.size() != 1) { - usage(); - } - printf("0x%lx\n", getConsoleMode()); - } else { - usage(); - } - - return 0; -} diff --git a/node_modules/node-pty/deps/winpty/misc/DebugClient.py b/node_modules/node-pty/deps/winpty/misc/DebugClient.py deleted file mode 100644 index cd12df8..0000000 --- a/node_modules/node-pty/deps/winpty/misc/DebugClient.py +++ /dev/null @@ -1,42 +0,0 @@ -#!python -# Run with native CPython. Needs pywin32 extensions. - -# Copyright (c) 2011-2012 Ryan Prichard -# -# 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. - -import winerror -import win32pipe -import win32file -import win32api -import sys -import pywintypes -import time - -if len(sys.argv) != 2: - print("Usage: %s message" % sys.argv[0]) - sys.exit(1) - -message = "[%05.3f %s]: %s" % (time.time() % 100000, sys.argv[0], sys.argv[1]) - -win32pipe.CallNamedPipe( - "\\\\.\\pipe\\DebugServer", - message.encode(), - 16, - win32pipe.NMPWAIT_WAIT_FOREVER) diff --git a/node_modules/node-pty/deps/winpty/misc/DebugServer.py b/node_modules/node-pty/deps/winpty/misc/DebugServer.py deleted file mode 100644 index 3fc068b..0000000 --- a/node_modules/node-pty/deps/winpty/misc/DebugServer.py +++ /dev/null @@ -1,63 +0,0 @@ -#!python -# -# Run with native CPython. Needs pywin32 extensions. - -# Copyright (c) 2011-2012 Ryan Prichard -# -# 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. - -import win32pipe -import win32api -import win32file -import time -import threading -import sys - -# A message may not be larger than this size. -MSG_SIZE=4096 - -serverPipe = win32pipe.CreateNamedPipe( - "\\\\.\\pipe\\DebugServer", - win32pipe.PIPE_ACCESS_DUPLEX, - win32pipe.PIPE_TYPE_MESSAGE | win32pipe.PIPE_READMODE_MESSAGE, - win32pipe.PIPE_UNLIMITED_INSTANCES, - MSG_SIZE, - MSG_SIZE, - 10 * 1000, - None) -while True: - win32pipe.ConnectNamedPipe(serverPipe, None) - (ret, data) = win32file.ReadFile(serverPipe, MSG_SIZE) - print(data.decode()) - sys.stdout.flush() - - # The client uses CallNamedPipe to send its message. CallNamedPipe waits - # for a reply message. If I send a reply, however, using WriteFile, then - # sometimes WriteFile fails with: - # pywintypes.error: (232, 'WriteFile', 'The pipe is being closed.') - # I can't figure out how to write a strictly correct pipe server, but if - # I comment out the WriteFile line, then everything seems to work. I - # think the DisconnectNamedPipe call aborts the client's CallNamedPipe - # call normally. - - try: - win32file.WriteFile(serverPipe, b'OK') - except: - pass - win32pipe.DisconnectNamedPipe(serverPipe) diff --git a/node_modules/node-pty/deps/winpty/misc/DumpLines.py b/node_modules/node-pty/deps/winpty/misc/DumpLines.py deleted file mode 100644 index 4004996..0000000 --- a/node_modules/node-pty/deps/winpty/misc/DumpLines.py +++ /dev/null @@ -1,5 +0,0 @@ -#!/usr/bin/env python -import sys - -for i in range(1, int(sys.argv[1]) + 1): - print i, "X" * 78 diff --git a/node_modules/node-pty/deps/winpty/misc/EnableExtendedFlags.txt b/node_modules/node-pty/deps/winpty/misc/EnableExtendedFlags.txt deleted file mode 100644 index 37914da..0000000 --- a/node_modules/node-pty/deps/winpty/misc/EnableExtendedFlags.txt +++ /dev/null @@ -1,46 +0,0 @@ -Note regarding ENABLE_EXTENDED_FLAGS (2016-05-30) - -There is a complicated interaction between the ENABLE_EXTENDED_FLAGS flag -and the ENABLE_QUICK_EDIT_MODE and ENABLE_INSERT_MODE flags (presumably for -backwards compatibility?). I studied the behavior on Windows 7 and Windows -10, with both the old and new consoles, and I didn't see any differences -between versions. Here's what I seemed to observe: - - - The console has three flags internally: - - QuickEdit - - InsertMode - - ExtendedFlags - - - SetConsoleMode psuedocode: - void SetConsoleMode(..., DWORD mode) { - ExtendedFlags = (mode & (ENABLE_EXTENDED_FLAGS - | ENABLE_QUICK_EDIT_MODE - | ENABLE_INSERT_MODE )) != 0; - if (ExtendedFlags) { - QuickEdit = (mode & ENABLE_QUICK_EDIT_MODE) != 0; - InsertMode = (mode & ENABLE_INSERT_MODE) != 0; - } - } - - - Setting QuickEdit or InsertMode from the properties dialog GUI does not - affect the ExtendedFlags setting -- it simply toggles the one flag. - - - GetConsoleMode psuedocode: - GetConsoleMode(..., DWORD *result) { - if (ExtendedFlags) { - *result |= ENABLE_EXTENDED_FLAGS; - if (QuickEdit) { *result |= ENABLE_QUICK_EDIT_MODE; } - if (InsertMode) { *result |= ENABLE_INSERT_MODE; } - } - } - -Effectively, the ExtendedFlags flags controls whether the other two flags -are visible/controlled by the user application. If they aren't visible, -though, there is no way for the user application to make them visible, -except by overwriting their values! Calling SetConsoleMode with just -ENABLE_EXTENDED_FLAGS would clear the extended flags we want to read. - -Consequently, if a program temporarily alters the QuickEdit flag (e.g. to -enable mouse input), it cannot restore the original values of the QuickEdit -and InsertMode flags, UNLESS every other console program cooperates by -keeping the ExtendedFlags flag set. diff --git a/node_modules/node-pty/deps/winpty/misc/Font-Report-June2016/CP437-Consolas.txt b/node_modules/node-pty/deps/winpty/misc/Font-Report-June2016/CP437-Consolas.txt deleted file mode 100644 index 067bd38..0000000 --- a/node_modules/node-pty/deps/winpty/misc/Font-Report-June2016/CP437-Consolas.txt +++ /dev/null @@ -1,528 +0,0 @@ -================================== -Code Page 437, Consolas font -================================== - -Options: -face "Consolas" -family 0x36 -Chars: A2 A3 2014 3044 30FC 4000 - -FontSurvey "-face \"Consolas\" -family 0x36" - -Windows 7 ---------- - -Size 1: 1,3 BAD (HHHHHH) -Size 2: 1,2 BAD (HHHHHH) -Size 3: 1,3 BAD (HHHHHH) -Size 4: 2,4 BAD (HHHHHH) -Size 5: 2,5 BAD (HHHHHH) -Size 6: 3,6 BAD (HHHHHH) -Size 7: 3,6 BAD (HHHHHH) -Size 8: 4,8 BAD (HHHHHH) -Size 9: 4,9 BAD (HHHHHH) -Size 10: 5,10 BAD (HHHHHH) -Size 11: 5,11 BAD (HHHHHH) -Size 12: 6,12 BAD (HHHHHH) -Size 13: 6,13 BAD (HHHHHH) -Size 14: 7,14 BAD (HHHHHH) -Size 15: 7,15 BAD (HHHHHH) -Size 16: 8,16 BAD (HHHHHH) -Size 17: 8,17 BAD (HHHHHH) -Size 18: 8,18 BAD (HHHHHH) -Size 19: 9,19 BAD (HHHHHH) -Size 20: 9,20 BAD (HHHHHH) -Size 21: 10,22 BAD (HHHHHH) -Size 22: 10,22 BAD (HHHHHH) -Size 23: 11,23 BAD (HHHHHH) -Size 24: 11,24 BAD (HHHHHH) -Size 25: 12,25 BAD (HHHHHH) -Size 26: 12,26 BAD (HHHHHH) -Size 27: 13,27 BAD (HHHHHH) -Size 28: 13,28 BAD (HHHHHH) -Size 29: 14,29 BAD (HHHHHH) -Size 30: 14,30 BAD (HHHHHH) -Size 31: 15,31 BAD (HHHHHH) -Size 32: 15,32 BAD (HHHHHH) -Size 33: 15,33 BAD (HHHHHH) -Size 34: 16,34 BAD (HHHHHH) -Size 35: 16,36 BAD (HHHHHH) -Size 36: 17,36 BAD (HHHHHH) -Size 37: 17,37 BAD (HHHHHH) -Size 38: 18,38 BAD (HHHHHH) -Size 39: 18,39 BAD (HHHHHH) -Size 40: 19,40 BAD (HHHHHH) -Size 41: 19,41 BAD (HHHHHH) -Size 42: 20,42 BAD (HHHHHH) -Size 43: 20,43 BAD (HHHHHH) -Size 44: 21,44 BAD (HHHHHH) -Size 45: 21,45 BAD (HHHHHH) -Size 46: 22,46 BAD (HHHHHH) -Size 47: 22,47 BAD (HHHHHH) -Size 48: 23,48 BAD (HHHHHH) -Size 49: 23,49 BAD (HHHHHH) -Size 50: 23,50 BAD (HHHHHH) -Size 51: 24,51 BAD (HHHHHH) -Size 52: 24,52 BAD (HHHHHH) -Size 53: 25,53 BAD (HHHHHH) -Size 54: 25,54 BAD (HHHHHH) -Size 55: 26,55 BAD (HHHHHH) -Size 56: 26,56 BAD (HHHHHH) -Size 57: 27,57 BAD (HHHHHH) -Size 58: 27,58 BAD (HHHHHH) -Size 59: 28,59 BAD (HHHHHH) -Size 60: 28,60 BAD (HHHHHH) -Size 61: 29,61 BAD (HHHHHH) -Size 62: 29,62 BAD (HHHHHH) -Size 63: 30,64 BAD (HHHHHH) -Size 64: 30,64 BAD (HHHHHH) -Size 65: 31,65 BAD (HHHHHH) -Size 66: 31,66 BAD (HHHHHH) -Size 67: 31,67 BAD (HHHHHH) -Size 68: 32,68 BAD (HHHHHH) -Size 69: 32,69 BAD (HHHHHH) -Size 70: 33,70 BAD (HHHHHH) -Size 71: 33,71 BAD (HHHHHH) -Size 72: 34,72 BAD (HHHHHH) -Size 73: 34,73 BAD (HHHHHH) -Size 74: 35,74 BAD (HHHHHH) -Size 75: 35,75 BAD (HHHHHH) -Size 76: 36,76 BAD (HHHHHH) -Size 77: 36,77 BAD (HHHHHH) -Size 78: 37,78 BAD (HHHHHH) -Size 79: 37,79 BAD (HHHHHH) -Size 80: 38,80 BAD (HHHHHH) -Size 81: 38,81 BAD (HHHHHH) -Size 82: 39,82 BAD (HHHHHH) -Size 83: 39,83 BAD (HHHHHH) -Size 84: 39,84 BAD (HHHHHH) -Size 85: 40,85 BAD (HHHHHH) -Size 86: 40,86 BAD (HHHHHH) -Size 87: 41,87 BAD (HHHHHH) -Size 88: 41,88 BAD (HHHHHH) -Size 89: 42,89 BAD (HHHHHH) -Size 90: 42,90 BAD (HHHHHH) -Size 91: 43,91 BAD (HHHHHH) -Size 92: 43,92 BAD (HHHHHH) -Size 93: 44,93 BAD (HHHHHH) -Size 94: 44,94 BAD (HHHHHH) -Size 95: 45,95 BAD (HHHHHH) -Size 96: 45,96 BAD (HHHHHH) -Size 97: 46,97 BAD (HHHHHH) -Size 98: 46,98 BAD (HHHHHH) -Size 99: 46,99 BAD (HHHHHH) -Size 100: 47,100 BAD (HHHHHH) - -Windows 8 ---------- - -Size 1: 1,3 BAD (HHHHHH) -Size 2: 1,2 BAD (HHHHHH) -Size 3: 1,3 BAD (HHHHHH) -Size 4: 2,4 BAD (HHHHHH) -Size 5: 2,5 BAD (HHHHHH) -Size 6: 3,6 BAD (HHHHHH) -Size 7: 3,6 BAD (HHHHHH) -Size 8: 4,8 BAD (HHHHHH) -Size 9: 4,9 BAD (HHHHHH) -Size 10: 5,10 BAD (HHHHHH) -Size 11: 5,11 BAD (HHHHHH) -Size 12: 6,12 BAD (HHHHHH) -Size 13: 6,13 BAD (HHHHHH) -Size 14: 7,14 BAD (HHHHHH) -Size 15: 7,15 BAD (HHHHHH) -Size 16: 8,16 BAD (HHHHHH) -Size 17: 8,17 BAD (HHHHHH) -Size 18: 8,18 BAD (HHHHHH) -Size 19: 9,19 BAD (HHHHHH) -Size 20: 9,20 BAD (HHHHHH) -Size 21: 10,22 BAD (HHHHHH) -Size 22: 10,22 BAD (HHHHHH) -Size 23: 11,23 BAD (HHHHHH) -Size 24: 11,24 BAD (HHHHHH) -Size 25: 12,25 BAD (HHHHHH) -Size 26: 12,26 BAD (HHHHHH) -Size 27: 13,27 BAD (HHHHHH) -Size 28: 13,28 BAD (HHHHHH) -Size 29: 14,29 BAD (HHHHHH) -Size 30: 14,30 BAD (HHHHHH) -Size 31: 15,31 BAD (HHHHHH) -Size 32: 15,32 BAD (HHHHHH) -Size 33: 15,33 BAD (HHHHHH) -Size 34: 16,34 BAD (HHHHHH) -Size 35: 16,36 BAD (HHHHHH) -Size 36: 17,36 BAD (HHHHHH) -Size 37: 17,37 BAD (HHHHHH) -Size 38: 18,38 BAD (HHHHHH) -Size 39: 18,39 BAD (HHHHHH) -Size 40: 19,40 BAD (HHHHHH) -Size 41: 19,41 BAD (HHHHHH) -Size 42: 20,42 BAD (HHHHHH) -Size 43: 20,43 BAD (HHHHHH) -Size 44: 21,44 BAD (HHHHHH) -Size 45: 21,45 BAD (HHHHHH) -Size 46: 22,46 BAD (HHHHHH) -Size 47: 22,47 BAD (HHHHHH) -Size 48: 23,48 BAD (HHHHHH) -Size 49: 23,49 BAD (HHHHHH) -Size 50: 23,50 BAD (HHHHHH) -Size 51: 24,51 BAD (HHHHHH) -Size 52: 24,52 BAD (HHHHHH) -Size 53: 25,53 BAD (HHHHHH) -Size 54: 25,54 BAD (HHHHHH) -Size 55: 26,55 BAD (HHHHHH) -Size 56: 26,56 BAD (HHHHHH) -Size 57: 27,57 BAD (HHHHHH) -Size 58: 27,58 BAD (HHHHHH) -Size 59: 28,59 BAD (HHHHHH) -Size 60: 28,60 BAD (HHHHHH) -Size 61: 29,61 BAD (HHHHHH) -Size 62: 29,62 BAD (HHHHHH) -Size 63: 30,64 BAD (HHHHHH) -Size 64: 30,64 BAD (HHHHHH) -Size 65: 31,65 BAD (HHHHHH) -Size 66: 31,66 BAD (HHHHHH) -Size 67: 31,67 BAD (HHHHHH) -Size 68: 32,68 BAD (HHHHHH) -Size 69: 32,69 BAD (HHHHHH) -Size 70: 33,70 BAD (HHHHHH) -Size 71: 33,71 BAD (HHHHHH) -Size 72: 34,72 BAD (HHHHHH) -Size 73: 34,73 BAD (HHHHHH) -Size 74: 35,74 BAD (HHHHHH) -Size 75: 35,75 BAD (HHHHHH) -Size 76: 36,76 BAD (HHHHHH) -Size 77: 36,77 BAD (HHHHHH) -Size 78: 37,78 BAD (HHHHHH) -Size 79: 37,79 BAD (HHHHHH) -Size 80: 38,80 BAD (HHHHHH) -Size 81: 38,81 BAD (HHHHHH) -Size 82: 39,82 BAD (HHHHHH) -Size 83: 39,83 BAD (HHHHHH) -Size 84: 39,84 BAD (HHHHHH) -Size 85: 40,85 BAD (HHHHHH) -Size 86: 40,86 BAD (HHHHHH) -Size 87: 41,87 BAD (HHHHHH) -Size 88: 41,88 BAD (HHHHHH) -Size 89: 42,89 BAD (HHHHHH) -Size 90: 42,90 BAD (HHHHHH) -Size 91: 43,91 BAD (HHHHHH) -Size 92: 43,92 BAD (HHHHHH) -Size 93: 44,93 BAD (HHHHHH) -Size 94: 44,94 BAD (HHHHHH) -Size 95: 45,95 BAD (HHHHHH) -Size 96: 45,96 BAD (HHHHHH) -Size 97: 46,97 BAD (HHHHHH) -Size 98: 46,98 BAD (HHHHHH) -Size 99: 46,99 BAD (HHHHHH) -Size 100: 47,100 BAD (HHHHHH) - -Windows 8.1 ------------ - -Size 1: 1,3 BAD (HHHHHH) -Size 2: 1,2 BAD (HHHHHH) -Size 3: 1,3 BAD (HHHHHH) -Size 4: 2,4 BAD (HHHHHH) -Size 5: 2,5 BAD (HHHHHH) -Size 6: 3,6 BAD (HHHHHH) -Size 7: 3,6 BAD (HHHHHH) -Size 8: 4,8 BAD (HHHHHH) -Size 9: 4,9 BAD (HHHHHH) -Size 10: 5,10 BAD (HHHHHH) -Size 11: 5,11 BAD (HHHHHH) -Size 12: 6,12 BAD (HHHHHH) -Size 13: 6,13 BAD (HHHHHH) -Size 14: 7,14 BAD (HHHHHH) -Size 15: 7,15 BAD (HHHHHH) -Size 16: 8,16 BAD (HHHHHH) -Size 17: 8,17 BAD (HHHHHH) -Size 18: 8,18 BAD (HHHHHH) -Size 19: 9,19 BAD (HHHHHH) -Size 20: 9,20 BAD (HHHHHH) -Size 21: 10,22 BAD (HHHHHH) -Size 22: 10,22 BAD (HHHHHH) -Size 23: 11,23 BAD (HHHHHH) -Size 24: 11,24 BAD (HHHHHH) -Size 25: 12,25 BAD (HHHHHH) -Size 26: 12,26 BAD (HHHHHH) -Size 27: 13,27 BAD (HHHHHH) -Size 28: 13,28 BAD (HHHHHH) -Size 29: 14,29 BAD (HHHHHH) -Size 30: 14,30 BAD (HHHHHH) -Size 31: 15,31 BAD (HHHHHH) -Size 32: 15,32 BAD (HHHHHH) -Size 33: 15,33 BAD (HHHHHH) -Size 34: 16,34 BAD (HHHHHH) -Size 35: 16,36 BAD (HHHHHH) -Size 36: 17,36 BAD (HHHHHH) -Size 37: 17,37 BAD (HHHHHH) -Size 38: 18,38 BAD (HHHHHH) -Size 39: 18,39 BAD (HHHHHH) -Size 40: 19,40 BAD (HHHHHH) -Size 41: 19,41 BAD (HHHHHH) -Size 42: 20,42 BAD (HHHHHH) -Size 43: 20,43 BAD (HHHHHH) -Size 44: 21,44 BAD (HHHHHH) -Size 45: 21,45 BAD (HHHHHH) -Size 46: 22,46 BAD (HHHHHH) -Size 47: 22,47 BAD (HHHHHH) -Size 48: 23,48 BAD (HHHHHH) -Size 49: 23,49 BAD (HHHHHH) -Size 50: 23,50 BAD (HHHHHH) -Size 51: 24,51 BAD (HHHHHH) -Size 52: 24,52 BAD (HHHHHH) -Size 53: 25,53 BAD (HHHHHH) -Size 54: 25,54 BAD (HHHHHH) -Size 55: 26,55 BAD (HHHHHH) -Size 56: 26,56 BAD (HHHHHH) -Size 57: 27,57 BAD (HHHHHH) -Size 58: 27,58 BAD (HHHHHH) -Size 59: 28,59 BAD (HHHHHH) -Size 60: 28,60 BAD (HHHHHH) -Size 61: 29,61 BAD (HHHHHH) -Size 62: 29,62 BAD (HHHHHH) -Size 63: 30,64 BAD (HHHHHH) -Size 64: 30,64 BAD (HHHHHH) -Size 65: 31,65 BAD (HHHHHH) -Size 66: 31,66 BAD (HHHHHH) -Size 67: 31,67 BAD (HHHHHH) -Size 68: 32,68 BAD (HHHHHH) -Size 69: 32,69 BAD (HHHHHH) -Size 70: 33,70 BAD (HHHHHH) -Size 71: 33,71 BAD (HHHHHH) -Size 72: 34,72 BAD (HHHHHH) -Size 73: 34,73 BAD (HHHHHH) -Size 74: 35,74 BAD (HHHHHH) -Size 75: 35,75 BAD (HHHHHH) -Size 76: 36,76 BAD (HHHHHH) -Size 77: 36,77 BAD (HHHHHH) -Size 78: 37,78 BAD (HHHHHH) -Size 79: 37,79 BAD (HHHHHH) -Size 80: 38,80 BAD (HHHHHH) -Size 81: 38,81 BAD (HHHHHH) -Size 82: 39,82 BAD (HHHHHH) -Size 83: 39,83 BAD (HHHHHH) -Size 84: 39,84 BAD (HHHHHH) -Size 85: 40,85 BAD (HHHHHH) -Size 86: 40,86 BAD (HHHHHH) -Size 87: 41,87 BAD (HHHHHH) -Size 88: 41,88 BAD (HHHHHH) -Size 89: 42,89 BAD (HHHHHH) -Size 90: 42,90 BAD (HHHHHH) -Size 91: 43,91 BAD (HHHHHH) -Size 92: 43,92 BAD (HHHHHH) -Size 93: 44,93 BAD (HHHHHH) -Size 94: 44,94 BAD (HHHHHH) -Size 95: 45,95 BAD (HHHHHH) -Size 96: 45,96 BAD (HHHHHH) -Size 97: 46,97 BAD (HHHHHH) -Size 98: 46,98 BAD (HHHHHH) -Size 99: 46,99 BAD (HHHHHH) -Size 100: 47,100 BAD (HHHHHH) - -Windows 10 14342 Old Console ----------------------------- - -Size 1: 1,3 BAD (HHHHHH) -Size 2: 1,2 BAD (HHHHHH) -Size 3: 1,3 BAD (HHHHHH) -Size 4: 2,4 BAD (HHHHHH) -Size 5: 2,5 BAD (HHHHHH) -Size 6: 3,6 BAD (HHHHHH) -Size 7: 3,6 BAD (HHHHHH) -Size 8: 4,8 BAD (HHHHHH) -Size 9: 4,9 BAD (HHHHHH) -Size 10: 5,10 BAD (HHHHHH) -Size 11: 5,11 BAD (HHHHHH) -Size 12: 6,12 BAD (HHHHHH) -Size 13: 6,13 BAD (HHHHHH) -Size 14: 7,14 BAD (HHHHHH) -Size 15: 7,15 BAD (HHHHHH) -Size 16: 8,16 BAD (HHHHHH) -Size 17: 8,17 BAD (HHHHHH) -Size 18: 8,18 BAD (HHHHHH) -Size 19: 9,19 BAD (HHHHHH) -Size 20: 9,20 BAD (HHHHHH) -Size 21: 10,22 BAD (HHHHHH) -Size 22: 10,22 BAD (HHHHHH) -Size 23: 11,23 BAD (HHHHHH) -Size 24: 11,24 BAD (HHHHHH) -Size 25: 12,25 BAD (HHHHHH) -Size 26: 12,26 BAD (HHHHHH) -Size 27: 13,27 BAD (HHHHHH) -Size 28: 13,28 BAD (HHHHHH) -Size 29: 14,29 BAD (HHHHHH) -Size 30: 14,30 BAD (HHHHHH) -Size 31: 15,31 BAD (HHHHHH) -Size 32: 15,32 BAD (HHHHHH) -Size 33: 15,33 BAD (HHHHHH) -Size 34: 16,34 BAD (HHHHHH) -Size 35: 16,36 BAD (HHHHHH) -Size 36: 17,36 BAD (HHHHHH) -Size 37: 17,37 BAD (HHHHHH) -Size 38: 18,38 BAD (HHHHHH) -Size 39: 18,39 BAD (HHHHHH) -Size 40: 19,40 BAD (HHHHHH) -Size 41: 19,41 BAD (HHHHHH) -Size 42: 20,42 BAD (HHHHHH) -Size 43: 20,43 BAD (HHHHHH) -Size 44: 21,44 BAD (HHHHHH) -Size 45: 21,45 BAD (HHHHHH) -Size 46: 22,46 BAD (HHHHHH) -Size 47: 22,47 BAD (HHHHHH) -Size 48: 23,48 BAD (HHHHHH) -Size 49: 23,49 BAD (HHHHHH) -Size 50: 23,50 BAD (HHHHHH) -Size 51: 24,51 BAD (HHHHHH) -Size 52: 24,52 BAD (HHHHHH) -Size 53: 25,53 BAD (HHHHHH) -Size 54: 25,54 BAD (HHHHHH) -Size 55: 26,55 BAD (HHHHHH) -Size 56: 26,56 BAD (HHHHHH) -Size 57: 27,57 BAD (HHHHHH) -Size 58: 27,58 BAD (HHHHHH) -Size 59: 28,59 BAD (HHHHHH) -Size 60: 28,60 BAD (HHHHHH) -Size 61: 29,61 BAD (HHHHHH) -Size 62: 29,62 BAD (HHHHHH) -Size 63: 30,64 BAD (HHHHHH) -Size 64: 30,64 BAD (HHHHHH) -Size 65: 31,65 BAD (HHHHHH) -Size 66: 31,66 BAD (HHHHHH) -Size 67: 31,67 BAD (HHHHHH) -Size 68: 32,68 BAD (HHHHHH) -Size 69: 32,69 BAD (HHHHHH) -Size 70: 33,70 BAD (HHHHHH) -Size 71: 33,71 BAD (HHHHHH) -Size 72: 34,72 BAD (HHHHHH) -Size 73: 34,73 BAD (HHHHHH) -Size 74: 35,74 BAD (HHHHHH) -Size 75: 35,75 BAD (HHHHHH) -Size 76: 36,76 BAD (HHHHHH) -Size 77: 36,77 BAD (HHHHHH) -Size 78: 37,78 BAD (HHHHHH) -Size 79: 37,79 BAD (HHHHHH) -Size 80: 38,80 BAD (HHHHHH) -Size 81: 38,81 BAD (HHHHHH) -Size 82: 39,82 BAD (HHHHHH) -Size 83: 39,83 BAD (HHHHHH) -Size 84: 39,84 BAD (HHHHHH) -Size 85: 40,85 BAD (HHHHHH) -Size 86: 40,86 BAD (HHHHHH) -Size 87: 41,87 BAD (HHHHHH) -Size 88: 41,88 BAD (HHHHHH) -Size 89: 42,89 BAD (HHHHHH) -Size 90: 42,90 BAD (HHHHHH) -Size 91: 43,91 BAD (HHHHHH) -Size 92: 43,92 BAD (HHHHHH) -Size 93: 44,93 BAD (HHHHHH) -Size 94: 44,94 BAD (HHHHHH) -Size 95: 45,95 BAD (HHHHHH) -Size 96: 45,96 BAD (HHHHHH) -Size 97: 46,97 BAD (HHHHHH) -Size 98: 46,98 BAD (HHHHHH) -Size 99: 46,99 BAD (HHHHHH) -Size 100: 47,100 BAD (HHHHHH) - -Windows 10 14342 New Console ----------------------------- - -Size 1: 1,1 BAD (HHHHHH) -Size 2: 1,2 BAD (HHHHHH) -Size 3: 1,3 BAD (HHHHHH) -Size 4: 2,4 BAD (HHHHHH) -Size 5: 2,5 BAD (HHHHHH) -Size 6: 3,6 BAD (HHHHHH) -Size 7: 3,7 BAD (HHHHHH) -Size 8: 4,8 BAD (HHHHHH) -Size 9: 4,9 BAD (HHHHHH) -Size 10: 5,10 BAD (HHHHHH) -Size 11: 5,11 BAD (HHHHHH) -Size 12: 6,12 BAD (HHHHHH) -Size 13: 6,13 BAD (HHHHHH) -Size 14: 7,14 BAD (HHHHHH) -Size 15: 7,15 BAD (HHHHHH) -Size 16: 8,16 BAD (HHHHHH) -Size 17: 8,17 BAD (HHHHHH) -Size 18: 8,18 BAD (HHHHHH) -Size 19: 9,19 BAD (HHHHHH) -Size 20: 9,20 BAD (HHHHHH) -Size 21: 10,21 BAD (HHHHHH) -Size 22: 10,22 BAD (HHHHHH) -Size 23: 11,23 BAD (HHHHHH) -Size 24: 11,24 BAD (HHHHHH) -Size 25: 12,25 BAD (HHHHHH) -Size 26: 12,26 BAD (HHHHHH) -Size 27: 13,27 BAD (HHHHHH) -Size 28: 13,28 BAD (HHHHHH) -Size 29: 14,29 BAD (HHHHHH) -Size 30: 14,30 BAD (HHHHHH) -Size 31: 15,31 BAD (HHHHHH) -Size 32: 15,32 BAD (HHHHHH) -Size 33: 15,33 BAD (HHHHHH) -Size 34: 16,34 BAD (HHHHHH) -Size 35: 16,35 BAD (HHHHHH) -Size 36: 17,36 BAD (HHHHHH) -Size 37: 17,37 BAD (HHHHHH) -Size 38: 18,38 BAD (HHHHHH) -Size 39: 18,39 BAD (HHHHHH) -Size 40: 19,40 BAD (HHHHHH) -Size 41: 19,41 BAD (HHHHHH) -Size 42: 20,42 BAD (HHHHHH) -Size 43: 20,43 BAD (HHHHHH) -Size 44: 21,44 BAD (HHHHHH) -Size 45: 21,45 BAD (HHHHHH) -Size 46: 22,46 BAD (HHHHHH) -Size 47: 22,47 BAD (HHHHHH) -Size 48: 23,48 BAD (HHHHHH) -Size 49: 23,49 BAD (HHHHHH) -Size 50: 23,50 BAD (HHHHHH) -Size 51: 24,51 BAD (HHHHHH) -Size 52: 24,52 BAD (HHHHHH) -Size 53: 25,53 BAD (HHHHHH) -Size 54: 25,54 BAD (HHHHHH) -Size 55: 26,55 BAD (HHHHHH) -Size 56: 26,56 BAD (HHHHHH) -Size 57: 27,57 BAD (HHHHHH) -Size 58: 27,58 BAD (HHHHHH) -Size 59: 28,59 BAD (HHHHHH) -Size 60: 28,60 BAD (HHHHHH) -Size 61: 29,61 BAD (HHHHHH) -Size 62: 29,62 BAD (HHHHHH) -Size 63: 30,63 BAD (HHHHHH) -Size 64: 30,64 BAD (HHHHHH) -Size 65: 31,65 BAD (HHHHHH) -Size 66: 31,66 BAD (HHHHHH) -Size 67: 31,67 BAD (HHHHHH) -Size 68: 32,68 BAD (HHHHHH) -Size 69: 32,69 BAD (HHHHHH) -Size 70: 33,70 BAD (HHHHHH) -Size 71: 33,71 BAD (HHHHHH) -Size 72: 34,72 BAD (HHHHHH) -Size 73: 34,73 BAD (HHHHHH) -Size 74: 35,74 BAD (HHHHHH) -Size 75: 35,75 BAD (HHHHHH) -Size 76: 36,76 BAD (HHHHHH) -Size 77: 36,77 BAD (HHHHHH) -Size 78: 37,78 BAD (HHHHHH) -Size 79: 37,79 BAD (HHHHHH) -Size 80: 38,80 BAD (HHHHHH) -Size 81: 38,81 BAD (HHHHHH) -Size 82: 39,82 BAD (HHHHHH) -Size 83: 39,83 BAD (HHHHHH) -Size 84: 39,84 BAD (HHHHHH) -Size 85: 40,85 BAD (HHHHHH) -Size 86: 40,86 BAD (HHHHHH) -Size 87: 41,87 BAD (HHHHHH) -Size 88: 41,88 BAD (HHHHHH) -Size 89: 42,89 BAD (HHHHHH) -Size 90: 42,90 BAD (HHHHHH) -Size 91: 43,91 BAD (HHHHHH) -Size 92: 43,92 BAD (HHHHHH) -Size 93: 44,93 BAD (HHHHHH) -Size 94: 44,94 BAD (HHHHHH) -Size 95: 45,95 BAD (HHHHHH) -Size 96: 45,96 BAD (HHHHHH) -Size 97: 46,97 BAD (HHHHHH) -Size 98: 46,98 BAD (HHHHHH) -Size 99: 46,99 BAD (HHHHHH) -Size 100: 47,100 BAD (HHHHHH) diff --git a/node_modules/node-pty/deps/winpty/misc/Font-Report-June2016/CP437-Lucida.txt b/node_modules/node-pty/deps/winpty/misc/Font-Report-June2016/CP437-Lucida.txt deleted file mode 100644 index 0eed93a..0000000 --- a/node_modules/node-pty/deps/winpty/misc/Font-Report-June2016/CP437-Lucida.txt +++ /dev/null @@ -1,633 +0,0 @@ -================================== -Code Page 437, Lucida Console font -================================== - -Options: -face "Lucida Console" -family 0x36 -Chars: A2 A3 2014 3044 30FC 4000 - -FontSurvey "-face \"Lucida Console\" -family 0x36" - -Vista ------ - -Size 1: 1,2 BAD (HHHHHH) -Size 2: 1,2 BAD (HHHHHH) -Size 3: 2,3 BAD (HHHHHH) -Size 4: 2,4 BAD (HHHHHH) -Size 5: 3,5 BAD (HHHHHH) -Size 6: 4,6 BAD (HHHHHH) -Size 7: 4,7 BAD (HHHHHH) -Size 8: 5,8 BAD (HHHHHH) -Size 9: 5,9 BAD (HHHHHH) -Size 10: 6,10 BAD (HHHHHH) -Size 11: 7,11 BAD (HHHHHH) -Size 12: 7,12 BAD (HHHHHH) -Size 13: 8,13 BAD (HHHHHH) -Size 14: 8,14 BAD (HHHHHH) -Size 15: 9,15 BAD (HHHHHH) -Size 16: 10,16 BAD (HHHHHH) -Size 17: 10,17 BAD (HHHHHH) -Size 18: 11,18 BAD (HHHHHH) -Size 19: 11,19 BAD (HHHHHH) -Size 20: 12,20 BAD (HHHHHH) -Size 21: 13,21 BAD (HHHHHH) -Size 22: 13,22 BAD (HHHHHH) -Size 23: 14,23 BAD (HHHHHH) -Size 24: 14,24 BAD (HHHHHH) -Size 25: 15,25 BAD (HHHHHH) -Size 26: 16,26 BAD (HHHHHH) -Size 27: 16,27 BAD (HHHHHH) -Size 28: 17,28 BAD (HHHHHH) -Size 29: 17,29 BAD (HHHHHH) -Size 30: 18,30 BAD (HHHHHH) -Size 31: 19,31 BAD (HHHHHH) -Size 32: 19,32 BAD (HHHHHH) -Size 33: 20,33 BAD (HHHHHH) -Size 34: 20,34 BAD (HHHHHH) -Size 35: 21,35 BAD (HHHHHH) -Size 36: 22,36 BAD (HHHHHH) -Size 37: 22,37 BAD (HHHHHH) -Size 38: 23,38 BAD (HHHHHH) -Size 39: 23,39 BAD (HHHHHH) -Size 40: 24,40 BAD (HHHHHH) -Size 41: 25,41 BAD (HHHHHH) -Size 42: 25,42 BAD (HHHHHH) -Size 43: 26,43 BAD (HHHHHH) -Size 44: 27,44 BAD (HHHHHH) -Size 45: 27,45 BAD (HHHHHH) -Size 46: 28,46 BAD (HHHHHH) -Size 47: 28,47 BAD (HHHHHH) -Size 48: 29,48 BAD (HHHHHH) -Size 49: 30,49 BAD (HHHHHH) -Size 50: 30,50 BAD (HHHHHH) -Size 51: 31,51 BAD (HHHHHH) -Size 52: 31,52 BAD (HHHHHH) -Size 53: 32,53 BAD (HHHHHH) -Size 54: 33,54 BAD (HHHHHH) -Size 55: 33,55 BAD (HHHHHH) -Size 56: 34,56 BAD (HHHHHH) -Size 57: 34,57 BAD (HHHHHH) -Size 58: 35,58 BAD (HHHHHH) -Size 59: 36,59 BAD (HHHHHH) -Size 60: 36,60 BAD (HHHHHH) -Size 61: 37,61 BAD (HHHHHH) -Size 62: 37,62 BAD (HHHHHH) -Size 63: 38,63 BAD (HHHHHH) -Size 64: 39,65 BAD (HHHHHH) -Size 65: 39,65 BAD (HHHHHH) -Size 66: 40,66 BAD (HHHHHH) -Size 67: 40,67 BAD (HHHHHH) -Size 68: 41,68 BAD (HHHHHH) -Size 69: 42,69 BAD (HHHHHH) -Size 70: 42,70 BAD (HHHHHH) -Size 71: 43,71 BAD (HHHHHH) -Size 72: 43,72 BAD (HHHHHH) -Size 73: 44,73 BAD (HHHHHH) -Size 74: 45,74 BAD (HHHHHH) -Size 75: 45,75 BAD (HHHHHH) -Size 76: 46,76 BAD (HHHHHH) -Size 77: 46,77 BAD (HHHHHH) -Size 78: 47,78 BAD (HHHHHH) -Size 79: 48,79 BAD (HHHHHH) -Size 80: 48,80 BAD (HHHHHH) -Size 81: 49,81 BAD (HHHHHH) -Size 82: 49,82 BAD (HHHHHH) -Size 83: 50,83 BAD (HHHHHH) -Size 84: 51,84 BAD (HHHHHH) -Size 85: 51,85 BAD (HHHHHH) -Size 86: 52,86 BAD (HHHHHH) -Size 87: 52,87 BAD (HHHHHH) -Size 88: 53,88 BAD (HHHHHH) -Size 89: 54,89 BAD (HHHHHH) -Size 90: 54,90 BAD (HHHHHH) -Size 91: 55,91 BAD (HHHHHH) -Size 92: 55,92 BAD (HHHHHH) -Size 93: 56,93 BAD (HHHHHH) -Size 94: 57,94 BAD (HHHHHH) -Size 95: 57,95 BAD (HHHHHH) -Size 96: 58,96 BAD (HHHHHH) -Size 97: 58,97 BAD (HHHHHH) -Size 98: 59,98 BAD (HHHHHH) -Size 99: 60,99 BAD (HHHHHH) -Size 100: 60,100 BAD (HHHHHH) - - -Windows 7 ---------- - -Size 1: 1,2 BAD (HHHHHH) -Size 2: 1,2 BAD (HHHHHH) -Size 3: 2,3 BAD (HHHHHH) -Size 4: 2,4 BAD (HHHHHH) -Size 5: 3,5 BAD (HHHHHH) -Size 6: 4,6 BAD (HHHHHH) -Size 7: 4,7 BAD (HHHHHH) -Size 8: 5,8 BAD (HHHHHH) -Size 9: 5,9 BAD (HHHHHH) -Size 10: 6,10 BAD (HHHHHH) -Size 11: 7,11 BAD (HHHHHH) -Size 12: 7,12 BAD (HHHHHH) -Size 13: 8,13 BAD (HHHHHH) -Size 14: 8,14 BAD (HHHHHH) -Size 15: 9,15 BAD (HHHHHH) -Size 16: 10,16 BAD (HHHHHH) -Size 17: 10,17 BAD (HHHHHH) -Size 18: 11,18 BAD (HHHHHH) -Size 19: 11,19 BAD (HHHHHH) -Size 20: 12,20 BAD (HHHHHH) -Size 21: 13,21 BAD (HHHHHH) -Size 22: 13,22 BAD (HHHHHH) -Size 23: 14,23 BAD (HHHHHH) -Size 24: 14,24 BAD (HHHHHH) -Size 25: 15,25 BAD (HHHHHH) -Size 26: 16,26 BAD (HHHHHH) -Size 27: 16,27 BAD (HHHHHH) -Size 28: 17,28 BAD (HHHHHH) -Size 29: 17,29 BAD (HHHHHH) -Size 30: 18,30 BAD (HHHHHH) -Size 31: 19,31 BAD (HHHHHH) -Size 32: 19,32 BAD (HHHHHH) -Size 33: 20,33 BAD (HHHHHH) -Size 34: 20,34 BAD (HHHHHH) -Size 35: 21,35 BAD (HHHHHH) -Size 36: 22,36 BAD (HHHHHH) -Size 37: 22,37 BAD (HHHHHH) -Size 38: 23,38 BAD (HHHHHH) -Size 39: 23,39 BAD (HHHHHH) -Size 40: 24,40 BAD (HHHHHH) -Size 41: 25,41 BAD (HHHHHH) -Size 42: 25,42 BAD (HHHHHH) -Size 43: 26,43 BAD (HHHHHH) -Size 44: 27,44 BAD (HHHHHH) -Size 45: 27,45 BAD (HHHHHH) -Size 46: 28,46 BAD (HHHHHH) -Size 47: 28,47 BAD (HHHHHH) -Size 48: 29,48 BAD (HHHHHH) -Size 49: 30,49 BAD (HHHHHH) -Size 50: 30,50 BAD (HHHHHH) -Size 51: 31,51 BAD (HHHHHH) -Size 52: 31,52 BAD (HHHHHH) -Size 53: 32,53 BAD (HHHHHH) -Size 54: 33,54 BAD (HHHHHH) -Size 55: 33,55 BAD (HHHHHH) -Size 56: 34,56 BAD (HHHHHH) -Size 57: 34,57 BAD (HHHHHH) -Size 58: 35,58 BAD (HHHHHH) -Size 59: 36,59 BAD (HHHHHH) -Size 60: 36,60 BAD (HHHHHH) -Size 61: 37,61 BAD (HHHHHH) -Size 62: 37,62 BAD (HHHHHH) -Size 63: 38,63 BAD (HHHHHH) -Size 64: 39,65 BAD (HHHHHH) -Size 65: 39,65 BAD (HHHHHH) -Size 66: 40,66 BAD (HHHHHH) -Size 67: 40,67 BAD (HHHHHH) -Size 68: 41,68 BAD (HHHHHH) -Size 69: 42,69 BAD (HHHHHH) -Size 70: 42,70 BAD (HHHHHH) -Size 71: 43,71 BAD (HHHHHH) -Size 72: 43,72 BAD (HHHHHH) -Size 73: 44,73 BAD (HHHHHH) -Size 74: 45,74 BAD (HHHHHH) -Size 75: 45,75 BAD (HHHHHH) -Size 76: 46,76 BAD (HHHHHH) -Size 77: 46,77 BAD (HHHHHH) -Size 78: 47,78 BAD (HHHHHH) -Size 79: 48,79 BAD (HHHHHH) -Size 80: 48,80 BAD (HHHHHH) -Size 81: 49,81 BAD (HHHHHH) -Size 82: 49,82 BAD (HHHHHH) -Size 83: 50,83 BAD (HHHHHH) -Size 84: 51,84 BAD (HHHHHH) -Size 85: 51,85 BAD (HHHHHH) -Size 86: 52,86 BAD (HHHHHH) -Size 87: 52,87 BAD (HHHHHH) -Size 88: 53,88 BAD (HHHHHH) -Size 89: 54,89 BAD (HHHHHH) -Size 90: 54,90 BAD (HHHHHH) -Size 91: 55,91 BAD (HHHHHH) -Size 92: 55,92 BAD (HHHHHH) -Size 93: 56,93 BAD (HHHHHH) -Size 94: 57,94 BAD (HHHHHH) -Size 95: 57,95 BAD (HHHHHH) -Size 96: 58,96 BAD (HHHHHH) -Size 97: 58,97 BAD (HHHHHH) -Size 98: 59,98 BAD (HHHHHH) -Size 99: 60,99 BAD (HHHHHH) -Size 100: 60,100 BAD (HHHHHH) - -Windows 8 ---------- - -Size 1: 1,2 BAD (HHHHHH) -Size 2: 1,2 BAD (HHHHHH) -Size 3: 2,3 BAD (HHHHHH) -Size 4: 2,4 BAD (HHHHHH) -Size 5: 3,5 BAD (HHHHHH) -Size 6: 4,6 BAD (HHHHHH) -Size 7: 4,7 BAD (HHHHHH) -Size 8: 5,8 BAD (HHHHHH) -Size 9: 5,9 BAD (HHHHHH) -Size 10: 6,10 BAD (HHHHHH) -Size 11: 7,11 BAD (HHHHHH) -Size 12: 7,12 BAD (HHHHHH) -Size 13: 8,13 BAD (HHHHHH) -Size 14: 8,14 BAD (HHHHHH) -Size 15: 9,15 BAD (HHHHHH) -Size 16: 10,16 BAD (HHHHHH) -Size 17: 10,17 BAD (HHHHHH) -Size 18: 11,18 BAD (HHHHHH) -Size 19: 11,19 BAD (HHHHHH) -Size 20: 12,20 BAD (HHHHHH) -Size 21: 13,21 BAD (HHHHHH) -Size 22: 13,22 BAD (HHHHHH) -Size 23: 14,23 BAD (HHHHHH) -Size 24: 14,24 BAD (HHHHHH) -Size 25: 15,25 BAD (HHHHHH) -Size 26: 16,26 BAD (HHHHHH) -Size 27: 16,27 BAD (HHHHHH) -Size 28: 17,28 BAD (HHHHHH) -Size 29: 17,29 BAD (HHHHHH) -Size 30: 18,30 BAD (HHHHHH) -Size 31: 19,31 BAD (HHHHHH) -Size 32: 19,32 BAD (HHHHHH) -Size 33: 20,33 BAD (HHHHHH) -Size 34: 20,34 BAD (HHHHHH) -Size 35: 21,35 BAD (HHHHHH) -Size 36: 22,36 BAD (HHHHHH) -Size 37: 22,37 BAD (HHHHHH) -Size 38: 23,38 BAD (HHHHHH) -Size 39: 23,39 BAD (HHHHHH) -Size 40: 24,40 BAD (HHHHHH) -Size 41: 25,41 BAD (HHHHHH) -Size 42: 25,42 BAD (HHHHHH) -Size 43: 26,43 BAD (HHHHHH) -Size 44: 27,44 BAD (HHHHHH) -Size 45: 27,45 BAD (HHHHHH) -Size 46: 28,46 BAD (HHHHHH) -Size 47: 28,47 BAD (HHHHHH) -Size 48: 29,48 BAD (HHHHHH) -Size 49: 30,49 BAD (HHHHHH) -Size 50: 30,50 BAD (HHHHHH) -Size 51: 31,51 BAD (HHHHHH) -Size 52: 31,52 BAD (HHHHHH) -Size 53: 32,53 BAD (HHHHHH) -Size 54: 33,54 BAD (HHHHHH) -Size 55: 33,55 BAD (HHHHHH) -Size 56: 34,56 BAD (HHHHHH) -Size 57: 34,57 BAD (HHHHHH) -Size 58: 35,58 BAD (HHHHHH) -Size 59: 36,59 BAD (HHHHHH) -Size 60: 36,60 BAD (HHHHHH) -Size 61: 37,61 BAD (HHHHHH) -Size 62: 37,62 BAD (HHHHHH) -Size 63: 38,63 BAD (HHHHHH) -Size 64: 39,65 BAD (HHHHHH) -Size 65: 39,65 BAD (HHHHHH) -Size 66: 40,66 BAD (HHHHHH) -Size 67: 40,67 BAD (HHHHHH) -Size 68: 41,68 BAD (HHHHHH) -Size 69: 42,69 BAD (HHHHHH) -Size 70: 42,70 BAD (HHHHHH) -Size 71: 43,71 BAD (HHHHHH) -Size 72: 43,72 BAD (HHHHHH) -Size 73: 44,73 BAD (HHHHHH) -Size 74: 45,74 BAD (HHHHHH) -Size 75: 45,75 BAD (HHHHHH) -Size 76: 46,76 BAD (HHHHHH) -Size 77: 46,77 BAD (HHHHHH) -Size 78: 47,78 BAD (HHHHHH) -Size 79: 48,79 BAD (HHHHHH) -Size 80: 48,80 BAD (HHHHHH) -Size 81: 49,81 BAD (HHHHHH) -Size 82: 49,82 BAD (HHHHHH) -Size 83: 50,83 BAD (HHHHHH) -Size 84: 51,84 BAD (HHHHHH) -Size 85: 51,85 BAD (HHHHHH) -Size 86: 52,86 BAD (HHHHHH) -Size 87: 52,87 BAD (HHHHHH) -Size 88: 53,88 BAD (HHHHHH) -Size 89: 54,89 BAD (HHHHHH) -Size 90: 54,90 BAD (HHHHHH) -Size 91: 55,91 BAD (HHHHHH) -Size 92: 55,92 BAD (HHHHHH) -Size 93: 56,93 BAD (HHHHHH) -Size 94: 57,94 BAD (HHHHHH) -Size 95: 57,95 BAD (HHHHHH) -Size 96: 58,96 BAD (HHHHHH) -Size 97: 58,97 BAD (HHHHHH) -Size 98: 59,98 BAD (HHHHHH) -Size 99: 60,99 BAD (HHHHHH) -Size 100: 60,100 BAD (HHHHHH) - -Windows 8.1 ------------ - -Size 1: 1,2 BAD (HHHHHH) -Size 2: 1,2 BAD (HHHHHH) -Size 3: 2,3 BAD (HHHHHH) -Size 4: 2,4 BAD (HHHHHH) -Size 5: 3,5 BAD (HHHHHH) -Size 6: 4,6 BAD (HHHHHH) -Size 7: 4,7 BAD (HHHHHH) -Size 8: 5,8 BAD (HHHHHH) -Size 9: 5,9 BAD (HHHHHH) -Size 10: 6,10 BAD (HHHHHH) -Size 11: 7,11 BAD (HHHHHH) -Size 12: 7,12 BAD (HHHHHH) -Size 13: 8,13 BAD (HHHHHH) -Size 14: 8,14 BAD (HHHHHH) -Size 15: 9,15 BAD (HHHHHH) -Size 16: 10,16 BAD (HHHHHH) -Size 17: 10,17 BAD (HHHHHH) -Size 18: 11,18 BAD (HHHHHH) -Size 19: 11,19 BAD (HHHHHH) -Size 20: 12,20 BAD (HHHHHH) -Size 21: 13,21 BAD (HHHHHH) -Size 22: 13,22 BAD (HHHHHH) -Size 23: 14,23 BAD (HHHHHH) -Size 24: 14,24 BAD (HHHHHH) -Size 25: 15,25 BAD (HHHHHH) -Size 26: 16,26 BAD (HHHHHH) -Size 27: 16,27 BAD (HHHHHH) -Size 28: 17,28 BAD (HHHHHH) -Size 29: 17,29 BAD (HHHHHH) -Size 30: 18,30 BAD (HHHHHH) -Size 31: 19,31 BAD (HHHHHH) -Size 32: 19,32 BAD (HHHHHH) -Size 33: 20,33 BAD (HHHHHH) -Size 34: 20,34 BAD (HHHHHH) -Size 35: 21,35 BAD (HHHHHH) -Size 36: 22,36 BAD (HHHHHH) -Size 37: 22,37 BAD (HHHHHH) -Size 38: 23,38 BAD (HHHHHH) -Size 39: 23,39 BAD (HHHHHH) -Size 40: 24,40 BAD (HHHHHH) -Size 41: 25,41 BAD (HHHHHH) -Size 42: 25,42 BAD (HHHHHH) -Size 43: 26,43 BAD (HHHHHH) -Size 44: 27,44 BAD (HHHHHH) -Size 45: 27,45 BAD (HHHHHH) -Size 46: 28,46 BAD (HHHHHH) -Size 47: 28,47 BAD (HHHHHH) -Size 48: 29,48 BAD (HHHHHH) -Size 49: 30,49 BAD (HHHHHH) -Size 50: 30,50 BAD (HHHHHH) -Size 51: 31,51 BAD (HHHHHH) -Size 52: 31,52 BAD (HHHHHH) -Size 53: 32,53 BAD (HHHHHH) -Size 54: 33,54 BAD (HHHHHH) -Size 55: 33,55 BAD (HHHHHH) -Size 56: 34,56 BAD (HHHHHH) -Size 57: 34,57 BAD (HHHHHH) -Size 58: 35,58 BAD (HHHHHH) -Size 59: 36,59 BAD (HHHHHH) -Size 60: 36,60 BAD (HHHHHH) -Size 61: 37,61 BAD (HHHHHH) -Size 62: 37,62 BAD (HHHHHH) -Size 63: 38,63 BAD (HHHHHH) -Size 64: 39,65 BAD (HHHHHH) -Size 65: 39,65 BAD (HHHHHH) -Size 66: 40,66 BAD (HHHHHH) -Size 67: 40,67 BAD (HHHHHH) -Size 68: 41,68 BAD (HHHHHH) -Size 69: 42,69 BAD (HHHHHH) -Size 70: 42,70 BAD (HHHHHH) -Size 71: 43,71 BAD (HHHHHH) -Size 72: 43,72 BAD (HHHHHH) -Size 73: 44,73 BAD (HHHHHH) -Size 74: 45,74 BAD (HHHHHH) -Size 75: 45,75 BAD (HHHHHH) -Size 76: 46,76 BAD (HHHHHH) -Size 77: 46,77 BAD (HHHHHH) -Size 78: 47,78 BAD (HHHHHH) -Size 79: 48,79 BAD (HHHHHH) -Size 80: 48,80 BAD (HHHHHH) -Size 81: 49,81 BAD (HHHHHH) -Size 82: 49,82 BAD (HHHHHH) -Size 83: 50,83 BAD (HHHHHH) -Size 84: 51,84 BAD (HHHHHH) -Size 85: 51,85 BAD (HHHHHH) -Size 86: 52,86 BAD (HHHHHH) -Size 87: 52,87 BAD (HHHHHH) -Size 88: 53,88 BAD (HHHHHH) -Size 89: 54,89 BAD (HHHHHH) -Size 90: 54,90 BAD (HHHHHH) -Size 91: 55,91 BAD (HHHHHH) -Size 92: 55,92 BAD (HHHHHH) -Size 93: 56,93 BAD (HHHHHH) -Size 94: 57,94 BAD (HHHHHH) -Size 95: 57,95 BAD (HHHHHH) -Size 96: 58,96 BAD (HHHHHH) -Size 97: 58,97 BAD (HHHHHH) -Size 98: 59,98 BAD (HHHHHH) -Size 99: 60,99 BAD (HHHHHH) -Size 100: 60,100 BAD (HHHHHH) - -Windows 10 14342 Old Console ----------------------------- - -Size 1: 1,2 BAD (HHHHHH) -Size 2: 1,2 BAD (HHHHHH) -Size 3: 2,3 BAD (HHHHHH) -Size 4: 2,4 BAD (HHHHHH) -Size 5: 3,5 BAD (HHHHHH) -Size 6: 4,6 BAD (HHHHHH) -Size 7: 4,7 BAD (HHHHHH) -Size 8: 5,8 BAD (HHHHHH) -Size 9: 5,9 BAD (HHHHHH) -Size 10: 6,10 BAD (HHHHHH) -Size 11: 7,11 BAD (HHHHHH) -Size 12: 7,12 BAD (HHHHHH) -Size 13: 8,13 BAD (HHHHHH) -Size 14: 8,14 BAD (HHHHHH) -Size 15: 9,15 BAD (HHHHHH) -Size 16: 10,16 BAD (HHHHHH) -Size 17: 10,17 BAD (HHHHHH) -Size 18: 11,18 BAD (HHHHHH) -Size 19: 11,19 BAD (HHHHHH) -Size 20: 12,20 BAD (HHHHHH) -Size 21: 13,21 BAD (HHHHHH) -Size 22: 13,22 BAD (HHHHHH) -Size 23: 14,23 BAD (HHHHHH) -Size 24: 14,24 BAD (HHHHHH) -Size 25: 15,25 BAD (HHHHHH) -Size 26: 16,26 BAD (HHHHHH) -Size 27: 16,27 BAD (HHHHHH) -Size 28: 17,28 BAD (HHHHHH) -Size 29: 17,29 BAD (HHHHHH) -Size 30: 18,30 BAD (HHHHHH) -Size 31: 19,31 BAD (HHHHHH) -Size 32: 19,32 BAD (HHHHHH) -Size 33: 20,33 BAD (HHHHHH) -Size 34: 20,34 BAD (HHHHHH) -Size 35: 21,35 BAD (HHHHHH) -Size 36: 22,36 BAD (HHHHHH) -Size 37: 22,37 BAD (HHHHHH) -Size 38: 23,38 BAD (HHHHHH) -Size 39: 23,39 BAD (HHHHHH) -Size 40: 24,40 BAD (HHHHHH) -Size 41: 25,41 BAD (HHHHHH) -Size 42: 25,42 BAD (HHHHHH) -Size 43: 26,43 BAD (HHHHHH) -Size 44: 27,44 BAD (HHHHHH) -Size 45: 27,45 BAD (HHHHHH) -Size 46: 28,46 BAD (HHHHHH) -Size 47: 28,47 BAD (HHHHHH) -Size 48: 29,48 BAD (HHHHHH) -Size 49: 30,49 BAD (HHHHHH) -Size 50: 30,50 BAD (HHHHHH) -Size 51: 31,51 BAD (HHHHHH) -Size 52: 31,52 BAD (HHHHHH) -Size 53: 32,53 BAD (HHHHHH) -Size 54: 33,54 BAD (HHHHHH) -Size 55: 33,55 BAD (HHHHHH) -Size 56: 34,56 BAD (HHHHHH) -Size 57: 34,57 BAD (HHHHHH) -Size 58: 35,58 BAD (HHHHHH) -Size 59: 36,59 BAD (HHHHHH) -Size 60: 36,60 BAD (HHHHHH) -Size 61: 37,61 BAD (HHHHHH) -Size 62: 37,62 BAD (HHHHHH) -Size 63: 38,63 BAD (HHHHHH) -Size 64: 39,65 BAD (HHHHHH) -Size 65: 39,65 BAD (HHHHHH) -Size 66: 40,66 BAD (HHHHHH) -Size 67: 40,67 BAD (HHHHHH) -Size 68: 41,68 BAD (HHHHHH) -Size 69: 42,69 BAD (HHHHHH) -Size 70: 42,70 BAD (HHHHHH) -Size 71: 43,71 BAD (HHHHHH) -Size 72: 43,72 BAD (HHHHHH) -Size 73: 44,73 BAD (HHHHHH) -Size 74: 45,74 BAD (HHHHHH) -Size 75: 45,75 BAD (HHHHHH) -Size 76: 46,76 BAD (HHHHHH) -Size 77: 46,77 BAD (HHHHHH) -Size 78: 47,78 BAD (HHHHHH) -Size 79: 48,79 BAD (HHHHHH) -Size 80: 48,80 BAD (HHHHHH) -Size 81: 49,81 BAD (HHHHHH) -Size 82: 49,82 BAD (HHHHHH) -Size 83: 50,83 BAD (HHHHHH) -Size 84: 51,84 BAD (HHHHHH) -Size 85: 51,85 BAD (HHHHHH) -Size 86: 52,86 BAD (HHHHHH) -Size 87: 52,87 BAD (HHHHHH) -Size 88: 53,88 BAD (HHHHHH) -Size 89: 54,89 BAD (HHHHHH) -Size 90: 54,90 BAD (HHHHHH) -Size 91: 55,91 BAD (HHHHHH) -Size 92: 55,92 BAD (HHHHHH) -Size 93: 56,93 BAD (HHHHHH) -Size 94: 57,94 BAD (HHHHHH) -Size 95: 57,95 BAD (HHHHHH) -Size 96: 58,96 BAD (HHHHHH) -Size 97: 58,97 BAD (HHHHHH) -Size 98: 59,98 BAD (HHHHHH) -Size 99: 60,99 BAD (HHHHHH) -Size 100: 60,100 BAD (HHHHHH) - -Windows 10 14342 New Console ----------------------------- - -Size 1: 1,1 BAD (HHHHHH) -Size 2: 1,2 BAD (HHHHHH) -Size 3: 2,3 BAD (HHHHHH) -Size 4: 2,4 BAD (HHHHHH) -Size 5: 3,5 BAD (HHHHHH) -Size 6: 4,6 BAD (HHHHHH) -Size 7: 4,7 BAD (HHHHHH) -Size 8: 5,8 BAD (HHHHHH) -Size 9: 5,9 BAD (HHHHHH) -Size 10: 6,10 BAD (HHHHHH) -Size 11: 7,11 BAD (HHHHHH) -Size 12: 7,12 BAD (HHHHHH) -Size 13: 8,13 BAD (HHHHHH) -Size 14: 8,14 BAD (HHHHHH) -Size 15: 9,15 BAD (HHHHHH) -Size 16: 10,16 BAD (HHHHHH) -Size 17: 10,17 BAD (HHHHHH) -Size 18: 11,18 BAD (HHHHHH) -Size 19: 11,19 BAD (HHHHHH) -Size 20: 12,20 BAD (HHHHHH) -Size 21: 13,21 BAD (HHHHHH) -Size 22: 13,22 BAD (HHHHHH) -Size 23: 14,23 BAD (HHHHHH) -Size 24: 14,24 BAD (HHHHHH) -Size 25: 15,25 BAD (HHHHHH) -Size 26: 16,26 BAD (HHHHHH) -Size 27: 16,27 BAD (HHHHHH) -Size 28: 17,28 BAD (HHHHHH) -Size 29: 17,29 BAD (HHHHHH) -Size 30: 18,30 BAD (HHHHHH) -Size 31: 19,31 BAD (HHHHHH) -Size 32: 19,32 BAD (HHHHHH) -Size 33: 20,33 BAD (HHHHHH) -Size 34: 20,34 BAD (HHHHHH) -Size 35: 21,35 BAD (HHHHHH) -Size 36: 22,36 BAD (HHHHHH) -Size 37: 22,37 BAD (HHHHHH) -Size 38: 23,38 BAD (HHHHHH) -Size 39: 23,39 BAD (HHHHHH) -Size 40: 24,40 BAD (HHHHHH) -Size 41: 25,41 BAD (HHHHHH) -Size 42: 25,42 BAD (HHHHHH) -Size 43: 26,43 BAD (HHHHHH) -Size 44: 27,44 BAD (HHHHHH) -Size 45: 27,45 BAD (HHHHHH) -Size 46: 28,46 BAD (HHHHHH) -Size 47: 28,47 BAD (HHHHHH) -Size 48: 29,48 BAD (HHHHHH) -Size 49: 30,49 BAD (HHHHHH) -Size 50: 30,50 BAD (HHHHHH) -Size 51: 31,51 BAD (HHHHHH) -Size 52: 31,52 BAD (HHHHHH) -Size 53: 32,53 BAD (HHHHHH) -Size 54: 33,54 BAD (HHHHHH) -Size 55: 33,55 BAD (HHHHHH) -Size 56: 34,56 BAD (HHHHHH) -Size 57: 34,57 BAD (HHHHHH) -Size 58: 35,58 BAD (HHHHHH) -Size 59: 36,59 BAD (HHHHHH) -Size 60: 36,60 BAD (HHHHHH) -Size 61: 37,61 BAD (HHHHHH) -Size 62: 37,62 BAD (HHHHHH) -Size 63: 38,63 BAD (HHHHHH) -Size 64: 39,64 BAD (HHHHHH) -Size 65: 39,65 BAD (HHHHHH) -Size 66: 40,66 BAD (HHHHHH) -Size 67: 40,67 BAD (HHHHHH) -Size 68: 41,68 BAD (HHHHHH) -Size 69: 42,69 BAD (HHHHHH) -Size 70: 42,70 BAD (HHHHHH) -Size 71: 43,71 BAD (HHHHHH) -Size 72: 43,72 BAD (HHHHHH) -Size 73: 44,73 BAD (HHHHHH) -Size 74: 45,74 BAD (HHHHHH) -Size 75: 45,75 BAD (HHHHHH) -Size 76: 46,76 BAD (HHHHHH) -Size 77: 46,77 BAD (HHHHHH) -Size 78: 47,78 BAD (HHHHHH) -Size 79: 48,79 BAD (HHHHHH) -Size 80: 48,80 BAD (HHHHHH) -Size 81: 49,81 BAD (HHHHHH) -Size 82: 49,82 BAD (HHHHHH) -Size 83: 50,83 BAD (HHHHHH) -Size 84: 51,84 BAD (HHHHHH) -Size 85: 51,85 BAD (HHHHHH) -Size 86: 52,86 BAD (HHHHHH) -Size 87: 52,87 BAD (HHHHHH) -Size 88: 53,88 BAD (HHHHHH) -Size 89: 54,89 BAD (HHHHHH) -Size 90: 54,90 BAD (HHHHHH) -Size 91: 55,91 BAD (HHHHHH) -Size 92: 55,92 BAD (HHHHHH) -Size 93: 56,93 BAD (HHHHHH) -Size 94: 57,94 BAD (HHHHHH) -Size 95: 57,95 BAD (HHHHHH) -Size 96: 58,96 BAD (HHHHHH) -Size 97: 58,97 BAD (HHHHHH) -Size 98: 59,98 BAD (HHHHHH) -Size 99: 60,99 BAD (HHHHHH) -Size 100: 60,100 BAD (HHHHHH) diff --git a/node_modules/node-pty/deps/winpty/misc/Font-Report-June2016/CP932.txt b/node_modules/node-pty/deps/winpty/misc/Font-Report-June2016/CP932.txt deleted file mode 100644 index ed3637e..0000000 --- a/node_modules/node-pty/deps/winpty/misc/Font-Report-June2016/CP932.txt +++ /dev/null @@ -1,630 +0,0 @@ -======================================= -Code Page 932, Japanese, MS Gothic font -======================================= - -Options: -face-gothic -family 0x36 -Chars: A2 A3 2014 3044 30FC 4000 - -Vista ------ - -Size 1: 1,2 OK (HHHFFF) -Size 2: 1,2 OK (HHHFFF) -Size 3: 2,3 BAD (FFFFHH) -Size 4: 2,4 OK (HHHFFF) -Size 5: 3,5 OK (HHHFFF) -Size 6: 3,6 OK (HHHFFF) -Size 7: 4,7 OK (HHHFFF) -Size 8: 4,8 OK (HHHFFF) -Size 9: 5,9 OK (HHHFFF) -Size 10: 5,10 OK (HHHFFF) -Size 11: 6,11 OK (HHHFFF) -Size 12: 6,12 OK (HHHFFF) -Size 13: 7,13 OK (HHHFFF) -Size 14: 7,14 BAD (HHHFHH) -Size 15: 8,15 OK (HHHFFF) -Size 16: 8,16 BAD (HHHFHH) -Size 17: 9,17 OK (HHHFFF) -Size 18: 9,18 BAD (HHHFHH) -Size 19: 10,19 OK (HHHFFF) -Size 20: 10,20 BAD (HHHFHH) -Size 21: 11,21 OK (HHHFFF) -Size 22: 11,22 BAD (HHHFHH) -Size 23: 12,23 BAD (HHHFHH) -Size 24: 12,24 BAD (HHHFHH) -Size 25: 13,25 BAD (HHHFHH) -Size 26: 13,26 BAD (HHHFHH) -Size 27: 14,27 BAD (HHHFHH) -Size 28: 14,28 BAD (HHHFHH) -Size 29: 15,29 BAD (HHHFHH) -Size 30: 15,30 BAD (HHHFHH) -Size 31: 16,31 BAD (HHHFHH) -Size 32: 16,33 BAD (HHHFHH) -Size 33: 17,33 BAD (HHHFHH) -Size 34: 17,34 BAD (HHHFHH) -Size 35: 18,35 BAD (HHHFHH) -Size 36: 18,36 BAD (HHHFHH) -Size 37: 19,37 BAD (HHHFHH) -Size 38: 19,38 BAD (HHHFHH) -Size 39: 20,39 BAD (HHHFHH) -Size 40: 20,40 BAD (HHHFHH) -Size 41: 21,41 BAD (HHHFHH) -Size 42: 21,42 BAD (HHHFHH) -Size 43: 22,43 BAD (HHHFHH) -Size 44: 22,44 BAD (HHHFHH) -Size 45: 23,45 BAD (HHHFHH) -Size 46: 23,46 BAD (HHHFHH) -Size 47: 24,47 BAD (HHHFHH) -Size 48: 24,48 BAD (HHHFHH) -Size 49: 25,49 BAD (HHHFHH) -Size 50: 25,50 BAD (HHHFHH) -Size 51: 26,51 BAD (HHHFHH) -Size 52: 26,52 BAD (HHHFHH) -Size 53: 27,53 BAD (HHHFHH) -Size 54: 27,54 BAD (HHHFHH) -Size 55: 28,55 BAD (HHHFHH) -Size 56: 28,56 BAD (HHHFHH) -Size 57: 29,57 BAD (HHHFHH) -Size 58: 29,58 BAD (HHHFHH) -Size 59: 30,59 BAD (HHHFHH) -Size 60: 30,60 BAD (HHHFHH) -Size 61: 31,61 BAD (HHHFHH) -Size 62: 31,62 BAD (HHHFHH) -Size 63: 32,63 BAD (HHHFHH) -Size 64: 32,64 BAD (HHHFHH) -Size 65: 33,65 BAD (HHHFHH) -Size 66: 33,66 BAD (HHHFHH) -Size 67: 34,67 BAD (HHHFHH) -Size 68: 34,68 BAD (HHHFHH) -Size 69: 35,69 BAD (HHHFHH) -Size 70: 35,70 BAD (HHHFHH) -Size 71: 36,71 BAD (HHHFHH) -Size 72: 36,72 BAD (HHHFHH) -Size 73: 37,73 BAD (HHHFHH) -Size 74: 37,74 BAD (HHHFHH) -Size 75: 38,75 BAD (HHHFHH) -Size 76: 38,76 BAD (HHHFHH) -Size 77: 39,77 BAD (HHHFHH) -Size 78: 39,78 BAD (HHHFHH) -Size 79: 40,79 BAD (HHHFHH) -Size 80: 40,80 BAD (HHHFHH) -Size 81: 41,81 BAD (HHHFHH) -Size 82: 41,82 BAD (HHHFHH) -Size 83: 42,83 BAD (HHHFHH) -Size 84: 42,84 BAD (HHHFHH) -Size 85: 43,85 BAD (HHHFHH) -Size 86: 43,86 BAD (HHHFHH) -Size 87: 44,87 BAD (HHHFHH) -Size 88: 44,88 BAD (HHHFHH) -Size 89: 45,89 BAD (HHHFHH) -Size 90: 45,90 BAD (HHHFHH) -Size 91: 46,91 BAD (HHHFHH) -Size 92: 46,92 BAD (HHHFHH) -Size 93: 47,93 BAD (HHHFHH) -Size 94: 47,94 BAD (HHHFHH) -Size 95: 48,95 BAD (HHHFHH) -Size 96: 48,97 BAD (HHHFHH) -Size 97: 49,97 BAD (HHHFHH) -Size 98: 49,98 BAD (HHHFHH) -Size 99: 50,99 BAD (HHHFHH) -Size 100: 50,100 BAD (HHHFHH) - -Windows 7 ---------- - -Size 1: 1,2 OK (HHHFFF) -Size 2: 1,2 OK (HHHFFF) -Size 3: 2,3 BAD (FFFFHH) -Size 4: 2,4 OK (HHHFFF) -Size 5: 3,5 OK (HHHFFF) -Size 6: 3,6 OK (HHHFFF) -Size 7: 4,7 OK (HHHFFF) -Size 8: 4,8 OK (HHHFFF) -Size 9: 5,9 OK (HHHFFF) -Size 10: 5,10 OK (HHHFFF) -Size 11: 6,11 OK (HHHFFF) -Size 12: 6,12 OK (HHHFFF) -Size 13: 7,13 OK (HHHFFF) -Size 14: 7,14 BAD (FFFFFF) -Size 15: 8,15 OK (HHHFFF) -Size 16: 8,16 BAD (FFFFFF) -Size 17: 9,17 OK (HHHFFF) -Size 18: 9,18 BAD (FFFFFF) -Size 19: 10,19 OK (HHHFFF) -Size 20: 10,20 BAD (FFFFFF) -Size 21: 11,21 OK (HHHFFF) -Size 22: 11,22 BAD (FFFFFF) -Size 23: 12,23 BAD (FFFFFF) -Size 24: 12,24 BAD (FFFFFF) -Size 25: 13,25 BAD (FFFFFF) -Size 26: 13,26 BAD (FFFFFF) -Size 27: 14,27 BAD (FFFFFF) -Size 28: 14,28 BAD (FFFFFF) -Size 29: 15,29 BAD (FFFFFF) -Size 30: 15,30 BAD (FFFFFF) -Size 31: 16,31 BAD (FFFFFF) -Size 32: 16,33 BAD (FFFFFF) -Size 33: 17,33 BAD (FFFFFF) -Size 34: 17,34 BAD (FFFFFF) -Size 35: 18,35 BAD (FFFFFF) -Size 36: 18,36 BAD (FFFFFF) -Size 37: 19,37 BAD (FFFFFF) -Size 38: 19,38 BAD (FFFFFF) -Size 39: 20,39 BAD (FFFFFF) -Size 40: 20,40 BAD (FFFFFF) -Size 41: 21,41 BAD (FFFFFF) -Size 42: 21,42 BAD (FFFFFF) -Size 43: 22,43 BAD (FFFFFF) -Size 44: 22,44 BAD (FFFFFF) -Size 45: 23,45 BAD (FFFFFF) -Size 46: 23,46 BAD (FFFFFF) -Size 47: 24,47 BAD (FFFFFF) -Size 48: 24,48 BAD (FFFFFF) -Size 49: 25,49 BAD (FFFFFF) -Size 50: 25,50 BAD (FFFFFF) -Size 51: 26,51 BAD (FFFFFF) -Size 52: 26,52 BAD (FFFFFF) -Size 53: 27,53 BAD (FFFFFF) -Size 54: 27,54 BAD (FFFFFF) -Size 55: 28,55 BAD (FFFFFF) -Size 56: 28,56 BAD (FFFFFF) -Size 57: 29,57 BAD (FFFFFF) -Size 58: 29,58 BAD (FFFFFF) -Size 59: 30,59 BAD (FFFFFF) -Size 60: 30,60 BAD (FFFFFF) -Size 61: 31,61 BAD (FFFFFF) -Size 62: 31,62 BAD (FFFFFF) -Size 63: 32,63 BAD (FFFFFF) -Size 64: 32,64 BAD (FFFFFF) -Size 65: 33,65 BAD (FFFFFF) -Size 66: 33,66 BAD (FFFFFF) -Size 67: 34,67 BAD (FFFFFF) -Size 68: 34,68 BAD (FFFFFF) -Size 69: 35,69 BAD (FFFFFF) -Size 70: 35,70 BAD (FFFFFF) -Size 71: 36,71 BAD (FFFFFF) -Size 72: 36,72 BAD (FFFFFF) -Size 73: 37,73 BAD (FFFFFF) -Size 74: 37,74 BAD (FFFFFF) -Size 75: 38,75 BAD (FFFFFF) -Size 76: 38,76 BAD (FFFFFF) -Size 77: 39,77 BAD (FFFFFF) -Size 78: 39,78 BAD (FFFFFF) -Size 79: 40,79 BAD (FFFFFF) -Size 80: 40,80 BAD (FFFFFF) -Size 81: 41,81 BAD (FFFFFF) -Size 82: 41,82 BAD (FFFFFF) -Size 83: 42,83 BAD (FFFFFF) -Size 84: 42,84 BAD (FFFFFF) -Size 85: 43,85 BAD (FFFFFF) -Size 86: 43,86 BAD (FFFFFF) -Size 87: 44,87 BAD (FFFFFF) -Size 88: 44,88 BAD (FFFFFF) -Size 89: 45,89 BAD (FFFFFF) -Size 90: 45,90 BAD (FFFFFF) -Size 91: 46,91 BAD (FFFFFF) -Size 92: 46,92 BAD (FFFFFF) -Size 93: 47,93 BAD (FFFFFF) -Size 94: 47,94 BAD (FFFFFF) -Size 95: 48,95 BAD (FFFFFF) -Size 96: 48,97 BAD (FFFFFF) -Size 97: 49,97 BAD (FFFFFF) -Size 98: 49,98 BAD (FFFFFF) -Size 99: 50,99 BAD (FFFFFF) -Size 100: 50,100 BAD (FFFFFF) - -Windows 8 ---------- - -Size 1: 1,2 BAD (FFFFHH) -Size 2: 1,2 BAD (FFFFHH) -Size 3: 2,3 BAD (FFFFFF) -Size 4: 2,4 BAD (FFFFHH) -Size 5: 3,5 BAD (FFFFFF) -Size 6: 3,6 BAD (FFFFHH) -Size 7: 4,7 BAD (FFFFFF) -Size 8: 4,8 BAD (FFFFHH) -Size 9: 5,9 BAD (FFFFFF) -Size 10: 5,10 BAD (FFFFHH) -Size 11: 6,11 BAD (FFFFFF) -Size 12: 6,12 BAD (FFFFHH) -Size 13: 7,13 BAD (FFFFFF) -Size 14: 7,14 BAD (FFFFHH) -Size 15: 8,15 BAD (FFFFFF) -Size 16: 8,16 BAD (FFFFHH) -Size 17: 9,17 BAD (FFFFFF) -Size 18: 9,18 BAD (FFFFHH) -Size 19: 10,19 BAD (FFFFFF) -Size 20: 10,20 BAD (FFFFFF) -Size 21: 11,21 BAD (FFFFFF) -Size 22: 11,22 BAD (FFFFFF) -Size 23: 12,23 BAD (FFFFFF) -Size 24: 12,24 BAD (FFFFFF) -Size 25: 13,25 BAD (FFFFFF) -Size 26: 13,26 BAD (FFFFFF) -Size 27: 14,27 BAD (FFFFFF) -Size 28: 14,28 BAD (FFFFFF) -Size 29: 15,29 BAD (FFFFFF) -Size 30: 15,30 BAD (FFFFFF) -Size 31: 16,31 BAD (FFFFFF) -Size 32: 16,33 BAD (FFFFFF) -Size 33: 17,33 BAD (FFFFFF) -Size 34: 17,34 BAD (FFFFFF) -Size 35: 18,35 BAD (FFFFFF) -Size 36: 18,36 BAD (FFFFFF) -Size 37: 19,37 BAD (FFFFFF) -Size 38: 19,38 BAD (FFFFFF) -Size 39: 20,39 BAD (FFFFFF) -Size 40: 20,40 BAD (FFFFFF) -Size 41: 21,41 BAD (FFFFFF) -Size 42: 21,42 BAD (FFFFFF) -Size 43: 22,43 BAD (FFFFFF) -Size 44: 22,44 BAD (FFFFFF) -Size 45: 23,45 BAD (FFFFFF) -Size 46: 23,46 BAD (FFFFFF) -Size 47: 24,47 BAD (FFFFFF) -Size 48: 24,48 BAD (FFFFFF) -Size 49: 25,49 BAD (FFFFFF) -Size 50: 25,50 BAD (FFFFFF) -Size 51: 26,51 BAD (FFFFFF) -Size 52: 26,52 BAD (FFFFFF) -Size 53: 27,53 BAD (FFFFFF) -Size 54: 27,54 BAD (FFFFFF) -Size 55: 28,55 BAD (FFFFFF) -Size 56: 28,56 BAD (FFFFFF) -Size 57: 29,57 BAD (FFFFFF) -Size 58: 29,58 BAD (FFFFFF) -Size 59: 30,59 BAD (FFFFFF) -Size 60: 30,60 BAD (FFFFFF) -Size 61: 31,61 BAD (FFFFFF) -Size 62: 31,62 BAD (FFFFFF) -Size 63: 32,63 BAD (FFFFFF) -Size 64: 32,64 BAD (FFFFFF) -Size 65: 33,65 BAD (FFFFFF) -Size 66: 33,66 BAD (FFFFFF) -Size 67: 34,67 BAD (FFFFFF) -Size 68: 34,68 BAD (FFFFFF) -Size 69: 35,69 BAD (FFFFFF) -Size 70: 35,70 BAD (FFFFFF) -Size 71: 36,71 BAD (FFFFFF) -Size 72: 36,72 BAD (FFFFFF) -Size 73: 37,73 BAD (FFFFFF) -Size 74: 37,74 BAD (FFFFFF) -Size 75: 38,75 BAD (FFFFFF) -Size 76: 38,76 BAD (FFFFFF) -Size 77: 39,77 BAD (FFFFFF) -Size 78: 39,78 BAD (FFFFFF) -Size 79: 40,79 BAD (FFFFFF) -Size 80: 40,80 BAD (FFFFFF) -Size 81: 41,81 BAD (FFFFFF) -Size 82: 41,82 BAD (FFFFFF) -Size 83: 42,83 BAD (FFFFFF) -Size 84: 42,84 BAD (FFFFFF) -Size 85: 43,85 BAD (FFFFFF) -Size 86: 43,86 BAD (FFFFFF) -Size 87: 44,87 BAD (FFFFFF) -Size 88: 44,88 BAD (FFFFFF) -Size 89: 45,89 BAD (FFFFFF) -Size 90: 45,90 BAD (FFFFFF) -Size 91: 46,91 BAD (FFFFFF) -Size 92: 46,92 BAD (FFFFFF) -Size 93: 47,93 BAD (FFFFFF) -Size 94: 47,94 BAD (FFFFFF) -Size 95: 48,95 BAD (FFFFFF) -Size 96: 48,97 BAD (FFFFFF) -Size 97: 49,97 BAD (FFFFFF) -Size 98: 49,98 BAD (FFFFFF) -Size 99: 50,99 BAD (FFFFFF) -Size 100: 50,100 BAD (FFFFFF) - -Windows 8.1 ------------ - -Size 1: 1,2 BAD (FFFFHH) -Size 2: 1,2 BAD (FFFFHH) -Size 3: 2,3 BAD (FFFFFF) -Size 4: 2,4 BAD (FFFFHH) -Size 5: 3,5 BAD (FFFFFF) -Size 6: 3,6 BAD (FFFFHH) -Size 7: 4,7 BAD (FFFFFF) -Size 8: 4,8 BAD (FFFFHH) -Size 9: 5,9 BAD (FFFFFF) -Size 10: 5,10 BAD (FFFFHH) -Size 11: 6,11 BAD (FFFFFF) -Size 12: 6,12 BAD (FFFFHH) -Size 13: 7,13 BAD (FFFFFF) -Size 14: 7,14 BAD (FFFFHH) -Size 15: 8,15 BAD (FFFFFF) -Size 16: 8,16 BAD (FFFFHH) -Size 17: 9,17 BAD (FFFFFF) -Size 18: 9,18 BAD (FFFFHH) -Size 19: 10,19 BAD (FFFFFF) -Size 20: 10,20 BAD (FFFFFF) -Size 21: 11,21 BAD (FFFFFF) -Size 22: 11,22 BAD (FFFFFF) -Size 23: 12,23 BAD (FFFFFF) -Size 24: 12,24 BAD (FFFFFF) -Size 25: 13,25 BAD (FFFFFF) -Size 26: 13,26 BAD (FFFFFF) -Size 27: 14,27 BAD (FFFFFF) -Size 28: 14,28 BAD (FFFFFF) -Size 29: 15,29 BAD (FFFFFF) -Size 30: 15,30 BAD (FFFFFF) -Size 31: 16,31 BAD (FFFFFF) -Size 32: 16,33 BAD (FFFFFF) -Size 33: 17,33 BAD (FFFFFF) -Size 34: 17,34 BAD (FFFFFF) -Size 35: 18,35 BAD (FFFFFF) -Size 36: 18,36 BAD (FFFFFF) -Size 37: 19,37 BAD (FFFFFF) -Size 38: 19,38 BAD (FFFFFF) -Size 39: 20,39 BAD (FFFFFF) -Size 40: 20,40 BAD (FFFFFF) -Size 41: 21,41 BAD (FFFFFF) -Size 42: 21,42 BAD (FFFFFF) -Size 43: 22,43 BAD (FFFFFF) -Size 44: 22,44 BAD (FFFFFF) -Size 45: 23,45 BAD (FFFFFF) -Size 46: 23,46 BAD (FFFFFF) -Size 47: 24,47 BAD (FFFFFF) -Size 48: 24,48 BAD (FFFFFF) -Size 49: 25,49 BAD (FFFFFF) -Size 50: 25,50 BAD (FFFFFF) -Size 51: 26,51 BAD (FFFFFF) -Size 52: 26,52 BAD (FFFFFF) -Size 53: 27,53 BAD (FFFFFF) -Size 54: 27,54 BAD (FFFFFF) -Size 55: 28,55 BAD (FFFFFF) -Size 56: 28,56 BAD (FFFFFF) -Size 57: 29,57 BAD (FFFFFF) -Size 58: 29,58 BAD (FFFFFF) -Size 59: 30,59 BAD (FFFFFF) -Size 60: 30,60 BAD (FFFFFF) -Size 61: 31,61 BAD (FFFFFF) -Size 62: 31,62 BAD (FFFFFF) -Size 63: 32,63 BAD (FFFFFF) -Size 64: 32,64 BAD (FFFFFF) -Size 65: 33,65 BAD (FFFFFF) -Size 66: 33,66 BAD (FFFFFF) -Size 67: 34,67 BAD (FFFFFF) -Size 68: 34,68 BAD (FFFFFF) -Size 69: 35,69 BAD (FFFFFF) -Size 70: 35,70 BAD (FFFFFF) -Size 71: 36,71 BAD (FFFFFF) -Size 72: 36,72 BAD (FFFFFF) -Size 73: 37,73 BAD (FFFFFF) -Size 74: 37,74 BAD (FFFFFF) -Size 75: 38,75 BAD (FFFFFF) -Size 76: 38,76 BAD (FFFFFF) -Size 77: 39,77 BAD (FFFFFF) -Size 78: 39,78 BAD (FFFFFF) -Size 79: 40,79 BAD (FFFFFF) -Size 80: 40,80 BAD (FFFFFF) -Size 81: 41,81 BAD (FFFFFF) -Size 82: 41,82 BAD (FFFFFF) -Size 83: 42,83 BAD (FFFFFF) -Size 84: 42,84 BAD (FFFFFF) -Size 85: 43,85 BAD (FFFFFF) -Size 86: 43,86 BAD (FFFFFF) -Size 87: 44,87 BAD (FFFFFF) -Size 88: 44,88 BAD (FFFFFF) -Size 89: 45,89 BAD (FFFFFF) -Size 90: 45,90 BAD (FFFFFF) -Size 91: 46,91 BAD (FFFFFF) -Size 92: 46,92 BAD (FFFFFF) -Size 93: 47,93 BAD (FFFFFF) -Size 94: 47,94 BAD (FFFFFF) -Size 95: 48,95 BAD (FFFFFF) -Size 96: 48,97 BAD (FFFFFF) -Size 97: 49,97 BAD (FFFFFF) -Size 98: 49,98 BAD (FFFFFF) -Size 99: 50,99 BAD (FFFFFF) -Size 100: 50,100 BAD (FFFFFF) - -Windows 10 14342 Old Console ----------------------------- - -Size 1: 1,2 BAD (FFFFHH) -Size 2: 1,2 BAD (FFFFHH) -Size 3: 2,3 BAD (FFFFFF) -Size 4: 2,4 BAD (FFFFHH) -Size 5: 3,5 BAD (FFFFFF) -Size 6: 3,6 BAD (FFFFHH) -Size 7: 4,7 BAD (FFFFFF) -Size 8: 4,8 BAD (FFFFHH) -Size 9: 5,9 BAD (FFFFFF) -Size 10: 5,10 BAD (FFFFHH) -Size 11: 6,11 BAD (FFFFFF) -Size 12: 6,12 BAD (FFFFHH) -Size 13: 7,13 BAD (FFFFFF) -Size 14: 7,14 BAD (FFFFHH) -Size 15: 8,15 BAD (FFFFFF) -Size 16: 8,16 BAD (FFFFHH) -Size 17: 9,17 BAD (FFFFFF) -Size 18: 9,18 BAD (FFFFHH) -Size 19: 10,19 BAD (FFFFFF) -Size 20: 10,20 BAD (FFFFFF) -Size 21: 11,21 BAD (FFFFFF) -Size 22: 11,22 BAD (FFFFFF) -Size 23: 12,23 BAD (FFFFFF) -Size 24: 12,24 BAD (FFFFFF) -Size 25: 13,25 BAD (FFFFFF) -Size 26: 13,26 BAD (FFFFFF) -Size 27: 14,27 BAD (FFFFFF) -Size 28: 14,28 BAD (FFFFFF) -Size 29: 15,29 BAD (FFFFFF) -Size 30: 15,30 BAD (FFFFFF) -Size 31: 16,31 BAD (FFFFFF) -Size 32: 16,33 BAD (FFFFFF) -Size 33: 17,33 BAD (FFFFFF) -Size 34: 17,34 BAD (FFFFFF) -Size 35: 18,35 BAD (FFFFFF) -Size 36: 18,36 BAD (FFFFFF) -Size 37: 19,37 BAD (FFFFFF) -Size 38: 19,38 BAD (FFFFFF) -Size 39: 20,39 BAD (FFFFFF) -Size 40: 20,40 BAD (FFFFFF) -Size 41: 21,41 BAD (FFFFFF) -Size 42: 21,42 BAD (FFFFFF) -Size 43: 22,43 BAD (FFFFFF) -Size 44: 22,44 BAD (FFFFFF) -Size 45: 23,45 BAD (FFFFFF) -Size 46: 23,46 BAD (FFFFFF) -Size 47: 24,47 BAD (FFFFFF) -Size 48: 24,48 BAD (FFFFFF) -Size 49: 25,49 BAD (FFFFFF) -Size 50: 25,50 BAD (FFFFFF) -Size 51: 26,51 BAD (FFFFFF) -Size 52: 26,52 BAD (FFFFFF) -Size 53: 27,53 BAD (FFFFFF) -Size 54: 27,54 BAD (FFFFFF) -Size 55: 28,55 BAD (FFFFFF) -Size 56: 28,56 BAD (FFFFFF) -Size 57: 29,57 BAD (FFFFFF) -Size 58: 29,58 BAD (FFFFFF) -Size 59: 30,59 BAD (FFFFFF) -Size 60: 30,60 BAD (FFFFFF) -Size 61: 31,61 BAD (FFFFFF) -Size 62: 31,62 BAD (FFFFFF) -Size 63: 32,63 BAD (FFFFFF) -Size 64: 32,64 BAD (FFFFFF) -Size 65: 33,65 BAD (FFFFFF) -Size 66: 33,66 BAD (FFFFFF) -Size 67: 34,67 BAD (FFFFFF) -Size 68: 34,68 BAD (FFFFFF) -Size 69: 35,69 BAD (FFFFFF) -Size 70: 35,70 BAD (FFFFFF) -Size 71: 36,71 BAD (FFFFFF) -Size 72: 36,72 BAD (FFFFFF) -Size 73: 37,73 BAD (FFFFFF) -Size 74: 37,74 BAD (FFFFFF) -Size 75: 38,75 BAD (FFFFFF) -Size 76: 38,76 BAD (FFFFFF) -Size 77: 39,77 BAD (FFFFFF) -Size 78: 39,78 BAD (FFFFFF) -Size 79: 40,79 BAD (FFFFFF) -Size 80: 40,80 BAD (FFFFFF) -Size 81: 41,81 BAD (FFFFFF) -Size 82: 41,82 BAD (FFFFFF) -Size 83: 42,83 BAD (FFFFFF) -Size 84: 42,84 BAD (FFFFFF) -Size 85: 43,85 BAD (FFFFFF) -Size 86: 43,86 BAD (FFFFFF) -Size 87: 44,87 BAD (FFFFFF) -Size 88: 44,88 BAD (FFFFFF) -Size 89: 45,89 BAD (FFFFFF) -Size 90: 45,90 BAD (FFFFFF) -Size 91: 46,91 BAD (FFFFFF) -Size 92: 46,92 BAD (FFFFFF) -Size 93: 47,93 BAD (FFFFFF) -Size 94: 47,94 BAD (FFFFFF) -Size 95: 48,95 BAD (FFFFFF) -Size 96: 48,97 BAD (FFFFFF) -Size 97: 49,97 BAD (FFFFFF) -Size 98: 49,98 BAD (FFFFFF) -Size 99: 50,99 BAD (FFFFFF) -Size 100: 50,100 BAD (FFFFFF) - -Windows 10 14342 New Console ----------------------------- - -Size 1: 1,1 OK (HHHFFF) -Size 2: 1,2 OK (HHHFFF) -Size 3: 2,3 OK (HHHFFF) -Size 4: 2,4 OK (HHHFFF) -Size 5: 3,5 OK (HHHFFF) -Size 6: 3,6 OK (HHHFFF) -Size 7: 4,7 OK (HHHFFF) -Size 8: 4,8 OK (HHHFFF) -Size 9: 5,9 OK (HHHFFF) -Size 10: 5,10 OK (HHHFFF) -Size 11: 6,11 OK (HHHFFF) -Size 12: 6,12 OK (HHHFFF) -Size 13: 7,13 OK (HHHFFF) -Size 14: 7,14 OK (HHHFFF) -Size 15: 8,15 OK (HHHFFF) -Size 16: 8,16 OK (HHHFFF) -Size 17: 9,17 OK (HHHFFF) -Size 18: 9,18 OK (HHHFFF) -Size 19: 10,19 OK (HHHFFF) -Size 20: 10,20 OK (HHHFFF) -Size 21: 11,21 OK (HHHFFF) -Size 22: 11,22 OK (HHHFFF) -Size 23: 12,23 OK (HHHFFF) -Size 24: 12,24 OK (HHHFFF) -Size 25: 13,25 OK (HHHFFF) -Size 26: 13,26 OK (HHHFFF) -Size 27: 14,27 OK (HHHFFF) -Size 28: 14,28 OK (HHHFFF) -Size 29: 15,29 OK (HHHFFF) -Size 30: 15,30 OK (HHHFFF) -Size 31: 16,31 OK (HHHFFF) -Size 32: 16,32 OK (HHHFFF) -Size 33: 17,33 OK (HHHFFF) -Size 34: 17,34 OK (HHHFFF) -Size 35: 18,35 OK (HHHFFF) -Size 36: 18,36 OK (HHHFFF) -Size 37: 19,37 OK (HHHFFF) -Size 38: 19,38 OK (HHHFFF) -Size 39: 20,39 OK (HHHFFF) -Size 40: 20,40 OK (HHHFFF) -Size 41: 21,41 OK (HHHFFF) -Size 42: 21,42 OK (HHHFFF) -Size 43: 22,43 OK (HHHFFF) -Size 44: 22,44 OK (HHHFFF) -Size 45: 23,45 OK (HHHFFF) -Size 46: 23,46 OK (HHHFFF) -Size 47: 24,47 OK (HHHFFF) -Size 48: 24,48 OK (HHHFFF) -Size 49: 25,49 OK (HHHFFF) -Size 50: 25,50 OK (HHHFFF) -Size 51: 26,51 OK (HHHFFF) -Size 52: 26,52 OK (HHHFFF) -Size 53: 27,53 OK (HHHFFF) -Size 54: 27,54 OK (HHHFFF) -Size 55: 28,55 OK (HHHFFF) -Size 56: 28,56 OK (HHHFFF) -Size 57: 29,57 OK (HHHFFF) -Size 58: 29,58 OK (HHHFFF) -Size 59: 30,59 OK (HHHFFF) -Size 60: 30,60 OK (HHHFFF) -Size 61: 31,61 OK (HHHFFF) -Size 62: 31,62 OK (HHHFFF) -Size 63: 32,63 OK (HHHFFF) -Size 64: 32,64 OK (HHHFFF) -Size 65: 33,65 OK (HHHFFF) -Size 66: 33,66 OK (HHHFFF) -Size 67: 34,67 OK (HHHFFF) -Size 68: 34,68 OK (HHHFFF) -Size 69: 35,69 OK (HHHFFF) -Size 70: 35,70 OK (HHHFFF) -Size 71: 36,71 OK (HHHFFF) -Size 72: 36,72 OK (HHHFFF) -Size 73: 37,73 OK (HHHFFF) -Size 74: 37,74 OK (HHHFFF) -Size 75: 38,75 OK (HHHFFF) -Size 76: 38,76 OK (HHHFFF) -Size 77: 39,77 OK (HHHFFF) -Size 78: 39,78 OK (HHHFFF) -Size 79: 40,79 OK (HHHFFF) -Size 80: 40,80 OK (HHHFFF) -Size 81: 41,81 OK (HHHFFF) -Size 82: 41,82 OK (HHHFFF) -Size 83: 42,83 OK (HHHFFF) -Size 84: 42,84 OK (HHHFFF) -Size 85: 43,85 OK (HHHFFF) -Size 86: 43,86 OK (HHHFFF) -Size 87: 44,87 OK (HHHFFF) -Size 88: 44,88 OK (HHHFFF) -Size 89: 45,89 OK (HHHFFF) -Size 90: 45,90 OK (HHHFFF) -Size 91: 46,91 OK (HHHFFF) -Size 92: 46,92 OK (HHHFFF) -Size 93: 47,93 OK (HHHFFF) -Size 94: 47,94 OK (HHHFFF) -Size 95: 48,95 OK (HHHFFF) -Size 96: 48,96 OK (HHHFFF) -Size 97: 49,97 OK (HHHFFF) -Size 98: 49,98 OK (HHHFFF) -Size 99: 50,99 OK (HHHFFF) -Size 100: 50,100 OK (HHHFFF) diff --git a/node_modules/node-pty/deps/winpty/misc/Font-Report-June2016/CP936.txt b/node_modules/node-pty/deps/winpty/misc/Font-Report-June2016/CP936.txt deleted file mode 100644 index 43210da..0000000 --- a/node_modules/node-pty/deps/winpty/misc/Font-Report-June2016/CP936.txt +++ /dev/null @@ -1,630 +0,0 @@ -========================================================== -Code Page 936, Chinese Simplified (China/PRC), SimSun font -========================================================== - -Options: -face-simsun -family 0x36 -Chars: A2 A3 2014 3044 30FC 4000 - -Vista ------ - -Size 1: 1,2 GOOD (HHFFFF) -Size 2: 1,2 GOOD (HHFFFF) -Size 3: 2,3 BAD (FFHFHH) -Size 4: 2,5 GOOD (HHFFFF) -Size 5: 3,6 BAD (HHHFHH) -Size 6: 3,7 GOOD (HHFFFF) -Size 7: 4,8 BAD (HHHFHH) -Size 8: 4,9 GOOD (HHFFFF) -Size 9: 5,10 BAD (HHHFHH) -Size 10: 5,11 GOOD (HHFFFF) -Size 11: 6,13 BAD (HHHFHH) -Size 12: 6,14 GOOD (HHFFFF) -Size 13: 7,15 BAD (HHHFHH) -Size 14: 7,16 GOOD (HHFFFF) -Size 15: 8,17 BAD (HHHFHH) -Size 16: 8,18 GOOD (HHFFFF) -Size 17: 9,19 BAD (HHHFHH) -Size 18: 9,21 GOOD (HHFFFF) -Size 19: 10,22 BAD (HHHFHH) -Size 20: 10,23 GOOD (HHFFFF) -Size 21: 11,24 BAD (HHHFHH) -Size 22: 11,25 GOOD (HHFFFF) -Size 23: 12,26 BAD (HHHFHH) -Size 24: 12,27 GOOD (HHFFFF) -Size 25: 13,29 BAD (HHHFHH) -Size 26: 13,30 GOOD (HHFFFF) -Size 27: 14,31 BAD (HHHFHH) -Size 28: 14,32 GOOD (HHFFFF) -Size 29: 15,33 BAD (HHHFHH) -Size 30: 15,34 GOOD (HHFFFF) -Size 31: 16,35 BAD (HHHFHH) -Size 32: 16,38 GOOD (HHFFFF) -Size 33: 17,38 BAD (HHHFHH) -Size 34: 17,39 GOOD (HHFFFF) -Size 35: 18,40 BAD (HHHFHH) -Size 36: 18,41 GOOD (HHFFFF) -Size 37: 19,42 BAD (HHHFHH) -Size 38: 19,43 GOOD (HHFFFF) -Size 39: 20,44 BAD (HHHFHH) -Size 40: 20,46 GOOD (HHFFFF) -Size 41: 21,47 BAD (HHHFHH) -Size 42: 21,48 GOOD (HHFFFF) -Size 43: 22,49 BAD (HHHFHH) -Size 44: 22,50 GOOD (HHFFFF) -Size 45: 23,51 BAD (HHHFHH) -Size 46: 23,52 GOOD (HHFFFF) -Size 47: 24,54 BAD (HHHFHH) -Size 48: 24,55 GOOD (HHFFFF) -Size 49: 25,56 BAD (HHHFHH) -Size 50: 25,57 GOOD (HHFFFF) -Size 51: 26,58 BAD (HHHFHH) -Size 52: 26,59 GOOD (HHFFFF) -Size 53: 27,60 BAD (HHHFHH) -Size 54: 27,62 GOOD (HHFFFF) -Size 55: 28,63 BAD (HHHFHH) -Size 56: 28,64 GOOD (HHFFFF) -Size 57: 29,65 BAD (HHHFHH) -Size 58: 29,66 GOOD (HHFFFF) -Size 59: 30,67 BAD (HHHFHH) -Size 60: 30,68 GOOD (HHFFFF) -Size 61: 31,70 BAD (HHHFHH) -Size 62: 31,71 GOOD (HHFFFF) -Size 63: 32,72 BAD (HHHFHH) -Size 64: 32,73 GOOD (HHFFFF) -Size 65: 33,74 GOOD (HHFFFF) -Size 66: 33,75 GOOD (HHFFFF) -Size 67: 34,76 GOOD (HHFFFF) -Size 68: 34,78 GOOD (HHFFFF) -Size 69: 35,79 GOOD (HHFFFF) -Size 70: 35,80 GOOD (HHFFFF) -Size 71: 36,81 GOOD (HHFFFF) -Size 72: 36,82 GOOD (HHFFFF) -Size 73: 37,83 GOOD (HHFFFF) -Size 74: 37,84 GOOD (HHFFFF) -Size 75: 38,86 GOOD (HHFFFF) -Size 76: 38,87 GOOD (HHFFFF) -Size 77: 39,88 GOOD (HHFFFF) -Size 78: 39,89 GOOD (HHFFFF) -Size 79: 40,90 GOOD (HHFFFF) -Size 80: 40,91 GOOD (HHFFFF) -Size 81: 41,92 GOOD (HHFFFF) -Size 82: 41,94 GOOD (HHFFFF) -Size 83: 42,95 GOOD (HHFFFF) -Size 84: 42,96 GOOD (HHFFFF) -Size 85: 43,97 GOOD (HHFFFF) -Size 86: 43,98 GOOD (HHFFFF) -Size 87: 44,99 GOOD (HHFFFF) -Size 88: 44,100 GOOD (HHFFFF) -Size 89: 45,102 GOOD (HHFFFF) -Size 90: 45,103 GOOD (HHFFFF) -Size 91: 46,104 GOOD (HHFFFF) -Size 92: 46,105 GOOD (HHFFFF) -Size 93: 47,106 GOOD (HHFFFF) -Size 94: 47,107 GOOD (HHFFFF) -Size 95: 48,108 GOOD (HHFFFF) -Size 96: 48,111 GOOD (HHFFFF) -Size 97: 49,111 GOOD (HHFFFF) -Size 98: 49,112 GOOD (HHFFFF) -Size 99: 50,113 GOOD (HHFFFF) -Size 100: 50,114 GOOD (HHFFFF) - -Windows 7 ---------- - -Size 1: 1,2 GOOD (HHFFFF) -Size 2: 1,2 GOOD (HHFFFF) -Size 3: 2,3 BAD (FFHFHH) -Size 4: 2,5 GOOD (HHFFFF) -Size 5: 3,6 BAD (FFHFHH) -Size 6: 3,7 GOOD (HHFFFF) -Size 7: 4,8 BAD (FFHFHH) -Size 8: 4,9 GOOD (HHFFFF) -Size 9: 5,10 BAD (FFHFHH) -Size 10: 5,11 GOOD (HHFFFF) -Size 11: 6,13 BAD (FFHFHH) -Size 12: 6,14 GOOD (HHFFFF) -Size 13: 7,15 BAD (FFHFHH) -Size 14: 7,16 GOOD (HHFFFF) -Size 15: 8,17 BAD (FFHFHH) -Size 16: 8,18 GOOD (HHFFFF) -Size 17: 9,19 BAD (FFHFHH) -Size 18: 9,21 GOOD (HHFFFF) -Size 19: 10,22 BAD (FFHFHH) -Size 20: 10,23 GOOD (HHFFFF) -Size 21: 11,24 BAD (FFHFHH) -Size 22: 11,25 GOOD (HHFFFF) -Size 23: 12,26 BAD (FFHFHH) -Size 24: 12,27 GOOD (HHFFFF) -Size 25: 13,29 BAD (FFHFHH) -Size 26: 13,30 GOOD (HHFFFF) -Size 27: 14,31 BAD (FFHFHH) -Size 28: 14,32 GOOD (HHFFFF) -Size 29: 15,33 BAD (FFHFHH) -Size 30: 15,34 GOOD (HHFFFF) -Size 31: 16,35 BAD (FFHFHH) -Size 32: 16,38 GOOD (HHFFFF) -Size 33: 17,38 BAD (FFHFHH) -Size 34: 17,39 GOOD (HHFFFF) -Size 35: 18,40 BAD (FFHFHH) -Size 36: 18,41 GOOD (HHFFFF) -Size 37: 19,42 BAD (FFHFHH) -Size 38: 19,43 GOOD (HHFFFF) -Size 39: 20,44 BAD (FFHFHH) -Size 40: 20,46 GOOD (HHFFFF) -Size 41: 21,47 BAD (FFHFHH) -Size 42: 21,48 GOOD (HHFFFF) -Size 43: 22,49 BAD (FFHFHH) -Size 44: 22,50 GOOD (HHFFFF) -Size 45: 23,51 BAD (FFHFHH) -Size 46: 23,52 GOOD (HHFFFF) -Size 47: 24,54 BAD (FFHFHH) -Size 48: 24,55 GOOD (HHFFFF) -Size 49: 25,56 BAD (FFHFHH) -Size 50: 25,57 GOOD (HHFFFF) -Size 51: 26,58 BAD (FFHFHH) -Size 52: 26,59 GOOD (HHFFFF) -Size 53: 27,60 BAD (FFHFHH) -Size 54: 27,62 GOOD (HHFFFF) -Size 55: 28,63 BAD (FFHFHH) -Size 56: 28,64 GOOD (HHFFFF) -Size 57: 29,65 BAD (FFHFHH) -Size 58: 29,66 GOOD (HHFFFF) -Size 59: 30,67 BAD (FFHFHH) -Size 60: 30,68 GOOD (HHFFFF) -Size 61: 31,70 BAD (FFHFHH) -Size 62: 31,71 GOOD (HHFFFF) -Size 63: 32,72 BAD (FFHFHH) -Size 64: 32,73 GOOD (HHFFFF) -Size 65: 33,74 GOOD (HHFFFF) -Size 66: 33,75 GOOD (HHFFFF) -Size 67: 34,76 GOOD (HHFFFF) -Size 68: 34,78 GOOD (HHFFFF) -Size 69: 35,79 GOOD (HHFFFF) -Size 70: 35,80 GOOD (HHFFFF) -Size 71: 36,81 GOOD (HHFFFF) -Size 72: 36,82 GOOD (HHFFFF) -Size 73: 37,83 GOOD (HHFFFF) -Size 74: 37,84 GOOD (HHFFFF) -Size 75: 38,86 GOOD (HHFFFF) -Size 76: 38,87 GOOD (HHFFFF) -Size 77: 39,88 GOOD (HHFFFF) -Size 78: 39,89 GOOD (HHFFFF) -Size 79: 40,90 GOOD (HHFFFF) -Size 80: 40,91 GOOD (HHFFFF) -Size 81: 41,92 GOOD (HHFFFF) -Size 82: 41,94 GOOD (HHFFFF) -Size 83: 42,95 GOOD (HHFFFF) -Size 84: 42,96 GOOD (HHFFFF) -Size 85: 43,97 GOOD (HHFFFF) -Size 86: 43,98 GOOD (HHFFFF) -Size 87: 44,99 GOOD (HHFFFF) -Size 88: 44,100 GOOD (HHFFFF) -Size 89: 45,102 GOOD (HHFFFF) -Size 90: 45,103 GOOD (HHFFFF) -Size 91: 46,104 GOOD (HHFFFF) -Size 92: 46,105 GOOD (HHFFFF) -Size 93: 47,106 GOOD (HHFFFF) -Size 94: 47,107 GOOD (HHFFFF) -Size 95: 48,108 GOOD (HHFFFF) -Size 96: 48,111 GOOD (HHFFFF) -Size 97: 49,111 GOOD (HHFFFF) -Size 98: 49,112 GOOD (HHFFFF) -Size 99: 50,113 GOOD (HHFFFF) -Size 100: 50,114 GOOD (HHFFFF) - -Windows 8 ---------- - -Size 1: 1,2 GOOD (HHFFFF) -Size 2: 1,2 GOOD (HHFFFF) -Size 3: 2,3 BAD (FFHFHH) -Size 4: 2,5 GOOD (HHFFFF) -Size 5: 3,6 BAD (FFHFHH) -Size 6: 3,7 GOOD (HHFFFF) -Size 7: 4,8 BAD (FFHFHH) -Size 8: 4,9 GOOD (HHFFFF) -Size 9: 5,10 BAD (FFHFHH) -Size 10: 5,11 GOOD (HHFFFF) -Size 11: 6,13 BAD (FFHFHH) -Size 12: 6,14 GOOD (HHFFFF) -Size 13: 7,15 BAD (FFHFHH) -Size 14: 7,16 GOOD (HHFFFF) -Size 15: 8,17 BAD (FFHFHH) -Size 16: 8,18 GOOD (HHFFFF) -Size 17: 9,19 BAD (FFHFHH) -Size 18: 9,21 GOOD (HHFFFF) -Size 19: 10,22 BAD (FFHFHH) -Size 20: 10,23 GOOD (HHFFFF) -Size 21: 11,24 BAD (FFHFHH) -Size 22: 11,25 GOOD (HHFFFF) -Size 23: 12,26 BAD (FFHFHH) -Size 24: 12,27 GOOD (HHFFFF) -Size 25: 13,29 BAD (FFHFHH) -Size 26: 13,30 GOOD (HHFFFF) -Size 27: 14,31 BAD (FFHFHH) -Size 28: 14,32 GOOD (HHFFFF) -Size 29: 15,33 BAD (FFHFHH) -Size 30: 15,34 GOOD (HHFFFF) -Size 31: 16,35 BAD (FFHFHH) -Size 32: 16,38 GOOD (HHFFFF) -Size 33: 17,38 BAD (FFHFHH) -Size 34: 17,39 GOOD (HHFFFF) -Size 35: 18,40 BAD (FFHFHH) -Size 36: 18,41 GOOD (HHFFFF) -Size 37: 19,42 BAD (FFHFHH) -Size 38: 19,43 GOOD (HHFFFF) -Size 39: 20,44 BAD (FFHFHH) -Size 40: 20,46 GOOD (HHFFFF) -Size 41: 21,47 BAD (FFHFHH) -Size 42: 21,48 GOOD (HHFFFF) -Size 43: 22,49 BAD (FFHFHH) -Size 44: 22,50 GOOD (HHFFFF) -Size 45: 23,51 BAD (FFHFHH) -Size 46: 23,52 GOOD (HHFFFF) -Size 47: 24,54 BAD (FFHFHH) -Size 48: 24,55 GOOD (HHFFFF) -Size 49: 25,56 BAD (FFHFHH) -Size 50: 25,57 GOOD (HHFFFF) -Size 51: 26,58 BAD (FFHFHH) -Size 52: 26,59 GOOD (HHFFFF) -Size 53: 27,60 BAD (FFHFHH) -Size 54: 27,62 GOOD (HHFFFF) -Size 55: 28,63 BAD (FFHFHH) -Size 56: 28,64 GOOD (HHFFFF) -Size 57: 29,65 BAD (FFHFHH) -Size 58: 29,66 GOOD (HHFFFF) -Size 59: 30,67 BAD (FFHFHH) -Size 60: 30,68 GOOD (HHFFFF) -Size 61: 31,70 BAD (FFHFHH) -Size 62: 31,71 GOOD (HHFFFF) -Size 63: 32,72 BAD (FFHFHH) -Size 64: 32,73 GOOD (HHFFFF) -Size 65: 33,74 GOOD (HHFFFF) -Size 66: 33,75 GOOD (HHFFFF) -Size 67: 34,76 GOOD (HHFFFF) -Size 68: 34,78 GOOD (HHFFFF) -Size 69: 35,79 GOOD (HHFFFF) -Size 70: 35,80 GOOD (HHFFFF) -Size 71: 36,81 GOOD (HHFFFF) -Size 72: 36,82 GOOD (HHFFFF) -Size 73: 37,83 GOOD (HHFFFF) -Size 74: 37,84 GOOD (HHFFFF) -Size 75: 38,86 GOOD (HHFFFF) -Size 76: 38,87 GOOD (HHFFFF) -Size 77: 39,88 GOOD (HHFFFF) -Size 78: 39,89 GOOD (HHFFFF) -Size 79: 40,90 GOOD (HHFFFF) -Size 80: 40,91 GOOD (HHFFFF) -Size 81: 41,92 GOOD (HHFFFF) -Size 82: 41,94 GOOD (HHFFFF) -Size 83: 42,95 GOOD (HHFFFF) -Size 84: 42,96 GOOD (HHFFFF) -Size 85: 43,97 GOOD (HHFFFF) -Size 86: 43,98 GOOD (HHFFFF) -Size 87: 44,99 GOOD (HHFFFF) -Size 88: 44,100 GOOD (HHFFFF) -Size 89: 45,102 GOOD (HHFFFF) -Size 90: 45,103 GOOD (HHFFFF) -Size 91: 46,104 GOOD (HHFFFF) -Size 92: 46,105 GOOD (HHFFFF) -Size 93: 47,106 GOOD (HHFFFF) -Size 94: 47,107 GOOD (HHFFFF) -Size 95: 48,108 GOOD (HHFFFF) -Size 96: 48,111 GOOD (HHFFFF) -Size 97: 49,111 GOOD (HHFFFF) -Size 98: 49,112 GOOD (HHFFFF) -Size 99: 50,113 GOOD (HHFFFF) -Size 100: 50,114 GOOD (HHFFFF) - -Windows 8.1 ------------ - -Size 1: 1,2 GOOD (HHFFFF) -Size 2: 1,2 GOOD (HHFFFF) -Size 3: 2,3 BAD (FFHFHH) -Size 4: 2,5 GOOD (HHFFFF) -Size 5: 3,6 BAD (FFHFHH) -Size 6: 3,7 GOOD (HHFFFF) -Size 7: 4,8 BAD (FFHFHH) -Size 8: 4,9 GOOD (HHFFFF) -Size 9: 5,10 BAD (FFHFHH) -Size 10: 5,11 GOOD (HHFFFF) -Size 11: 6,13 BAD (FFHFHH) -Size 12: 6,14 GOOD (HHFFFF) -Size 13: 7,15 BAD (FFHFHH) -Size 14: 7,16 GOOD (HHFFFF) -Size 15: 8,17 BAD (FFHFHH) -Size 16: 8,18 GOOD (HHFFFF) -Size 17: 9,19 BAD (FFHFHH) -Size 18: 9,21 GOOD (HHFFFF) -Size 19: 10,22 BAD (FFHFHH) -Size 20: 10,23 GOOD (HHFFFF) -Size 21: 11,24 BAD (FFHFHH) -Size 22: 11,25 GOOD (HHFFFF) -Size 23: 12,26 BAD (FFHFHH) -Size 24: 12,27 GOOD (HHFFFF) -Size 25: 13,29 BAD (FFHFHH) -Size 26: 13,30 GOOD (HHFFFF) -Size 27: 14,31 BAD (FFHFHH) -Size 28: 14,32 GOOD (HHFFFF) -Size 29: 15,33 BAD (FFHFHH) -Size 30: 15,34 GOOD (HHFFFF) -Size 31: 16,35 BAD (FFHFHH) -Size 32: 16,38 GOOD (HHFFFF) -Size 33: 17,38 BAD (FFHFHH) -Size 34: 17,39 GOOD (HHFFFF) -Size 35: 18,40 BAD (FFHFHH) -Size 36: 18,41 GOOD (HHFFFF) -Size 37: 19,42 BAD (FFHFHH) -Size 38: 19,43 GOOD (HHFFFF) -Size 39: 20,44 BAD (FFHFHH) -Size 40: 20,46 GOOD (HHFFFF) -Size 41: 21,47 BAD (FFHFHH) -Size 42: 21,48 GOOD (HHFFFF) -Size 43: 22,49 BAD (FFHFHH) -Size 44: 22,50 GOOD (HHFFFF) -Size 45: 23,51 BAD (FFHFHH) -Size 46: 23,52 GOOD (HHFFFF) -Size 47: 24,54 BAD (FFHFHH) -Size 48: 24,55 GOOD (HHFFFF) -Size 49: 25,56 BAD (FFHFHH) -Size 50: 25,57 GOOD (HHFFFF) -Size 51: 26,58 BAD (FFHFHH) -Size 52: 26,59 GOOD (HHFFFF) -Size 53: 27,60 BAD (FFHFHH) -Size 54: 27,62 GOOD (HHFFFF) -Size 55: 28,63 BAD (FFHFHH) -Size 56: 28,64 GOOD (HHFFFF) -Size 57: 29,65 BAD (FFHFHH) -Size 58: 29,66 GOOD (HHFFFF) -Size 59: 30,67 BAD (FFHFHH) -Size 60: 30,68 GOOD (HHFFFF) -Size 61: 31,70 BAD (FFHFHH) -Size 62: 31,71 GOOD (HHFFFF) -Size 63: 32,72 BAD (FFHFHH) -Size 64: 32,73 GOOD (HHFFFF) -Size 65: 33,74 GOOD (HHFFFF) -Size 66: 33,75 GOOD (HHFFFF) -Size 67: 34,76 GOOD (HHFFFF) -Size 68: 34,78 GOOD (HHFFFF) -Size 69: 35,79 GOOD (HHFFFF) -Size 70: 35,80 GOOD (HHFFFF) -Size 71: 36,81 GOOD (HHFFFF) -Size 72: 36,82 GOOD (HHFFFF) -Size 73: 37,83 GOOD (HHFFFF) -Size 74: 37,84 GOOD (HHFFFF) -Size 75: 38,86 GOOD (HHFFFF) -Size 76: 38,87 GOOD (HHFFFF) -Size 77: 39,88 GOOD (HHFFFF) -Size 78: 39,89 GOOD (HHFFFF) -Size 79: 40,90 GOOD (HHFFFF) -Size 80: 40,91 GOOD (HHFFFF) -Size 81: 41,92 GOOD (HHFFFF) -Size 82: 41,94 GOOD (HHFFFF) -Size 83: 42,95 GOOD (HHFFFF) -Size 84: 42,96 GOOD (HHFFFF) -Size 85: 43,97 GOOD (HHFFFF) -Size 86: 43,98 GOOD (HHFFFF) -Size 87: 44,99 GOOD (HHFFFF) -Size 88: 44,100 GOOD (HHFFFF) -Size 89: 45,102 GOOD (HHFFFF) -Size 90: 45,103 GOOD (HHFFFF) -Size 91: 46,104 GOOD (HHFFFF) -Size 92: 46,105 GOOD (HHFFFF) -Size 93: 47,106 GOOD (HHFFFF) -Size 94: 47,107 GOOD (HHFFFF) -Size 95: 48,108 GOOD (HHFFFF) -Size 96: 48,111 GOOD (HHFFFF) -Size 97: 49,111 GOOD (HHFFFF) -Size 98: 49,112 GOOD (HHFFFF) -Size 99: 50,113 GOOD (HHFFFF) -Size 100: 50,114 GOOD (HHFFFF) - -Windows 10 14342 Old Console ----------------------------- - -Size 1: 1,2 GOOD (HHFFFF) -Size 2: 1,2 GOOD (HHFFFF) -Size 3: 2,3 BAD (FFHFHH) -Size 4: 2,5 GOOD (HHFFFF) -Size 5: 3,6 BAD (FFHFHH) -Size 6: 3,7 GOOD (HHFFFF) -Size 7: 4,8 BAD (FFHFHH) -Size 8: 4,9 GOOD (HHFFFF) -Size 9: 5,10 BAD (FFHFHH) -Size 10: 5,11 GOOD (HHFFFF) -Size 11: 6,13 BAD (FFHFHH) -Size 12: 6,14 GOOD (HHFFFF) -Size 13: 7,15 BAD (FFHFHH) -Size 14: 7,16 GOOD (HHFFFF) -Size 15: 8,17 BAD (FFHFHH) -Size 16: 8,18 GOOD (HHFFFF) -Size 17: 9,19 BAD (FFHFHH) -Size 18: 9,21 GOOD (HHFFFF) -Size 19: 10,22 BAD (FFHFHH) -Size 20: 10,23 GOOD (HHFFFF) -Size 21: 11,24 BAD (FFHFHH) -Size 22: 11,25 GOOD (HHFFFF) -Size 23: 12,26 BAD (FFHFHH) -Size 24: 12,27 GOOD (HHFFFF) -Size 25: 13,29 BAD (FFHFHH) -Size 26: 13,30 GOOD (HHFFFF) -Size 27: 14,31 BAD (FFHFHH) -Size 28: 14,32 GOOD (HHFFFF) -Size 29: 15,33 BAD (FFHFHH) -Size 30: 15,34 GOOD (HHFFFF) -Size 31: 16,35 BAD (FFHFHH) -Size 32: 16,38 GOOD (HHFFFF) -Size 33: 17,38 BAD (FFHFHH) -Size 34: 17,39 GOOD (HHFFFF) -Size 35: 18,40 BAD (FFHFHH) -Size 36: 18,41 GOOD (HHFFFF) -Size 37: 19,42 BAD (FFHFHH) -Size 38: 19,43 GOOD (HHFFFF) -Size 39: 20,44 BAD (FFHFHH) -Size 40: 20,46 GOOD (HHFFFF) -Size 41: 21,47 BAD (FFHFHH) -Size 42: 21,48 GOOD (HHFFFF) -Size 43: 22,49 BAD (FFHFHH) -Size 44: 22,50 GOOD (HHFFFF) -Size 45: 23,51 BAD (FFHFHH) -Size 46: 23,52 GOOD (HHFFFF) -Size 47: 24,54 BAD (FFHFHH) -Size 48: 24,55 GOOD (HHFFFF) -Size 49: 25,56 BAD (FFHFHH) -Size 50: 25,57 GOOD (HHFFFF) -Size 51: 26,58 BAD (FFHFHH) -Size 52: 26,59 GOOD (HHFFFF) -Size 53: 27,60 BAD (FFHFHH) -Size 54: 27,62 GOOD (HHFFFF) -Size 55: 28,63 BAD (FFHFHH) -Size 56: 28,64 GOOD (HHFFFF) -Size 57: 29,65 BAD (FFHFHH) -Size 58: 29,66 GOOD (HHFFFF) -Size 59: 30,67 BAD (FFHFHH) -Size 60: 30,68 GOOD (HHFFFF) -Size 61: 31,70 BAD (FFHFHH) -Size 62: 31,71 GOOD (HHFFFF) -Size 63: 32,72 BAD (FFHFHH) -Size 64: 32,73 GOOD (HHFFFF) -Size 65: 33,74 GOOD (HHFFFF) -Size 66: 33,75 GOOD (HHFFFF) -Size 67: 34,76 GOOD (HHFFFF) -Size 68: 34,78 GOOD (HHFFFF) -Size 69: 35,79 GOOD (HHFFFF) -Size 70: 35,80 GOOD (HHFFFF) -Size 71: 36,81 GOOD (HHFFFF) -Size 72: 36,82 GOOD (HHFFFF) -Size 73: 37,83 GOOD (HHFFFF) -Size 74: 37,84 GOOD (HHFFFF) -Size 75: 38,86 GOOD (HHFFFF) -Size 76: 38,87 GOOD (HHFFFF) -Size 77: 39,88 GOOD (HHFFFF) -Size 78: 39,89 GOOD (HHFFFF) -Size 79: 40,90 GOOD (HHFFFF) -Size 80: 40,91 GOOD (HHFFFF) -Size 81: 41,92 GOOD (HHFFFF) -Size 82: 41,94 GOOD (HHFFFF) -Size 83: 42,95 GOOD (HHFFFF) -Size 84: 42,96 GOOD (HHFFFF) -Size 85: 43,97 GOOD (HHFFFF) -Size 86: 43,98 GOOD (HHFFFF) -Size 87: 44,99 GOOD (HHFFFF) -Size 88: 44,100 GOOD (HHFFFF) -Size 89: 45,102 GOOD (HHFFFF) -Size 90: 45,103 GOOD (HHFFFF) -Size 91: 46,104 GOOD (HHFFFF) -Size 92: 46,105 GOOD (HHFFFF) -Size 93: 47,106 GOOD (HHFFFF) -Size 94: 47,107 GOOD (HHFFFF) -Size 95: 48,108 GOOD (HHFFFF) -Size 96: 48,111 GOOD (HHFFFF) -Size 97: 49,111 GOOD (HHFFFF) -Size 98: 49,112 GOOD (HHFFFF) -Size 99: 50,113 GOOD (HHFFFF) -Size 100: 50,114 GOOD (HHFFFF) - -Windows 10 14342 New Console ----------------------------- - -Size 1: 1,1 GOOD (HHFFFF) -Size 2: 1,2 GOOD (HHFFFF) -Size 3: 2,3 GOOD (HHFFFF) -Size 4: 2,4 GOOD (HHFFFF) -Size 5: 3,5 GOOD (HHFFFF) -Size 6: 3,6 GOOD (HHFFFF) -Size 7: 4,7 GOOD (HHFFFF) -Size 8: 4,8 GOOD (HHFFFF) -Size 9: 5,9 GOOD (HHFFFF) -Size 10: 5,10 GOOD (HHFFFF) -Size 11: 6,11 GOOD (HHFFFF) -Size 12: 6,12 GOOD (HHFFFF) -Size 13: 7,13 GOOD (HHFFFF) -Size 14: 7,14 GOOD (HHFFFF) -Size 15: 8,15 GOOD (HHFFFF) -Size 16: 8,16 GOOD (HHFFFF) -Size 17: 9,17 GOOD (HHFFFF) -Size 18: 9,18 GOOD (HHFFFF) -Size 19: 10,19 GOOD (HHFFFF) -Size 20: 10,20 GOOD (HHFFFF) -Size 21: 11,21 GOOD (HHFFFF) -Size 22: 11,22 GOOD (HHFFFF) -Size 23: 12,23 GOOD (HHFFFF) -Size 24: 12,24 GOOD (HHFFFF) -Size 25: 13,25 GOOD (HHFFFF) -Size 26: 13,26 GOOD (HHFFFF) -Size 27: 14,27 GOOD (HHFFFF) -Size 28: 14,28 GOOD (HHFFFF) -Size 29: 15,29 GOOD (HHFFFF) -Size 30: 15,30 GOOD (HHFFFF) -Size 31: 16,31 GOOD (HHFFFF) -Size 32: 16,32 GOOD (HHFFFF) -Size 33: 17,33 GOOD (HHFFFF) -Size 34: 17,34 GOOD (HHFFFF) -Size 35: 18,35 GOOD (HHFFFF) -Size 36: 18,36 GOOD (HHFFFF) -Size 37: 19,37 GOOD (HHFFFF) -Size 38: 19,38 GOOD (HHFFFF) -Size 39: 20,39 GOOD (HHFFFF) -Size 40: 20,40 GOOD (HHFFFF) -Size 41: 21,41 GOOD (HHFFFF) -Size 42: 21,42 GOOD (HHFFFF) -Size 43: 22,43 GOOD (HHFFFF) -Size 44: 22,44 GOOD (HHFFFF) -Size 45: 23,45 GOOD (HHFFFF) -Size 46: 23,46 GOOD (HHFFFF) -Size 47: 24,47 GOOD (HHFFFF) -Size 48: 24,48 GOOD (HHFFFF) -Size 49: 25,49 GOOD (HHFFFF) -Size 50: 25,50 GOOD (HHFFFF) -Size 51: 26,51 GOOD (HHFFFF) -Size 52: 26,52 GOOD (HHFFFF) -Size 53: 27,53 GOOD (HHFFFF) -Size 54: 27,54 GOOD (HHFFFF) -Size 55: 28,55 GOOD (HHFFFF) -Size 56: 28,56 GOOD (HHFFFF) -Size 57: 29,57 GOOD (HHFFFF) -Size 58: 29,58 GOOD (HHFFFF) -Size 59: 30,59 GOOD (HHFFFF) -Size 60: 30,60 GOOD (HHFFFF) -Size 61: 31,61 GOOD (HHFFFF) -Size 62: 31,62 GOOD (HHFFFF) -Size 63: 32,63 GOOD (HHFFFF) -Size 64: 32,64 GOOD (HHFFFF) -Size 65: 33,65 GOOD (HHFFFF) -Size 66: 33,66 GOOD (HHFFFF) -Size 67: 34,67 GOOD (HHFFFF) -Size 68: 34,68 GOOD (HHFFFF) -Size 69: 35,69 GOOD (HHFFFF) -Size 70: 35,70 GOOD (HHFFFF) -Size 71: 36,71 GOOD (HHFFFF) -Size 72: 36,72 GOOD (HHFFFF) -Size 73: 37,73 GOOD (HHFFFF) -Size 74: 37,74 GOOD (HHFFFF) -Size 75: 38,75 GOOD (HHFFFF) -Size 76: 38,76 GOOD (HHFFFF) -Size 77: 39,77 GOOD (HHFFFF) -Size 78: 39,78 GOOD (HHFFFF) -Size 79: 40,79 GOOD (HHFFFF) -Size 80: 40,80 GOOD (HHFFFF) -Size 81: 41,81 GOOD (HHFFFF) -Size 82: 41,82 GOOD (HHFFFF) -Size 83: 42,83 GOOD (HHFFFF) -Size 84: 42,84 GOOD (HHFFFF) -Size 85: 43,85 GOOD (HHFFFF) -Size 86: 43,86 GOOD (HHFFFF) -Size 87: 44,87 GOOD (HHFFFF) -Size 88: 44,88 GOOD (HHFFFF) -Size 89: 45,89 GOOD (HHFFFF) -Size 90: 45,90 GOOD (HHFFFF) -Size 91: 46,91 GOOD (HHFFFF) -Size 92: 46,92 GOOD (HHFFFF) -Size 93: 47,93 GOOD (HHFFFF) -Size 94: 47,94 GOOD (HHFFFF) -Size 95: 48,95 GOOD (HHFFFF) -Size 96: 48,96 GOOD (HHFFFF) -Size 97: 49,97 GOOD (HHFFFF) -Size 98: 49,98 GOOD (HHFFFF) -Size 99: 50,99 GOOD (HHFFFF) -Size 100: 50,100 GOOD (HHFFFF) diff --git a/node_modules/node-pty/deps/winpty/misc/Font-Report-June2016/CP949.txt b/node_modules/node-pty/deps/winpty/misc/Font-Report-June2016/CP949.txt deleted file mode 100644 index 2f0ea1e..0000000 --- a/node_modules/node-pty/deps/winpty/misc/Font-Report-June2016/CP949.txt +++ /dev/null @@ -1,630 +0,0 @@ -===================================== -Code Page 949, Korean, GulimChe font -===================================== - -Options: -face-gulimche -family 0x36 -Chars: A2 A3 2014 3044 30FC 4000 - -Vista ------ - -Size 1: 1,2 OK (HHHFFF) -Size 2: 1,2 OK (HHHFFF) -Size 3: 2,3 BAD (FFFFHH) -Size 4: 2,5 OK (HHHFFF) -Size 5: 3,6 BAD (HHHFHH) -Size 6: 3,7 OK (HHHFFF) -Size 7: 4,8 BAD (HHHFHH) -Size 8: 4,9 OK (HHHFFF) -Size 9: 5,10 BAD (HHHFHH) -Size 10: 5,11 OK (HHHFFF) -Size 11: 6,13 BAD (HHHFHH) -Size 12: 6,14 OK (HHHFFF) -Size 13: 7,15 BAD (HHHFHH) -Size 14: 7,16 OK (HHHFFF) -Size 15: 8,17 BAD (HHHFHH) -Size 16: 8,18 OK (HHHFFF) -Size 17: 9,20 BAD (HHHFHH) -Size 18: 9,21 OK (HHHFFF) -Size 19: 10,22 BAD (HHHFHH) -Size 20: 10,23 OK (HHHFFF) -Size 21: 11,24 BAD (HHHFHH) -Size 22: 11,25 OK (HHHFFF) -Size 23: 12,26 BAD (HHHFHH) -Size 24: 12,28 OK (HHHFFF) -Size 25: 13,29 BAD (HHHFHH) -Size 26: 13,30 OK (HHHFFF) -Size 27: 14,31 BAD (HHHFHH) -Size 28: 14,32 OK (HHHFFF) -Size 29: 15,33 BAD (HHHFHH) -Size 30: 15,34 OK (HHHFFF) -Size 31: 16,36 BAD (HHHFHH) -Size 32: 16,37 OK (HHHFFF) -Size 33: 17,38 BAD (HHHFHH) -Size 34: 17,39 OK (HHHFFF) -Size 35: 18,40 BAD (HHHFHH) -Size 36: 18,41 OK (HHHFFF) -Size 37: 19,42 BAD (HHHFHH) -Size 38: 19,44 OK (HHHFFF) -Size 39: 20,45 BAD (HHHFHH) -Size 40: 20,46 OK (HHHFFF) -Size 41: 21,47 BAD (HHHFHH) -Size 42: 21,48 OK (HHHFFF) -Size 43: 22,49 BAD (HHHFHH) -Size 44: 22,51 OK (HHHFFF) -Size 45: 23,52 BAD (HHHFHH) -Size 46: 23,53 OK (HHHFFF) -Size 47: 24,54 BAD (HHHFHH) -Size 48: 24,55 OK (HHHFFF) -Size 49: 25,56 BAD (HHHFHH) -Size 50: 25,57 OK (HHHFFF) -Size 51: 26,59 BAD (HHHFHH) -Size 52: 26,60 OK (HHHFFF) -Size 53: 27,61 BAD (HHHFHH) -Size 54: 27,62 OK (HHHFFF) -Size 55: 28,63 BAD (HHHFHH) -Size 56: 28,64 OK (HHHFFF) -Size 57: 29,65 BAD (HHHFHH) -Size 58: 29,67 OK (HHHFFF) -Size 59: 30,68 BAD (HHHFHH) -Size 60: 30,69 OK (HHHFFF) -Size 61: 31,70 BAD (HHHFHH) -Size 62: 31,71 OK (HHHFFF) -Size 63: 32,72 BAD (HHHFHH) -Size 64: 32,74 OK (HHHFFF) -Size 65: 33,75 BAD (HHHFHH) -Size 66: 33,76 OK (HHHFFF) -Size 67: 34,77 BAD (HHHFHH) -Size 68: 34,78 OK (HHHFFF) -Size 69: 35,79 BAD (HHHFHH) -Size 70: 35,80 OK (HHHFFF) -Size 71: 36,82 BAD (HHHFHH) -Size 72: 36,83 OK (HHHFFF) -Size 73: 37,84 BAD (HHHFHH) -Size 74: 37,85 OK (HHHFFF) -Size 75: 38,86 BAD (HHHFHH) -Size 76: 38,87 OK (HHHFFF) -Size 77: 39,88 BAD (HHHFHH) -Size 78: 39,90 OK (HHHFFF) -Size 79: 40,91 BAD (HHHFHH) -Size 80: 40,92 OK (HHHFFF) -Size 81: 41,93 BAD (HHHFHH) -Size 82: 41,94 OK (HHHFFF) -Size 83: 42,95 BAD (HHHFHH) -Size 84: 42,96 OK (HHHFFF) -Size 85: 43,98 BAD (HHHFHH) -Size 86: 43,99 OK (HHHFFF) -Size 87: 44,100 BAD (HHHFHH) -Size 88: 44,101 OK (HHHFFF) -Size 89: 45,102 BAD (HHHFHH) -Size 90: 45,103 OK (HHHFFF) -Size 91: 46,105 BAD (HHHFHH) -Size 92: 46,106 OK (HHHFFF) -Size 93: 47,107 BAD (HHHFHH) -Size 94: 47,108 OK (HHHFFF) -Size 95: 48,109 BAD (HHHFHH) -Size 96: 48,110 OK (HHHFFF) -Size 97: 49,111 BAD (HHHFHH) -Size 98: 49,113 OK (HHHFFF) -Size 99: 50,114 BAD (HHHFHH) -Size 100: 50,115 OK (HHHFFF) - -Windows 7 ---------- - -Size 1: 1,2 OK (HHHFFF) -Size 2: 1,2 OK (HHHFFF) -Size 3: 2,3 BAD (FFFFHH) -Size 4: 2,5 OK (HHHFFF) -Size 5: 3,6 BAD (FFFFHH) -Size 6: 3,7 OK (HHHFFF) -Size 7: 4,8 BAD (FFFFHH) -Size 8: 4,9 OK (HHHFFF) -Size 9: 5,10 BAD (FFFFHH) -Size 10: 5,11 OK (HHHFFF) -Size 11: 6,13 BAD (FFFFHH) -Size 12: 6,14 OK (HHHFFF) -Size 13: 7,15 BAD (FFFFHH) -Size 14: 7,16 OK (HHHFFF) -Size 15: 8,17 BAD (FFFFHH) -Size 16: 8,18 OK (HHHFFF) -Size 17: 9,20 BAD (FFFFHH) -Size 18: 9,21 OK (HHHFFF) -Size 19: 10,22 BAD (FFFFHH) -Size 20: 10,23 OK (HHHFFF) -Size 21: 11,24 BAD (FFFFHH) -Size 22: 11,25 OK (HHHFFF) -Size 23: 12,26 BAD (FFFFHH) -Size 24: 12,28 OK (HHHFFF) -Size 25: 13,29 BAD (FFFFHH) -Size 26: 13,30 OK (HHHFFF) -Size 27: 14,31 BAD (FFFFHH) -Size 28: 14,32 OK (HHHFFF) -Size 29: 15,33 BAD (FFFFHH) -Size 30: 15,34 OK (HHHFFF) -Size 31: 16,36 BAD (FFFFHH) -Size 32: 16,37 OK (HHHFFF) -Size 33: 17,38 BAD (FFFFHH) -Size 34: 17,39 OK (HHHFFF) -Size 35: 18,40 BAD (FFFFHH) -Size 36: 18,41 OK (HHHFFF) -Size 37: 19,42 BAD (FFFFHH) -Size 38: 19,44 OK (HHHFFF) -Size 39: 20,45 BAD (FFFFHH) -Size 40: 20,46 OK (HHHFFF) -Size 41: 21,47 BAD (FFFFHH) -Size 42: 21,48 OK (HHHFFF) -Size 43: 22,49 BAD (FFFFHH) -Size 44: 22,51 OK (HHHFFF) -Size 45: 23,52 BAD (FFFFHH) -Size 46: 23,53 OK (HHHFFF) -Size 47: 24,54 BAD (FFFFHH) -Size 48: 24,55 OK (HHHFFF) -Size 49: 25,56 BAD (FFFFHH) -Size 50: 25,57 OK (HHHFFF) -Size 51: 26,59 BAD (FFFFHH) -Size 52: 26,60 OK (HHHFFF) -Size 53: 27,61 BAD (FFFFHH) -Size 54: 27,62 OK (HHHFFF) -Size 55: 28,63 BAD (FFFFHH) -Size 56: 28,64 OK (HHHFFF) -Size 57: 29,65 BAD (FFFFHH) -Size 58: 29,67 OK (HHHFFF) -Size 59: 30,68 BAD (FFFFHH) -Size 60: 30,69 OK (HHHFFF) -Size 61: 31,70 BAD (FFFFHH) -Size 62: 31,71 OK (HHHFFF) -Size 63: 32,72 BAD (FFFFHH) -Size 64: 32,74 OK (HHHFFF) -Size 65: 33,75 BAD (FFFFHH) -Size 66: 33,76 OK (HHHFFF) -Size 67: 34,77 BAD (FFFFHH) -Size 68: 34,78 OK (HHHFFF) -Size 69: 35,79 BAD (FFFFHH) -Size 70: 35,80 OK (HHHFFF) -Size 71: 36,82 BAD (FFFFHH) -Size 72: 36,83 OK (HHHFFF) -Size 73: 37,84 BAD (FFFFHH) -Size 74: 37,85 OK (HHHFFF) -Size 75: 38,86 BAD (FFFFHH) -Size 76: 38,87 OK (HHHFFF) -Size 77: 39,88 BAD (FFFFHH) -Size 78: 39,90 OK (HHHFFF) -Size 79: 40,91 BAD (FFFFHH) -Size 80: 40,92 OK (HHHFFF) -Size 81: 41,93 BAD (FFFFHH) -Size 82: 41,94 OK (HHHFFF) -Size 83: 42,95 BAD (FFFFHH) -Size 84: 42,96 OK (HHHFFF) -Size 85: 43,98 BAD (FFFFHH) -Size 86: 43,99 OK (HHHFFF) -Size 87: 44,100 BAD (FFFFHH) -Size 88: 44,101 OK (HHHFFF) -Size 89: 45,102 BAD (FFFFHH) -Size 90: 45,103 OK (HHHFFF) -Size 91: 46,105 BAD (FFFFHH) -Size 92: 46,106 OK (HHHFFF) -Size 93: 47,107 BAD (FFFFHH) -Size 94: 47,108 OK (HHHFFF) -Size 95: 48,109 BAD (FFFFHH) -Size 96: 48,110 OK (HHHFFF) -Size 97: 49,111 BAD (FFFFHH) -Size 98: 49,113 OK (HHHFFF) -Size 99: 50,114 BAD (FFFFHH) -Size 100: 50,115 OK (HHHFFF) - -Windows 8 ---------- - -Size 1: 1,2 OK (HHHFFF) -Size 2: 1,2 OK (HHHFFF) -Size 3: 2,3 BAD (FFFFHH) -Size 4: 2,5 OK (HHHFFF) -Size 5: 3,6 BAD (FFFFHH) -Size 6: 3,7 OK (HHHFFF) -Size 7: 4,8 BAD (FFFFHH) -Size 8: 4,9 OK (HHHFFF) -Size 9: 5,10 BAD (FFFFHH) -Size 10: 5,11 OK (HHHFFF) -Size 11: 6,13 BAD (FFFFHH) -Size 12: 6,14 OK (HHHFFF) -Size 13: 7,15 BAD (FFFFHH) -Size 14: 7,16 OK (HHHFFF) -Size 15: 8,17 BAD (FFFFHH) -Size 16: 8,18 OK (HHHFFF) -Size 17: 9,20 BAD (FFFFHH) -Size 18: 9,21 OK (HHHFFF) -Size 19: 10,22 BAD (FFFFHH) -Size 20: 10,23 OK (HHHFFF) -Size 21: 11,24 BAD (FFFFHH) -Size 22: 11,25 OK (HHHFFF) -Size 23: 12,26 BAD (FFFFHH) -Size 24: 12,28 OK (HHHFFF) -Size 25: 13,29 BAD (FFFFHH) -Size 26: 13,30 OK (HHHFFF) -Size 27: 14,31 BAD (FFFFHH) -Size 28: 14,32 OK (HHHFFF) -Size 29: 15,33 BAD (FFFFHH) -Size 30: 15,34 OK (HHHFFF) -Size 31: 16,36 BAD (FFFFHH) -Size 32: 16,37 OK (HHHFFF) -Size 33: 17,38 BAD (FFFFHH) -Size 34: 17,39 OK (HHHFFF) -Size 35: 18,40 BAD (FFFFHH) -Size 36: 18,41 OK (HHHFFF) -Size 37: 19,42 BAD (FFFFHH) -Size 38: 19,44 OK (HHHFFF) -Size 39: 20,45 BAD (FFFFHH) -Size 40: 20,46 OK (HHHFFF) -Size 41: 21,47 BAD (FFFFHH) -Size 42: 21,48 OK (HHHFFF) -Size 43: 22,49 BAD (FFFFHH) -Size 44: 22,51 OK (HHHFFF) -Size 45: 23,52 BAD (FFFFHH) -Size 46: 23,53 OK (HHHFFF) -Size 47: 24,54 BAD (FFFFHH) -Size 48: 24,55 OK (HHHFFF) -Size 49: 25,56 BAD (FFFFHH) -Size 50: 25,57 OK (HHHFFF) -Size 51: 26,59 BAD (FFFFHH) -Size 52: 26,60 OK (HHHFFF) -Size 53: 27,61 BAD (FFFFHH) -Size 54: 27,62 OK (HHHFFF) -Size 55: 28,63 BAD (FFFFHH) -Size 56: 28,64 OK (HHHFFF) -Size 57: 29,65 BAD (FFFFHH) -Size 58: 29,67 OK (HHHFFF) -Size 59: 30,68 BAD (FFFFHH) -Size 60: 30,69 OK (HHHFFF) -Size 61: 31,70 BAD (FFFFHH) -Size 62: 31,71 OK (HHHFFF) -Size 63: 32,72 BAD (FFFFHH) -Size 64: 32,74 OK (HHHFFF) -Size 65: 33,75 BAD (FFFFHH) -Size 66: 33,76 OK (HHHFFF) -Size 67: 34,77 BAD (FFFFHH) -Size 68: 34,78 OK (HHHFFF) -Size 69: 35,79 BAD (FFFFHH) -Size 70: 35,80 OK (HHHFFF) -Size 71: 36,82 BAD (FFFFHH) -Size 72: 36,83 OK (HHHFFF) -Size 73: 37,84 BAD (FFFFHH) -Size 74: 37,85 OK (HHHFFF) -Size 75: 38,86 BAD (FFFFHH) -Size 76: 38,87 OK (HHHFFF) -Size 77: 39,88 BAD (FFFFHH) -Size 78: 39,90 OK (HHHFFF) -Size 79: 40,91 BAD (FFFFHH) -Size 80: 40,92 OK (HHHFFF) -Size 81: 41,93 BAD (FFFFHH) -Size 82: 41,94 OK (HHHFFF) -Size 83: 42,95 BAD (FFFFHH) -Size 84: 42,96 OK (HHHFFF) -Size 85: 43,98 BAD (FFFFHH) -Size 86: 43,99 OK (HHHFFF) -Size 87: 44,100 BAD (FFFFHH) -Size 88: 44,101 OK (HHHFFF) -Size 89: 45,102 BAD (FFFFHH) -Size 90: 45,103 OK (HHHFFF) -Size 91: 46,105 BAD (FFFFHH) -Size 92: 46,106 OK (HHHFFF) -Size 93: 47,107 BAD (FFFFHH) -Size 94: 47,108 OK (HHHFFF) -Size 95: 48,109 BAD (FFFFHH) -Size 96: 48,110 OK (HHHFFF) -Size 97: 49,111 BAD (FFFFHH) -Size 98: 49,113 OK (HHHFFF) -Size 99: 50,114 BAD (FFFFHH) -Size 100: 50,115 OK (HHHFFF) - -Windows 8.1 ------------ - -Size 1: 1,2 OK (HHHFFF) -Size 2: 1,2 OK (HHHFFF) -Size 3: 2,3 BAD (FFFFHH) -Size 4: 2,5 OK (HHHFFF) -Size 5: 3,6 BAD (FFFFHH) -Size 6: 3,7 OK (HHHFFF) -Size 7: 4,8 BAD (FFFFHH) -Size 8: 4,9 OK (HHHFFF) -Size 9: 5,10 BAD (FFFFHH) -Size 10: 5,11 OK (HHHFFF) -Size 11: 6,13 BAD (FFFFHH) -Size 12: 6,14 OK (HHHFFF) -Size 13: 7,15 BAD (FFFFHH) -Size 14: 7,16 OK (HHHFFF) -Size 15: 8,17 BAD (FFFFHH) -Size 16: 8,18 OK (HHHFFF) -Size 17: 9,20 BAD (FFFFHH) -Size 18: 9,21 OK (HHHFFF) -Size 19: 10,22 BAD (FFFFHH) -Size 20: 10,23 OK (HHHFFF) -Size 21: 11,24 BAD (FFFFHH) -Size 22: 11,25 OK (HHHFFF) -Size 23: 12,26 BAD (FFFFHH) -Size 24: 12,28 OK (HHHFFF) -Size 25: 13,29 BAD (FFFFHH) -Size 26: 13,30 OK (HHHFFF) -Size 27: 14,31 BAD (FFFFHH) -Size 28: 14,32 OK (HHHFFF) -Size 29: 15,33 BAD (FFFFHH) -Size 30: 15,34 OK (HHHFFF) -Size 31: 16,36 BAD (FFFFHH) -Size 32: 16,37 OK (HHHFFF) -Size 33: 17,38 BAD (FFFFHH) -Size 34: 17,39 OK (HHHFFF) -Size 35: 18,40 BAD (FFFFHH) -Size 36: 18,41 OK (HHHFFF) -Size 37: 19,42 BAD (FFFFHH) -Size 38: 19,44 OK (HHHFFF) -Size 39: 20,45 BAD (FFFFHH) -Size 40: 20,46 OK (HHHFFF) -Size 41: 21,47 BAD (FFFFHH) -Size 42: 21,48 OK (HHHFFF) -Size 43: 22,49 BAD (FFFFHH) -Size 44: 22,51 OK (HHHFFF) -Size 45: 23,52 BAD (FFFFHH) -Size 46: 23,53 OK (HHHFFF) -Size 47: 24,54 BAD (FFFFHH) -Size 48: 24,55 OK (HHHFFF) -Size 49: 25,56 BAD (FFFFHH) -Size 50: 25,57 OK (HHHFFF) -Size 51: 26,59 BAD (FFFFHH) -Size 52: 26,60 OK (HHHFFF) -Size 53: 27,61 BAD (FFFFHH) -Size 54: 27,62 OK (HHHFFF) -Size 55: 28,63 BAD (FFFFHH) -Size 56: 28,64 OK (HHHFFF) -Size 57: 29,65 BAD (FFFFHH) -Size 58: 29,67 OK (HHHFFF) -Size 59: 30,68 BAD (FFFFHH) -Size 60: 30,69 OK (HHHFFF) -Size 61: 31,70 BAD (FFFFHH) -Size 62: 31,71 OK (HHHFFF) -Size 63: 32,72 BAD (FFFFHH) -Size 64: 32,74 OK (HHHFFF) -Size 65: 33,75 BAD (FFFFHH) -Size 66: 33,76 OK (HHHFFF) -Size 67: 34,77 BAD (FFFFHH) -Size 68: 34,78 OK (HHHFFF) -Size 69: 35,79 BAD (FFFFHH) -Size 70: 35,80 OK (HHHFFF) -Size 71: 36,82 BAD (FFFFHH) -Size 72: 36,83 OK (HHHFFF) -Size 73: 37,84 BAD (FFFFHH) -Size 74: 37,85 OK (HHHFFF) -Size 75: 38,86 BAD (FFFFHH) -Size 76: 38,87 OK (HHHFFF) -Size 77: 39,88 BAD (FFFFHH) -Size 78: 39,90 OK (HHHFFF) -Size 79: 40,91 BAD (FFFFHH) -Size 80: 40,92 OK (HHHFFF) -Size 81: 41,93 BAD (FFFFHH) -Size 82: 41,94 OK (HHHFFF) -Size 83: 42,95 BAD (FFFFHH) -Size 84: 42,96 OK (HHHFFF) -Size 85: 43,98 BAD (FFFFHH) -Size 86: 43,99 OK (HHHFFF) -Size 87: 44,100 BAD (FFFFHH) -Size 88: 44,101 OK (HHHFFF) -Size 89: 45,102 BAD (FFFFHH) -Size 90: 45,103 OK (HHHFFF) -Size 91: 46,105 BAD (FFFFHH) -Size 92: 46,106 OK (HHHFFF) -Size 93: 47,107 BAD (FFFFHH) -Size 94: 47,108 OK (HHHFFF) -Size 95: 48,109 BAD (FFFFHH) -Size 96: 48,110 OK (HHHFFF) -Size 97: 49,111 BAD (FFFFHH) -Size 98: 49,113 OK (HHHFFF) -Size 99: 50,114 BAD (FFFFHH) -Size 100: 50,115 OK (HHHFFF) - -Windows 10 14342 Old Console ----------------------------- - -Size 1: 1,2 OK (HHHFFF) -Size 2: 1,2 OK (HHHFFF) -Size 3: 2,3 BAD (FFFFHH) -Size 4: 2,5 OK (HHHFFF) -Size 5: 3,6 BAD (FFFFHH) -Size 6: 3,7 OK (HHHFFF) -Size 7: 4,8 BAD (FFFFHH) -Size 8: 4,9 OK (HHHFFF) -Size 9: 5,10 BAD (FFFFHH) -Size 10: 5,11 OK (HHHFFF) -Size 11: 6,13 BAD (FFFFHH) -Size 12: 6,14 OK (HHHFFF) -Size 13: 7,15 BAD (FFFFHH) -Size 14: 7,16 OK (HHHFFF) -Size 15: 8,17 BAD (FFFFHH) -Size 16: 8,18 OK (HHHFFF) -Size 17: 9,20 BAD (FFFFHH) -Size 18: 9,21 OK (HHHFFF) -Size 19: 10,22 BAD (FFFFHH) -Size 20: 10,23 OK (HHHFFF) -Size 21: 11,24 BAD (FFFFHH) -Size 22: 11,25 OK (HHHFFF) -Size 23: 12,26 BAD (FFFFHH) -Size 24: 12,28 OK (HHHFFF) -Size 25: 13,29 BAD (FFFFHH) -Size 26: 13,30 OK (HHHFFF) -Size 27: 14,31 BAD (FFFFHH) -Size 28: 14,32 OK (HHHFFF) -Size 29: 15,33 BAD (FFFFHH) -Size 30: 15,34 OK (HHHFFF) -Size 31: 16,36 BAD (FFFFHH) -Size 32: 16,37 OK (HHHFFF) -Size 33: 17,38 BAD (FFFFHH) -Size 34: 17,39 OK (HHHFFF) -Size 35: 18,40 BAD (FFFFHH) -Size 36: 18,41 OK (HHHFFF) -Size 37: 19,42 BAD (FFFFHH) -Size 38: 19,44 OK (HHHFFF) -Size 39: 20,45 BAD (FFFFHH) -Size 40: 20,46 OK (HHHFFF) -Size 41: 21,47 BAD (FFFFHH) -Size 42: 21,48 OK (HHHFFF) -Size 43: 22,49 BAD (FFFFHH) -Size 44: 22,51 OK (HHHFFF) -Size 45: 23,52 BAD (FFFFHH) -Size 46: 23,53 OK (HHHFFF) -Size 47: 24,54 BAD (FFFFHH) -Size 48: 24,55 OK (HHHFFF) -Size 49: 25,56 BAD (FFFFHH) -Size 50: 25,57 OK (HHHFFF) -Size 51: 26,59 BAD (FFFFHH) -Size 52: 26,60 OK (HHHFFF) -Size 53: 27,61 BAD (FFFFHH) -Size 54: 27,62 OK (HHHFFF) -Size 55: 28,63 BAD (FFFFHH) -Size 56: 28,64 OK (HHHFFF) -Size 57: 29,65 BAD (FFFFHH) -Size 58: 29,67 OK (HHHFFF) -Size 59: 30,68 BAD (FFFFHH) -Size 60: 30,69 OK (HHHFFF) -Size 61: 31,70 BAD (FFFFHH) -Size 62: 31,71 OK (HHHFFF) -Size 63: 32,72 BAD (FFFFHH) -Size 64: 32,74 OK (HHHFFF) -Size 65: 33,75 BAD (FFFFHH) -Size 66: 33,76 OK (HHHFFF) -Size 67: 34,77 BAD (FFFFHH) -Size 68: 34,78 OK (HHHFFF) -Size 69: 35,79 BAD (FFFFHH) -Size 70: 35,80 OK (HHHFFF) -Size 71: 36,82 BAD (FFFFHH) -Size 72: 36,83 OK (HHHFFF) -Size 73: 37,84 BAD (FFFFHH) -Size 74: 37,85 OK (HHHFFF) -Size 75: 38,86 BAD (FFFFHH) -Size 76: 38,87 OK (HHHFFF) -Size 77: 39,88 BAD (FFFFHH) -Size 78: 39,90 OK (HHHFFF) -Size 79: 40,91 BAD (FFFFHH) -Size 80: 40,92 OK (HHHFFF) -Size 81: 41,93 BAD (FFFFHH) -Size 82: 41,94 OK (HHHFFF) -Size 83: 42,95 BAD (FFFFHH) -Size 84: 42,96 OK (HHHFFF) -Size 85: 43,98 BAD (FFFFHH) -Size 86: 43,99 OK (HHHFFF) -Size 87: 44,100 BAD (FFFFHH) -Size 88: 44,101 OK (HHHFFF) -Size 89: 45,102 BAD (FFFFHH) -Size 90: 45,103 OK (HHHFFF) -Size 91: 46,105 BAD (FFFFHH) -Size 92: 46,106 OK (HHHFFF) -Size 93: 47,107 BAD (FFFFHH) -Size 94: 47,108 OK (HHHFFF) -Size 95: 48,109 BAD (FFFFHH) -Size 96: 48,110 OK (HHHFFF) -Size 97: 49,111 BAD (FFFFHH) -Size 98: 49,113 OK (HHHFFF) -Size 99: 50,114 BAD (FFFFHH) -Size 100: 50,115 OK (HHHFFF) - -Windows 10 14342 New Console ----------------------------- - -Size 1: 1,1 OK (HHHFFF) -Size 2: 1,2 OK (HHHFFF) -Size 3: 2,3 OK (HHHFFF) -Size 4: 2,4 OK (HHHFFF) -Size 5: 3,5 OK (HHHFFF) -Size 6: 3,6 OK (HHHFFF) -Size 7: 4,7 OK (HHHFFF) -Size 8: 4,8 OK (HHHFFF) -Size 9: 5,9 OK (HHHFFF) -Size 10: 5,10 OK (HHHFFF) -Size 11: 6,11 OK (HHHFFF) -Size 12: 6,12 OK (HHHFFF) -Size 13: 7,13 OK (HHHFFF) -Size 14: 7,14 OK (HHHFFF) -Size 15: 8,15 OK (HHHFFF) -Size 16: 8,16 OK (HHHFFF) -Size 17: 9,17 OK (HHHFFF) -Size 18: 9,18 OK (HHHFFF) -Size 19: 10,19 OK (HHHFFF) -Size 20: 10,20 OK (HHHFFF) -Size 21: 11,21 OK (HHHFFF) -Size 22: 11,22 OK (HHHFFF) -Size 23: 12,23 OK (HHHFFF) -Size 24: 12,24 OK (HHHFFF) -Size 25: 13,25 OK (HHHFFF) -Size 26: 13,26 OK (HHHFFF) -Size 27: 14,27 OK (HHHFFF) -Size 28: 14,28 OK (HHHFFF) -Size 29: 15,29 OK (HHHFFF) -Size 30: 15,30 OK (HHHFFF) -Size 31: 16,31 OK (HHHFFF) -Size 32: 16,32 OK (HHHFFF) -Size 33: 17,33 OK (HHHFFF) -Size 34: 17,34 OK (HHHFFF) -Size 35: 18,35 OK (HHHFFF) -Size 36: 18,36 OK (HHHFFF) -Size 37: 19,37 OK (HHHFFF) -Size 38: 19,38 OK (HHHFFF) -Size 39: 20,39 OK (HHHFFF) -Size 40: 20,40 OK (HHHFFF) -Size 41: 21,41 OK (HHHFFF) -Size 42: 21,42 OK (HHHFFF) -Size 43: 22,43 OK (HHHFFF) -Size 44: 22,44 OK (HHHFFF) -Size 45: 23,45 OK (HHHFFF) -Size 46: 23,46 OK (HHHFFF) -Size 47: 24,47 OK (HHHFFF) -Size 48: 24,48 OK (HHHFFF) -Size 49: 25,49 OK (HHHFFF) -Size 50: 25,50 OK (HHHFFF) -Size 51: 26,51 OK (HHHFFF) -Size 52: 26,52 OK (HHHFFF) -Size 53: 27,53 OK (HHHFFF) -Size 54: 27,54 OK (HHHFFF) -Size 55: 28,55 OK (HHHFFF) -Size 56: 28,56 OK (HHHFFF) -Size 57: 29,57 OK (HHHFFF) -Size 58: 29,58 OK (HHHFFF) -Size 59: 30,59 OK (HHHFFF) -Size 60: 30,60 OK (HHHFFF) -Size 61: 31,61 OK (HHHFFF) -Size 62: 31,62 OK (HHHFFF) -Size 63: 32,63 OK (HHHFFF) -Size 64: 32,64 OK (HHHFFF) -Size 65: 33,65 OK (HHHFFF) -Size 66: 33,66 OK (HHHFFF) -Size 67: 34,67 OK (HHHFFF) -Size 68: 34,68 OK (HHHFFF) -Size 69: 35,69 OK (HHHFFF) -Size 70: 35,70 OK (HHHFFF) -Size 71: 36,71 OK (HHHFFF) -Size 72: 36,72 OK (HHHFFF) -Size 73: 37,73 OK (HHHFFF) -Size 74: 37,74 OK (HHHFFF) -Size 75: 38,75 OK (HHHFFF) -Size 76: 38,76 OK (HHHFFF) -Size 77: 39,77 OK (HHHFFF) -Size 78: 39,78 OK (HHHFFF) -Size 79: 40,79 OK (HHHFFF) -Size 80: 40,80 OK (HHHFFF) -Size 81: 41,81 OK (HHHFFF) -Size 82: 41,82 OK (HHHFFF) -Size 83: 42,83 OK (HHHFFF) -Size 84: 42,84 OK (HHHFFF) -Size 85: 43,85 OK (HHHFFF) -Size 86: 43,86 OK (HHHFFF) -Size 87: 44,87 OK (HHHFFF) -Size 88: 44,88 OK (HHHFFF) -Size 89: 45,89 OK (HHHFFF) -Size 90: 45,90 OK (HHHFFF) -Size 91: 46,91 OK (HHHFFF) -Size 92: 46,92 OK (HHHFFF) -Size 93: 47,93 OK (HHHFFF) -Size 94: 47,94 OK (HHHFFF) -Size 95: 48,95 OK (HHHFFF) -Size 96: 48,96 OK (HHHFFF) -Size 97: 49,97 OK (HHHFFF) -Size 98: 49,98 OK (HHHFFF) -Size 99: 50,99 OK (HHHFFF) -Size 100: 50,100 OK (HHHFFF) diff --git a/node_modules/node-pty/deps/winpty/misc/Font-Report-June2016/CP950.txt b/node_modules/node-pty/deps/winpty/misc/Font-Report-June2016/CP950.txt deleted file mode 100644 index 0dbade5..0000000 --- a/node_modules/node-pty/deps/winpty/misc/Font-Report-June2016/CP950.txt +++ /dev/null @@ -1,630 +0,0 @@ -=========================================================== -Code Page 950, Chinese Traditional (Taiwan), MingLight font -=========================================================== - -Options: -face-minglight -family 0x36 -Chars: A2 A3 2014 3044 30FC 4000 - -Vista ------ - -Size 1: 1,2 GOOD (HHFFFF) -Size 2: 1,2 GOOD (HHFFFF) -Size 3: 2,4 BAD (FFHFHH) -Size 4: 2,5 GOOD (HHFFFF) -Size 5: 3,6 BAD (HHHFHH) -Size 6: 3,7 GOOD (HHFFFF) -Size 7: 4,8 BAD (HHHFHH) -Size 8: 4,10 GOOD (HHFFFF) -Size 9: 5,11 BAD (HHHFHH) -Size 10: 5,12 GOOD (HHFFFF) -Size 11: 6,13 BAD (HHHFHH) -Size 12: 6,14 GOOD (HHFFFF) -Size 13: 7,16 BAD (HHHFHH) -Size 14: 7,17 GOOD (HHFFFF) -Size 15: 8,18 BAD (HHHFHH) -Size 16: 8,19 GOOD (HHFFFF) -Size 17: 9,20 BAD (HHHFHH) -Size 18: 9,22 GOOD (HHFFFF) -Size 19: 10,23 BAD (HHHFHH) -Size 20: 10,24 GOOD (HHFFFF) -Size 21: 11,25 BAD (HHHFHH) -Size 22: 11,26 GOOD (HHFFFF) -Size 23: 12,28 BAD (HHHFHH) -Size 24: 12,29 GOOD (HHFFFF) -Size 25: 13,30 BAD (HHHFHH) -Size 26: 13,31 GOOD (HHFFFF) -Size 27: 14,32 BAD (HHHFHH) -Size 28: 14,34 GOOD (HHFFFF) -Size 29: 15,35 BAD (HHHFHH) -Size 30: 15,36 GOOD (HHFFFF) -Size 31: 16,37 BAD (HHHFHH) -Size 32: 16,38 GOOD (HHFFFF) -Size 33: 17,40 BAD (HHHFHH) -Size 34: 17,41 GOOD (HHFFFF) -Size 35: 18,42 BAD (HHHFHH) -Size 36: 18,43 GOOD (HHFFFF) -Size 37: 19,44 BAD (HHHFHH) -Size 38: 19,46 GOOD (HHFFFF) -Size 39: 20,47 BAD (HHHFHH) -Size 40: 20,48 GOOD (HHFFFF) -Size 41: 21,49 BAD (HHHFHH) -Size 42: 21,50 GOOD (HHFFFF) -Size 43: 22,52 BAD (HHHFHH) -Size 44: 22,53 GOOD (HHFFFF) -Size 45: 23,54 BAD (HHHFHH) -Size 46: 23,55 GOOD (HHFFFF) -Size 47: 24,56 BAD (HHHFHH) -Size 48: 24,58 GOOD (HHFFFF) -Size 49: 25,59 BAD (HHHFHH) -Size 50: 25,60 GOOD (HHFFFF) -Size 51: 26,61 BAD (HHHFHH) -Size 52: 26,62 GOOD (HHFFFF) -Size 53: 27,64 BAD (HHHFHH) -Size 54: 27,65 GOOD (HHFFFF) -Size 55: 28,66 BAD (HHHFHH) -Size 56: 28,67 GOOD (HHFFFF) -Size 57: 29,68 BAD (HHHFHH) -Size 58: 29,70 GOOD (HHFFFF) -Size 59: 30,71 BAD (HHHFHH) -Size 60: 30,72 GOOD (HHFFFF) -Size 61: 31,73 BAD (HHHFHH) -Size 62: 31,74 GOOD (HHFFFF) -Size 63: 32,76 BAD (HHHFHH) -Size 64: 32,77 GOOD (HHFFFF) -Size 65: 33,78 BAD (HHHFHH) -Size 66: 33,79 GOOD (HHFFFF) -Size 67: 34,80 BAD (HHHFHH) -Size 68: 34,82 GOOD (HHFFFF) -Size 69: 35,83 BAD (HHHFHH) -Size 70: 35,84 GOOD (HHFFFF) -Size 71: 36,85 BAD (HHHFHH) -Size 72: 36,86 GOOD (HHFFFF) -Size 73: 37,88 BAD (HHHFHH) -Size 74: 37,89 GOOD (HHFFFF) -Size 75: 38,90 BAD (HHHFHH) -Size 76: 38,91 GOOD (HHFFFF) -Size 77: 39,92 BAD (HHHFHH) -Size 78: 39,94 GOOD (HHFFFF) -Size 79: 40,95 BAD (HHHFHH) -Size 80: 40,96 GOOD (HHFFFF) -Size 81: 41,97 BAD (HHHFHH) -Size 82: 41,98 GOOD (HHFFFF) -Size 83: 42,100 BAD (HHHFHH) -Size 84: 42,101 GOOD (HHFFFF) -Size 85: 43,102 BAD (HHHFHH) -Size 86: 43,103 GOOD (HHFFFF) -Size 87: 44,104 BAD (HHHFHH) -Size 88: 44,106 GOOD (HHFFFF) -Size 89: 45,107 BAD (HHHFHH) -Size 90: 45,108 GOOD (HHFFFF) -Size 91: 46,109 BAD (HHHFHH) -Size 92: 46,110 GOOD (HHFFFF) -Size 93: 47,112 BAD (HHHFHH) -Size 94: 47,113 GOOD (HHFFFF) -Size 95: 48,114 BAD (HHHFHH) -Size 96: 48,115 GOOD (HHFFFF) -Size 97: 49,116 BAD (HHHFHH) -Size 98: 49,118 GOOD (HHFFFF) -Size 99: 50,119 BAD (HHHFHH) -Size 100: 50,120 GOOD (HHFFFF) - -Windows 7 ---------- - -Size 1: 1,2 GOOD (HHFFFF) -Size 2: 1,2 GOOD (HHFFFF) -Size 3: 2,4 BAD (FFHFHH) -Size 4: 2,5 GOOD (HHFFFF) -Size 5: 3,6 BAD (FFHFHH) -Size 6: 3,7 GOOD (HHFFFF) -Size 7: 4,8 BAD (FFHFHH) -Size 8: 4,10 GOOD (HHFFFF) -Size 9: 5,11 BAD (FFHFHH) -Size 10: 5,12 GOOD (HHFFFF) -Size 11: 6,13 BAD (FFHFHH) -Size 12: 6,14 GOOD (HHFFFF) -Size 13: 7,16 BAD (FFHFHH) -Size 14: 7,17 GOOD (HHFFFF) -Size 15: 8,18 BAD (FFHFHH) -Size 16: 8,19 GOOD (HHFFFF) -Size 17: 9,20 BAD (FFHFHH) -Size 18: 9,22 GOOD (HHFFFF) -Size 19: 10,23 BAD (FFHFHH) -Size 20: 10,24 GOOD (HHFFFF) -Size 21: 11,25 BAD (FFHFHH) -Size 22: 11,26 GOOD (HHFFFF) -Size 23: 12,28 BAD (FFHFHH) -Size 24: 12,29 GOOD (HHFFFF) -Size 25: 13,30 BAD (FFHFHH) -Size 26: 13,31 GOOD (HHFFFF) -Size 27: 14,32 BAD (FFHFHH) -Size 28: 14,34 GOOD (HHFFFF) -Size 29: 15,35 BAD (FFHFHH) -Size 30: 15,36 GOOD (HHFFFF) -Size 31: 16,37 BAD (FFHFHH) -Size 32: 16,38 GOOD (HHFFFF) -Size 33: 17,40 BAD (FFHFHH) -Size 34: 17,41 GOOD (HHFFFF) -Size 35: 18,42 BAD (FFHFHH) -Size 36: 18,43 GOOD (HHFFFF) -Size 37: 19,44 BAD (FFHFHH) -Size 38: 19,46 GOOD (HHFFFF) -Size 39: 20,47 BAD (FFHFHH) -Size 40: 20,48 GOOD (HHFFFF) -Size 41: 21,49 BAD (FFHFHH) -Size 42: 21,50 GOOD (HHFFFF) -Size 43: 22,52 BAD (FFHFHH) -Size 44: 22,53 GOOD (HHFFFF) -Size 45: 23,54 BAD (FFHFHH) -Size 46: 23,55 GOOD (HHFFFF) -Size 47: 24,56 BAD (FFHFHH) -Size 48: 24,58 GOOD (HHFFFF) -Size 49: 25,59 BAD (FFHFHH) -Size 50: 25,60 GOOD (HHFFFF) -Size 51: 26,61 BAD (FFHFHH) -Size 52: 26,62 GOOD (HHFFFF) -Size 53: 27,64 BAD (FFHFHH) -Size 54: 27,65 GOOD (HHFFFF) -Size 55: 28,66 BAD (FFHFHH) -Size 56: 28,67 GOOD (HHFFFF) -Size 57: 29,68 BAD (FFHFHH) -Size 58: 29,70 GOOD (HHFFFF) -Size 59: 30,71 BAD (FFHFHH) -Size 60: 30,72 GOOD (HHFFFF) -Size 61: 31,73 BAD (FFHFHH) -Size 62: 31,74 GOOD (HHFFFF) -Size 63: 32,76 BAD (FFHFHH) -Size 64: 32,77 GOOD (HHFFFF) -Size 65: 33,78 BAD (FFHFHH) -Size 66: 33,79 GOOD (HHFFFF) -Size 67: 34,80 BAD (FFHFHH) -Size 68: 34,82 GOOD (HHFFFF) -Size 69: 35,83 BAD (FFHFHH) -Size 70: 35,84 GOOD (HHFFFF) -Size 71: 36,85 BAD (FFHFHH) -Size 72: 36,86 GOOD (HHFFFF) -Size 73: 37,88 BAD (FFHFHH) -Size 74: 37,89 GOOD (HHFFFF) -Size 75: 38,90 BAD (FFHFHH) -Size 76: 38,91 GOOD (HHFFFF) -Size 77: 39,92 BAD (FFHFHH) -Size 78: 39,94 GOOD (HHFFFF) -Size 79: 40,95 BAD (FFHFHH) -Size 80: 40,96 GOOD (HHFFFF) -Size 81: 41,97 BAD (FFHFHH) -Size 82: 41,98 GOOD (HHFFFF) -Size 83: 42,100 BAD (FFHFHH) -Size 84: 42,101 GOOD (HHFFFF) -Size 85: 43,102 BAD (FFHFHH) -Size 86: 43,103 GOOD (HHFFFF) -Size 87: 44,104 BAD (FFHFHH) -Size 88: 44,106 GOOD (HHFFFF) -Size 89: 45,107 BAD (FFHFHH) -Size 90: 45,108 GOOD (HHFFFF) -Size 91: 46,109 BAD (FFHFHH) -Size 92: 46,110 GOOD (HHFFFF) -Size 93: 47,112 BAD (FFHFHH) -Size 94: 47,113 GOOD (HHFFFF) -Size 95: 48,114 BAD (FFHFHH) -Size 96: 48,115 GOOD (HHFFFF) -Size 97: 49,116 BAD (FFHFHH) -Size 98: 49,118 GOOD (HHFFFF) -Size 99: 50,119 BAD (FFHFHH) -Size 100: 50,120 GOOD (HHFFFF) - -Windows 8 ---------- - -Size 1: 1,2 GOOD (HHFFFF) -Size 2: 1,2 GOOD (HHFFFF) -Size 3: 2,4 BAD (FFHFHH) -Size 4: 2,5 GOOD (HHFFFF) -Size 5: 3,6 BAD (FFHFHH) -Size 6: 3,7 GOOD (HHFFFF) -Size 7: 4,8 BAD (FFHFHH) -Size 8: 4,10 GOOD (HHFFFF) -Size 9: 5,11 BAD (FFHFHH) -Size 10: 5,12 GOOD (HHFFFF) -Size 11: 6,13 BAD (FFHFHH) -Size 12: 6,14 GOOD (HHFFFF) -Size 13: 7,16 BAD (FFHFHH) -Size 14: 7,17 GOOD (HHFFFF) -Size 15: 8,18 BAD (FFHFHH) -Size 16: 8,19 GOOD (HHFFFF) -Size 17: 9,20 BAD (FFHFHH) -Size 18: 9,22 GOOD (HHFFFF) -Size 19: 10,23 BAD (FFHFHH) -Size 20: 10,24 GOOD (HHFFFF) -Size 21: 11,25 BAD (FFHFHH) -Size 22: 11,26 GOOD (HHFFFF) -Size 23: 12,28 BAD (FFHFHH) -Size 24: 12,29 GOOD (HHFFFF) -Size 25: 13,30 BAD (FFHFHH) -Size 26: 13,31 GOOD (HHFFFF) -Size 27: 14,32 BAD (FFHFHH) -Size 28: 14,34 GOOD (HHFFFF) -Size 29: 15,35 BAD (FFHFHH) -Size 30: 15,36 GOOD (HHFFFF) -Size 31: 16,37 BAD (FFHFHH) -Size 32: 16,38 GOOD (HHFFFF) -Size 33: 17,40 BAD (FFHFHH) -Size 34: 17,41 GOOD (HHFFFF) -Size 35: 18,42 BAD (FFHFHH) -Size 36: 18,43 GOOD (HHFFFF) -Size 37: 19,44 BAD (FFHFHH) -Size 38: 19,46 GOOD (HHFFFF) -Size 39: 20,47 BAD (FFHFHH) -Size 40: 20,48 GOOD (HHFFFF) -Size 41: 21,49 BAD (FFHFHH) -Size 42: 21,50 GOOD (HHFFFF) -Size 43: 22,52 BAD (FFHFHH) -Size 44: 22,53 GOOD (HHFFFF) -Size 45: 23,54 BAD (FFHFHH) -Size 46: 23,55 GOOD (HHFFFF) -Size 47: 24,56 BAD (FFHFHH) -Size 48: 24,58 GOOD (HHFFFF) -Size 49: 25,59 BAD (FFHFHH) -Size 50: 25,60 GOOD (HHFFFF) -Size 51: 26,61 BAD (FFHFHH) -Size 52: 26,62 GOOD (HHFFFF) -Size 53: 27,64 BAD (FFHFHH) -Size 54: 27,65 GOOD (HHFFFF) -Size 55: 28,66 BAD (FFHFHH) -Size 56: 28,67 GOOD (HHFFFF) -Size 57: 29,68 BAD (FFHFHH) -Size 58: 29,70 GOOD (HHFFFF) -Size 59: 30,71 BAD (FFHFHH) -Size 60: 30,72 GOOD (HHFFFF) -Size 61: 31,73 BAD (FFHFHH) -Size 62: 31,74 GOOD (HHFFFF) -Size 63: 32,76 BAD (FFHFHH) -Size 64: 32,77 GOOD (HHFFFF) -Size 65: 33,78 BAD (FFHFHH) -Size 66: 33,79 GOOD (HHFFFF) -Size 67: 34,80 BAD (FFHFHH) -Size 68: 34,82 GOOD (HHFFFF) -Size 69: 35,83 BAD (FFHFHH) -Size 70: 35,84 GOOD (HHFFFF) -Size 71: 36,85 BAD (FFHFHH) -Size 72: 36,86 GOOD (HHFFFF) -Size 73: 37,88 BAD (FFHFHH) -Size 74: 37,89 GOOD (HHFFFF) -Size 75: 38,90 BAD (FFHFHH) -Size 76: 38,91 GOOD (HHFFFF) -Size 77: 39,92 BAD (FFHFHH) -Size 78: 39,94 GOOD (HHFFFF) -Size 79: 40,95 BAD (FFHFHH) -Size 80: 40,96 GOOD (HHFFFF) -Size 81: 41,97 BAD (FFHFHH) -Size 82: 41,98 GOOD (HHFFFF) -Size 83: 42,100 BAD (FFHFHH) -Size 84: 42,101 GOOD (HHFFFF) -Size 85: 43,102 BAD (FFHFHH) -Size 86: 43,103 GOOD (HHFFFF) -Size 87: 44,104 BAD (FFHFHH) -Size 88: 44,106 GOOD (HHFFFF) -Size 89: 45,107 BAD (FFHFHH) -Size 90: 45,108 GOOD (HHFFFF) -Size 91: 46,109 BAD (FFHFHH) -Size 92: 46,110 GOOD (HHFFFF) -Size 93: 47,112 BAD (FFHFHH) -Size 94: 47,113 GOOD (HHFFFF) -Size 95: 48,114 BAD (FFHFHH) -Size 96: 48,115 GOOD (HHFFFF) -Size 97: 49,116 BAD (FFHFHH) -Size 98: 49,118 GOOD (HHFFFF) -Size 99: 50,119 BAD (FFHFHH) -Size 100: 50,120 GOOD (HHFFFF) - -Windows 8.1 ------------ - -Size 1: 1,2 GOOD (HHFFFF) -Size 2: 1,2 GOOD (HHFFFF) -Size 3: 2,4 BAD (FFHFHH) -Size 4: 2,5 GOOD (HHFFFF) -Size 5: 3,6 BAD (FFHFHH) -Size 6: 3,7 GOOD (HHFFFF) -Size 7: 4,8 BAD (FFHFHH) -Size 8: 4,10 GOOD (HHFFFF) -Size 9: 5,11 BAD (FFHFHH) -Size 10: 5,12 GOOD (HHFFFF) -Size 11: 6,13 BAD (FFHFHH) -Size 12: 6,14 GOOD (HHFFFF) -Size 13: 7,16 BAD (FFHFHH) -Size 14: 7,17 GOOD (HHFFFF) -Size 15: 8,18 BAD (FFHFHH) -Size 16: 8,19 GOOD (HHFFFF) -Size 17: 9,20 BAD (FFHFHH) -Size 18: 9,22 GOOD (HHFFFF) -Size 19: 10,23 BAD (FFHFHH) -Size 20: 10,24 GOOD (HHFFFF) -Size 21: 11,25 BAD (FFHFHH) -Size 22: 11,26 GOOD (HHFFFF) -Size 23: 12,28 BAD (FFHFHH) -Size 24: 12,29 GOOD (HHFFFF) -Size 25: 13,30 BAD (FFHFHH) -Size 26: 13,31 GOOD (HHFFFF) -Size 27: 14,32 BAD (FFHFHH) -Size 28: 14,34 GOOD (HHFFFF) -Size 29: 15,35 BAD (FFHFHH) -Size 30: 15,36 GOOD (HHFFFF) -Size 31: 16,37 BAD (FFHFHH) -Size 32: 16,38 GOOD (HHFFFF) -Size 33: 17,40 BAD (FFHFHH) -Size 34: 17,41 GOOD (HHFFFF) -Size 35: 18,42 BAD (FFHFHH) -Size 36: 18,43 GOOD (HHFFFF) -Size 37: 19,44 BAD (FFHFHH) -Size 38: 19,46 GOOD (HHFFFF) -Size 39: 20,47 BAD (FFHFHH) -Size 40: 20,48 GOOD (HHFFFF) -Size 41: 21,49 BAD (FFHFHH) -Size 42: 21,50 GOOD (HHFFFF) -Size 43: 22,52 BAD (FFHFHH) -Size 44: 22,53 GOOD (HHFFFF) -Size 45: 23,54 BAD (FFHFHH) -Size 46: 23,55 GOOD (HHFFFF) -Size 47: 24,56 BAD (FFHFHH) -Size 48: 24,58 GOOD (HHFFFF) -Size 49: 25,59 BAD (FFHFHH) -Size 50: 25,60 GOOD (HHFFFF) -Size 51: 26,61 BAD (FFHFHH) -Size 52: 26,62 GOOD (HHFFFF) -Size 53: 27,64 BAD (FFHFHH) -Size 54: 27,65 GOOD (HHFFFF) -Size 55: 28,66 BAD (FFHFHH) -Size 56: 28,67 GOOD (HHFFFF) -Size 57: 29,68 BAD (FFHFHH) -Size 58: 29,70 GOOD (HHFFFF) -Size 59: 30,71 BAD (FFHFHH) -Size 60: 30,72 GOOD (HHFFFF) -Size 61: 31,73 BAD (FFHFHH) -Size 62: 31,74 GOOD (HHFFFF) -Size 63: 32,76 BAD (FFHFHH) -Size 64: 32,77 GOOD (HHFFFF) -Size 65: 33,78 BAD (FFHFHH) -Size 66: 33,79 GOOD (HHFFFF) -Size 67: 34,80 BAD (FFHFHH) -Size 68: 34,82 GOOD (HHFFFF) -Size 69: 35,83 BAD (FFHFHH) -Size 70: 35,84 GOOD (HHFFFF) -Size 71: 36,85 BAD (FFHFHH) -Size 72: 36,86 GOOD (HHFFFF) -Size 73: 37,88 BAD (FFHFHH) -Size 74: 37,89 GOOD (HHFFFF) -Size 75: 38,90 BAD (FFHFHH) -Size 76: 38,91 GOOD (HHFFFF) -Size 77: 39,92 BAD (FFHFHH) -Size 78: 39,94 GOOD (HHFFFF) -Size 79: 40,95 BAD (FFHFHH) -Size 80: 40,96 GOOD (HHFFFF) -Size 81: 41,97 BAD (FFHFHH) -Size 82: 41,98 GOOD (HHFFFF) -Size 83: 42,100 BAD (FFHFHH) -Size 84: 42,101 GOOD (HHFFFF) -Size 85: 43,102 BAD (FFHFHH) -Size 86: 43,103 GOOD (HHFFFF) -Size 87: 44,104 BAD (FFHFHH) -Size 88: 44,106 GOOD (HHFFFF) -Size 89: 45,107 BAD (FFHFHH) -Size 90: 45,108 GOOD (HHFFFF) -Size 91: 46,109 BAD (FFHFHH) -Size 92: 46,110 GOOD (HHFFFF) -Size 93: 47,112 BAD (FFHFHH) -Size 94: 47,113 GOOD (HHFFFF) -Size 95: 48,114 BAD (FFHFHH) -Size 96: 48,115 GOOD (HHFFFF) -Size 97: 49,116 BAD (FFHFHH) -Size 98: 49,118 GOOD (HHFFFF) -Size 99: 50,119 BAD (FFHFHH) -Size 100: 50,120 GOOD (HHFFFF) - -Windows 10 14342 Old Console ----------------------------- - -Size 1: 1,2 GOOD (HHFFFF) -Size 2: 1,2 GOOD (HHFFFF) -Size 3: 2,4 BAD (FFHFHH) -Size 4: 2,5 GOOD (HHFFFF) -Size 5: 3,6 BAD (FFHFHH) -Size 6: 3,7 GOOD (HHFFFF) -Size 7: 4,8 BAD (FFHFHH) -Size 8: 4,10 GOOD (HHFFFF) -Size 9: 5,11 BAD (FFHFHH) -Size 10: 5,12 GOOD (HHFFFF) -Size 11: 6,13 BAD (FFHFHH) -Size 12: 6,14 GOOD (HHFFFF) -Size 13: 7,16 BAD (FFHFHH) -Size 14: 7,17 GOOD (HHFFFF) -Size 15: 8,18 BAD (FFHFHH) -Size 16: 8,19 GOOD (HHFFFF) -Size 17: 9,20 BAD (FFHFHH) -Size 18: 9,22 GOOD (HHFFFF) -Size 19: 10,23 BAD (FFHFHH) -Size 20: 10,24 GOOD (HHFFFF) -Size 21: 11,25 BAD (FFHFHH) -Size 22: 11,26 GOOD (HHFFFF) -Size 23: 12,28 BAD (FFHFHH) -Size 24: 12,29 GOOD (HHFFFF) -Size 25: 13,30 BAD (FFHFHH) -Size 26: 13,31 GOOD (HHFFFF) -Size 27: 14,32 BAD (FFHFHH) -Size 28: 14,34 GOOD (HHFFFF) -Size 29: 15,35 BAD (FFHFHH) -Size 30: 15,36 GOOD (HHFFFF) -Size 31: 16,37 BAD (FFHFHH) -Size 32: 16,38 GOOD (HHFFFF) -Size 33: 17,40 BAD (FFHFHH) -Size 34: 17,41 GOOD (HHFFFF) -Size 35: 18,42 BAD (FFHFHH) -Size 36: 18,43 GOOD (HHFFFF) -Size 37: 19,44 BAD (FFHFHH) -Size 38: 19,46 GOOD (HHFFFF) -Size 39: 20,47 BAD (FFHFHH) -Size 40: 20,48 GOOD (HHFFFF) -Size 41: 21,49 BAD (FFHFHH) -Size 42: 21,50 GOOD (HHFFFF) -Size 43: 22,52 BAD (FFHFHH) -Size 44: 22,53 GOOD (HHFFFF) -Size 45: 23,54 BAD (FFHFHH) -Size 46: 23,55 GOOD (HHFFFF) -Size 47: 24,56 BAD (FFHFHH) -Size 48: 24,58 GOOD (HHFFFF) -Size 49: 25,59 BAD (FFHFHH) -Size 50: 25,60 GOOD (HHFFFF) -Size 51: 26,61 BAD (FFHFHH) -Size 52: 26,62 GOOD (HHFFFF) -Size 53: 27,64 BAD (FFHFHH) -Size 54: 27,65 GOOD (HHFFFF) -Size 55: 28,66 BAD (FFHFHH) -Size 56: 28,67 GOOD (HHFFFF) -Size 57: 29,68 BAD (FFHFHH) -Size 58: 29,70 GOOD (HHFFFF) -Size 59: 30,71 BAD (FFHFHH) -Size 60: 30,72 GOOD (HHFFFF) -Size 61: 31,73 BAD (FFHFHH) -Size 62: 31,74 GOOD (HHFFFF) -Size 63: 32,76 BAD (FFHFHH) -Size 64: 32,77 GOOD (HHFFFF) -Size 65: 33,78 BAD (FFHFHH) -Size 66: 33,79 GOOD (HHFFFF) -Size 67: 34,80 BAD (FFHFHH) -Size 68: 34,82 GOOD (HHFFFF) -Size 69: 35,83 BAD (FFHFHH) -Size 70: 35,84 GOOD (HHFFFF) -Size 71: 36,85 BAD (FFHFHH) -Size 72: 36,86 GOOD (HHFFFF) -Size 73: 37,88 BAD (FFHFHH) -Size 74: 37,89 GOOD (HHFFFF) -Size 75: 38,90 BAD (FFHFHH) -Size 76: 38,91 GOOD (HHFFFF) -Size 77: 39,92 BAD (FFHFHH) -Size 78: 39,94 GOOD (HHFFFF) -Size 79: 40,95 BAD (FFHFHH) -Size 80: 40,96 GOOD (HHFFFF) -Size 81: 41,97 BAD (FFHFHH) -Size 82: 41,98 GOOD (HHFFFF) -Size 83: 42,100 BAD (FFHFHH) -Size 84: 42,101 GOOD (HHFFFF) -Size 85: 43,102 BAD (FFHFHH) -Size 86: 43,103 GOOD (HHFFFF) -Size 87: 44,104 BAD (FFHFHH) -Size 88: 44,106 GOOD (HHFFFF) -Size 89: 45,107 BAD (FFHFHH) -Size 90: 45,108 GOOD (HHFFFF) -Size 91: 46,109 BAD (FFHFHH) -Size 92: 46,110 GOOD (HHFFFF) -Size 93: 47,112 BAD (FFHFHH) -Size 94: 47,113 GOOD (HHFFFF) -Size 95: 48,114 BAD (FFHFHH) -Size 96: 48,115 GOOD (HHFFFF) -Size 97: 49,116 BAD (FFHFHH) -Size 98: 49,118 GOOD (HHFFFF) -Size 99: 50,119 BAD (FFHFHH) -Size 100: 50,120 GOOD (HHFFFF) - -Windows 10 14342 New Console ----------------------------- - -Size 1: 1,1 GOOD (HHFFFF) -Size 2: 1,2 GOOD (HHFFFF) -Size 3: 2,3 GOOD (HHFFFF) -Size 4: 2,4 GOOD (HHFFFF) -Size 5: 3,5 GOOD (HHFFFF) -Size 6: 3,6 GOOD (HHFFFF) -Size 7: 4,7 GOOD (HHFFFF) -Size 8: 4,8 GOOD (HHFFFF) -Size 9: 5,9 GOOD (HHFFFF) -Size 10: 5,10 GOOD (HHFFFF) -Size 11: 6,11 GOOD (HHFFFF) -Size 12: 6,12 GOOD (HHFFFF) -Size 13: 7,13 GOOD (HHFFFF) -Size 14: 7,14 GOOD (HHFFFF) -Size 15: 8,15 GOOD (HHFFFF) -Size 16: 8,16 GOOD (HHFFFF) -Size 17: 9,17 GOOD (HHFFFF) -Size 18: 9,18 GOOD (HHFFFF) -Size 19: 10,19 GOOD (HHFFFF) -Size 20: 10,20 GOOD (HHFFFF) -Size 21: 11,21 GOOD (HHFFFF) -Size 22: 11,22 GOOD (HHFFFF) -Size 23: 12,23 GOOD (HHFFFF) -Size 24: 12,24 GOOD (HHFFFF) -Size 25: 13,25 GOOD (HHFFFF) -Size 26: 13,26 GOOD (HHFFFF) -Size 27: 14,27 GOOD (HHFFFF) -Size 28: 14,28 GOOD (HHFFFF) -Size 29: 15,29 GOOD (HHFFFF) -Size 30: 15,30 GOOD (HHFFFF) -Size 31: 16,31 GOOD (HHFFFF) -Size 32: 16,32 GOOD (HHFFFF) -Size 33: 17,33 GOOD (HHFFFF) -Size 34: 17,34 GOOD (HHFFFF) -Size 35: 18,35 GOOD (HHFFFF) -Size 36: 18,36 GOOD (HHFFFF) -Size 37: 19,37 GOOD (HHFFFF) -Size 38: 19,38 GOOD (HHFFFF) -Size 39: 20,39 GOOD (HHFFFF) -Size 40: 20,40 GOOD (HHFFFF) -Size 41: 21,41 GOOD (HHFFFF) -Size 42: 21,42 GOOD (HHFFFF) -Size 43: 22,43 GOOD (HHFFFF) -Size 44: 22,44 GOOD (HHFFFF) -Size 45: 23,45 GOOD (HHFFFF) -Size 46: 23,46 GOOD (HHFFFF) -Size 47: 24,47 GOOD (HHFFFF) -Size 48: 24,48 GOOD (HHFFFF) -Size 49: 25,49 GOOD (HHFFFF) -Size 50: 25,50 GOOD (HHFFFF) -Size 51: 26,51 GOOD (HHFFFF) -Size 52: 26,52 GOOD (HHFFFF) -Size 53: 27,53 GOOD (HHFFFF) -Size 54: 27,54 GOOD (HHFFFF) -Size 55: 28,55 GOOD (HHFFFF) -Size 56: 28,56 GOOD (HHFFFF) -Size 57: 29,57 GOOD (HHFFFF) -Size 58: 29,58 GOOD (HHFFFF) -Size 59: 30,59 GOOD (HHFFFF) -Size 60: 30,60 GOOD (HHFFFF) -Size 61: 31,61 GOOD (HHFFFF) -Size 62: 31,62 GOOD (HHFFFF) -Size 63: 32,63 GOOD (HHFFFF) -Size 64: 32,64 GOOD (HHFFFF) -Size 65: 33,65 GOOD (HHFFFF) -Size 66: 33,66 GOOD (HHFFFF) -Size 67: 34,67 GOOD (HHFFFF) -Size 68: 34,68 GOOD (HHFFFF) -Size 69: 35,69 GOOD (HHFFFF) -Size 70: 35,70 GOOD (HHFFFF) -Size 71: 36,71 GOOD (HHFFFF) -Size 72: 36,72 GOOD (HHFFFF) -Size 73: 37,73 GOOD (HHFFFF) -Size 74: 37,74 GOOD (HHFFFF) -Size 75: 38,75 GOOD (HHFFFF) -Size 76: 38,76 GOOD (HHFFFF) -Size 77: 39,77 GOOD (HHFFFF) -Size 78: 39,78 GOOD (HHFFFF) -Size 79: 40,79 GOOD (HHFFFF) -Size 80: 40,80 GOOD (HHFFFF) -Size 81: 41,81 GOOD (HHFFFF) -Size 82: 41,82 GOOD (HHFFFF) -Size 83: 42,83 GOOD (HHFFFF) -Size 84: 42,84 GOOD (HHFFFF) -Size 85: 43,85 GOOD (HHFFFF) -Size 86: 43,86 GOOD (HHFFFF) -Size 87: 44,87 GOOD (HHFFFF) -Size 88: 44,88 GOOD (HHFFFF) -Size 89: 45,89 GOOD (HHFFFF) -Size 90: 45,90 GOOD (HHFFFF) -Size 91: 46,91 GOOD (HHFFFF) -Size 92: 46,92 GOOD (HHFFFF) -Size 93: 47,93 GOOD (HHFFFF) -Size 94: 47,94 GOOD (HHFFFF) -Size 95: 48,95 GOOD (HHFFFF) -Size 96: 48,96 GOOD (HHFFFF) -Size 97: 49,97 GOOD (HHFFFF) -Size 98: 49,98 GOOD (HHFFFF) -Size 99: 50,99 GOOD (HHFFFF) -Size 100: 50,100 GOOD (HHFFFF) diff --git a/node_modules/node-pty/deps/winpty/misc/Font-Report-June2016/MinimumWindowWidths.txt b/node_modules/node-pty/deps/winpty/misc/Font-Report-June2016/MinimumWindowWidths.txt deleted file mode 100644 index d5261d8..0000000 --- a/node_modules/node-pty/deps/winpty/misc/Font-Report-June2016/MinimumWindowWidths.txt +++ /dev/null @@ -1,16 +0,0 @@ -The narrowest allowed console window, in pixels, on a conventional (~96dpi) -monitor: - -(mode con: cols=40 lines=40) && SetFont.exe -face "Lucida Console" -h 1 && (ping -n 4 127.0.0.1 > NUL) && cls && GetConsolePos.exe && SetFont.exe -face "Lucida Console" -h 12 - -(mode con: cols=40 lines=40) && SetFont.exe -face "Lucida Console" -h 16 && (ping -n 4 127.0.0.1 > NUL) && cls && GetConsolePos.exe && SetFont.exe -face "Lucida Console" -h 12 - - sz1:px sz1:col sz16:px sz16:col -Vista: 124 104 137 10 -Windows 7: 132 112 147 11 -Windows 8: 140 120 147 11 -Windows 8.1: 140 120 147 11 -Windows 10 OLD: 136 116 147 11 -Windows 10 NEW: 136 103 136 10 - -I used build 14342 to test Windows 10. diff --git a/node_modules/node-pty/deps/winpty/misc/Font-Report-June2016/Results.txt b/node_modules/node-pty/deps/winpty/misc/Font-Report-June2016/Results.txt deleted file mode 100644 index 15a825c..0000000 --- a/node_modules/node-pty/deps/winpty/misc/Font-Report-June2016/Results.txt +++ /dev/null @@ -1,4 +0,0 @@ -As before, avoid odd sizes in favor of even sizes. - -It's curious that the Japanese font is handled so poorly, especially with -Windows 8 and later. diff --git a/node_modules/node-pty/deps/winpty/misc/Font-Report-June2016/Windows10SetFontBugginess.txt b/node_modules/node-pty/deps/winpty/misc/Font-Report-June2016/Windows10SetFontBugginess.txt deleted file mode 100644 index fef397a..0000000 --- a/node_modules/node-pty/deps/winpty/misc/Font-Report-June2016/Windows10SetFontBugginess.txt +++ /dev/null @@ -1,144 +0,0 @@ -Issues: - - - Starting with the 14342 build, changing the font using - SetCurrentConsoleFontEx does not affect the window size. e.g. The content - itself will resize/redraw, but the window neither shrinks nor expands. - Presumably this is an oversight? It's almost a convenience; if a program - is going to resize the window anyway, then it's nice that the window size - contraints don't get in the way. Ordinarily, changing the font doesn't just - change the window size in pixels--it can also change the size as measured in - rows and columns. - - - (Aside: in the 14342 build, there is also a bug with wmic.exe. Open a console - with more than 300 lines of screen buffer, then fill those lines with, e.g., - dir /s. Then run wmic.exe. You won't be able to see the wmic.exe prompt. - If you query the screen buffer info somehow, you'll notice that the srWindow - is not contained within the dwSize. This breaks winpty's scraping, because - it's invalid.) - - - In build 14316, with the Japanese locale, with the 437 code page, attempting - to set the Consolas font instead sets the Terminal (raster) font. It seems - to pick an appropriate vertical size. - - - It seems necessary to specify "-family 0x36" for maximum reliability. - Setting the family to 0 almost always works, and specifying just -tt rarely - works. - -Win7 - English locale / 437 code page: - SetFont.exe -face Consolas -h 16 works - SetFont.exe -face Consolas -h 16 -tt selects Terminal font instead - SetFont.exe -face Consolas -h 16 -family 0x36 works - Japanese locale / 932 code page: - SetFont.exe -face Consolas -h 16 works - SetFont.exe -face Consolas -h 16 -tt selects Terminal font instead - SetFont.exe -face Consolas -h 16 -family 0x36 works - Japanese locale / 437 code page: - SetFont.exe -face Consolas -h 16 works - SetFont.exe -face Consolas -h 16 -tt unreliable - SetFont.exe -face Consolas -h 16 -family 0x36 works - -Win10 Build 10586 - New console - Japanese locale / 437 code page: - SetFont.exe -face Consolas -h 16 works - SetFont.exe -face Consolas -h 16 -tt selects Terminal instead - SetFont.exe -face Consolas -h 16 -family 0x36 works - -Win10 Build 14316 - Old console - English locale / 437 code page: - SetFont.exe -face Consolas -h 16 works - SetFont.exe -face Consolas -h 16 -tt selects Terminal font instead - SetFont.exe -face Consolas -h 16 -family 0x36 works - Japanese locale / 932 code page: - SetFont.exe -face Consolas -h 16 works - SetFont.exe -face Consolas -h 16 -tt selects Terminal font instead - SetFont.exe -face Consolas -h 16 -family 0x36 works - Japanese locale / 437 code page: - SetFont.exe -face Consolas -h 16 works - SetFont.exe -face Consolas -h 16 -tt selected very small Consolas font - SetFont.exe -face Consolas -h 16 -family 0x36 works - New console - English locale / 437 code page: - SetFont.exe -face Consolas -h 16 works - SetFont.exe -face Consolas -h 16 -tt works - SetFont.exe -face Consolas -h 16 -family 0x36 works - Japanese locale / 932 code page: - SetFont.exe -face Consolas -h 16 selects gothic instead - SetFont.exe -face Consolas -h 16 -tt selects gothic instead - SetFont.exe -face Consolas -h 16 -family 0x36 selects gothic instead - Japanese locale / 437 code page: - SetFont.exe -face Consolas -h 16 selects Terminal font instead - SetFont.exe -face Consolas -h 16 -tt selects Terminal font instead - SetFont.exe -face Consolas -h 16 -family 0x36(*) selects Terminal font instead - -Win10 Build 14342 - Old Console - English locale / 437 code page: - SetFont.exe -face Consolas -h 16 works - SetFont.exe -face Consolas -h 16 -tt selects Terminal font instead - SetFont.exe -face Consolas -h 16 -family 0x36 works - Japanese locale / 932 code page: - SetFont.exe -face Consolas -h 16 works - SetFont.exe -face Consolas -h 16 -tt selects Terminal font instead - SetFont.exe -face Consolas -h 16 -family 0x36 works - Japanese locale / 437 code page: - SetFont.exe -face Consolas -h 16 works - SetFont.exe -face Consolas -h 16 -tt selects Terminal font instead - SetFont.exe -face Consolas -h 16 -family 0x36 works - New console - English locale / 437 code page: - SetFont.exe -face Consolas -h 16 works - SetFont.exe -face Consolas -h 16 -tt works - SetFont.exe -face Consolas -h 16 -family 0x36 works - Japanese locale / 932 code page: - SetFont.exe -face Consolas -h 16 selects gothic instead - SetFont.exe -face Consolas -h 16 -tt selects gothic instead - SetFont.exe -face Consolas -h 16 -family 0x36 selects gothic instead - Japanese locale / 437 code page: - SetFont.exe -face Consolas -h 16 selects Terminal font instead - SetFont.exe -face Consolas -h 16 -tt works - SetFont.exe -face Consolas -h 16 -family 0x36 works - -(*) I was trying to figure out whether the inconsistency was at when I stumbled -onto this completely unexpected bug. Here's more detail: - - F:\>SetFont.exe -face Consolas -h 16 -family 0x36 -weight normal -w 8 - Setting to: nFont=0 dwFontSize=(8,16) FontFamily=0x36 FontWeight=400 FaceName="Consolas" - SetCurrentConsoleFontEx returned 1 - - F:\>GetFont.exe - largestConsoleWindowSize=(96,50) - maxWnd=0: nFont=0 dwFontSize=(12,16) FontFamily=0x30 FontWeight=400 FaceName=Terminal (54 65 72 6D 69 6E 61 6C) - maxWnd=1: nFont=0 dwFontSize=(96,25) FontFamily=0x30 FontWeight=400 FaceName=Terminal (54 65 72 6D 69 6E 61 6C) - 00-00: 12x16 - GetNumberOfConsoleFonts returned 0 - CP=437 OutputCP=437 - - F:\>SetFont.exe -face "Lucida Console" -h 16 -family 0x36 -weight normal - Setting to: nFont=0 dwFontSize=(0,16) FontFamily=0x36 FontWeight=400 FaceName="Lucida Console" - SetCurrentConsoleFontEx returned 1 - - F:\>GetFont.exe - largestConsoleWindowSize=(96,50) - maxWnd=0: nFont=0 dwFontSize=(12,16) FontFamily=0x30 FontWeight=400 FaceName=Terminal (54 65 72 6D 69 6E 61 6C) - maxWnd=1: nFont=0 dwFontSize=(96,25) FontFamily=0x30 FontWeight=400 FaceName=Terminal (54 65 72 6D 69 6E 61 6C) - 00-00: 12x16 - GetNumberOfConsoleFonts returned 0 - CP=437 OutputCP=437 - - F:\>SetFont.exe -face "Lucida Console" -h 12 -family 0x36 -weight normal - Setting to: nFont=0 dwFontSize=(0,12) FontFamily=0x36 FontWeight=400 FaceName="Lucida Console" - SetCurrentConsoleFontEx returned 1 - - F:\>GetFont.exe - largestConsoleWindowSize=(230,66) - maxWnd=0: nFont=0 dwFontSize=(5,12) FontFamily=0x30 FontWeight=400 FaceName=Terminal (54 65 72 6D 69 6E 61 6C) - maxWnd=1: nFont=0 dwFontSize=(116,36) FontFamily=0x30 FontWeight=400 FaceName=Terminal (54 65 72 6D 69 6E 61 6C) - 00-00: 5x12 - GetNumberOfConsoleFonts returned 0 - CP=437 OutputCP=437 - -Even attempting to set to a Lucida Console / Consolas font from the Console -properties dialog fails. diff --git a/node_modules/node-pty/deps/winpty/misc/FontSurvey.cc b/node_modules/node-pty/deps/winpty/misc/FontSurvey.cc deleted file mode 100644 index 254bcc8..0000000 --- a/node_modules/node-pty/deps/winpty/misc/FontSurvey.cc +++ /dev/null @@ -1,100 +0,0 @@ -#include - -#include -#include -#include - -#include - -#include "TestUtil.cc" - -#define COUNT_OF(array) (sizeof(array) / sizeof((array)[0])) - -// See https://en.wikipedia.org/wiki/List_of_CJK_fonts -const wchar_t kMSGothic[] = { 0xff2d, 0xff33, 0x0020, 0x30b4, 0x30b7, 0x30c3, 0x30af, 0 }; // Japanese -const wchar_t kNSimSun[] = { 0x65b0, 0x5b8b, 0x4f53, 0 }; // Simplified Chinese -const wchar_t kMingLight[] = { 0x7d30, 0x660e, 0x9ad4, 0 }; // Traditional Chinese -const wchar_t kGulimChe[] = { 0xad74, 0xb9bc, 0xccb4, 0 }; // Korean - -std::vector condense(const std::vector &buf) { - std::vector ret; - size_t i = 0; - while (i < buf.size()) { - if (buf[i].Char.UnicodeChar == L' ' && - ((buf[i].Attributes & 0x300) == 0)) { - // end of line - break; - } else if (i + 1 < buf.size() && - ((buf[i].Attributes & 0x300) == 0x100) && - ((buf[i + 1].Attributes & 0x300) == 0x200) && - buf[i].Char.UnicodeChar != L' ' && - buf[i].Char.UnicodeChar == buf[i + 1].Char.UnicodeChar) { - // double-width - ret.push_back(true); - i += 2; - } else if ((buf[i].Attributes & 0x300) == 0) { - // single-width - ret.push_back(false); - i++; - } else { - ASSERT(false && "unexpected output"); - } - } - return ret; -} - -int main(int argc, char *argv[]) { - if (argc != 2) { - printf("Usage: %s \"arguments for SetFont.exe\"\n", argv[0]); - return 1; - } - - const char *setFontArgs = argv[1]; - - const wchar_t testLine[] = { 0xA2, 0xA3, 0x2014, 0x3044, 0x30FC, 0x4000, 0 }; - const HANDLE conout = openConout(); - - char setFontCmd[1024]; - for (int h = 1; h <= 100; ++h) { - sprintf(setFontCmd, ".\\SetFont.exe %s -h %d && cls", setFontArgs, h); - system(setFontCmd); - - CONSOLE_FONT_INFOEX infoex = {}; - infoex.cbSize = sizeof(infoex); - BOOL success = GetCurrentConsoleFontEx(conout, FALSE, &infoex); - ASSERT(success && "GetCurrentConsoleFontEx failed"); - - DWORD actual = 0; - success = WriteConsoleW(conout, testLine, wcslen(testLine), &actual, nullptr); - ASSERT(success && actual == wcslen(testLine)); - - std::vector readBuf(14); - const SMALL_RECT readRegion = {0, 0, static_cast(readBuf.size() - 1), 0}; - SMALL_RECT readRegion2 = readRegion; - success = ReadConsoleOutputW( - conout, readBuf.data(), - {static_cast(readBuf.size()), 1}, - {0, 0}, - &readRegion2); - ASSERT(success && !memcmp(&readRegion, &readRegion2, sizeof(readRegion))); - - const auto widths = condense(readBuf); - std::string widthsStr; - for (bool width : widths) { - widthsStr.append(width ? "F" : "H"); - } - char size[16]; - sprintf(size, "%d,%d", infoex.dwFontSize.X, infoex.dwFontSize.Y); - const char *status = ""; - if (widthsStr == "HHFFFF") { - status = "GOOD"; - } else if (widthsStr == "HHHFFF") { - status = "OK"; - } else { - status = "BAD"; - } - trace("Size %3d: %-7s %-4s (%s)", h, size, status, widthsStr.c_str()); - } - sprintf(setFontCmd, ".\\SetFont.exe %s -h 14", setFontArgs); - system(setFontCmd); -} diff --git a/node_modules/node-pty/deps/winpty/misc/FormatChar.h b/node_modules/node-pty/deps/winpty/misc/FormatChar.h deleted file mode 100644 index aade488..0000000 --- a/node_modules/node-pty/deps/winpty/misc/FormatChar.h +++ /dev/null @@ -1,21 +0,0 @@ -#include -#include -#include - -static inline void formatChar(char *str, char ch) -{ - // Print some common control codes. - switch (ch) { - case '\r': strcpy(str, "CR "); break; - case '\n': strcpy(str, "LF "); break; - case ' ': strcpy(str, "SP "); break; - case 27: strcpy(str, "^[ "); break; - case 3: strcpy(str, "^C "); break; - default: - if (isgraph(ch)) - sprintf(str, "%c ", ch); - else - sprintf(str, "%02x ", ch); - break; - } -} diff --git a/node_modules/node-pty/deps/winpty/misc/FreezePerfTest.cc b/node_modules/node-pty/deps/winpty/misc/FreezePerfTest.cc deleted file mode 100644 index 2c0b008..0000000 --- a/node_modules/node-pty/deps/winpty/misc/FreezePerfTest.cc +++ /dev/null @@ -1,62 +0,0 @@ -#include - -#include "TestUtil.cc" - -const int SC_CONSOLE_MARK = 0xFFF2; -const int SC_CONSOLE_SELECT_ALL = 0xFFF5; - -int main(int argc, char *argv[0]) { - - if (argc != 2) { - printf("Usage: %s (mark|selectall|read)\n", argv[0]); - return 1; - } - - enum class Test { Mark, SelectAll, Read } test; - if (!strcmp(argv[1], "mark")) { - test = Test::Mark; - } else if (!strcmp(argv[1], "selectall")) { - test = Test::SelectAll; - } else if (!strcmp(argv[1], "read")) { - test = Test::Read; - } else { - printf("Invalid test: %s\n", argv[1]); - return 1; - } - - HANDLE conout = GetStdHandle(STD_OUTPUT_HANDLE); - TimeMeasurement tm; - HWND hwnd = GetConsoleWindow(); - - setWindowPos(0, 0, 1, 1); - setBufferSize(100, 3000); - system("cls"); - setWindowPos(0, 2975, 100, 25); - setCursorPos(0, 2999); - - ShowWindow(hwnd, SW_HIDE); - - for (int i = 0; i < 1000; ++i) { - // CONSOLE_SCREEN_BUFFER_INFO info = {}; - // GetConsoleScreenBufferInfo(conout, &info); - - if (test == Test::Mark) { - SendMessage(hwnd, WM_SYSCOMMAND, SC_CONSOLE_MARK, 0); - SendMessage(hwnd, WM_CHAR, 27, 0x00010001); - } else if (test == Test::SelectAll) { - SendMessage(hwnd, WM_SYSCOMMAND, SC_CONSOLE_SELECT_ALL, 0); - SendMessage(hwnd, WM_CHAR, 27, 0x00010001); - } else if (test == Test::Read) { - static CHAR_INFO buffer[100 * 3000]; - const SMALL_RECT readRegion = {0, 0, 99, 2999}; - SMALL_RECT tmp = readRegion; - BOOL ret = ReadConsoleOutput(conout, buffer, {100, 3000}, {0, 0}, &tmp); - ASSERT(ret && !memcmp(&tmp, &readRegion, sizeof(tmp))); - } - } - - ShowWindow(hwnd, SW_SHOW); - - printf("elapsed: %f\n", tm.elapsed()); - return 0; -} diff --git a/node_modules/node-pty/deps/winpty/misc/GetCh.cc b/node_modules/node-pty/deps/winpty/misc/GetCh.cc deleted file mode 100644 index cd6ed19..0000000 --- a/node_modules/node-pty/deps/winpty/misc/GetCh.cc +++ /dev/null @@ -1,20 +0,0 @@ -#include -#include -#include - -int main() { - printf("\nPress any keys -- Ctrl-D exits\n\n"); - - while (true) { - const int ch = getch(); - printf("0x%x", ch); - if (isgraph(ch)) { - printf(" '%c'", ch); - } - printf("\n"); - if (ch == 0x4) { // Ctrl-D - break; - } - } - return 0; -} diff --git a/node_modules/node-pty/deps/winpty/misc/GetConsolePos.cc b/node_modules/node-pty/deps/winpty/misc/GetConsolePos.cc deleted file mode 100644 index 1f3cc53..0000000 --- a/node_modules/node-pty/deps/winpty/misc/GetConsolePos.cc +++ /dev/null @@ -1,41 +0,0 @@ -#include - -#include - -#include "TestUtil.cc" - -int main() { - const HANDLE conout = openConout(); - - CONSOLE_SCREEN_BUFFER_INFO info = {}; - BOOL ret = GetConsoleScreenBufferInfo(conout, &info); - ASSERT(ret && "GetConsoleScreenBufferInfo failed"); - - trace("cursor=%d,%d", info.dwCursorPosition.X, info.dwCursorPosition.Y); - printf("cursor=%d,%d\n", info.dwCursorPosition.X, info.dwCursorPosition.Y); - - trace("srWindow={L=%d,T=%d,R=%d,B=%d}", info.srWindow.Left, info.srWindow.Top, info.srWindow.Right, info.srWindow.Bottom); - printf("srWindow={L=%d,T=%d,R=%d,B=%d}\n", info.srWindow.Left, info.srWindow.Top, info.srWindow.Right, info.srWindow.Bottom); - - trace("dwSize=%d,%d", info.dwSize.X, info.dwSize.Y); - printf("dwSize=%d,%d\n", info.dwSize.X, info.dwSize.Y); - - const HWND hwnd = GetConsoleWindow(); - if (hwnd != NULL) { - RECT r = {}; - if (GetWindowRect(hwnd, &r)) { - const int w = r.right - r.left; - const int h = r.bottom - r.top; - trace("hwnd: pos=(%d,%d) size=(%d,%d)", r.left, r.top, w, h); - printf("hwnd: pos=(%d,%d) size=(%d,%d)\n", r.left, r.top, w, h); - } else { - trace("GetWindowRect failed"); - printf("GetWindowRect failed\n"); - } - } else { - trace("GetConsoleWindow returned NULL"); - printf("GetConsoleWindow returned NULL\n"); - } - - return 0; -} diff --git a/node_modules/node-pty/deps/winpty/misc/GetFont.cc b/node_modules/node-pty/deps/winpty/misc/GetFont.cc deleted file mode 100644 index 3862531..0000000 --- a/node_modules/node-pty/deps/winpty/misc/GetFont.cc +++ /dev/null @@ -1,261 +0,0 @@ -#include -#include -#include -#include - -#include "../src/shared/OsModule.h" -#include "../src/shared/StringUtil.h" - -#include "TestUtil.cc" -#include "../src/shared/StringUtil.cc" - -#define COUNT_OF(x) (sizeof(x) / sizeof((x)[0])) - -// Some of these types and functions are missing from the MinGW headers. -// Others are undocumented. - -struct AGENT_CONSOLE_FONT_INFO { - DWORD nFont; - COORD dwFontSize; -}; - -struct AGENT_CONSOLE_FONT_INFOEX { - ULONG cbSize; - DWORD nFont; - COORD dwFontSize; - UINT FontFamily; - UINT FontWeight; - WCHAR FaceName[LF_FACESIZE]; -}; - -// undocumented XP API -typedef BOOL WINAPI SetConsoleFont_t( - HANDLE hOutput, - DWORD dwFontIndex); - -// undocumented XP API -typedef DWORD WINAPI GetNumberOfConsoleFonts_t(); - -// XP and up -typedef BOOL WINAPI GetCurrentConsoleFont_t( - HANDLE hOutput, - BOOL bMaximumWindow, - AGENT_CONSOLE_FONT_INFO *lpConsoleCurrentFont); - -// XP and up -typedef COORD WINAPI GetConsoleFontSize_t( - HANDLE hConsoleOutput, - DWORD nFont); - -// Vista and up -typedef BOOL WINAPI GetCurrentConsoleFontEx_t( - HANDLE hConsoleOutput, - BOOL bMaximumWindow, - AGENT_CONSOLE_FONT_INFOEX *lpConsoleCurrentFontEx); - -// Vista and up -typedef BOOL WINAPI SetCurrentConsoleFontEx_t( - HANDLE hConsoleOutput, - BOOL bMaximumWindow, - AGENT_CONSOLE_FONT_INFOEX *lpConsoleCurrentFontEx); - -#define GET_MODULE_PROC(mod, funcName) \ - m_##funcName = reinterpret_cast((mod).proc(#funcName)); \ - -#define DEFINE_ACCESSOR(funcName) \ - funcName##_t &funcName() const { \ - ASSERT(valid()); \ - return *m_##funcName; \ - } - -class XPFontAPI { -public: - XPFontAPI() : m_kernel32(L"kernel32.dll") { - GET_MODULE_PROC(m_kernel32, GetCurrentConsoleFont); - GET_MODULE_PROC(m_kernel32, GetConsoleFontSize); - } - - bool valid() const { - return m_GetCurrentConsoleFont != NULL && - m_GetConsoleFontSize != NULL; - } - - DEFINE_ACCESSOR(GetCurrentConsoleFont) - DEFINE_ACCESSOR(GetConsoleFontSize) - -private: - OsModule m_kernel32; - GetCurrentConsoleFont_t *m_GetCurrentConsoleFont; - GetConsoleFontSize_t *m_GetConsoleFontSize; -}; - -class UndocumentedXPFontAPI : public XPFontAPI { -public: - UndocumentedXPFontAPI() : m_kernel32(L"kernel32.dll") { - GET_MODULE_PROC(m_kernel32, SetConsoleFont); - GET_MODULE_PROC(m_kernel32, GetNumberOfConsoleFonts); - } - - bool valid() const { - return this->XPFontAPI::valid() && - m_SetConsoleFont != NULL && - m_GetNumberOfConsoleFonts != NULL; - } - - DEFINE_ACCESSOR(SetConsoleFont) - DEFINE_ACCESSOR(GetNumberOfConsoleFonts) - -private: - OsModule m_kernel32; - SetConsoleFont_t *m_SetConsoleFont; - GetNumberOfConsoleFonts_t *m_GetNumberOfConsoleFonts; -}; - -class VistaFontAPI : public XPFontAPI { -public: - VistaFontAPI() : m_kernel32(L"kernel32.dll") { - GET_MODULE_PROC(m_kernel32, GetCurrentConsoleFontEx); - GET_MODULE_PROC(m_kernel32, SetCurrentConsoleFontEx); - } - - bool valid() const { - return this->XPFontAPI::valid() && - m_GetCurrentConsoleFontEx != NULL && - m_SetCurrentConsoleFontEx != NULL; - } - - DEFINE_ACCESSOR(GetCurrentConsoleFontEx) - DEFINE_ACCESSOR(SetCurrentConsoleFontEx) - -private: - OsModule m_kernel32; - GetCurrentConsoleFontEx_t *m_GetCurrentConsoleFontEx; - SetCurrentConsoleFontEx_t *m_SetCurrentConsoleFontEx; -}; - -static std::vector > readFontTable( - XPFontAPI &api, HANDLE conout, DWORD maxCount) { - std::vector > ret; - for (DWORD i = 0; i < maxCount; ++i) { - COORD size = api.GetConsoleFontSize()(conout, i); - if (size.X == 0 && size.Y == 0) { - break; - } - ret.push_back(std::make_pair(i, size)); - } - return ret; -} - -static void dumpFontTable(HANDLE conout) { - const int kMaxCount = 1000; - XPFontAPI api; - if (!api.valid()) { - printf("dumpFontTable: cannot dump font table -- missing APIs\n"); - return; - } - std::vector > table = - readFontTable(api, conout, kMaxCount); - std::string line; - char tmp[128]; - size_t first = 0; - while (first < table.size()) { - size_t last = std::min(table.size() - 1, first + 10 - 1); - winpty_snprintf(tmp, "%02u-%02u:", - static_cast(first), static_cast(last)); - line = tmp; - for (size_t i = first; i <= last; ++i) { - if (i % 10 == 5) { - line += " - "; - } - winpty_snprintf(tmp, " %2dx%-2d", - table[i].second.X, table[i].second.Y); - line += tmp; - } - printf("%s\n", line.c_str()); - first = last + 1; - } - if (table.size() == kMaxCount) { - printf("... stopped reading at %d fonts ...\n", kMaxCount); - } -} - -static std::string stringToCodePoints(const std::wstring &str) { - std::string ret = "("; - for (size_t i = 0; i < str.size(); ++i) { - char tmp[32]; - winpty_snprintf(tmp, "%X", str[i]); - if (ret.size() > 1) { - ret.push_back(' '); - } - ret += tmp; - } - ret.push_back(')'); - return ret; -} - -static void dumpFontInfoEx( - const AGENT_CONSOLE_FONT_INFOEX &infoex) { - std::wstring faceName(infoex.FaceName, - winpty_wcsnlen(infoex.FaceName, COUNT_OF(infoex.FaceName))); - cprintf(L"nFont=%u dwFontSize=(%d,%d) " - "FontFamily=0x%x FontWeight=%u FaceName=%ls %hs\n", - static_cast(infoex.nFont), - infoex.dwFontSize.X, infoex.dwFontSize.Y, - infoex.FontFamily, infoex.FontWeight, faceName.c_str(), - stringToCodePoints(faceName).c_str()); -} - -static void dumpVistaFont(VistaFontAPI &api, HANDLE conout, BOOL maxWindow) { - AGENT_CONSOLE_FONT_INFOEX infoex = {0}; - infoex.cbSize = sizeof(infoex); - if (!api.GetCurrentConsoleFontEx()(conout, maxWindow, &infoex)) { - printf("GetCurrentConsoleFontEx call failed\n"); - return; - } - dumpFontInfoEx(infoex); -} - -static void dumpXPFont(XPFontAPI &api, HANDLE conout, BOOL maxWindow) { - AGENT_CONSOLE_FONT_INFO info = {0}; - if (!api.GetCurrentConsoleFont()(conout, maxWindow, &info)) { - printf("GetCurrentConsoleFont call failed\n"); - return; - } - printf("nFont=%u dwFontSize=(%d,%d)\n", - static_cast(info.nFont), - info.dwFontSize.X, info.dwFontSize.Y); -} - -static void dumpFontAndTable(HANDLE conout) { - VistaFontAPI vista; - if (vista.valid()) { - printf("maxWnd=0: "); dumpVistaFont(vista, conout, FALSE); - printf("maxWnd=1: "); dumpVistaFont(vista, conout, TRUE); - dumpFontTable(conout); - return; - } - UndocumentedXPFontAPI xp; - if (xp.valid()) { - printf("maxWnd=0: "); dumpXPFont(xp, conout, FALSE); - printf("maxWnd=1: "); dumpXPFont(xp, conout, TRUE); - dumpFontTable(conout); - return; - } - printf("setSmallFont: neither Vista nor XP APIs detected -- giving up\n"); - dumpFontTable(conout); -} - -int main() { - const HANDLE conout = openConout(); - const COORD largest = GetLargestConsoleWindowSize(conout); - printf("largestConsoleWindowSize=(%d,%d)\n", largest.X, largest.Y); - dumpFontAndTable(conout); - UndocumentedXPFontAPI xp; - if (xp.valid()) { - printf("GetNumberOfConsoleFonts returned %u\n", xp.GetNumberOfConsoleFonts()()); - } else { - printf("The GetNumberOfConsoleFonts API was missing\n"); - } - printf("CP=%u OutputCP=%u\n", GetConsoleCP(), GetConsoleOutputCP()); - return 0; -} diff --git a/node_modules/node-pty/deps/winpty/misc/IdentifyConsoleWindow.ps1 b/node_modules/node-pty/deps/winpty/misc/IdentifyConsoleWindow.ps1 deleted file mode 100644 index 0c48859..0000000 --- a/node_modules/node-pty/deps/winpty/misc/IdentifyConsoleWindow.ps1 +++ /dev/null @@ -1,51 +0,0 @@ -# -# Usage: powershell \IdentifyConsoleWindow.ps1 -# -# This script determines whether the process has a console attached, whether -# that console has a non-NULL window (e.g. HWND), and whether the window is on -# the current window station. -# - -$signature = @' -[DllImport("kernel32.dll", SetLastError=true)] -public static extern IntPtr GetConsoleWindow(); - -[DllImport("kernel32.dll", CharSet=CharSet.Auto, SetLastError=true)] -public static extern bool SetConsoleTitle(String title); - -[DllImport("user32.dll", CharSet=CharSet.Auto, SetLastError=true)] -public static extern int GetWindowText(IntPtr hWnd, - System.Text.StringBuilder lpString, - int nMaxCount); -'@ - -$WinAPI = Add-Type -MemberDefinition $signature ` - -Name WinAPI -Namespace IdentifyConsoleWindow -PassThru - -if (!$WinAPI::SetConsoleTitle("ConsoleWindowScript")) { - echo "error: could not change console title -- is a console attached?" - exit 1 -} else { - echo "note: successfully set console title to ""ConsoleWindowScript""." -} - -$hwnd = $WinAPI::GetConsoleWindow() -if ($hwnd -eq 0) { - echo "note: GetConsoleWindow returned NULL." -} else { - echo "note: GetConsoleWindow returned 0x$($hwnd.ToString("X"))." - $sb = New-Object System.Text.StringBuilder -ArgumentList 4096 - if ($WinAPI::GetWindowText($hwnd, $sb, $sb.Capacity)) { - $title = $sb.ToString() - echo "note: GetWindowText returned ""${title}""." - if ($title -eq "ConsoleWindowScript") { - echo "success!" - } else { - echo "error: expected to see ""ConsoleWindowScript""." - echo " (Perhaps the console window is on a different window station?)" - } - } else { - echo "error: GetWindowText could not read the window title." - echo " (Perhaps the console window is on a different window station?)" - } -} diff --git a/node_modules/node-pty/deps/winpty/misc/IsNewConsole.cc b/node_modules/node-pty/deps/winpty/misc/IsNewConsole.cc deleted file mode 100644 index 2b554c7..0000000 --- a/node_modules/node-pty/deps/winpty/misc/IsNewConsole.cc +++ /dev/null @@ -1,87 +0,0 @@ -// Determines whether this is a new console by testing whether MARK moves the -// cursor. -// -// WARNING: This test program may behave erratically if run under winpty. -// - -#include - -#include -#include - -#include "TestUtil.cc" - -const int SC_CONSOLE_MARK = 0xFFF2; -const int SC_CONSOLE_SELECT_ALL = 0xFFF5; - -static COORD getWindowPos(HANDLE conout) { - CONSOLE_SCREEN_BUFFER_INFO info = {}; - BOOL ret = GetConsoleScreenBufferInfo(conout, &info); - ASSERT(ret && "GetConsoleScreenBufferInfo failed"); - return { info.srWindow.Left, info.srWindow.Top }; -} - -static COORD getWindowSize(HANDLE conout) { - CONSOLE_SCREEN_BUFFER_INFO info = {}; - BOOL ret = GetConsoleScreenBufferInfo(conout, &info); - ASSERT(ret && "GetConsoleScreenBufferInfo failed"); - return { - static_cast(info.srWindow.Right - info.srWindow.Left + 1), - static_cast(info.srWindow.Bottom - info.srWindow.Top + 1) - }; -} - -static COORD getCursorPos(HANDLE conout) { - CONSOLE_SCREEN_BUFFER_INFO info = {}; - BOOL ret = GetConsoleScreenBufferInfo(conout, &info); - ASSERT(ret && "GetConsoleScreenBufferInfo failed"); - return info.dwCursorPosition; -} - -static void setCursorPos(HANDLE conout, COORD pos) { - BOOL ret = SetConsoleCursorPosition(conout, pos); - ASSERT(ret && "SetConsoleCursorPosition failed"); -} - -int main() { - const HANDLE conout = openConout(); - const HWND hwnd = GetConsoleWindow(); - ASSERT(hwnd != NULL && "GetConsoleWindow() returned NULL"); - - // With the legacy console, the Mark command moves the the cursor to the - // top-left cell of the visible console window. Determine whether this - // is the new console by seeing if the cursor moves. - - const auto windowSize = getWindowSize(conout); - if (windowSize.X <= 1) { - printf("Error: console window must be at least 2 columns wide\n"); - trace("Error: console window must be at least 2 columns wide"); - return 1; - } - - bool cursorMoved = false; - const auto initialPos = getCursorPos(conout); - - const auto windowPos = getWindowPos(conout); - setCursorPos(conout, { static_cast(windowPos.X + 1), windowPos.Y }); - - { - const auto posA = getCursorPos(conout); - SendMessage(hwnd, WM_SYSCOMMAND, SC_CONSOLE_MARK, 0); - const auto posB = getCursorPos(conout); - cursorMoved = memcmp(&posA, &posB, sizeof(posA)) != 0; - SendMessage(hwnd, WM_CHAR, 27, 0x00010001); // Send ESCAPE - } - - setCursorPos(conout, initialPos); - - if (cursorMoved) { - printf("Legacy console (i.e. MARK moved cursor)\n"); - trace("Legacy console (i.e. MARK moved cursor)"); - } else { - printf("Windows 10 new console (i.e MARK did not move cursor)\n"); - trace("Windows 10 new console (i.e MARK did not move cursor)"); - } - - return 0; -} diff --git a/node_modules/node-pty/deps/winpty/misc/MouseInputNotes.txt b/node_modules/node-pty/deps/winpty/misc/MouseInputNotes.txt deleted file mode 100644 index 18460c6..0000000 --- a/node_modules/node-pty/deps/winpty/misc/MouseInputNotes.txt +++ /dev/null @@ -1,90 +0,0 @@ -Introduction -============ - -The only specification I could find describing mouse input escape sequences -was the /usr/share/doc/xterm/ctlseqs.txt.gz file installed on my Ubuntu -machine. - -Here are the relevant escape sequences: - - * [ON] CSI '?' M 'h' Enable mouse input mode M - * [OFF] CSI '?' M 'l' Disable mouse input mode M - * [EVT] CSI 'M' F X Y Mouse event (default or mode 1005) - * [EVT6] CSI '<' F ';' X ';' Y 'M' Mouse event with mode 1006 - * [EVT6] CSI '<' F ';' X ';' Y 'm' Mouse event with mode 1006 (up) - * [EVT15] CSI F ';' X ';' Y 'M' Mouse event with mode 1015 - -The first batch of modes affect what events are reported: - - * 9: Presses only (not as well-supported as the other modes) - * 1000: Presses and releases - * 1002: Presses, releases, and moves-while-pressed - * 1003: Presses, releases, and all moves - -The next batch of modes affect the encoding of the mouse events: - - * 1005: The X and Y coordinates are UTF-8 codepoints rather than bytes. - * 1006: Use the EVT6 sequences instead of EVT - * 1015: Use the EVT15 sequence instead of EVT (aka URVXT-mode) - -Support for modes in existing terminals -======================================= - - | 9 1000 1002 1003 | 1004 | overflow | defhi | 1005 1006 1015 ----------------------------------+---------------------+------+--------------+-------+---------------- -Eclipse TM Terminal (Neon) | _ _ _ _ | _ | n/a | n/a | _ _ _ -gnome-terminal 3.6.2 | X X X X | _ | suppressed*b | 0x07 | _ X X -iTerm2 2.1.4 | _ X X X | OI | wrap*z | n/a | X X X -jediterm/IntelliJ | _ X X X | _ | ch='?' | 0xff | X X X -Konsole 2.13.2 | _ X X *a | _ | suppressed | 0xff | X X X -mintty 2.2.2 | X X X X | OI | ch='\0' | 0xff | X X X -putty 0.66 | _ X X _ | _ | suppressed | 0xff | _ X X -rxvt 2.7.10 | X X _ _ | _ | wrap*z | n/a | _ _ _ -screen(under xterm) | X X X X | _ | suppressed | 0xff | _ _ _ -urxvt 9.21 | X X X X | _ | wrap*z | n/a | X _ X -xfce4-terminal 0.6.3 (GTK2 VTE) | X X X X | _ | wrap | n/a | _ _ _ -xterm | X X X X | OI | ch='\0' | 0xff | X X X - -*a: Mode 1003 is handled the same way as 1002. -*b: The coordinate wraps from 0xff to 0x00, then maxs out at 0x07. I'm - guessing this behavior is a bug? I'm using the Xubuntu 14.04 - gnome-terminal. -*z: These terminals have a bug where column 224 (and row 224, presumably) - yields a truncated escape sequence. 224 + 32 is 0, so it would normally - yield `CSI 'M' F '\0' Y`, but the '\0' is interpreted as a NUL-terminator. - -Problem 1: How do these flags work? -=================================== - -Terminals accept the OFF sequence with any of the input modes. This makes -little sense--there are two multi-value settings, not seven independent flags! - -All the terminals handle Granularity the same way. ON-Granularity sets -Granularity to the specified value, and OFF-Granularity sets Granularity to -OFF. - -Terminals vary in how they handle the Encoding modes. For example: - - * xterm. ON-Encoding sets Encoding. OFF-Encoding with a non-active Encoding - has no effect. OFF-Encoding otherwise resets Encoding to Default. - - * mintty (tested 2.2.2), iTerm2 2.1.4, and jediterm. ON-Encoding sets - Encoding. OFF-Encoding resets Encoding to Default. - - * Konsole (tested 2.13.2) seems to configure each encoding method - independently. The effective Encoding is the first enabled encoding in this - list: - - Mode 1006 - - Mode 1015 - - Mode 1005 - - Default - - * gnome-terminal (tested 3.6.2) also configures each encoding method - independently. The effective Encoding is the first enabled encoding in - this list: - - Mode 1006 - - Mode 1015 - - Default - Mode 1005 is not supported. - - * xfce4 terminal 0.6.3 (GTK2 VTE) always outputs the default encoding method. diff --git a/node_modules/node-pty/deps/winpty/misc/MoveConsoleWindow.cc b/node_modules/node-pty/deps/winpty/misc/MoveConsoleWindow.cc deleted file mode 100644 index 7d9684f..0000000 --- a/node_modules/node-pty/deps/winpty/misc/MoveConsoleWindow.cc +++ /dev/null @@ -1,34 +0,0 @@ -#include - -#include "TestUtil.cc" - -int main(int argc, char *argv[]) { - if (argc != 3 && argc != 5) { - printf("Usage: %s x y\n", argv[0]); - printf("Usage: %s x y width height\n", argv[0]); - return 1; - } - - HWND hwnd = GetConsoleWindow(); - - const int x = atoi(argv[1]); - const int y = atoi(argv[2]); - - int w = 0, h = 0; - if (argc == 3) { - RECT r = {}; - BOOL ret = GetWindowRect(hwnd, &r); - ASSERT(ret && "GetWindowRect failed on console window"); - w = r.right - r.left; - h = r.bottom - r.top; - } else { - w = atoi(argv[3]); - h = atoi(argv[4]); - } - - BOOL ret = MoveWindow(hwnd, x, y, w, h, TRUE); - trace("MoveWindow: ret=%d", ret); - printf("MoveWindow: ret=%d\n", ret); - - return 0; -} diff --git a/node_modules/node-pty/deps/winpty/misc/Notes.txt b/node_modules/node-pty/deps/winpty/misc/Notes.txt deleted file mode 100644 index 410e184..0000000 --- a/node_modules/node-pty/deps/winpty/misc/Notes.txt +++ /dev/null @@ -1,219 +0,0 @@ -Test programs -------------- - -Cygwin - emacs - vim - mc (Midnight Commander) - lynx - links - less - more - wget - -Capturing the console output ----------------------------- - -Initial idea: - -In the agent, keep track of the remote terminal state for N lines of -(window+history). Also keep track of the terminal size. Regularly poll for -changes to the console screen buffer, then use some number of edits to bring -the remote terminal into sync with the console. - -This idea seems to have trouble when a Unix terminal is resized. When the -server receives a resize notification, it can have a hard time figuring out -what the terminal did. Race conditions might also be a problem. - -The behavior of the terminal can be tricky: - - - When the window is expanded by one line, does the terminal add a blank line - to the bottom or move a line from the history into the top? - - - When the window is shrunk by one line, does the terminal delete the topmost - or the bottommost line? Can it delete the line with the cursor? - -Some popular behaviors for expanding: - - [all] If there are no history lines, then add a line at the bottom. - - [konsole] Always add a line at the bottom. - - [putty,xterm,rxvt] Pull in a history line from the top. - - [g-t] I can't tell. It seems to add a blank line, until the program writes - to stdout or until I click the scroll bar, then the output "snaps" back down, - pulling lines out of the history. I thought I saw different behavior - between Ubuntu 10.10 and 11.10, so maybe GNOME 3 changed something. Avoid - using "bash" to test this behavior because "bash" apparently always writes - the prompt after terminal resize. - -Some popular behaviors for shrinking: - - [konsole,putty,xterm,rxvt] If the line at the bottom is blank, then delete - it. Otherwise, move the topmost line into history. - - [g-t] If the line at the bottom has not been touched, then delete it. - Otherwise, move the topmost line into history. - -(TODO: I need to test my theories about the terminal behavior better still. -It's interesting to see how g-t handles clear differently than every other -terminal.) - -There is an ANSI escape sequence (DSR) that sends the current cursor location -to the terminal's input. One idea I had was to use this code to figure out how -the terminal had handled a resize. I currently think this idea won't work due -to race conditions. - -Newer idea: - -Keep track of the last N lines that have been sent to the remote terminal. -Poll for changes to console output. When the output changes, send just the -changed content to the terminal. In particular: - - Don't send a cursor position (CUP) code. Instead, if the line that's 3 - steps up from the latest line changes, send a relative cursor up (CUU) - code. It's OK to send an absolute column number code (CHA). - - At least in general, don't try to send complete screenshots of the current - console window. - -The idea is that sending just the changes should have good behavior for streams -of output, even when those streams modify the output (e.g. an archiver, or -maybe a downloader/packager/wget). I need to think about whether this works -for full-screen programs (e.g. emacs, less, lynx, the above list of programs). - -I noticed that console programs don't typically modify the window or buffer -coordinates. edit.com is an exception. - -I tested the pager in native Python (more?), and I verified that ENTER and SPACE -both paid no attention to the location of the console window within the screen -buffer. This makes sense -- why would they care? The Cygwin less, on the other -hand, does care. If I scroll the window up, then Cygwin less will write to a -position within the window. I didn't really expect this behavior, but it -doesn't seem to be a problem. - -Setting up a TestNetServer service ----------------------------------- - -First run the deploy.sh script to copy files into deploy. Make sure -TestNetServer.exe will run in a bare environment (no MinGW or Qt in the path). - -Install the Windows Server 2003 Resource Kit. It will have two programs in it, -instsrv and srvany. - -Run: - - InstSrv TestNetServer \srvany.exe - -This creates a service named "TestNetServer" that uses the Microsoft service -wrapper. To configure the new service to run TestNetServer, set a registry -value: - - [HKLM\SYSTEM\CurrentControlSet\Services\TestNetServer\Parameters] - Application=\TestNetServer.exe - -Also see http://www.iopus.com/guides/srvany.htm. - -To remove the service, run: - - InstSrv TestNetServer REMOVE - -TODO ----- - -Agent: When resizing the console, consider whether to add lines to the top -or bottom. I remember thinking the current behavior was wrong for some -application, but I forgot which one. - -Make the font as small as possible. The console window dimensions are limited by -the screen size, so making the font small reduces an unnecessary limitation on the -PseudoConsole size. There's a documented Vista/Win7 API for this -(SetCurrentConsoleFontEx), and apparently WinXP has an undocumented API -(SetConsoleFont): - http://blogs.microsoft.co.il/blogs/pavely/archive/2009/07/23/changing-console-fonts.aspx - -Make the agent work with DOS programs like edit and qbasic. - - Detect that the terminal program has resized the window/buffer and enter a - simple just-scrape-and-dont-resize mode. Track the client window size and - send the intersection of the console and the agent's client. - - I also need to generate keyboard scan codes. - - Solve the NTVDM.EXE console shutdown problem, probably by ignoring NTVDM.EXE - when it appears on the GetConsoleProcessList list. - -Rename the agent? Is the term "proxy" more accurate? - -Optimize the polling. e.g. Use a longer poll interval when the console is idle. -Do a minimal poll that checks whether the sync marker or window has moved. - -Increase the console buffer size to ~9000 lines. Beware making it so big that -reading the sync column exhausts the 32KB conhost<->agent heap. - -Reduce the memory overhead of the agent. The agent's m_bufferData array can -be small (a few hundred lines?) relative to the console buffer size. - -Try to handle console background color better. - Unix terminal emulators have a user-configurable foreground and background -color, and for best results, the agent really needs to avoid changing the colors, -especially the background color. It's undesirable/ugly to SSH into a machine -and see the command prompt change the colors. It's especially ugly that the -terminal retains its original colors and only drawn cells get the new colors. -(e.g. Resizing the window to the right uses the local terminal colors rather -than the remote colors.) It's especially ugly in gnome-terminal, which draws -user-configurable black as black, but VT100 black as dark-gray. - If there were a way to query the terminal emulator's colors, then I could -match the console's colors to the terminal and everything would just work. As -far as I know, that's not possible. - I thought of a kludge that might work. Instead of translating console white -and black to VT/100 white and black, I would translate them to "reset" and -"invert". I'd translate other colors normally. This approach should produce -ideal results for command-line work and tolerable results for full-screen -programs without configuration. Configuring the agent for black-on-white or -white-on-black would produce ideal results in all situations. - This kludge only really applies to the SSH application. For a Win32 Konsole -application, it should be easy to get the colors right all the time. - -Try using the screen reader API: - - To eliminate polling. - - To detect when a line wraps. When a line wraps, it'd be nice not to send a - CRLF to the terminal emulator so copy-and-paste works better. - - To detect hard tabs with Cygwin. - -Implement VT100/ANSI escape sequence recognition for input. Decide where this -functionality belongs. PseudoConsole.dll? Disambiguating ESC from an escape -sequence might be tricky. For the SSH server, I was thinking that when a small -SSH payload ended with an ESC character, I could assume the character was really -an ESC keypress, on the assumption that if it were an escape sequence, the -payload would probably contain the whole sequence. I'm not sure this works, -especially if there's a lot of other traffic multiplexed on the SSH socket. - -Support Unicode. - - Some DOS programs draw using line/box characters. Can these characters be - translated to the Unicode equivalents? - -Create automated tests. - -Experiment with the Terminator emulator, an emulator that doesn't wrap lines. -How many columns does it report having? What column does it report the cursor -in as it's writing past the right end of the window? Will Terminator be a -problem if I implement line wrapping detection in the agent? - -BUG: After the unix-adapter/pconsole.exe program exits, the blinking cursor is -replaced with a hidden cursor. - -Fix assert() in the agent. If it fails, the failure message needs to be -reported somewhere. Pop up a dialog box? Maybe switch the active desktop, -then show a dialog box? - -TODO: There's already a pconsole project on GitHub. Maybe rename this project -to something else? winpty? - -TODO: Can the DebugServer system be replaced with OutputDebugString? How -do we decide whose processes' output to collect? - -TODO: Three executables: - build/winpty-agent.exe - build/winpty.dll - build/console.exe - -BUG: Run the pconsole.exe inside another console. As I type dir, I see this: - D:\rprichard\pconsole> - D:\rprichard\pconsole>d - D:\rprichard\pconsole>di - D:\rprichard\pconsole>dir - In the output of "dir", every other line is blank. - There was a bug in Terminal::sendLine that was causing this to happen - frequently. Now that I fixed it, this bug should only manifest on lines - whose last column is not a space (i.e. a full line). diff --git a/node_modules/node-pty/deps/winpty/misc/OSVersion.cc b/node_modules/node-pty/deps/winpty/misc/OSVersion.cc deleted file mode 100644 index 456708f..0000000 --- a/node_modules/node-pty/deps/winpty/misc/OSVersion.cc +++ /dev/null @@ -1,27 +0,0 @@ -#include - -#include -#include -#include - -#include - -int main() { - setlocale(LC_ALL, ""); - - OSVERSIONINFOEXW info = {0}; - info.dwOSVersionInfoSize = sizeof(info); - assert(GetVersionExW((OSVERSIONINFOW*)&info)); - - printf("dwMajorVersion = %d\n", (int)info.dwMajorVersion); - printf("dwMinorVersion = %d\n", (int)info.dwMinorVersion); - printf("dwBuildNumber = %d\n", (int)info.dwBuildNumber); - printf("dwPlatformId = %d\n", (int)info.dwPlatformId); - printf("szCSDVersion = %ls\n", info.szCSDVersion); - printf("wServicePackMajor = %d\n", info.wServicePackMajor); - printf("wServicePackMinor = %d\n", info.wServicePackMinor); - printf("wSuiteMask = 0x%x\n", (unsigned int)info.wSuiteMask); - printf("wProductType = 0x%x\n", (unsigned int)info.wProductType); - - return 0; -} diff --git a/node_modules/node-pty/deps/winpty/misc/ScreenBufferFreezeInactive.cc b/node_modules/node-pty/deps/winpty/misc/ScreenBufferFreezeInactive.cc deleted file mode 100644 index 656d4f1..0000000 --- a/node_modules/node-pty/deps/winpty/misc/ScreenBufferFreezeInactive.cc +++ /dev/null @@ -1,101 +0,0 @@ -// -// Verify that console selection blocks writes to an inactive console screen -// buffer. Writes TEST PASSED or TEST FAILED to the popup console window. -// - -#include -#include - -#include - -#include "TestUtil.cc" - -const int SC_CONSOLE_MARK = 0xFFF2; -const int SC_CONSOLE_SELECT_ALL = 0xFFF5; - -bool g_useMark = false; - -CALLBACK DWORD pausingThread(LPVOID dummy) -{ - HWND hwnd = GetConsoleWindow(); - trace("Sending selection to freeze"); - SendMessage(hwnd, WM_SYSCOMMAND, - g_useMark ? SC_CONSOLE_MARK : - SC_CONSOLE_SELECT_ALL, - 0); - Sleep(1000); - trace("Sending escape WM_CHAR to unfreeze"); - SendMessage(hwnd, WM_CHAR, 27, 0x00010001); - Sleep(1000); -} - -static HANDLE createBuffer() { - HANDLE buf = CreateConsoleScreenBuffer( - GENERIC_READ | GENERIC_WRITE, - FILE_SHARE_READ | FILE_SHARE_WRITE, - NULL, - CONSOLE_TEXTMODE_BUFFER, - NULL); - ASSERT(buf != INVALID_HANDLE_VALUE); - return buf; -} - -static void runTest(bool useMark, bool createEarly) { - trace("======================================="); - trace("useMark=%d createEarly=%d", useMark, createEarly); - g_useMark = useMark; - HANDLE buf = INVALID_HANDLE_VALUE; - - if (createEarly) { - buf = createBuffer(); - } - - CreateThread(NULL, 0, - pausingThread, NULL, - 0, NULL); - Sleep(500); - - if (!createEarly) { - trace("Creating buffer"); - TimeMeasurement tm1; - buf = createBuffer(); - const double elapsed1 = tm1.elapsed(); - if (elapsed1 >= 0.250) { - printf("!!! TEST FAILED !!!\n"); - Sleep(2000); - return; - } - } - - trace("Writing to aux buffer"); - TimeMeasurement tm2; - DWORD actual = 0; - BOOL ret = WriteConsoleW(buf, L"HI", 2, &actual, NULL); - const double elapsed2 = tm2.elapsed(); - trace("Writing to aux buffer: finished: ret=%d actual=%d (elapsed=%1.3f)", ret, actual, elapsed2); - if (elapsed2 < 0.250) { - printf("!!! TEST FAILED !!!\n"); - } else { - printf("TEST PASSED\n"); - } - Sleep(2000); -} - -int main(int argc, char **argv) { - if (argc == 1) { - startChildProcess(L"child"); - return 0; - } - - std::string arg = argv[1]; - if (arg == "child") { - for (int useMark = 0; useMark <= 1; useMark++) { - for (int createEarly = 0; createEarly <= 1; createEarly++) { - runTest(useMark, createEarly); - } - } - printf("done...\n"); - Sleep(1000); - } - return 0; -} diff --git a/node_modules/node-pty/deps/winpty/misc/ScreenBufferTest.cc b/node_modules/node-pty/deps/winpty/misc/ScreenBufferTest.cc deleted file mode 100644 index fa584b9..0000000 --- a/node_modules/node-pty/deps/winpty/misc/ScreenBufferTest.cc +++ /dev/null @@ -1,671 +0,0 @@ -// -// Windows versions tested -// -// Vista Enterprise SP2 32-bit -// - ver reports [Version 6.0.6002] -// - kernel32.dll product/file versions are 6.0.6002.19381 -// -// Windows 7 Ultimate SP1 32-bit -// - ver reports [Version 6.1.7601] -// - conhost.exe product/file versions are 6.1.7601.18847 -// - kernel32.dll product/file versions are 6.1.7601.18847 -// -// Windows Server 2008 R2 Datacenter SP1 64-bit -// - ver reports [Version 6.1.7601] -// - conhost.exe product/file versions are 6.1.7601.23153 -// - kernel32.dll product/file versions are 6.1.7601.23153 -// -// Windows 8 Enterprise 32-bit -// - ver reports [Version 6.2.9200] -// - conhost.exe product/file versions are 6.2.9200.16578 -// - kernel32.dll product/file versions are 6.2.9200.16859 -// - -// -// Specific version details on working Server 2008 R2: -// -// dwMajorVersion = 6 -// dwMinorVersion = 1 -// dwBuildNumber = 7601 -// dwPlatformId = 2 -// szCSDVersion = Service Pack 1 -// wServicePackMajor = 1 -// wServicePackMinor = 0 -// wSuiteMask = 0x190 -// wProductType = 0x3 -// -// Specific version details on broken Win7: -// -// dwMajorVersion = 6 -// dwMinorVersion = 1 -// dwBuildNumber = 7601 -// dwPlatformId = 2 -// szCSDVersion = Service Pack 1 -// wServicePackMajor = 1 -// wServicePackMinor = 0 -// wSuiteMask = 0x100 -// wProductType = 0x1 -// - -#include -#include -#include - -#include "TestUtil.cc" - -const char *g_prefix = ""; - -static void dumpHandles() { - trace("%sSTDIN=0x%I64x STDOUT=0x%I64x STDERR=0x%I64x", - g_prefix, - (long long)GetStdHandle(STD_INPUT_HANDLE), - (long long)GetStdHandle(STD_OUTPUT_HANDLE), - (long long)GetStdHandle(STD_ERROR_HANDLE)); -} - -static const char *successOrFail(BOOL ret) { - return ret ? "ok" : "FAILED"; -} - -static void startChildInSameConsole(const wchar_t *args, BOOL - bInheritHandles=FALSE) { - wchar_t program[1024]; - wchar_t cmdline[1024]; - GetModuleFileNameW(NULL, program, 1024); - swprintf(cmdline, L"\"%ls\" %ls", program, args); - - STARTUPINFOW sui; - PROCESS_INFORMATION pi; - memset(&sui, 0, sizeof(sui)); - memset(&pi, 0, sizeof(pi)); - sui.cb = sizeof(sui); - - CreateProcessW(program, cmdline, - NULL, NULL, - /*bInheritHandles=*/bInheritHandles, - /*dwCreationFlags=*/0, - NULL, NULL, - &sui, &pi); -} - -static void closeHandle(HANDLE h) { - trace("%sClosing handle 0x%I64x...", g_prefix, (long long)h); - trace("%sClosing handle 0x%I64x... %s", g_prefix, (long long)h, successOrFail(CloseHandle(h))); -} - -static HANDLE createBuffer() { - - // If sa isn't provided, the handle defaults to not-inheritable. - SECURITY_ATTRIBUTES sa = {0}; - sa.nLength = sizeof(sa); - sa.bInheritHandle = TRUE; - - trace("%sCreating a new buffer...", g_prefix); - HANDLE conout = CreateConsoleScreenBuffer( - GENERIC_READ | GENERIC_WRITE, - FILE_SHARE_READ | FILE_SHARE_WRITE, - &sa, - CONSOLE_TEXTMODE_BUFFER, NULL); - - trace("%sCreating a new buffer... 0x%I64x", g_prefix, (long long)conout); - return conout; -} - -static HANDLE openConout() { - - // If sa isn't provided, the handle defaults to not-inheritable. - SECURITY_ATTRIBUTES sa = {0}; - sa.nLength = sizeof(sa); - sa.bInheritHandle = TRUE; - - trace("%sOpening CONOUT...", g_prefix); - HANDLE conout = CreateFileW(L"CONOUT$", - GENERIC_READ | GENERIC_WRITE, - FILE_SHARE_READ | FILE_SHARE_WRITE, - &sa, - OPEN_EXISTING, 0, NULL); - trace("%sOpening CONOUT... 0x%I64x", g_prefix, (long long)conout); - return conout; -} - -static void setConsoleActiveScreenBuffer(HANDLE conout) { - trace("%sSetConsoleActiveScreenBuffer(0x%I64x) called...", - g_prefix, (long long)conout); - trace("%sSetConsoleActiveScreenBuffer(0x%I64x) called... %s", - g_prefix, (long long)conout, - successOrFail(SetConsoleActiveScreenBuffer(conout))); -} - -static void writeTest(HANDLE conout, const char *msg) { - char writeData[256]; - sprintf(writeData, "%s%s\n", g_prefix, msg); - - trace("%sWriting to 0x%I64x: '%s'...", - g_prefix, (long long)conout, msg); - DWORD actual = 0; - BOOL ret = WriteConsoleA(conout, writeData, strlen(writeData), &actual, NULL); - trace("%sWriting to 0x%I64x: '%s'... %s", - g_prefix, (long long)conout, msg, - successOrFail(ret && actual == strlen(writeData))); -} - -static void writeTest(const char *msg) { - writeTest(GetStdHandle(STD_OUTPUT_HANDLE), msg); -} - - - -/////////////////////////////////////////////////////////////////////////////// -// TEST 1 -- create new buffer, activate it, and close the handle. The console -// automatically switches the screen buffer back to the original. -// -// This test passes everywhere. -// - -static void test1(int argc, char *argv[]) { - if (!strcmp(argv[1], "1")) { - startChildProcess(L"1:child"); - return; - } - - HANDLE origBuffer = GetStdHandle(STD_OUTPUT_HANDLE); - writeTest(origBuffer, "<-- origBuffer -->"); - - HANDLE newBuffer = createBuffer(); - writeTest(newBuffer, "<-- newBuffer -->"); - setConsoleActiveScreenBuffer(newBuffer); - Sleep(2000); - - writeTest(origBuffer, "TEST PASSED!"); - - // Closing the handle w/o switching the active screen buffer automatically - // switches the console back to the original buffer. - closeHandle(newBuffer); - - while (true) { - Sleep(1000); - } -} - - - -/////////////////////////////////////////////////////////////////////////////// -// TEST 2 -- Test program that creates and activates newBuffer, starts a child -// process, then closes its newBuffer handle. newBuffer remains activated, -// because the child keeps it active. (Also see TEST D.) -// - -static void test2(int argc, char *argv[]) { - if (!strcmp(argv[1], "2")) { - startChildProcess(L"2:parent"); - return; - } - - if (!strcmp(argv[1], "2:parent")) { - g_prefix = "parent: "; - dumpHandles(); - HANDLE origBuffer = GetStdHandle(STD_OUTPUT_HANDLE); - writeTest(origBuffer, "<-- origBuffer -->"); - - HANDLE newBuffer = createBuffer(); - writeTest(newBuffer, "<-- newBuffer -->"); - setConsoleActiveScreenBuffer(newBuffer); - - Sleep(1000); - writeTest(newBuffer, "bInheritHandles=FALSE:"); - startChildInSameConsole(L"2:child", FALSE); - Sleep(1000); - writeTest(newBuffer, "bInheritHandles=TRUE:"); - startChildInSameConsole(L"2:child", TRUE); - - Sleep(1000); - trace("parent:----"); - - // Close the new buffer. The active screen buffer doesn't automatically - // switch back to origBuffer, because the child process has a handle open - // to the original buffer. - closeHandle(newBuffer); - - Sleep(600 * 1000); - return; - } - - if (!strcmp(argv[1], "2:child")) { - g_prefix = "child: "; - dumpHandles(); - // The child's output isn't visible, because it's still writing to - // origBuffer. - trace("child:----"); - writeTest("writing to STDOUT"); - - // Handle inheritability is curious. The console handles this program - // creates are inheritable, but CreateProcess is called with both - // bInheritHandles=TRUE and bInheritHandles=FALSE. - // - // Vista and Windows 7: bInheritHandles has no effect. The child and - // parent processes have the same STDIN/STDOUT/STDERR handles: - // 0x3, 0x7, and 0xB. The parent has a 0xF handle for newBuffer. - // The child can only write to 0x7, 0xB, and 0xF. Only the writes to - // 0xF are visible (i.e. they touch newBuffer). - // - // Windows 8 or Windows 10 (legacy or non-legacy): the lowest 2 bits of - // the HANDLE to WriteConsole seem to be ignored. The new process' - // console handles always refer to the buffer that was active when they - // started, but the values of the handles depend upon bInheritHandles. - // With bInheritHandles=TRUE, the child has the same - // STDIN/STDOUT/STDERR/newBuffer handles as the parent, and the three - // output handles all work, though their output is all visible. With - // bInheritHandles=FALSE, the child has different STDIN/STDOUT/STDERR - // handles, and only the new STDOUT/STDERR handles work. - // - for (unsigned int i = 0x1; i <= 0xB0; ++i) { - char msg[256]; - sprintf(msg, "Write to handle 0x%x", i); - HANDLE h = reinterpret_cast(i); - writeTest(h, msg); - } - - Sleep(600 * 1000); - return; - } -} - - - -/////////////////////////////////////////////////////////////////////////////// -// TEST A -- demonstrate an apparent Windows bug with screen buffers -// -// Steps: -// - The parent starts a child process. -// - The child process creates and activates newBuffer -// - The parent opens CONOUT$ and writes to it. -// - The parent closes CONOUT$. -// - At this point, broken Windows reactivates origBuffer. -// - The child writes to newBuffer again. -// - The child activates origBuffer again, then closes newBuffer. -// -// Test passes if the message "TEST PASSED!" is visible. -// Test commonly fails if conhost.exe crashes. -// -// Results: -// - Windows 7 Ultimate SP1 32-bit: conhost.exe crashes -// - Windows Server 2008 R2 Datacenter SP1 64-bit: PASS -// - Windows 8 Enterprise 32-bit: PASS -// - Windows 10 64-bit (legacy and non-legacy): PASS -// - -static void testA_parentWork() { - // Open an extra CONOUT$ handle so that the HANDLE values in parent and - // child don't collide. I think it's OK if they collide, but since we're - // trying to track down a Windows bug, it's best to avoid unnecessary - // complication. - HANDLE dummy = openConout(); - - Sleep(3000); - - // Step 2: Open CONOUT$ in the parent. This opens the active buffer, which - // was just created in the child. It's handle 0x13. Write to it. - - HANDLE newBuffer = openConout(); - writeTest(newBuffer, "step2: writing to newBuffer"); - - Sleep(3000); - - // Step 3: Close handle 0x13. With Windows 7, the console switches back to - // origBuffer, and (unless I'm missing something) it shouldn't. - - closeHandle(newBuffer); -} - -static void testA_childWork() { - HANDLE origBuffer = GetStdHandle(STD_OUTPUT_HANDLE); - - // - // Step 1: Create the new screen buffer in the child process and make it - // active. (Typically, it's handle 0x0F.) - // - - HANDLE newBuffer = createBuffer(); - - setConsoleActiveScreenBuffer(newBuffer); - writeTest(newBuffer, "<-- newBuffer -->"); - - Sleep(9000); - trace("child:----"); - - // Step 4: write to the newBuffer again. - writeTest(newBuffer, "TEST PASSED!"); - - // - // Step 5: Switch back to the original screen buffer and close the new - // buffer. The switch call succeeds, but the CloseHandle call freezes for - // several seconds, because conhost.exe crashes. - // - Sleep(3000); - - setConsoleActiveScreenBuffer(origBuffer); - writeTest(origBuffer, "writing to origBuffer"); - - closeHandle(newBuffer); - - // The console HWND is NULL. - trace("child: console HWND=0x%I64x", (long long)GetConsoleWindow()); - - // At this point, the console window has closed, but the parent/child - // processes are still running. Calling AllocConsole would fail, but - // calling FreeConsole followed by AllocConsole would both succeed, and a - // new console would appear. -} - -static void testA(int argc, char *argv[]) { - - if (!strcmp(argv[1], "A")) { - startChildProcess(L"A:parent"); - return; - } - - if (!strcmp(argv[1], "A:parent")) { - g_prefix = "parent: "; - trace("parent:----"); - dumpHandles(); - writeTest("<-- origBuffer -->"); - startChildInSameConsole(L"A:child"); - testA_parentWork(); - Sleep(120000); - return; - } - - if (!strcmp(argv[1], "A:child")) { - g_prefix = "child: "; - dumpHandles(); - testA_childWork(); - Sleep(120000); - return; - } -} - - - -/////////////////////////////////////////////////////////////////////////////// -// TEST B -- invert TEST A -- also crashes conhost on Windows 7 -// -// Test passes if the message "TEST PASSED!" is visible. -// Test commonly fails if conhost.exe crashes. -// -// Results: -// - Windows 7 Ultimate SP1 32-bit: conhost.exe crashes -// - Windows Server 2008 R2 Datacenter SP1 64-bit: PASS -// - Windows 8 Enterprise 32-bit: PASS -// - Windows 10 64-bit (legacy and non-legacy): PASS -// - -static void testB(int argc, char *argv[]) { - if (!strcmp(argv[1], "B")) { - startChildProcess(L"B:parent"); - return; - } - - if (!strcmp(argv[1], "B:parent")) { - g_prefix = "parent: "; - startChildInSameConsole(L"B:child"); - writeTest("<-- origBuffer -->"); - HANDLE origBuffer = GetStdHandle(STD_OUTPUT_HANDLE); - - // - // Step 1: Create the new buffer and make it active. - // - trace("%s----", g_prefix); - HANDLE newBuffer = createBuffer(); - setConsoleActiveScreenBuffer(newBuffer); - writeTest(newBuffer, "<-- newBuffer -->"); - - // - // Step 4: Attempt to write again to the new buffer. - // - Sleep(9000); - trace("%s----", g_prefix); - writeTest(newBuffer, "TEST PASSED!"); - - // - // Step 5: Switch back to the original buffer. - // - Sleep(3000); - trace("%s----", g_prefix); - setConsoleActiveScreenBuffer(origBuffer); - closeHandle(newBuffer); - writeTest(origBuffer, "writing to the initial buffer"); - - Sleep(60000); - return; - } - - if (!strcmp(argv[1], "B:child")) { - g_prefix = "child: "; - Sleep(3000); - trace("%s----", g_prefix); - - // - // Step 2: Open the newly active buffer and write to it. - // - HANDLE newBuffer = openConout(); - writeTest(newBuffer, "writing to newBuffer"); - - // - // Step 3: Close the newly active buffer. - // - Sleep(3000); - closeHandle(newBuffer); - - Sleep(60000); - return; - } -} - - - -/////////////////////////////////////////////////////////////////////////////// -// TEST C -- Interleaving open/close of console handles also seems to break on -// Windows 7. -// -// Test: -// - child creates and activates newBuf1 -// - parent opens newBuf1 -// - child creates and activates newBuf2 -// - parent opens newBuf2, then closes newBuf1 -// - child switches back to newBuf1 -// * At this point, the console starts malfunctioning. -// - parent and child close newBuf2 -// - child closes newBuf1 -// -// Test passes if the message "TEST PASSED!" is visible. -// Test commonly fails if conhost.exe crashes. -// -// Results: -// - Windows 7 Ultimate SP1 32-bit: conhost.exe crashes -// - Windows Server 2008 R2 Datacenter SP1 64-bit: PASS -// - Windows 8 Enterprise 32-bit: PASS -// - Windows 10 64-bit (legacy and non-legacy): PASS -// - -static void testC(int argc, char *argv[]) { - if (!strcmp(argv[1], "C")) { - startChildProcess(L"C:parent"); - return; - } - - if (!strcmp(argv[1], "C:parent")) { - startChildInSameConsole(L"C:child"); - writeTest("<-- origBuffer -->"); - g_prefix = "parent: "; - - // At time=4, open newBuffer1. - Sleep(4000); - trace("%s---- t=4", g_prefix); - const HANDLE newBuffer1 = openConout(); - - // At time=8, open newBuffer2, and close newBuffer1. - Sleep(4000); - trace("%s---- t=8", g_prefix); - const HANDLE newBuffer2 = openConout(); - closeHandle(newBuffer1); - - // At time=25, cleanup of newBuffer2. - Sleep(17000); - trace("%s---- t=25", g_prefix); - closeHandle(newBuffer2); - - Sleep(240000); - return; - } - - if (!strcmp(argv[1], "C:child")) { - g_prefix = "child: "; - - // At time=2, create newBuffer1 and activate it. - Sleep(2000); - trace("%s---- t=2", g_prefix); - const HANDLE newBuffer1 = createBuffer(); - setConsoleActiveScreenBuffer(newBuffer1); - writeTest(newBuffer1, "<-- newBuffer1 -->"); - - // At time=6, create newBuffer2 and activate it. - Sleep(4000); - trace("%s---- t=6", g_prefix); - const HANDLE newBuffer2 = createBuffer(); - setConsoleActiveScreenBuffer(newBuffer2); - writeTest(newBuffer2, "<-- newBuffer2 -->"); - - // At time=10, attempt to switch back to newBuffer1. The parent process - // has opened and closed its handle to newBuffer1, so does it still exist? - Sleep(4000); - trace("%s---- t=10", g_prefix); - setConsoleActiveScreenBuffer(newBuffer1); - writeTest(newBuffer1, "write to newBuffer1: TEST PASSED!"); - - // At time=25, cleanup of newBuffer2. - Sleep(15000); - trace("%s---- t=25", g_prefix); - closeHandle(newBuffer2); - - // At time=35, cleanup of newBuffer1. The console should switch to the - // initial buffer again. - Sleep(10000); - trace("%s---- t=35", g_prefix); - closeHandle(newBuffer1); - - Sleep(240000); - return; - } -} - - - -/////////////////////////////////////////////////////////////////////////////// -// TEST D -- parent creates a new buffer, child launches, writes, -// closes it output handle, then parent writes again. (Also see TEST 2.) -// -// On success, this will appear: -// -// parent: <-- newBuffer --> -// child: writing to newBuffer -// parent: TEST PASSED! -// -// If this appears, it indicates that the child's closing its output handle did -// not destroy newBuffer. -// -// Results: -// - Windows 7 Ultimate SP1 32-bit: PASS -// - Windows 8 Enterprise 32-bit: PASS -// - Windows 10 64-bit (legacy and non-legacy): PASS -// - -static void testD(int argc, char *argv[]) { - if (!strcmp(argv[1], "D")) { - startChildProcess(L"D:parent"); - return; - } - - if (!strcmp(argv[1], "D:parent")) { - g_prefix = "parent: "; - HANDLE origBuffer = GetStdHandle(STD_OUTPUT_HANDLE); - writeTest(origBuffer, "<-- origBuffer -->"); - - HANDLE newBuffer = createBuffer(); - writeTest(newBuffer, "<-- newBuffer -->"); - setConsoleActiveScreenBuffer(newBuffer); - - // At t=2, start a child process, explicitly forcing it to use - // newBuffer for its standard handles. These calls are apparently - // redundant on Windows 8 and up. - Sleep(2000); - trace("parent:----"); - trace("parent: starting child process"); - SetStdHandle(STD_OUTPUT_HANDLE, newBuffer); - SetStdHandle(STD_ERROR_HANDLE, newBuffer); - startChildInSameConsole(L"D:child"); - SetStdHandle(STD_OUTPUT_HANDLE, origBuffer); - SetStdHandle(STD_ERROR_HANDLE, origBuffer); - - // At t=6, write again to newBuffer. - Sleep(4000); - trace("parent:----"); - writeTest(newBuffer, "TEST PASSED!"); - - // At t=8, close the newBuffer. In earlier versions of windows - // (including Server 2008 R2), the console then switches back to - // origBuffer. As of Windows 8, it doesn't, because somehow the child - // process is keeping the console on newBuffer, even though the child - // process closed its STDIN/STDOUT/STDERR handles. Killing the child - // process by hand after the test finishes *does* force the console - // back to origBuffer. - Sleep(2000); - closeHandle(newBuffer); - - Sleep(120000); - return; - } - - if (!strcmp(argv[1], "D:child")) { - g_prefix = "child: "; - // At t=2, the child starts. - trace("child:----"); - dumpHandles(); - writeTest("writing to newBuffer"); - - // At t=4, the child explicitly closes its handle. - Sleep(2000); - trace("child:----"); - if (GetStdHandle(STD_ERROR_HANDLE) != GetStdHandle(STD_OUTPUT_HANDLE)) { - closeHandle(GetStdHandle(STD_ERROR_HANDLE)); - } - closeHandle(GetStdHandle(STD_OUTPUT_HANDLE)); - closeHandle(GetStdHandle(STD_INPUT_HANDLE)); - - Sleep(120000); - return; - } -} - - - -int main(int argc, char *argv[]) { - if (argc == 1) { - printf("USAGE: %s testnum\n", argv[0]); - return 0; - } - - if (argv[1][0] == '1') { - test1(argc, argv); - } else if (argv[1][0] == '2') { - test2(argc, argv); - } else if (argv[1][0] == 'A') { - testA(argc, argv); - } else if (argv[1][0] == 'B') { - testB(argc, argv); - } else if (argv[1][0] == 'C') { - testC(argc, argv); - } else if (argv[1][0] == 'D') { - testD(argc, argv); - } - return 0; -} diff --git a/node_modules/node-pty/deps/winpty/misc/ScreenBufferTest2.cc b/node_modules/node-pty/deps/winpty/misc/ScreenBufferTest2.cc deleted file mode 100644 index 2b648c9..0000000 --- a/node_modules/node-pty/deps/winpty/misc/ScreenBufferTest2.cc +++ /dev/null @@ -1,151 +0,0 @@ -#include - -#include "TestUtil.cc" - -const char *g_prefix = ""; - -static void dumpHandles() { - trace("%sSTDIN=0x%I64x STDOUT=0x%I64x STDERR=0x%I64x", - g_prefix, - (long long)GetStdHandle(STD_INPUT_HANDLE), - (long long)GetStdHandle(STD_OUTPUT_HANDLE), - (long long)GetStdHandle(STD_ERROR_HANDLE)); -} - -static HANDLE createBuffer() { - - // If sa isn't provided, the handle defaults to not-inheritable. - SECURITY_ATTRIBUTES sa = {0}; - sa.nLength = sizeof(sa); - sa.bInheritHandle = TRUE; - - trace("%sCreating a new buffer...", g_prefix); - HANDLE conout = CreateConsoleScreenBuffer( - GENERIC_READ | GENERIC_WRITE, - FILE_SHARE_READ | FILE_SHARE_WRITE, - &sa, - CONSOLE_TEXTMODE_BUFFER, NULL); - - trace("%sCreating a new buffer... 0x%I64x", g_prefix, (long long)conout); - return conout; -} - -static const char *successOrFail(BOOL ret) { - return ret ? "ok" : "FAILED"; -} - -static void setConsoleActiveScreenBuffer(HANDLE conout) { - trace("%sSetConsoleActiveScreenBuffer(0x%I64x) called...", - g_prefix, (long long)conout); - trace("%sSetConsoleActiveScreenBuffer(0x%I64x) called... %s", - g_prefix, (long long)conout, - successOrFail(SetConsoleActiveScreenBuffer(conout))); -} - -static void writeTest(HANDLE conout, const char *msg) { - char writeData[256]; - sprintf(writeData, "%s%s\n", g_prefix, msg); - - trace("%sWriting to 0x%I64x: '%s'...", - g_prefix, (long long)conout, msg); - DWORD actual = 0; - BOOL ret = WriteConsoleA(conout, writeData, strlen(writeData), &actual, NULL); - trace("%sWriting to 0x%I64x: '%s'... %s", - g_prefix, (long long)conout, msg, - successOrFail(ret && actual == strlen(writeData))); -} - -static HANDLE startChildInSameConsole(const wchar_t *args, BOOL - bInheritHandles=FALSE) { - wchar_t program[1024]; - wchar_t cmdline[1024]; - GetModuleFileNameW(NULL, program, 1024); - swprintf(cmdline, L"\"%ls\" %ls", program, args); - - STARTUPINFOW sui; - PROCESS_INFORMATION pi; - memset(&sui, 0, sizeof(sui)); - memset(&pi, 0, sizeof(pi)); - sui.cb = sizeof(sui); - - CreateProcessW(program, cmdline, - NULL, NULL, - /*bInheritHandles=*/bInheritHandles, - /*dwCreationFlags=*/0, - NULL, NULL, - &sui, &pi); - - return pi.hProcess; -} - -static HANDLE dup(HANDLE h, HANDLE targetProcess) { - HANDLE h2 = INVALID_HANDLE_VALUE; - BOOL ret = DuplicateHandle( - GetCurrentProcess(), h, - targetProcess, &h2, - 0, TRUE, DUPLICATE_SAME_ACCESS); - trace("dup(0x%I64x) to process 0x%I64x... %s, 0x%I64x", - (long long)h, - (long long)targetProcess, - successOrFail(ret), - (long long)h2); - return h2; -} - -int main(int argc, char *argv[]) { - if (argc == 1) { - startChildProcess(L"parent"); - return 0; - } - - if (!strcmp(argv[1], "parent")) { - g_prefix = "parent: "; - dumpHandles(); - HANDLE hChild = startChildInSameConsole(L"child"); - - // Windows 10. - HANDLE orig1 = GetStdHandle(STD_OUTPUT_HANDLE); - HANDLE new1 = createBuffer(); - - Sleep(2000); - setConsoleActiveScreenBuffer(new1); - - // Handle duplication results to child process in same console: - // - Windows XP: fails - // - Windows 7 Ultimate SP1 32-bit: fails - // - Windows Server 2008 R2 Datacenter SP1 64-bit: fails - // - Windows 8 Enterprise 32-bit: succeeds - // - Windows 10: succeeds - HANDLE orig2 = dup(orig1, GetCurrentProcess()); - HANDLE new2 = dup(new1, GetCurrentProcess()); - - dup(orig1, hChild); - dup(new1, hChild); - - // The writes to orig1/orig2 are invisible. The writes to new1/new2 - // are visible. - writeTest(orig1, "write to orig1"); - writeTest(orig2, "write to orig2"); - writeTest(new1, "write to new1"); - writeTest(new2, "write to new2"); - - Sleep(120000); - return 0; - } - - if (!strcmp(argv[1], "child")) { - g_prefix = "child: "; - dumpHandles(); - Sleep(4000); - for (unsigned int i = 0x1; i <= 0xB0; ++i) { - char msg[256]; - sprintf(msg, "Write to handle 0x%x", i); - HANDLE h = reinterpret_cast(i); - writeTest(h, msg); - } - Sleep(120000); - return 0; - } - - return 0; -} diff --git a/node_modules/node-pty/deps/winpty/misc/SelectAllTest.cc b/node_modules/node-pty/deps/winpty/misc/SelectAllTest.cc deleted file mode 100644 index a6c2773..0000000 --- a/node_modules/node-pty/deps/winpty/misc/SelectAllTest.cc +++ /dev/null @@ -1,45 +0,0 @@ -#define _WIN32_WINNT 0x0501 -#include -#include - -#include "../src/shared/DebugClient.cc" - -const int SC_CONSOLE_MARK = 0xFFF2; -const int SC_CONSOLE_SELECT_ALL = 0xFFF5; - -CALLBACK DWORD pausingThread(LPVOID dummy) -{ - HWND hwnd = GetConsoleWindow(); - while (true) { - SendMessage(hwnd, WM_SYSCOMMAND, SC_CONSOLE_SELECT_ALL, 0); - Sleep(1000); - SendMessage(hwnd, WM_CHAR, 27, 0x00010001); - Sleep(1000); - } -} - -int main() -{ - HANDLE out = GetStdHandle(STD_OUTPUT_HANDLE); - CONSOLE_SCREEN_BUFFER_INFO info; - - GetConsoleScreenBufferInfo(out, &info); - COORD initial = info.dwCursorPosition; - - CreateThread(NULL, 0, - pausingThread, NULL, - 0, NULL); - - for (int i = 0; i < 30; ++i) { - Sleep(100); - GetConsoleScreenBufferInfo(out, &info); - if (memcmp(&info.dwCursorPosition, &initial, sizeof(COORD)) != 0) { - trace("cursor moved to [%d,%d]", - info.dwCursorPosition.X, - info.dwCursorPosition.Y); - } else { - trace("cursor in expected position"); - } - } - return 0; -} diff --git a/node_modules/node-pty/deps/winpty/misc/SetBufferSize.cc b/node_modules/node-pty/deps/winpty/misc/SetBufferSize.cc deleted file mode 100644 index b50a1f8..0000000 --- a/node_modules/node-pty/deps/winpty/misc/SetBufferSize.cc +++ /dev/null @@ -1,32 +0,0 @@ -#include - -#include -#include - -#include "TestUtil.cc" - -int main(int argc, char *argv[]) { - if (argc != 3) { - printf("Usage: %s x y width height\n", argv[0]); - return 1; - } - - const HANDLE conout = CreateFileW(L"CONOUT$", - GENERIC_READ | GENERIC_WRITE, - FILE_SHARE_READ | FILE_SHARE_WRITE, - NULL, OPEN_EXISTING, 0, NULL); - ASSERT(conout != INVALID_HANDLE_VALUE); - - COORD size = { - (short)atoi(argv[1]), - (short)atoi(argv[2]), - }; - - BOOL ret = SetConsoleScreenBufferSize(conout, size); - const unsigned lastError = GetLastError(); - const char *const retStr = ret ? "OK" : "failed"; - trace("SetConsoleScreenBufferSize ret: %s (LastError=0x%x)", retStr, lastError); - printf("SetConsoleScreenBufferSize ret: %s (LastError=0x%x)\n", retStr, lastError); - - return 0; -} diff --git a/node_modules/node-pty/deps/winpty/misc/SetCursorPos.cc b/node_modules/node-pty/deps/winpty/misc/SetCursorPos.cc deleted file mode 100644 index d20fdbd..0000000 --- a/node_modules/node-pty/deps/winpty/misc/SetCursorPos.cc +++ /dev/null @@ -1,10 +0,0 @@ -#include - -#include "TestUtil.cc" - -int main(int argc, char *argv[]) { - int col = atoi(argv[1]); - int row = atoi(argv[2]); - setCursorPos(col, row); - return 0; -} diff --git a/node_modules/node-pty/deps/winpty/misc/SetFont.cc b/node_modules/node-pty/deps/winpty/misc/SetFont.cc deleted file mode 100644 index 9bcd4b4..0000000 --- a/node_modules/node-pty/deps/winpty/misc/SetFont.cc +++ /dev/null @@ -1,145 +0,0 @@ -#include -#include -#include -#include -#include - -#include "TestUtil.cc" - -#define COUNT_OF(array) (sizeof(array) / sizeof((array)[0])) - -// See https://en.wikipedia.org/wiki/List_of_CJK_fonts -const wchar_t kMSGothic[] = { 0xff2d, 0xff33, 0x0020, 0x30b4, 0x30b7, 0x30c3, 0x30af, 0 }; // Japanese -const wchar_t kNSimSun[] = { 0x65b0, 0x5b8b, 0x4f53, 0 }; // Simplified Chinese -const wchar_t kMingLight[] = { 0x7d30, 0x660e, 0x9ad4, 0 }; // Traditional Chinese -const wchar_t kGulimChe[] = { 0xad74, 0xb9bc, 0xccb4, 0 }; // Korean - -int main() { - setlocale(LC_ALL, ""); - wchar_t *cmdline = GetCommandLineW(); - int argc = 0; - wchar_t **argv = CommandLineToArgvW(cmdline, &argc); - const HANDLE conout = openConout(); - - if (argc == 1) { - cprintf(L"Usage:\n"); - cprintf(L" SetFont \n"); - cprintf(L" SetFont options\n"); - cprintf(L"\n"); - cprintf(L"Options for SetCurrentConsoleFontEx:\n"); - cprintf(L" -idx INDEX\n"); - cprintf(L" -w WIDTH\n"); - cprintf(L" -h HEIGHT\n"); - cprintf(L" -family (0xNN|NN)\n"); - cprintf(L" -weight (normal|bold|NNN)\n"); - cprintf(L" -face FACENAME\n"); - cprintf(L" -face-{gothic|simsun|minglight|gulimche) [JP,CN-sim,CN-tra,KR]\n"); - cprintf(L" -tt\n"); - cprintf(L" -vec\n"); - cprintf(L" -vp\n"); - cprintf(L" -dev\n"); - cprintf(L" -roman\n"); - cprintf(L" -swiss\n"); - cprintf(L" -modern\n"); - cprintf(L" -script\n"); - cprintf(L" -decorative\n"); - return 0; - } - - if (isdigit(argv[1][0])) { - int index = _wtoi(argv[1]); - HMODULE kernel32 = LoadLibraryW(L"kernel32.dll"); - FARPROC proc = GetProcAddress(kernel32, "SetConsoleFont"); - if (proc == NULL) { - cprintf(L"Couldn't get address of SetConsoleFont\n"); - } else { - BOOL ret = reinterpret_cast(proc)( - conout, index); - cprintf(L"SetFont returned %d\n", ret); - } - return 0; - } - - CONSOLE_FONT_INFOEX fontex = {0}; - fontex.cbSize = sizeof(fontex); - - for (int i = 1; i < argc; ++i) { - std::wstring arg = argv[i]; - if (i + 1 < argc) { - std::wstring next = argv[i + 1]; - if (arg == L"-idx") { - fontex.nFont = _wtoi(next.c_str()); - ++i; continue; - } else if (arg == L"-w") { - fontex.dwFontSize.X = _wtoi(next.c_str()); - ++i; continue; - } else if (arg == L"-h") { - fontex.dwFontSize.Y = _wtoi(next.c_str()); - ++i; continue; - } else if (arg == L"-weight") { - if (next == L"normal") { - fontex.FontWeight = 400; - } else if (next == L"bold") { - fontex.FontWeight = 700; - } else { - fontex.FontWeight = _wtoi(next.c_str()); - } - ++i; continue; - } else if (arg == L"-face") { - wcsncpy(fontex.FaceName, next.c_str(), COUNT_OF(fontex.FaceName)); - ++i; continue; - } else if (arg == L"-family") { - fontex.FontFamily = strtol(narrowString(next).c_str(), nullptr, 0); - ++i; continue; - } - } - if (arg == L"-tt") { - fontex.FontFamily |= TMPF_TRUETYPE; - } else if (arg == L"-vec") { - fontex.FontFamily |= TMPF_VECTOR; - } else if (arg == L"-vp") { - // Setting the TMPF_FIXED_PITCH bit actually indicates variable - // pitch. - fontex.FontFamily |= TMPF_FIXED_PITCH; - } else if (arg == L"-dev") { - fontex.FontFamily |= TMPF_DEVICE; - } else if (arg == L"-roman") { - fontex.FontFamily = (fontex.FontFamily & ~0xF0) | FF_ROMAN; - } else if (arg == L"-swiss") { - fontex.FontFamily = (fontex.FontFamily & ~0xF0) | FF_SWISS; - } else if (arg == L"-modern") { - fontex.FontFamily = (fontex.FontFamily & ~0xF0) | FF_MODERN; - } else if (arg == L"-script") { - fontex.FontFamily = (fontex.FontFamily & ~0xF0) | FF_SCRIPT; - } else if (arg == L"-decorative") { - fontex.FontFamily = (fontex.FontFamily & ~0xF0) | FF_DECORATIVE; - } else if (arg == L"-face-gothic") { - wcsncpy(fontex.FaceName, kMSGothic, COUNT_OF(fontex.FaceName)); - } else if (arg == L"-face-simsun") { - wcsncpy(fontex.FaceName, kNSimSun, COUNT_OF(fontex.FaceName)); - } else if (arg == L"-face-minglight") { - wcsncpy(fontex.FaceName, kMingLight, COUNT_OF(fontex.FaceName)); - } else if (arg == L"-face-gulimche") { - wcsncpy(fontex.FaceName, kGulimChe, COUNT_OF(fontex.FaceName)); - } else { - cprintf(L"Unrecognized argument: %ls\n", arg.c_str()); - exit(1); - } - } - - cprintf(L"Setting to: nFont=%u dwFontSize=(%d,%d) " - L"FontFamily=0x%x FontWeight=%u " - L"FaceName=\"%ls\"\n", - static_cast(fontex.nFont), - fontex.dwFontSize.X, fontex.dwFontSize.Y, - fontex.FontFamily, fontex.FontWeight, - fontex.FaceName); - - BOOL ret = SetCurrentConsoleFontEx( - conout, - FALSE, - &fontex); - cprintf(L"SetCurrentConsoleFontEx returned %d\n", ret); - - return 0; -} diff --git a/node_modules/node-pty/deps/winpty/misc/SetWindowRect.cc b/node_modules/node-pty/deps/winpty/misc/SetWindowRect.cc deleted file mode 100644 index 6291dd6..0000000 --- a/node_modules/node-pty/deps/winpty/misc/SetWindowRect.cc +++ /dev/null @@ -1,36 +0,0 @@ -#include - -#include -#include - -#include "TestUtil.cc" - -int main(int argc, char *argv[]) { - if (argc != 5) { - printf("Usage: %s x y width height\n", argv[0]); - return 1; - } - - const HANDLE conout = CreateFileW(L"CONOUT$", - GENERIC_READ | GENERIC_WRITE, - FILE_SHARE_READ | FILE_SHARE_WRITE, - NULL, OPEN_EXISTING, 0, NULL); - ASSERT(conout != INVALID_HANDLE_VALUE); - - SMALL_RECT sr = { - (short)atoi(argv[1]), - (short)atoi(argv[2]), - (short)(atoi(argv[1]) + atoi(argv[3]) - 1), - (short)(atoi(argv[2]) + atoi(argv[4]) - 1), - }; - - trace("Calling SetConsoleWindowInfo with {L=%d,T=%d,R=%d,B=%d}", - sr.Left, sr.Top, sr.Right, sr.Bottom); - BOOL ret = SetConsoleWindowInfo(conout, TRUE, &sr); - const unsigned lastError = GetLastError(); - const char *const retStr = ret ? "OK" : "failed"; - trace("SetConsoleWindowInfo ret: %s (LastError=0x%x)", retStr, lastError); - printf("SetConsoleWindowInfo ret: %s (LastError=0x%x)\n", retStr, lastError); - - return 0; -} diff --git a/node_modules/node-pty/deps/winpty/misc/ShowArgv.cc b/node_modules/node-pty/deps/winpty/misc/ShowArgv.cc deleted file mode 100644 index 29a0f09..0000000 --- a/node_modules/node-pty/deps/winpty/misc/ShowArgv.cc +++ /dev/null @@ -1,12 +0,0 @@ -// This test program is useful for studying commandline<->argv conversion. - -#include -#include - -int main(int argc, char **argv) -{ - printf("cmdline = [%s]\n", GetCommandLine()); - for (int i = 0; i < argc; ++i) - printf("[%s]\n", argv[i]); - return 0; -} diff --git a/node_modules/node-pty/deps/winpty/misc/ShowConsoleInput.cc b/node_modules/node-pty/deps/winpty/misc/ShowConsoleInput.cc deleted file mode 100644 index 75fbfb8..0000000 --- a/node_modules/node-pty/deps/winpty/misc/ShowConsoleInput.cc +++ /dev/null @@ -1,40 +0,0 @@ -#include -#include -#include - -int main(int argc, char *argv[]) -{ - static int escCount = 0; - - HANDLE hStdin = GetStdHandle(STD_INPUT_HANDLE); - while (true) { - DWORD count; - INPUT_RECORD ir; - if (!ReadConsoleInput(hStdin, &ir, 1, &count)) { - printf("ReadConsoleInput failed\n"); - return 1; - } - - if (true) { - DWORD mode; - GetConsoleMode(hStdin, &mode); - SetConsoleMode(hStdin, mode & ~ENABLE_PROCESSED_INPUT); - } - - if (ir.EventType == KEY_EVENT) { - const KEY_EVENT_RECORD &ker = ir.Event.KeyEvent; - printf("%s", ker.bKeyDown ? "dn" : "up"); - printf(" ch="); - if (isprint(ker.uChar.AsciiChar)) - printf("'%c'", ker.uChar.AsciiChar); - printf("%d", ker.uChar.AsciiChar); - printf(" vk=%#x", ker.wVirtualKeyCode); - printf(" scan=%#x", ker.wVirtualScanCode); - printf(" state=%#x", (int)ker.dwControlKeyState); - printf(" repeat=%d", ker.wRepeatCount); - printf("\n"); - if (ker.uChar.AsciiChar == 27 && ++escCount == 6) - break; - } - } -} diff --git a/node_modules/node-pty/deps/winpty/misc/Spew.py b/node_modules/node-pty/deps/winpty/misc/Spew.py deleted file mode 100644 index 9d1796a..0000000 --- a/node_modules/node-pty/deps/winpty/misc/Spew.py +++ /dev/null @@ -1,5 +0,0 @@ -#!/usr/bin/env python -i = 0; -while True: - i += 1 - print(i) diff --git a/node_modules/node-pty/deps/winpty/misc/TestUtil.cc b/node_modules/node-pty/deps/winpty/misc/TestUtil.cc deleted file mode 100644 index c832a12..0000000 --- a/node_modules/node-pty/deps/winpty/misc/TestUtil.cc +++ /dev/null @@ -1,172 +0,0 @@ -// This file is included into test programs using #include - -#include -#include -#include -#include -#include -#include -#include - -#include "../src/shared/DebugClient.h" -#include "../src/shared/TimeMeasurement.h" - -#include "../src/shared/DebugClient.cc" -#include "../src/shared/WinptyAssert.cc" -#include "../src/shared/WinptyException.cc" - -// Launch this test program again, in a new console that we will destroy. -static void startChildProcess(const wchar_t *args) { - wchar_t program[1024]; - wchar_t cmdline[1024]; - GetModuleFileNameW(NULL, program, 1024); - swprintf(cmdline, L"\"%ls\" %ls", program, args); - - STARTUPINFOW sui; - PROCESS_INFORMATION pi; - memset(&sui, 0, sizeof(sui)); - memset(&pi, 0, sizeof(pi)); - sui.cb = sizeof(sui); - - CreateProcessW(program, cmdline, - NULL, NULL, - /*bInheritHandles=*/FALSE, - /*dwCreationFlags=*/CREATE_NEW_CONSOLE, - NULL, NULL, - &sui, &pi); -} - -static void setBufferSize(HANDLE conout, int x, int y) { - COORD size = { static_cast(x), static_cast(y) }; - BOOL success = SetConsoleScreenBufferSize(conout, size); - trace("setBufferSize: (%d,%d), result=%d", x, y, success); -} - -static void setWindowPos(HANDLE conout, int x, int y, int w, int h) { - SMALL_RECT r = { - static_cast(x), static_cast(y), - static_cast(x + w - 1), - static_cast(y + h - 1) - }; - BOOL success = SetConsoleWindowInfo(conout, /*bAbsolute=*/TRUE, &r); - trace("setWindowPos: (%d,%d,%d,%d), result=%d", x, y, w, h, success); -} - -static void setCursorPos(HANDLE conout, int x, int y) { - COORD coord = { static_cast(x), static_cast(y) }; - SetConsoleCursorPosition(conout, coord); -} - -static void setBufferSize(int x, int y) { - setBufferSize(GetStdHandle(STD_OUTPUT_HANDLE), x, y); -} - -static void setWindowPos(int x, int y, int w, int h) { - setWindowPos(GetStdHandle(STD_OUTPUT_HANDLE), x, y, w, h); -} - -static void setCursorPos(int x, int y) { - setCursorPos(GetStdHandle(STD_OUTPUT_HANDLE), x, y); -} - -static void countDown(int sec) { - for (int i = sec; i > 0; --i) { - printf("%d.. ", i); - fflush(stdout); - Sleep(1000); - } - printf("\n"); -} - -static void writeBox(int x, int y, int w, int h, char ch, int attributes=7) { - CHAR_INFO info = { 0 }; - info.Char.AsciiChar = ch; - info.Attributes = attributes; - std::vector buf(w * h, info); - HANDLE conout = GetStdHandle(STD_OUTPUT_HANDLE); - COORD bufSize = { static_cast(w), static_cast(h) }; - COORD bufCoord = { 0, 0 }; - SMALL_RECT writeRegion = { - static_cast(x), - static_cast(y), - static_cast(x + w - 1), - static_cast(y + h - 1) - }; - WriteConsoleOutputA(conout, buf.data(), bufSize, bufCoord, &writeRegion); -} - -static void setChar(int x, int y, char ch, int attributes=7) { - writeBox(x, y, 1, 1, ch, attributes); -} - -static void fillChar(int x, int y, int repeat, char ch) { - COORD coord = { static_cast(x), static_cast(y) }; - DWORD actual = 0; - FillConsoleOutputCharacterA( - GetStdHandle(STD_OUTPUT_HANDLE), - ch, repeat, coord, &actual); -} - -static void repeatChar(int count, char ch) { - for (int i = 0; i < count; ++i) { - putchar(ch); - } - fflush(stdout); -} - -// I don't know why, but wprintf fails to print this face name, -// "ï¼­ï¼³ ゴシック" (aka MS Gothic). It helps to use wprintf instead of printf, and -// it helps to call `setlocale(LC_ALL, "")`, but the Japanese symbols are -// ultimately converted to `?` symbols, even though MS Gothic is able to -// display its own name, and the current code page is 932 (Shift-JIS). -static void cvfprintf(HANDLE conout, const wchar_t *fmt, va_list ap) { - wchar_t buffer[256]; - vswprintf(buffer, 256 - 1, fmt, ap); - buffer[255] = L'\0'; - DWORD actual = 0; - if (!WriteConsoleW(conout, buffer, wcslen(buffer), &actual, NULL)) { - wprintf(L"WriteConsoleW call failed!\n"); - } -} - -static void cfprintf(HANDLE conout, const wchar_t *fmt, ...) { - va_list ap; - va_start(ap, fmt); - cvfprintf(conout, fmt, ap); - va_end(ap); -} - -static void cprintf(const wchar_t *fmt, ...) { - va_list ap; - va_start(ap, fmt); - cvfprintf(GetStdHandle(STD_OUTPUT_HANDLE), fmt, ap); - va_end(ap); -} - -static std::string narrowString(const std::wstring &input) -{ - int mblen = WideCharToMultiByte( - CP_UTF8, 0, - input.data(), input.size(), - NULL, 0, NULL, NULL); - if (mblen <= 0) { - return std::string(); - } - std::vector tmp(mblen); - int mblen2 = WideCharToMultiByte( - CP_UTF8, 0, - input.data(), input.size(), - tmp.data(), tmp.size(), - NULL, NULL); - assert(mblen2 == mblen); - return std::string(tmp.data(), tmp.size()); -} - -HANDLE openConout() { - const HANDLE conout = CreateFileW(L"CONOUT$", - GENERIC_READ | GENERIC_WRITE, - FILE_SHARE_READ | FILE_SHARE_WRITE, - NULL, OPEN_EXISTING, 0, NULL); - ASSERT(conout != INVALID_HANDLE_VALUE); - return conout; -} diff --git a/node_modules/node-pty/deps/winpty/misc/UnicodeDoubleWidthTest.cc b/node_modules/node-pty/deps/winpty/misc/UnicodeDoubleWidthTest.cc deleted file mode 100644 index 7210d41..0000000 --- a/node_modules/node-pty/deps/winpty/misc/UnicodeDoubleWidthTest.cc +++ /dev/null @@ -1,102 +0,0 @@ -// Demonstrates how U+30FC is sometimes handled as a single-width character -// when it should be handled as a double-width character. -// -// It only runs on computers where 932 is a valid code page. Set the system -// local to "Japanese (Japan)" to ensure this. -// -// The problem seems to happen when U+30FC is printed in a console using the -// Lucida Console font, and only when that font is at certain sizes. -// - -#include -#include -#include -#include -#include -#include - -#include "TestUtil.cc" - -#define COUNT_OF(x) (sizeof(x) / sizeof((x)[0])) - -static void setFont(const wchar_t *faceName, int pxSize) { - CONSOLE_FONT_INFOEX infoex = {0}; - infoex.cbSize = sizeof(infoex); - infoex.dwFontSize.Y = pxSize; - wcsncpy(infoex.FaceName, faceName, COUNT_OF(infoex.FaceName)); - BOOL ret = SetCurrentConsoleFontEx( - GetStdHandle(STD_OUTPUT_HANDLE), FALSE, &infoex); - assert(ret); -} - -static bool performTest(const wchar_t testChar) { - const HANDLE conout = GetStdHandle(STD_OUTPUT_HANDLE); - - SetConsoleTextAttribute(conout, 7); - - system("cls"); - DWORD actual = 0; - BOOL ret = WriteConsoleW(conout, &testChar, 1, &actual, NULL); - assert(ret && actual == 1); - - CHAR_INFO verify[2]; - COORD bufSize = {2, 1}; - COORD bufCoord = {0, 0}; - const SMALL_RECT readRegion = {0, 0, 1, 0}; - SMALL_RECT actualRegion = readRegion; - ret = ReadConsoleOutputW(conout, verify, bufSize, bufCoord, &actualRegion); - assert(ret && !memcmp(&readRegion, &actualRegion, sizeof(readRegion))); - assert(verify[0].Char.UnicodeChar == testChar); - - if (verify[1].Char.UnicodeChar == testChar) { - // Typical double-width behavior with a TrueType font. Pass. - assert(verify[0].Attributes == 0x107); - assert(verify[1].Attributes == 0x207); - return true; - } else if (verify[1].Char.UnicodeChar == 0) { - // Typical double-width behavior with a Raster Font. Pass. - assert(verify[0].Attributes == 7); - assert(verify[1].Attributes == 0); - return true; - } else if (verify[1].Char.UnicodeChar == L' ') { - // Single-width behavior. Fail. - assert(verify[0].Attributes == 7); - assert(verify[1].Attributes == 7); - return false; - } else { - // Unexpected output. - assert(false); - } -} - -int main(int argc, char *argv[]) { - setlocale(LC_ALL, ""); - if (argc == 1) { - startChildProcess(L"CHILD"); - return 0; - } - - assert(SetConsoleCP(932)); - assert(SetConsoleOutputCP(932)); - - const wchar_t testChar = 0x30FC; - const wchar_t *const faceNames[] = { - L"Lucida Console", - L"Consolas", - L"ï¼­ï¼³ ゴシック", - }; - - trace("Test started"); - - for (auto faceName : faceNames) { - for (int px = 1; px <= 50; ++px) { - setFont(faceName, px); - if (!performTest(testChar)) { - trace("FAILURE: %s %dpx", narrowString(faceName).c_str(), px); - } - } - } - - trace("Test complete"); - return 0; -} diff --git a/node_modules/node-pty/deps/winpty/misc/UnicodeWideTest1.cc b/node_modules/node-pty/deps/winpty/misc/UnicodeWideTest1.cc deleted file mode 100644 index a8d798e..0000000 --- a/node_modules/node-pty/deps/winpty/misc/UnicodeWideTest1.cc +++ /dev/null @@ -1,246 +0,0 @@ -#include - -#include -#include - -#include "TestUtil.cc" - -#define COUNT_OF(x) (sizeof(x) / sizeof((x)[0])) - - -CHAR_INFO ci(wchar_t ch, WORD attributes) { - CHAR_INFO ret; - ret.Char.UnicodeChar = ch; - ret.Attributes = attributes; - return ret; -} - -CHAR_INFO ci(wchar_t ch) { - return ci(ch, 7); -} - -CHAR_INFO ci() { - return ci(L' '); -} - -bool operator==(SMALL_RECT x, SMALL_RECT y) { - return !memcmp(&x, &y, sizeof(x)); -} - -SMALL_RECT sr(COORD pt, COORD size) { - return { - pt.X, pt.Y, - static_cast(pt.X + size.X - 1), - static_cast(pt.Y + size.Y - 1) - }; -} - -static void set( - const COORD pt, - const COORD size, - const std::vector &data) { - assert(data.size() == size.X * size.Y); - SMALL_RECT writeRegion = sr(pt, size); - BOOL ret = WriteConsoleOutputW( - GetStdHandle(STD_OUTPUT_HANDLE), - data.data(), size, {0, 0}, &writeRegion); - assert(ret && writeRegion == sr(pt, size)); -} - -static void set( - const COORD pt, - const std::vector &data) { - set(pt, {static_cast(data.size()), 1}, data); -} - -static void writeAttrsAt( - const COORD pt, - const std::vector &data) { - DWORD actual = 0; - BOOL ret = WriteConsoleOutputAttribute( - GetStdHandle(STD_OUTPUT_HANDLE), - data.data(), data.size(), pt, &actual); - assert(ret && actual == data.size()); -} - -static void writeCharsAt( - const COORD pt, - const std::vector &data) { - DWORD actual = 0; - BOOL ret = WriteConsoleOutputCharacterW( - GetStdHandle(STD_OUTPUT_HANDLE), - data.data(), data.size(), pt, &actual); - assert(ret && actual == data.size()); -} - -static void writeChars( - const std::vector &data) { - DWORD actual = 0; - BOOL ret = WriteConsoleW( - GetStdHandle(STD_OUTPUT_HANDLE), - data.data(), data.size(), &actual, NULL); - assert(ret && actual == data.size()); -} - -std::vector get( - const COORD pt, - const COORD size) { - std::vector data(size.X * size.Y); - SMALL_RECT readRegion = sr(pt, size); - BOOL ret = ReadConsoleOutputW( - GetStdHandle(STD_OUTPUT_HANDLE), - data.data(), size, {0, 0}, &readRegion); - assert(ret && readRegion == sr(pt, size)); - return data; -} - -std::vector readCharsAt( - const COORD pt, - int size) { - std::vector data(size); - DWORD actual = 0; - BOOL ret = ReadConsoleOutputCharacterW( - GetStdHandle(STD_OUTPUT_HANDLE), - data.data(), data.size(), pt, &actual); - assert(ret); - data.resize(actual); // With double-width chars, we can read fewer than `size`. - return data; -} - -static void dump(const COORD pt, const COORD size) { - for (CHAR_INFO ci : get(pt, size)) { - printf("%04X %04X\n", ci.Char.UnicodeChar, ci.Attributes); - } -} - -static void dumpCharsAt(const COORD pt, int size) { - for (wchar_t ch : readCharsAt(pt, size)) { - printf("%04X\n", ch); - } -} - -static COORD getCursorPos() { - CONSOLE_SCREEN_BUFFER_INFO info = { sizeof(info) }; - assert(GetConsoleScreenBufferInfo(GetStdHandle(STD_OUTPUT_HANDLE), &info)); - return info.dwCursorPosition; -} - -static void test1() { - // We write "䀀䀀", then write "䀁" in the middle of the two. The second - // write turns the first and last cells into spaces. The LEADING/TRAILING - // flags retain consistency. - printf("test1 - overlap full-width char with full-width char\n"); - writeCharsAt({1,0}, {0x4000, 0x4000}); - dump({0,0}, {6,1}); - printf("\n"); - writeCharsAt({2,0}, {0x4001}); - dump({0,0}, {6,1}); - printf("\n"); -} - -static void test2() { - // Like `test1`, but use a lower-level API to do the write. Consistency is - // preserved here too -- the first and last cells are replaced with spaces. - printf("test2 - overlap full-width char with full-width char (lowlevel)\n"); - writeCharsAt({1,0}, {0x4000, 0x4000}); - dump({0,0}, {6,1}); - printf("\n"); - set({2,0}, {ci(0x4001,0x107), ci(0x4001,0x207)}); - dump({0,0}, {6,1}); - printf("\n"); -} - -static void test3() { - // However, the lower-level API can break the LEADING/TRAILING invariant - // explicitly: - printf("test3 - explicitly violate LEADING/TRAILING using lowlevel API\n"); - set({1,0}, { - ci(0x4000, 0x207), - ci(0x4001, 0x107), - ci(0x3044, 7), - ci(L'X', 0x107), - ci(L'X', 0x207), - }); - dump({0,0}, {7,1}); -} - -static void test4() { - // It is possible for the two cells of a double-width character to have two - // colors. - printf("test4 - use lowlevel to assign two colors to one full-width char\n"); - set({0,0}, { - ci(0x4000, 0x142), - ci(0x4000, 0x224), - }); - dump({0,0}, {2,1}); -} - -static void test5() { - // WriteConsoleOutputAttribute doesn't seem to affect the LEADING/TRAILING - // flags. - printf("test5 - WriteConsoleOutputAttribute cannot affect LEADING/TRAILING\n"); - - // Trying to clear the flags doesn't work... - writeCharsAt({0,0}, {0x4000}); - dump({0,0}, {2,1}); - writeAttrsAt({0,0}, {0x42, 0x24}); - printf("\n"); - dump({0,0}, {2,1}); - - // ... and trying to add them also doesn't work. - writeCharsAt({0,1}, {'A', ' '}); - writeAttrsAt({0,1}, {0x107, 0x207}); - printf("\n"); - dump({0,1}, {2,1}); -} - -static void test6() { - // The cursor position may be on either cell of a double-width character. - // Visually, the cursor appears under both cells, regardless of which - // specific one has the cursor. - printf("test6 - cursor can be either left or right cell of full-width char\n"); - - writeCharsAt({2,1}, {0x4000}); - - setCursorPos(2, 1); - auto pos1 = getCursorPos(); - Sleep(1000); - - setCursorPos(3, 1); - auto pos2 = getCursorPos(); - Sleep(1000); - - setCursorPos(0, 15); - printf("%d,%d\n", pos1.X, pos1.Y); - printf("%d,%d\n", pos2.X, pos2.Y); -} - -static void runTest(void (&test)()) { - system("cls"); - setCursorPos(0, 14); - test(); - system("pause"); -} - -int main(int argc, char *argv[]) { - if (argc == 1) { - startChildProcess(L"CHILD"); - return 0; - } - - setWindowPos(0, 0, 1, 1); - setBufferSize(80, 40); - setWindowPos(0, 0, 80, 40); - - auto cp = GetConsoleOutputCP(); - assert(cp == 932 || cp == 936 || cp == 949 || cp == 950); - - runTest(test1); - runTest(test2); - runTest(test3); - runTest(test4); - runTest(test5); - runTest(test6); - - return 0; -} diff --git a/node_modules/node-pty/deps/winpty/misc/UnicodeWideTest2.cc b/node_modules/node-pty/deps/winpty/misc/UnicodeWideTest2.cc deleted file mode 100644 index 05f80f7..0000000 --- a/node_modules/node-pty/deps/winpty/misc/UnicodeWideTest2.cc +++ /dev/null @@ -1,130 +0,0 @@ -// -// Test half-width vs full-width characters. -// - -#include -#include -#include -#include - -#include "TestUtil.cc" - -static void writeChars(const wchar_t *text) { - wcslen(text); - const int len = wcslen(text); - DWORD actual = 0; - BOOL ret = WriteConsoleW( - GetStdHandle(STD_OUTPUT_HANDLE), - text, len, &actual, NULL); - trace("writeChars: ret=%d, actual=%lld", ret, (long long)actual); -} - -static void dumpChars(int x, int y, int w, int h) { - BOOL ret; - const COORD bufSize = {w, h}; - const COORD bufCoord = {0, 0}; - const SMALL_RECT topLeft = {x, y, x + w - 1, y + h - 1}; - CHAR_INFO mbcsData[w * h]; - CHAR_INFO unicodeData[w * h]; - SMALL_RECT readRegion; - readRegion = topLeft; - ret = ReadConsoleOutputW(GetStdHandle(STD_OUTPUT_HANDLE), unicodeData, - bufSize, bufCoord, &readRegion); - assert(ret); - readRegion = topLeft; - ret = ReadConsoleOutputA(GetStdHandle(STD_OUTPUT_HANDLE), mbcsData, - bufSize, bufCoord, &readRegion); - assert(ret); - - printf("\n"); - for (int i = 0; i < w * h; ++i) { - printf("(%02d,%02d) CHAR: %04x %4x -- %02x %4x\n", - x + i % w, y + i / w, - (unsigned short)unicodeData[i].Char.UnicodeChar, - (unsigned short)unicodeData[i].Attributes, - (unsigned char)mbcsData[i].Char.AsciiChar, - (unsigned short)mbcsData[i].Attributes); - } -} - -int main(int argc, char *argv[]) { - system("cls"); - setWindowPos(0, 0, 1, 1); - setBufferSize(80, 38); - setWindowPos(0, 0, 80, 38); - - // Write text. - const wchar_t text1[] = { - 0x3044, // U+3044 (HIRAGANA LETTER I) - 0x2014, // U+2014 (EM DASH) - 0x3044, // U+3044 (HIRAGANA LETTER I) - 0xFF2D, // U+FF2D (FULLWIDTH LATIN CAPITAL LETTER M) - 0x30FC, // U+30FC (KATAKANA-HIRAGANA PROLONGED SOUND MARK) - 0x0031, // U+3031 (DIGIT ONE) - 0x2014, // U+2014 (EM DASH) - 0x0032, // U+0032 (DIGIT TWO) - 0x005C, // U+005C (REVERSE SOLIDUS) - 0x3044, // U+3044 (HIRAGANA LETTER I) - 0 - }; - setCursorPos(0, 0); - writeChars(text1); - - setCursorPos(78, 1); - writeChars(L"<>"); - - const wchar_t text2[] = { - 0x0032, // U+3032 (DIGIT TWO) - 0x3044, // U+3044 (HIRAGANA LETTER I) - 0, - }; - setCursorPos(78, 1); - writeChars(text2); - - system("pause"); - - dumpChars(0, 0, 17, 1); - dumpChars(2, 0, 2, 1); - dumpChars(2, 0, 1, 1); - dumpChars(3, 0, 1, 1); - dumpChars(78, 1, 2, 1); - dumpChars(0, 2, 2, 1); - - system("pause"); - system("cls"); - - const wchar_t text3[] = { - 0x30FC, 0x30FC, 0x30FC, 0xFF2D, // 1 - 0x30FC, 0x30FC, 0x30FC, 0xFF2D, // 2 - 0x30FC, 0x30FC, 0x30FC, 0xFF2D, // 3 - 0x30FC, 0x30FC, 0x30FC, 0xFF2D, // 4 - 0x30FC, 0x30FC, 0x30FC, 0xFF2D, // 5 - 0x30FC, 0x30FC, 0x30FC, 0xFF2D, // 6 - 0x30FC, 0x30FC, 0x30FC, 0xFF2D, // 7 - 0x30FC, 0x30FC, 0x30FC, 0xFF2D, // 8 - 0x30FC, 0x30FC, 0x30FC, 0xFF2D, // 9 - 0x30FC, 0x30FC, 0x30FC, 0xFF2D, // 10 - 0x30FC, 0x30FC, 0x30FC, 0xFF2D, // 11 - 0x30FC, 0x30FC, 0x30FC, 0xFF2D, // 12 - L'\r', '\n', - L'\r', '\n', - 0 - }; - writeChars(text3); - system("pause"); - { - const COORD bufSize = {80, 2}; - const COORD bufCoord = {0, 0}; - SMALL_RECT readRegion = {0, 0, 79, 1}; - CHAR_INFO unicodeData[160]; - BOOL ret = ReadConsoleOutputW(GetStdHandle(STD_OUTPUT_HANDLE), unicodeData, - bufSize, bufCoord, &readRegion); - assert(ret); - for (int i = 0; i < 96; ++i) { - printf("%04x ", unicodeData[i].Char.UnicodeChar); - } - printf("\n"); - } - - return 0; -} diff --git a/node_modules/node-pty/deps/winpty/misc/UnixEcho.cc b/node_modules/node-pty/deps/winpty/misc/UnixEcho.cc deleted file mode 100644 index 372e045..0000000 --- a/node_modules/node-pty/deps/winpty/misc/UnixEcho.cc +++ /dev/null @@ -1,89 +0,0 @@ -/* - * Unix test code that puts the terminal into raw mode, then echos typed - * characters to stdout. Derived from sample code in the Stevens book, posted - * online at http://www.lafn.org/~dave/linux/terminalIO.html. - */ - -#include -#include -#include -#include -#include "FormatChar.h" - -static struct termios save_termios; -static int term_saved; - -/* RAW! mode */ -int tty_raw(int fd) -{ - struct termios buf; - - if (tcgetattr(fd, &save_termios) < 0) /* get the original state */ - return -1; - - buf = save_termios; - - /* echo off, canonical mode off, extended input - processing off, signal chars off */ - buf.c_lflag &= ~(ECHO | ICANON | IEXTEN | ISIG); - - /* no SIGINT on BREAK, CR-to-NL off, input parity - check off, don't strip the 8th bit on input, - ouput flow control off */ - buf.c_iflag &= ~(BRKINT | ICRNL | ISTRIP | IXON); - - /* clear size bits, parity checking off */ - buf.c_cflag &= ~(CSIZE | PARENB); - - /* set 8 bits/char */ - buf.c_cflag |= CS8; - - /* output processing off */ - buf.c_oflag &= ~(OPOST); - - buf.c_cc[VMIN] = 1; /* 1 byte at a time */ - buf.c_cc[VTIME] = 0; /* no timer on input */ - - if (tcsetattr(fd, TCSAFLUSH, &buf) < 0) - return -1; - - term_saved = 1; - - return 0; -} - - -/* set it to normal! */ -int tty_reset(int fd) -{ - if (term_saved) - if (tcsetattr(fd, TCSAFLUSH, &save_termios) < 0) - return -1; - - return 0; -} - - -int main() -{ - tty_raw(0); - - int count = 0; - while (true) { - char ch; - char buf[16]; - int actual = read(0, &ch, 1); - if (actual != 1) { - perror("read error"); - break; - } - formatChar(buf, ch); - fputs(buf, stdout); - fflush(stdout); - if (ch == 3) // Ctrl-C - break; - } - - tty_reset(0); - return 0; -} diff --git a/node_modules/node-pty/deps/winpty/misc/Utf16Echo.cc b/node_modules/node-pty/deps/winpty/misc/Utf16Echo.cc deleted file mode 100644 index ef5f302..0000000 --- a/node_modules/node-pty/deps/winpty/misc/Utf16Echo.cc +++ /dev/null @@ -1,46 +0,0 @@ -#include -#include -#include -#include - -#include -#include - -int main(int argc, char *argv[]) { - system("cls"); - - if (argc == 1) { - printf("Usage: %s hhhh\n", argv[0]); - return 0; - } - - std::wstring dataToWrite; - for (int i = 1; i < argc; ++i) { - wchar_t ch = strtol(argv[i], NULL, 16); - dataToWrite.push_back(ch); - } - - DWORD actual = 0; - BOOL ret = WriteConsoleW( - GetStdHandle(STD_OUTPUT_HANDLE), - dataToWrite.data(), dataToWrite.size(), &actual, NULL); - assert(ret && actual == dataToWrite.size()); - - // Read it back. - std::vector readBuffer(dataToWrite.size() * 2); - COORD bufSize = {static_cast(readBuffer.size()), 1}; - COORD bufCoord = {0, 0}; - SMALL_RECT topLeft = {0, 0, static_cast(readBuffer.size() - 1), 0}; - ret = ReadConsoleOutputW( - GetStdHandle(STD_OUTPUT_HANDLE), readBuffer.data(), - bufSize, bufCoord, &topLeft); - assert(ret); - - printf("\n"); - for (int i = 0; i < readBuffer.size(); ++i) { - printf("CHAR: %04x %04x\n", - readBuffer[i].Char.UnicodeChar, - readBuffer[i].Attributes); - } - return 0; -} diff --git a/node_modules/node-pty/deps/winpty/misc/VeryLargeRead.cc b/node_modules/node-pty/deps/winpty/misc/VeryLargeRead.cc deleted file mode 100644 index 58f0897..0000000 --- a/node_modules/node-pty/deps/winpty/misc/VeryLargeRead.cc +++ /dev/null @@ -1,122 +0,0 @@ -// -// 2015-09-25 -// I measured these limits on the size of a single ReadConsoleOutputW call. -// The limit seems to more-or-less disppear with Windows 8, which is the first -// OS to stop using ALPCs for console I/O. My guess is that the new I/O -// method does not use the 64KiB shared memory buffer that the ALPC method -// uses. -// -// I'm guessing the remaining difference between Windows 8/8.1 and Windows 10 -// might be related to the 32-vs-64-bitness. -// -// Client OSs -// -// Windows XP 32-bit VM ==> up to 13304 characters -// - 13304x1 works, but 13305x1 fails instantly -// Windows 7 32-bit VM ==> between 16-17 thousand characters -// - 16000x1 works, 17000x1 fails instantly -// - 163x100 *crashes* conhost.exe but leaves VeryLargeRead.exe running -// Windows 8 32-bit VM ==> between 240-250 million characters -// - 10000x24000 works, but 10000x25000 does not -// Windows 8.1 32-bit VM ==> between 240-250 million characters -// - 10000x24000 works, but 10000x25000 does not -// Windows 10 64-bit VM ==> no limit (tested to 576 million characters) -// - 24000x24000 works -// - `ver` reports [Version 10.0.10240], conhost.exe and ConhostV1.dll are -// 10.0.10240.16384 for file and product version. ConhostV2.dll is -// 10.0.10240.16391 for file and product version. -// -// Server OSs -// -// Windows Server 2008 64-bit VM ==> 14300-14400 characters -// - 14300x1 works, 14400x1 fails instantly -// - This OS does not have conhost.exe. -// - `ver` reports [Version 6.0.6002] -// Windows Server 2008 R2 64-bit VM ==> 15600-15700 characters -// - 15600x1 works, 15700x1 fails instantly -// - This OS has conhost.exe, and procexp.exe reveals console ALPC ports in -// use in conhost.exe. -// - `ver` reports [Version 6.1.7601], conhost.exe is 6.1.7601.23153 for file -// and product version. -// Windows Server 2012 64-bit VM ==> at least 100 million characters -// - 10000x10000 works (VM had only 1GiB of RAM, so I skipped larger tests) -// - This OS has Windows 8's task manager and procexp.exe reveals the same -// lack of ALPC ports and the same \Device\ConDrv\* files as Windows 8. -// - `ver` reports [Version 6.2.9200], conhost.exe is 6.2.9200.16579 for file -// and product version. -// -// To summarize: -// -// client-OS server-OS notes -// --------------------------------------------------------------------------- -// XP Server 2008 CSRSS, small reads -// 7 Server 2008 R2 ALPC-to-conhost, small reads -// 8, 8.1 Server 2012 new I/O interface, large reads allowed -// 10 enhanced console w/rewrapping -// -// (Presumably, Win2K, Vista, and Win2K3 behave the same as XP. conhost.exe -// was announced as a Win7 feature.) -// - -#include -#include -#include - -#include "TestUtil.cc" - -int main(int argc, char *argv[]) { - long long width = 9000; - long long height = 9000; - - assert(argc >= 1); - if (argc == 4) { - width = atoi(argv[2]); - height = atoi(argv[3]); - } else { - if (argc == 3) { - width = atoi(argv[1]); - height = atoi(argv[2]); - } - wchar_t args[1024]; - swprintf(args, 1024, L"CHILD %lld %lld", width, height); - startChildProcess(args); - return 0; - } - - const HANDLE conout = GetStdHandle(STD_OUTPUT_HANDLE); - - setWindowPos(0, 0, 1, 1); - setBufferSize(width, height); - setWindowPos(0, 0, std::min(80LL, width), std::min(50LL, height)); - - setCursorPos(0, 0); - printf("A"); - fflush(stdout); - setCursorPos(width - 2, height - 1); - printf("B"); - fflush(stdout); - - trace("sizeof(CHAR_INFO) = %d", (int)sizeof(CHAR_INFO)); - - trace("Allocating buffer..."); - CHAR_INFO *buffer = new CHAR_INFO[width * height]; - assert(buffer != NULL); - memset(&buffer[0], 0, sizeof(CHAR_INFO)); - memset(&buffer[width * height - 2], 0, sizeof(CHAR_INFO)); - - COORD bufSize = { width, height }; - COORD bufCoord = { 0, 0 }; - SMALL_RECT readRegion = { 0, 0, width - 1, height - 1 }; - trace("ReadConsoleOutputW: calling..."); - BOOL success = ReadConsoleOutputW(conout, buffer, bufSize, bufCoord, &readRegion); - trace("ReadConsoleOutputW: success=%d", success); - - assert(buffer[0].Char.UnicodeChar == L'A'); - assert(buffer[width * height - 2].Char.UnicodeChar == L'B'); - trace("Top-left and bottom-right characters read successfully!"); - - Sleep(30000); - - delete [] buffer; - return 0; -} diff --git a/node_modules/node-pty/deps/winpty/misc/VkEscapeTest.cc b/node_modules/node-pty/deps/winpty/misc/VkEscapeTest.cc deleted file mode 100644 index 97bf59f..0000000 --- a/node_modules/node-pty/deps/winpty/misc/VkEscapeTest.cc +++ /dev/null @@ -1,56 +0,0 @@ -/* - * Sending VK_PAUSE to the console window almost works as a mechanism for - * pausing it, but it doesn't because the console could turn off the - * ENABLE_LINE_INPUT console mode flag. - */ - -#define _WIN32_WINNT 0x0501 -#include -#include -#include - -CALLBACK DWORD pausingThread(LPVOID dummy) -{ - if (1) { - Sleep(1000); - HWND hwnd = GetConsoleWindow(); - SendMessage(hwnd, WM_KEYDOWN, VK_PAUSE, 1); - Sleep(1000); - SendMessage(hwnd, WM_KEYDOWN, VK_ESCAPE, 1); - } - - if (0) { - INPUT_RECORD ir; - memset(&ir, 0, sizeof(ir)); - ir.EventType = KEY_EVENT; - ir.Event.KeyEvent.bKeyDown = TRUE; - ir.Event.KeyEvent.wVirtualKeyCode = VK_PAUSE; - ir.Event.KeyEvent.wRepeatCount = 1; - } - - return 0; -} - -int main() -{ - HANDLE hin = GetStdHandle(STD_INPUT_HANDLE); - HANDLE h = GetStdHandle(STD_OUTPUT_HANDLE); - COORD c = { 0, 0 }; - - DWORD mode; - GetConsoleMode(hin, &mode); - SetConsoleMode(hin, mode & - ~(ENABLE_LINE_INPUT)); - - CreateThread(NULL, 0, - pausingThread, NULL, - 0, NULL); - - int i = 0; - while (true) { - Sleep(100); - printf("%d\n", ++i); - } - - return 0; -} diff --git a/node_modules/node-pty/deps/winpty/misc/Win10ResizeWhileFrozen.cc b/node_modules/node-pty/deps/winpty/misc/Win10ResizeWhileFrozen.cc deleted file mode 100644 index 82feaf3..0000000 --- a/node_modules/node-pty/deps/winpty/misc/Win10ResizeWhileFrozen.cc +++ /dev/null @@ -1,52 +0,0 @@ -/* - * Demonstrates a conhost hang that occurs when widening the console buffer - * while selection is in progress. The problem affects the new Windows 10 - * console, not the "legacy" console mode that Windows 10 also includes. - * - * First tested with: - * - Windows 10.0.10240 - * - conhost.exe version 10.0.10240.16384 - * - ConhostV1.dll version 10.0.10240.16384 - * - ConhostV2.dll version 10.0.10240.16391 - */ - -#include -#include -#include -#include - -#include "TestUtil.cc" - -const int SC_CONSOLE_MARK = 0xFFF2; -const int SC_CONSOLE_SELECT_ALL = 0xFFF5; - -int main(int argc, char *argv[]) { - if (argc == 1) { - startChildProcess(L"CHILD"); - return 0; - } - - setWindowPos(0, 0, 1, 1); - setBufferSize(80, 25); - setWindowPos(0, 0, 80, 25); - - countDown(5); - - SendMessage(GetConsoleWindow(), WM_SYSCOMMAND, SC_CONSOLE_SELECT_ALL, 0); - Sleep(2000); - - // This API call does not return. In the console window, the "Select All" - // operation appears to end. The console window becomes non-responsive, - // and the conhost.exe process must be killed from the Task Manager. - // (Killing this test program or closing the console window is not - // sufficient.) - // - // The same hang occurs whether line resizing is off or on. It happens - // with both "Mark" and "Select All". Calling setBufferSize with the - // existing buffer size does not hang, but calling it with only a changed - // buffer height *does* hang. Calling setWindowPos does not hang. - setBufferSize(120, 25); - - printf("Done...\n"); - Sleep(2000); -} diff --git a/node_modules/node-pty/deps/winpty/misc/Win10WrapTest1.cc b/node_modules/node-pty/deps/winpty/misc/Win10WrapTest1.cc deleted file mode 100644 index 645fa95..0000000 --- a/node_modules/node-pty/deps/winpty/misc/Win10WrapTest1.cc +++ /dev/null @@ -1,57 +0,0 @@ -/* - * Demonstrates some wrapping behaviors of the new Windows 10 console. - */ - -#include -#include -#include - -#include "TestUtil.cc" - -int main(int argc, char *argv[]) { - if (argc == 1) { - startChildProcess(L"CHILD"); - return 0; - } - - setWindowPos(0, 0, 1, 1); - setBufferSize(40, 20); - setWindowPos(0, 0, 40, 20); - - system("cls"); - - repeatChar(39, 'A'); repeatChar(1, ' '); - repeatChar(39, 'B'); repeatChar(1, ' '); - printf("\n"); - - repeatChar(39, 'C'); repeatChar(1, ' '); - repeatChar(39, 'D'); repeatChar(1, ' '); - printf("\n"); - - repeatChar(40, 'E'); - repeatChar(40, 'F'); - printf("\n"); - - repeatChar(39, 'G'); repeatChar(1, ' '); - repeatChar(39, 'H'); repeatChar(1, ' '); - printf("\n"); - - Sleep(2000); - - setChar(39, 0, '*', 0x24); - setChar(39, 1, '*', 0x24); - - setChar(39, 3, ' ', 0x24); - setChar(39, 4, ' ', 0x24); - - setChar(38, 6, ' ', 0x24); - setChar(38, 7, ' ', 0x24); - - Sleep(2000); - setWindowPos(0, 0, 35, 20); - setBufferSize(35, 20); - trace("DONE"); - - printf("Sleeping forever...\n"); - while(true) { Sleep(1000); } -} diff --git a/node_modules/node-pty/deps/winpty/misc/Win10WrapTest2.cc b/node_modules/node-pty/deps/winpty/misc/Win10WrapTest2.cc deleted file mode 100644 index 50615fc..0000000 --- a/node_modules/node-pty/deps/winpty/misc/Win10WrapTest2.cc +++ /dev/null @@ -1,30 +0,0 @@ -#include - -#include "TestUtil.cc" - -int main(int argc, char *argv[]) { - if (argc == 1) { - startChildProcess(L"CHILD"); - return 0; - } - - const int WIDTH = 25; - - setWindowPos(0, 0, 1, 1); - setBufferSize(WIDTH, 40); - setWindowPos(0, 0, WIDTH, 20); - - system("cls"); - - for (int i = 0; i < 100; ++i) { - printf("FOO(%d)\n", i); - } - - repeatChar(5, '\n'); - repeatChar(WIDTH * 5, '.'); - repeatChar(10, '\n'); - setWindowPos(0, 20, WIDTH, 20); - writeBox(0, 5, 1, 10, '|'); - - Sleep(120000); -} diff --git a/node_modules/node-pty/deps/winpty/misc/Win32Echo1.cc b/node_modules/node-pty/deps/winpty/misc/Win32Echo1.cc deleted file mode 100644 index 06fc79f..0000000 --- a/node_modules/node-pty/deps/winpty/misc/Win32Echo1.cc +++ /dev/null @@ -1,26 +0,0 @@ -/* - * A Win32 program that reads raw console input with ReadFile and echos - * it to stdout. - */ - -#include -#include -#include - -int main() -{ - int count = 0; - HANDLE hStdIn = GetStdHandle(STD_INPUT_HANDLE); - HANDLE hStdOut = GetStdHandle(STD_OUTPUT_HANDLE); - SetConsoleMode(hStdIn, 0); - - while (true) { - DWORD actual; - char ch; - ReadFile(hStdIn, &ch, 1, &actual, NULL); - printf("%02x ", ch); - if (++count == 50) - break; - } - return 0; -} diff --git a/node_modules/node-pty/deps/winpty/misc/Win32Echo2.cc b/node_modules/node-pty/deps/winpty/misc/Win32Echo2.cc deleted file mode 100644 index b2ea2ad..0000000 --- a/node_modules/node-pty/deps/winpty/misc/Win32Echo2.cc +++ /dev/null @@ -1,19 +0,0 @@ -/* - * A Win32 program that reads raw console input with getch and echos - * it to stdout. - */ - -#include -#include - -int main() -{ - int count = 0; - while (true) { - int ch = getch(); - printf("%02x ", ch); - if (++count == 50) - break; - } - return 0; -} diff --git a/node_modules/node-pty/deps/winpty/misc/Win32Test1.cc b/node_modules/node-pty/deps/winpty/misc/Win32Test1.cc deleted file mode 100644 index a40d318..0000000 --- a/node_modules/node-pty/deps/winpty/misc/Win32Test1.cc +++ /dev/null @@ -1,46 +0,0 @@ -#define _WIN32_WINNT 0x0501 -#include "../src/shared/DebugClient.cc" -#include -#include - -const int SC_CONSOLE_MARK = 0xFFF2; - -CALLBACK DWORD writerThread(void*) -{ - while (true) { - Sleep(1000); - trace("writing"); - printf("X\n"); - trace("written"); - } -} - -int main() -{ - CreateThread(NULL, 0, writerThread, NULL, 0, NULL); - trace("marking console"); - HWND hwnd = GetConsoleWindow(); - PostMessage(hwnd, WM_SYSCOMMAND, SC_CONSOLE_MARK, 0); - - Sleep(2000); - - trace("reading output"); - CHAR_INFO buf[1]; - COORD bufSize = { 1, 1 }; - COORD zeroCoord = { 0, 0 }; - SMALL_RECT readRect = { 0, 0, 0, 0 }; - ReadConsoleOutput(GetStdHandle(STD_OUTPUT_HANDLE), - buf, - bufSize, - zeroCoord, - &readRect); - trace("done reading output"); - - Sleep(2000); - - PostMessage(hwnd, WM_CHAR, 27, 0x00010001); - - Sleep(1100); - - return 0; -} diff --git a/node_modules/node-pty/deps/winpty/misc/Win32Test2.cc b/node_modules/node-pty/deps/winpty/misc/Win32Test2.cc deleted file mode 100644 index 2777bad..0000000 --- a/node_modules/node-pty/deps/winpty/misc/Win32Test2.cc +++ /dev/null @@ -1,70 +0,0 @@ -/* - * This test demonstrates that putting a console into selection mode does not - * block the low-level console APIs, even though it blocks WriteFile. - */ - -#define _WIN32_WINNT 0x0501 -#include "../src/shared/DebugClient.cc" -#include -#include - -const int SC_CONSOLE_MARK = 0xFFF2; - -CALLBACK DWORD writerThread(void*) -{ - CHAR_INFO xChar, fillChar; - memset(&xChar, 0, sizeof(xChar)); - xChar.Char.AsciiChar = 'X'; - xChar.Attributes = 7; - memset(&fillChar, 0, sizeof(fillChar)); - fillChar.Char.AsciiChar = ' '; - fillChar.Attributes = 7; - COORD oneCoord = { 1, 1 }; - COORD zeroCoord = { 0, 0 }; - - while (true) { - SMALL_RECT writeRegion = { 5, 5, 5, 5 }; - WriteConsoleOutput(GetStdHandle(STD_OUTPUT_HANDLE), - &xChar, oneCoord, - zeroCoord, - &writeRegion); - Sleep(500); - SMALL_RECT scrollRect = { 1, 1, 20, 20 }; - COORD destCoord = { 0, 0 }; - ScrollConsoleScreenBuffer(GetStdHandle(STD_OUTPUT_HANDLE), - &scrollRect, - NULL, - destCoord, - &fillChar); - } -} - -int main() -{ - CreateThread(NULL, 0, writerThread, NULL, 0, NULL); - trace("marking console"); - HWND hwnd = GetConsoleWindow(); - PostMessage(hwnd, WM_SYSCOMMAND, SC_CONSOLE_MARK, 0); - - Sleep(2000); - - trace("reading output"); - CHAR_INFO buf[1]; - COORD bufSize = { 1, 1 }; - COORD zeroCoord = { 0, 0 }; - SMALL_RECT readRect = { 0, 0, 0, 0 }; - ReadConsoleOutput(GetStdHandle(STD_OUTPUT_HANDLE), - buf, - bufSize, - zeroCoord, - &readRect); - trace("done reading output"); - - Sleep(2000); - - PostMessage(hwnd, WM_CHAR, 27, 0x00010001); - - Sleep(1100); - - return 0; -} diff --git a/node_modules/node-pty/deps/winpty/misc/Win32Test3.cc b/node_modules/node-pty/deps/winpty/misc/Win32Test3.cc deleted file mode 100644 index 1fb92af..0000000 --- a/node_modules/node-pty/deps/winpty/misc/Win32Test3.cc +++ /dev/null @@ -1,78 +0,0 @@ -/* - * Creates a window station and starts a process under it. The new process - * also gets a new console. - */ - -#include -#include -#include - -int main() -{ - BOOL success; - - SECURITY_ATTRIBUTES sa; - memset(&sa, 0, sizeof(sa)); - sa.bInheritHandle = TRUE; - - HWINSTA originalStation = GetProcessWindowStation(); - printf("originalStation == 0x%x\n", originalStation); - HWINSTA station = CreateWindowStation(NULL, - 0, - WINSTA_ALL_ACCESS, - &sa); - printf("station == 0x%x\n", station); - if (!SetProcessWindowStation(station)) - printf("SetWindowStation failed!\n"); - HDESK desktop = CreateDesktop("Default", NULL, NULL, - /*dwFlags=*/0, GENERIC_ALL, - &sa); - printf("desktop = 0x%x\n", desktop); - - char stationName[256]; - stationName[0] = '\0'; - success = GetUserObjectInformation(station, UOI_NAME, - stationName, sizeof(stationName), - NULL); - printf("stationName = [%s]\n", stationName); - - char startupDesktop[256]; - sprintf(startupDesktop, "%s\\Default", stationName); - - STARTUPINFO sui; - PROCESS_INFORMATION pi; - memset(&sui, 0, sizeof(sui)); - memset(&pi, 0, sizeof(pi)); - sui.cb = sizeof(STARTUPINFO); - sui.lpDesktop = startupDesktop; - - // Start a cmd subprocess, and have it start its own cmd subprocess. - // Both subprocesses will connect to the same non-interactive window - // station. - - const char program[] = "c:\\windows\\system32\\cmd.exe"; - char cmdline[256]; - sprintf(cmdline, "%s /c cmd", program); - success = CreateProcess(program, - cmdline, - NULL, - NULL, - /*bInheritHandles=*/FALSE, - /*dwCreationFlags=*/CREATE_NEW_CONSOLE, - NULL, NULL, - &sui, - &pi); - - printf("pid == %d\n", pi.dwProcessId); - - // This sleep is necessary. We must give the child enough time to - // connect to the specified window station. - Sleep(5000); - - SetProcessWindowStation(originalStation); - CloseWindowStation(station); - CloseDesktop(desktop); - Sleep(5000); - - return 0; -} diff --git a/node_modules/node-pty/deps/winpty/misc/Win32Write1.cc b/node_modules/node-pty/deps/winpty/misc/Win32Write1.cc deleted file mode 100644 index 6e5bf96..0000000 --- a/node_modules/node-pty/deps/winpty/misc/Win32Write1.cc +++ /dev/null @@ -1,44 +0,0 @@ -/* - * A Win32 program that scrolls and writes to the console using the ioctl-like - * interface. - */ - -#include -#include - -int main() -{ - HANDLE conout = GetStdHandle(STD_OUTPUT_HANDLE); - - for (int i = 0; i < 80; ++i) { - - CONSOLE_SCREEN_BUFFER_INFO info; - GetConsoleScreenBufferInfo(conout, &info); - - SMALL_RECT src = { 0, 1, info.dwSize.X - 1, info.dwSize.Y - 1 }; - COORD destOrigin = { 0, 0 }; - CHAR_INFO fillCharInfo = { 0 }; - fillCharInfo.Char.AsciiChar = ' '; - fillCharInfo.Attributes = 7; - ScrollConsoleScreenBuffer(conout, - &src, - NULL, - destOrigin, - &fillCharInfo); - - CHAR_INFO buffer = { 0 }; - buffer.Char.AsciiChar = 'X'; - buffer.Attributes = 7; - COORD bufferSize = { 1, 1 }; - COORD bufferCoord = { 0, 0 }; - SMALL_RECT writeRegion = { 0, 0, 0, 0 }; - writeRegion.Left = writeRegion.Right = i; - writeRegion.Top = writeRegion.Bottom = 5; - WriteConsoleOutput(conout, - &buffer, bufferSize, bufferCoord, - &writeRegion); - - Sleep(250); - } - return 0; -} diff --git a/node_modules/node-pty/deps/winpty/misc/WindowsBugCrashReader.cc b/node_modules/node-pty/deps/winpty/misc/WindowsBugCrashReader.cc deleted file mode 100644 index e6d9558..0000000 --- a/node_modules/node-pty/deps/winpty/misc/WindowsBugCrashReader.cc +++ /dev/null @@ -1,27 +0,0 @@ -// I noticed this on the ConEmu web site: -// -// https://social.msdn.microsoft.com/Forums/en-US/40c8e395-cca9-45c8-b9b8-2fbe6782ac2b/readconsoleoutput-cause-access-violation-writing-location-exception -// https://conemu.github.io/en/MicrosoftBugs.html -// -// In Windows 7, 8, and 8.1, a ReadConsoleOutputW with an out-of-bounds read -// region crashes the application. I have reproduced the problem on Windows 8 -// and 8.1, but not on Windows 7. -// - -#include - -#include "TestUtil.cc" - -int main() { - setWindowPos(0, 0, 1, 1); - setBufferSize(80, 25); - setWindowPos(0, 0, 80, 25); - - const HANDLE conout = openConout(); - static CHAR_INFO lineBuf[80]; - SMALL_RECT readRegion = { 0, 999, 79, 999 }; - const BOOL ret = ReadConsoleOutputW(conout, lineBuf, {80, 1}, {0, 0}, &readRegion); - ASSERT(!ret && "ReadConsoleOutputW should have failed"); - - return 0; -} diff --git a/node_modules/node-pty/deps/winpty/misc/WriteConsole.cc b/node_modules/node-pty/deps/winpty/misc/WriteConsole.cc deleted file mode 100644 index a03670c..0000000 --- a/node_modules/node-pty/deps/winpty/misc/WriteConsole.cc +++ /dev/null @@ -1,106 +0,0 @@ -#include - -#include -#include -#include - -#include -#include - -static std::wstring mbsToWcs(const std::string &s) { - const size_t len = mbstowcs(nullptr, s.c_str(), 0); - if (len == static_cast(-1)) { - assert(false && "mbsToWcs: invalid string"); - } - std::wstring ret; - ret.resize(len); - const size_t len2 = mbstowcs(&ret[0], s.c_str(), len); - assert(len == len2); - return ret; -} - -uint32_t parseHex(wchar_t ch, bool &invalid) { - if (ch >= L'0' && ch <= L'9') { - return ch - L'0'; - } else if (ch >= L'a' && ch <= L'f') { - return ch - L'a' + 10; - } else if (ch >= L'A' && ch <= L'F') { - return ch - L'A' + 10; - } else { - invalid = true; - return 0; - } -} - -int main(int argc, char *argv[]) { - std::vector args; - for (int i = 1; i < argc; ++i) { - args.push_back(mbsToWcs(argv[i])); - } - - std::wstring out; - for (const auto &arg : args) { - if (!out.empty()) { - out.push_back(L' '); - } - for (size_t i = 0; i < arg.size(); ++i) { - wchar_t ch = arg[i]; - wchar_t nch = i + 1 < arg.size() ? arg[i + 1] : L'\0'; - if (ch == L'\\') { - switch (nch) { - case L'a': ch = L'\a'; ++i; break; - case L'b': ch = L'\b'; ++i; break; - case L'e': ch = L'\x1b'; ++i; break; - case L'f': ch = L'\f'; ++i; break; - case L'n': ch = L'\n'; ++i; break; - case L'r': ch = L'\r'; ++i; break; - case L't': ch = L'\t'; ++i; break; - case L'v': ch = L'\v'; ++i; break; - case L'\\': ch = L'\\'; ++i; break; - case L'\'': ch = L'\''; ++i; break; - case L'\"': ch = L'\"'; ++i; break; - case L'\?': ch = L'\?'; ++i; break; - case L'x': - if (i + 3 < arg.size()) { - bool invalid = false; - uint32_t d1 = parseHex(arg[i + 2], invalid); - uint32_t d2 = parseHex(arg[i + 3], invalid); - if (!invalid) { - i += 3; - ch = (d1 << 4) | d2; - } - } - break; - case L'u': - if (i + 5 < arg.size()) { - bool invalid = false; - uint32_t d1 = parseHex(arg[i + 2], invalid); - uint32_t d2 = parseHex(arg[i + 3], invalid); - uint32_t d3 = parseHex(arg[i + 4], invalid); - uint32_t d4 = parseHex(arg[i + 5], invalid); - if (!invalid) { - i += 5; - ch = (d1 << 24) | (d2 << 16) | (d3 << 8) | d4; - } - } - break; - default: break; - } - } - out.push_back(ch); - } - } - - DWORD actual = 0; - if (!WriteConsoleW( - GetStdHandle(STD_OUTPUT_HANDLE), - out.c_str(), - out.size(), - &actual, - nullptr)) { - fprintf(stderr, "WriteConsole failed (is stdout a console?)\n"); - exit(1); - } - - return 0; -} diff --git a/node_modules/node-pty/deps/winpty/misc/build32.sh b/node_modules/node-pty/deps/winpty/misc/build32.sh deleted file mode 100644 index 162993c..0000000 --- a/node_modules/node-pty/deps/winpty/misc/build32.sh +++ /dev/null @@ -1,9 +0,0 @@ -#!/bin/bash -set -e -name=$1 -name=${name%.} -name=${name%.cc} -name=${name%.exe} -echo Compiling $name.cc to $name.exe -i686-w64-mingw32-g++.exe -static -std=c++11 $name.cc -o $name.exe -i686-w64-mingw32-strip $name.exe diff --git a/node_modules/node-pty/deps/winpty/misc/build64.sh b/node_modules/node-pty/deps/winpty/misc/build64.sh deleted file mode 100644 index 6757967..0000000 --- a/node_modules/node-pty/deps/winpty/misc/build64.sh +++ /dev/null @@ -1,9 +0,0 @@ -#!/bin/bash -set -e -name=$1 -name=${name%.} -name=${name%.cc} -name=${name%.exe} -echo Compiling $name.cc to $name.exe -x86_64-w64-mingw32-g++.exe -static -std=c++11 $name.cc -o $name.exe -x86_64-w64-mingw32-strip $name.exe diff --git a/node_modules/node-pty/deps/winpty/misc/color-test.sh b/node_modules/node-pty/deps/winpty/misc/color-test.sh deleted file mode 100644 index 065c809..0000000 --- a/node_modules/node-pty/deps/winpty/misc/color-test.sh +++ /dev/null @@ -1,212 +0,0 @@ -#!/bin/bash - -FORE=$1 -BACK=$2 -FILL=$3 - -if [ "$FORE" = "" ]; then - FORE=DefaultFore -fi -if [ "$BACK" = "" ]; then - BACK=DefaultBack -fi - -# To detect color changes, we want a character that fills the whole cell -# if possible. U+2588 is perfect, except that it becomes invisible in the -# original xterm, when bolded. For that terminal, use something else, like -# "#" or "@". -if [ "$FILL" = "" ]; then - FILL="█" -fi - -# SGR (Select Graphic Rendition) -s() { - printf '\033[0m' - while [ "$1" != "" ]; do - printf '\033['"$1"'m' - shift - done -} - -# Print -p() { - echo -n "$@" -} - -# Print with newline -pn() { - echo "$@" -} - -# For practical reasons, sandwich black and white in-between the other colors. -FORE_COLORS="31 30 37 32 33 34 35 36" -BACK_COLORS="41 40 47 42 43 44 45 46" - - - -### Test order of Invert(7) -- it does not matter what order it appears in. - -# The Red color setting here (31) is shadowed by the green setting (32). The -# Reverse flag does not cause (32) to alter the background color immediately; -# instead, the Reverse flag is applied once to determine the final effective -# Fore/Back colors. -s 7 31 32; p " -- Should be: $BACK-on-green -- "; s; pn -s 31 7 32; p " -- Should be: $BACK-on-green -- "; s; pn -s 31 32 7; p " -- Should be: $BACK-on-green -- "; s; pn - -# As above, but for the background color. -s 7 41 42; p " -- Should be: green-on-$FORE -- "; s; pn -s 41 7 42; p " -- Should be: green-on-$FORE -- "; s; pn -s 41 42 7; p " -- Should be: green-on-$FORE -- "; s; pn - -# One last, related test -s 7; p "Invert text"; s 7 1; p " with some words bold"; s; pn; -s 0; p "Normal text"; s 0 1; p " with some words bold"; s; pn; - -pn - - - -### Test effect of Bold(1) on color, with and without Invert(7). - -# The Bold flag does not affect the background color when Reverse is missing. -# There should always be 8 colored boxes. -p " " -for x in $BACK_COLORS; do - s $x; p "-"; s $x 1; p "-" -done -s; pn " Bold should not affect background" - -# On some terminals, Bold affects color, and on some it doesn't. If there -# are only 8 colored boxes, then the next two tests will also show 8 colored -# boxes. If there are 16 boxes, then exactly one of the next two tests will -# also have 16 boxes. -p " " -for x in $FORE_COLORS; do - s $x; p "$FILL"; s $x 1; p "$FILL" -done -s; pn " Does bold affect foreground color?" - -# On some terminals, Bold+Invert highlights the final Background color. -p " " -for x in $FORE_COLORS; do - s $x 7; p "-"; s $x 7 1; p "-" -done -s; pn " Test if Bold+Invert affects background color" - -# On some terminals, Bold+Invert highlights the final Foreground color. -p " " -for x in $BACK_COLORS; do - s $x 7; p "$FILL"; s $x 7 1; p "$FILL" -done -s; pn " Test if Bold+Invert affects foreground color" - -pn - - - -### Test for support of ForeHi and BackHi properties. - -# ForeHi -p " " -for x in $FORE_COLORS; do - hi=$(( $x + 60 )) - s $x; p "$FILL"; s $hi; p "$FILL" -done -s; pn " Test for support of ForeHi colors" -p " " -for x in $FORE_COLORS; do - hi=$(( $x + 60 )) - s $x; p "$FILL"; s $x $hi; p "$FILL" -done -s; pn " Test for support of ForeHi colors (w/compat)" - -# BackHi -p " " -for x in $BACK_COLORS; do - hi=$(( $x + 60 )) - s $x; p "-"; s $hi; p "-" -done -s; pn " Test for support of BackHi colors" -p " " -for x in $BACK_COLORS; do - hi=$(( $x + 60 )) - s $x; p "-"; s $x $hi; p "-" -done -s; pn " Test for support of BackHi colors (w/compat)" - -pn - - - -### Identify the default fore and back colors. - -pn "Match default fore and back colors against 16-color palette" -pn " ==fore== ==back==" -for fore in $FORE_COLORS; do - forehi=$(( $fore + 60 )) - back=$(( $fore + 10 )) - backhi=$(( $back + 60 )) - p " " - s $fore; p "$FILL"; s; p "$FILL"; s $fore; p "$FILL"; s; p " " - s $forehi; p "$FILL"; s; p "$FILL"; s $forehi; p "$FILL"; s; p " " - s $back; p "-"; s; p "-"; s $back; p "-"; s; p " " - s $backhi; p "-"; s; p "-"; s $backhi; p "-"; s; p " " - pn " $fore $forehi $back $backhi" -done - -pn - - - -### Test coloring of rest-of-line. - -# -# When a new line is scrolled in, every cell in the line receives the -# current background color, which can be the default/transparent color. -# - -p "Newline with red background: usually no red -->"; s 41; pn -s; pn "This text is plain, but rest is red if scrolled -->" -s; p " "; s 41; printf '\033[1K'; s; printf '\033[1C'; pn "<-- red Erase-in-Line to beginning" -s; p "red Erase-in-Line to end -->"; s 41; printf '\033[0K'; s; pn -pn - - - -### Moving the cursor around does not change colors of anything. - -pn "Test modifying uncolored lines with a colored SGR:" -pn "aaaa" -pn -pn "____e" -s 31 42; printf '\033[4C\033[3A'; pn "bb" -pn "cccc" -pn "dddd" -s; pn - -pn "Test modifying colored+inverted+bold line with plain text:" -s 42 31 7 1; printf 'XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX\r'; -s; pn "This text is plain and followed by green-on-red -->" -pn - - - -### Full-width character overwriting - -pn 'Overwrite part of a full-width char with a half-width char' -p 'initial U+4000 ideographs -->'; s 31 42; p '䀀䀀'; s; pn -p 'write X to index #1 -->'; s 31 42; p '䀀䀀'; s 35 44; printf '\033[24G'; p X; s; pn -p 'write X to index #2 -->'; s 31 42; p '䀀䀀'; s 35 44; printf '\033[25G'; p X; s; pn -p 'write X to index #3 -->'; s 31 42; p '䀀䀀'; s 35 44; printf '\033[26G'; p X; s; pn -p 'write X to index #4 -->'; s 31 42; p '䀀䀀'; s 35 44; printf '\033[27G'; p X; s; pn -pn - -pn 'Verify that Erase-in-Line can "fix" last char in line' -p 'original -->'; s 31 42; p '䀀䀀'; s; pn -p 'overwrite -->'; s 31 42; p '䀀䀀'; s 35 44; printf '\033[30G'; p 'XXX'; s; pn -p 'overwrite + Erase-in-Line -->'; s 31 42; p '䀀䀀'; s 35 44; printf '\033[30G'; p 'XXX'; s; printf '\033[0K'; pn -p 'original -->'; s 31 42; p 'X䀀䀀'; s; pn -p 'overwrite -->'; s 31 42; p 'X䀀䀀'; s 35 44; printf '\033[30G'; p 'ーー'; s; pn -p 'overwrite + Erase-in-Line -->'; s 31 42; p 'X䀀䀀'; s 35 44; printf '\033[30G'; p 'ーー'; s; printf '\033[0K'; pn -pn diff --git a/node_modules/node-pty/deps/winpty/misc/font-notes.txt b/node_modules/node-pty/deps/winpty/misc/font-notes.txt deleted file mode 100644 index d4e36d8..0000000 --- a/node_modules/node-pty/deps/winpty/misc/font-notes.txt +++ /dev/null @@ -1,300 +0,0 @@ -================================================================== -Notes regarding fonts, code pages, and East Asian character widths -================================================================== - - -Registry settings -================= - - * There are console registry settings in `HKCU\Console`. That key has many - default settings (e.g. the default font settings) and also per-app subkeys - for app-specific overrides. - - * It is possible to override the code page with an app-specific setting. - - * There are registry settings in - `HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Console`. In particular, - the `TrueTypeFont` subkey has a list of suitable font names associated with - various CJK code pages, as well as default font names. - - * There are two values in `HKLM\SYSTEM\CurrentControlSet\Control\Nls\CodePage` - that specify the current code pages -- `OEMCP` and `ACP`. Setting the - system locale via the Control Panel's "Region" or "Language" dialogs seems - to change these code page values. - - -Console fonts -============= - - * The `FontFamily` field of `CONSOLE_FONT_INFOEX` has two parts: - - The high four bits can be exactly one of the `FF_xxxx` font families: - FF_DONTCARE(0x00) - FF_ROMAN(0x10) - FF_SWISS(0x20) - FF_MODERN(0x30) - FF_SCRIPT(0x40) - FF_DECORATIVE(0x50) - - The low four bits are a bitmask: - TMPF_FIXED_PITCH(1) -- actually means variable pitch - TMPF_VECTOR(2) - TMPF_TRUETYPE(4) - TMPF_DEVICE(8) - - * Each console has its own independent console font table. The current font - is identified with an index into this table. The size of the table is - returned by the undocumented `GetNumberOfConsoleFonts` API. It is apparently - possible to get the table size without this API, by instead calling - `GetConsoleFontSize` on each nonnegative index starting with 0 until the API - fails by returning (0, 0). - - * The font table grows dynamically. Each time the console is configured with - a previously-unused (FaceName, Size) combination, two entries are added to - the font table -- one with normal weight and one with bold weight. Fonts - added this way are always TrueType fonts. - - * Initially, the font table appears to contain only raster fonts. For - example, on an English Windows 8 installation, here is the initial font - table: - font 0: 4x6 - font 1: 6x8 - font 2: 8x8 - font 3: 16x8 - font 4: 5x12 - font 5: 7x12 - font 6: 8x12 -- the current font - font 7: 16x12 - font 8: 12x16 - font 9: 10x18 - `GetNumberOfConsoleFonts` returns 10, and this table matches the raster font - sizes according to the console properties dialog. - - * With a Japanese or Chinese locale, the initial font table appears to contain - the sizes applicable to both the East Asian raster font, as well as the - sizes for the CP437/CP1252 raster font. - - * The index passed to `SetCurrentConsoleFontEx` apparently has no effect. - The undocumented `SetConsoleFont` API, however, accepts *only* a font index, - and on Windows 8 English, it switches between all 10 fonts, even font index - #0. - - * If the index passed to `SetConsoleFont` identifies a Raster Font - incompatible with the current code page, then another Raster Font is - activated. - - * Passing "Terminal" to `SetCurrentConsoleFontEx` seems to have no effect. - Perhaps relatedly, `SetCurrentConsoleFontEx` does not fail if it is given a - bogus `FaceName`. Some font is still chosen and activated. Passing a face - name and height seems to work reliably, modulo the CP936 issue described - below. - - -Console fonts and code pages -============================ - - * On an English Windows installation, the default code page is 437, and it - cannot be set to 932 (Shift-JIS). (The API call fails.) Changing the - system locale to "Japanese (Japan)" using the Region/Language dialog - changes the default CP to 932 and permits changing the console CP between - 437 and 932. - - * A console has both an input code page and an output code page - (`{Get,Set}ConsoleCP` and `{Get,Set}ConsoleOutputCP`). I'm not going to - distinguish between the two for this document; presumably only the output - CP matters. The code page can change while the console is open, e.g. - by running `mode con: cp select={932,437,1252}` or by calling - `SetConsoleOutputCP`. - - * The current code page restricts which TrueType fonts and which Raster Font - sizes are available in the console properties dialog. This can change - while the console is open. - - * Changing the code page almost(?) always changes the current console font. - So far, I don't know how the new font is chosen. - - * With a CP of 932, the only TrueType font available in the console properties - dialog is "MS Gothic", displayed as "ï¼­ï¼³ ゴシック". It is still possible to - use the English-default TrueType console fonts, Lucida Console and Consolas, - via `SetCurrentConsoleFontEx`. - - * When using a Raster Font and CP437 or CP1252, writing a UTF-16 codepoint not - representable in the code page instead writes a question mark ('?') to the - console. This conversion does not apply with a TrueType font, nor with the - Raster Font for CP932 or CP936. - - -ReadConsoleOutput and double-width characters -============================================== - - * With a Raster Font active, when `ReadConsoleOutputW` reads two cells of a - double-width character, it fills only a single `CHAR_INFO` structure. The - unused trailing `CHAR_INFO` structures are zero-filled. With a TrueType - font active, `ReadConsoleOutputW` instead fills two `CHAR_INFO` structures, - the first marked with `COMMON_LVB_LEADING_BYTE` and the second marked with - `COMMON_LVB_TRAILING_BYTE`. The flag is a misnomer--there aren't two - *bytes*, but two cells, and they have equal `CHAR_INFO.Char.UnicodeChar` - values. - - * `ReadConsoleOutputA`, on the other hand, reads two `CHAR_INFO` cells, and - if the UTF-16 value can be represented as two bytes in the ANSI/OEM CP, then - the two bytes are placed in the two `CHAR_INFO.Char.AsciiChar` values, and - the `COMMON_LVB_{LEADING,TRAILING}_BYTE` values are also used. If the - codepoint isn't representable, I don't remember what happens -- I think the - `AsciiChar` values take on an invalid marker. - - * Reading only one cell of a double-width character reads a space (U+0020) - instead. Raster-vs-TrueType and wide-vs-ANSI do not matter. - - XXX: what about attributes? Can a double-width character have mismatched - color attributes? - - XXX: what happens when writing to just one cell of a double-width - character? - - -Default Windows fonts for East Asian languages -============================================== -CP932 / Japanese: "ï¼­ï¼³ ゴシック" (MS Gothic) -CP936 / Chinese Simplified: "新宋体" (SimSun) - - -Unreliable character width (half-width vs full-width) -===================================================== - -The half-width vs full-width status of a codepoint depends on at least these variables: - * OS version (Win10 legacy and new modes are different versions) - * system locale (English vs Japanese vs Chinese Simplified vs Chinese Traditional, etc) - * code page (437 vs 932 vs 936, etc) - * raster vs TrueType (Terminal vs MS Gothic vs SimSun, etc) - * font size - * rendered-vs-model (rendered width can be larger or smaller than model width) - -Example 1: U+2014 (EM DASH): East_Asian_Width: Ambiguous --------------------------------------------------------- - rendered modeled -CP932: Win7/8 Raster Fonts half half -CP932: Win7/8 Gothic 14/15px half full -CP932: Win7/8 Consolas 14/15px half full -CP932: Win7/8 Lucida Console 14px half full -CP932: Win7/8 Lucida Console 15px half half -CP932: Win10New Raster Fonts half half -CP932: Win10New Gothic 14/15px half half -CP932: Win10New Consolas 14/15px half half -CP932: Win10New Lucida Console 14/15px half half - -CP936: Win7/8 Raster Fonts full full -CP936: Win7/8 SimSun 14px full full -CP936: Win7/8 SimSun 15px full half -CP936: Win7/8 Consolas 14/15px half full -CP936: Win10New Raster Fonts full full -CP936: Win10New SimSum 14/15px full full -CP936: Win10New Consolas 14/15px half half - -Example 2: U+3044 (HIRAGANA LETTER I): East_Asian_Width: Wide -------------------------------------------------------------- - rendered modeled -CP932: Win7/8/10N Raster Fonts full full -CP932: Win7/8/10N Gothic 14/15px full full -CP932: Win7/8/10N Consolas 14/15px half(*2) full -CP932: Win7/8/10N Lucida Console 14/15px half(*3) full - -CP936: Win7/8/10N Raster Fonts full full -CP936: Win7/8/10N SimSun 14/15px full full -CP936: Win7/8/10N Consolas 14/15px full full - -Example 3: U+30FC (KATAKANA-HIRAGANA PROLONGED SOUND MARK): East_Asian_Width: Wide ----------------------------------------------------------------------------------- - rendered modeled -CP932: Win7 Raster Fonts full full -CP932: Win7 Gothic 14/15px full full -CP932: Win7 Consolas 14/15px half(*2) full -CP932: Win7 Lucida Console 14px half(*3) full -CP932: Win7 Lucida Console 15px half(*3) half -CP932: Win8 Raster Fonts full full -CP932: Win8 Gothic 14px full half -CP932: Win8 Gothic 15px full full -CP932: Win8 Consolas 14/15px half(*2) full -CP932: Win8 Lucida Console 14px half(*3) full -CP932: Win8 Lucida Console 15px half(*3) half -CP932: Win10New Raster Fonts full full -CP932: Win10New Gothic 14/15px full full -CP932: Win10New Consolas 14/15px half(*2) half -CP932: Win10New Lucida Console 14/15px half(*2) half - -CP936: Win7/8 Raster Fonts full full -CP936: Win7/8 SimSun 14px full full -CP936: Win7/8 SimSun 15px full half -CP936: Win7/8 Consolas 14px full full -CP936: Win7/8 Consolas 15px full half -CP936: Win10New Raster Fonts full full -CP936: Win10New SimSum 14/15px full full -CP936: Win10New Consolas 14/15px full full - -Example 4: U+4000 (CJK UNIFIED IDEOGRAPH-4000): East_Asian_Width: Wide ----------------------------------------------------------------------- - rendered modeled -CP932: Win7 Raster Fonts half(*1) half -CP932: Win7 Gothic 14/15px full full -CP932: Win7 Consolas 14/15px half(*2) full -CP932: Win7 Lucida Console 14px half(*3) full -CP932: Win7 Lucida Console 15px half(*3) half -CP932: Win8 Raster Fonts half(*1) half -CP932: Win8 Gothic 14px full half -CP932: Win8 Gothic 15px full full -CP932: Win8 Consolas 14/15px half(*2) full -CP932: Win8 Lucida Console 14px half(*3) full -CP932: Win8 Lucida Console 15px half(*3) half -CP932: Win10New Raster Fonts half(*1) half -CP932: Win10New Gothic 14/15px full full -CP932: Win10New Consolas 14/15px half(*2) half -CP932: Win10New Lucida Console 14/15px half(*2) half - -CP936: Win7/8 Raster Fonts full full -CP936: Win7/8 SimSun 14px full full -CP936: Win7/8 SimSun 15px full half -CP936: Win7/8 Consolas 14px full full -CP936: Win7/8 Consolas 15px full half -CP936: Win10New Raster Fonts full full -CP936: Win10New SimSum 14/15px full full -CP936: Win10New Consolas 14/15px full full - -(*1) Rendered as a half-width filled white box -(*2) Rendered as a half-width box with a question mark inside -(*3) Rendered as a half-width empty box -(!!) One of the only places in Win10New where rendered and modeled width disagree - - -Windows quirk: unreliable font heights with CP936 / Chinese Simplified -====================================================================== - -When I set the font to 新宋体 17px, using either the properties dialog or -`SetCurrentConsoleFontEx`, the height reported by `GetCurrentConsoleFontEx` is -not 17, but is instead 19. The same problem does not affect Raster Fonts, -nor have I seen the problem in the English or Japanese locales. I observed -this with Windows 7 and Windows 10 new mode. - -If I set the font using the facename, width, *and* height, then the -`SetCurrentConsoleFontEx` and `GetCurrentConsoleFontEx` values agree. If I -set the font using *only* the facename and height, then the two values -disagree. - - -Windows bug: GetCurrentConsoleFontEx is initially invalid -========================================================= - - - Assume there is no configured console font name in the registry. In this - case, the console defaults to a raster font. - - Open a new console and call the `GetCurrentConsoleFontEx` API. - - The `FaceName` field of the returned `CONSOLE_FONT_INFOEX` data - structure is incorrect. On Windows 7, 8, and 10, I observed that the - field was blank. On Windows 8, occasionally, it instead contained: - U+AE72 U+75BE U+0001 - The other fields of the structure all appeared correct: - nFont=6 dwFontSize=(8,12) FontFamily=0x30 FontWeight=400 - - The `FaceName` field becomes initialized easily: - - Open the console properties dialog and click OK. (Cancel is not - sufficient.) - - Call the undocumented `SetConsoleFont` with the current font table - index, which is 6 in the example above. - - It seems that the console uncritically accepts whatever string is - stored in the registry, including a blank string, and passes it on the - the `GetCurrentConsoleFontEx` caller. It is possible to get the console - to *write* a blank setting into the registry -- simply open the console - (default or app-specific) properties and click OK. diff --git a/node_modules/node-pty/deps/winpty/misc/winbug-15048.cc b/node_modules/node-pty/deps/winpty/misc/winbug-15048.cc deleted file mode 100644 index 0e98d64..0000000 --- a/node_modules/node-pty/deps/winpty/misc/winbug-15048.cc +++ /dev/null @@ -1,201 +0,0 @@ -/* - -Test program demonstrating a problem in Windows 15048's ReadConsoleOutput API. - -To compile: - - cl /nologo /EHsc winbug-15048.cc shell32.lib - -Example of regressed input: - -Case 1: - - > chcp 932 - > winbug-15048 -face-gothic 3044 - - Correct output: - - 1**34 (nb: U+3044 replaced with '**' to avoid MSVC encoding warning) - 5678 - - ReadConsoleOutputW (both rows, 3 cols) - row 0: U+0031(0007) U+3044(0107) U+3044(0207) U+0033(0007) - row 1: U+0035(0007) U+0036(0007) U+0037(0007) U+0038(0007) - - ReadConsoleOutputW (both rows, 4 cols) - row 0: U+0031(0007) U+3044(0107) U+3044(0207) U+0033(0007) U+0034(0007) - row 1: U+0035(0007) U+0036(0007) U+0037(0007) U+0038(0007) U+0020(0007) - - ReadConsoleOutputW (second row) - row 1: U+0035(0007) U+0036(0007) U+0037(0007) U+0038(0007) U+0020(0007) - - ... - - Win10 15048 bad output: - - 1**34 - 5678 - - ReadConsoleOutputW (both rows, 3 cols) - row 0: U+0031(0007) U+3044(0007) U+0033(0007) U+0035(0007) - row 1: U+0036(0007) U+0037(0007) U+0038(0007) U+0000(0000) - - ReadConsoleOutputW (both rows, 4 cols) - row 0: U+0031(0007) U+3044(0007) U+0033(0007) U+0034(0007) U+0035(0007) - row 1: U+0036(0007) U+0037(0007) U+0038(0007) U+0020(0007) U+0000(0000) - - ReadConsoleOutputW (second row) - row 1: U+0035(0007) U+0036(0007) U+0037(0007) U+0038(0007) U+0020(0007) - - ... - - The U+3044 character (HIRAGANA LETTER I) occupies two columns, but it only - fills one record in the ReadConsoleOutput output buffer, which has the - effect of shifting the first cell of the second row into the last cell of - the first row. Ordinarily, the first and second cells would also have the - COMMON_LVB_LEADING_BYTE and COMMON_LVB_TRAILING_BYTE attributes set, which - allows winpty to detect the double-column character. - -Case 2: - - > chcp 437 - > winbug-15048 -face "Lucida Console" -h 4 221A - - The same issue happens with U+221A (SQUARE ROOT), but only in certain - fonts. The console seems to think this character occupies two columns - if the font is sufficiently small. The Windows console properties dialog - doesn't allow fonts below 5 pt, but winpty tries to use 2pt and 4pt Lucida - Console to allow very large console windows. - -Case 3: - - > chcp 437 - > winbug-15048 -face "Lucida Console" -h 12 FF12 - - The console selection system thinks U+FF12 (FULLWIDTH DIGIT TWO) occupies - two columns, which happens to be correct, but it's displayed as a single - column unrecognized character. It otherwise behaves the same as the other - cases. - -*/ - -#include -#include -#include -#include -#include -#include - -#include - -#define COUNT_OF(array) (sizeof(array) / sizeof((array)[0])) - -// See https://en.wikipedia.org/wiki/List_of_CJK_fonts -const wchar_t kMSGothic[] = { 0xff2d, 0xff33, 0x0020, 0x30b4, 0x30b7, 0x30c3, 0x30af, 0 }; // Japanese -const wchar_t kNSimSun[] = { 0x65b0, 0x5b8b, 0x4f53, 0 }; // Simplified Chinese -const wchar_t kMingLight[] = { 0x7d30, 0x660e, 0x9ad4, 0 }; // Traditional Chinese -const wchar_t kGulimChe[] = { 0xad74, 0xb9bc, 0xccb4, 0 }; // Korean - -static void set_font(const wchar_t *name, int size) { - const HANDLE conout = GetStdHandle(STD_OUTPUT_HANDLE); - CONSOLE_FONT_INFOEX fontex {}; - fontex.cbSize = sizeof(fontex); - fontex.dwFontSize.Y = size; - fontex.FontWeight = 400; - fontex.FontFamily = 0x36; - wcsncpy(fontex.FaceName, name, COUNT_OF(fontex.FaceName)); - assert(SetCurrentConsoleFontEx(conout, FALSE, &fontex)); -} - -static void usage(const wchar_t *prog) { - printf("Usage: %ls [options]\n", prog); - printf(" -h HEIGHT\n"); - printf(" -face FACENAME\n"); - printf(" -face-{gothic|simsun|minglight|gulimche) [JP,CN-sim,CN-tra,KR]\n"); - printf(" hhhh -- print U+hhhh\n"); - exit(1); -} - -static void dump_region(SMALL_RECT region, const char *name) { - const HANDLE conout = GetStdHandle(STD_OUTPUT_HANDLE); - - CHAR_INFO buf[1000]; - memset(buf, 0xcc, sizeof(buf)); - - const int w = region.Right - region.Left + 1; - const int h = region.Bottom - region.Top + 1; - - assert(ReadConsoleOutputW( - conout, buf, { (short)w, (short)h }, { 0, 0 }, - ®ion)); - - printf("\n"); - printf("ReadConsoleOutputW (%s)\n", name); - for (int y = 0; y < h; ++y) { - printf("row %d: ", region.Top + y); - for (int i = 0; i < region.Left * 13; ++i) { - printf(" "); - } - for (int x = 0; x < w; ++x) { - const int i = y * w + x; - printf("U+%04x(%04x) ", buf[i].Char.UnicodeChar, buf[i].Attributes); - } - printf("\n"); - } -} - -int main() { - wchar_t *cmdline = GetCommandLineW(); - int argc = 0; - wchar_t **argv = CommandLineToArgvW(cmdline, &argc); - const wchar_t *font_name = L"Lucida Console"; - int font_height = 8; - int test_ch = 0xff12; // U+FF12 FULLWIDTH DIGIT TWO - - for (int i = 1; i < argc; ++i) { - const std::wstring arg = argv[i]; - const std::wstring next = i + 1 < argc ? argv[i + 1] : L""; - if (arg == L"-face" && i + 1 < argc) { - font_name = argv[i + 1]; - i++; - } else if (arg == L"-face-gothic") { - font_name = kMSGothic; - } else if (arg == L"-face-simsun") { - font_name = kNSimSun; - } else if (arg == L"-face-minglight") { - font_name = kMingLight; - } else if (arg == L"-face-gulimche") { - font_name = kGulimChe; - } else if (arg == L"-h" && i + 1 < argc) { - font_height = _wtoi(next.c_str()); - i++; - } else if (arg.c_str()[0] != '-') { - test_ch = wcstol(arg.c_str(), NULL, 16); - } else { - printf("Unrecognized argument: %ls\n", arg.c_str()); - usage(argv[0]); - } - } - - const HANDLE conout = GetStdHandle(STD_OUTPUT_HANDLE); - - set_font(font_name, font_height); - - system("cls"); - DWORD actual = 0; - wchar_t output[] = L"1234\n5678\n"; - output[1] = test_ch; - WriteConsoleW(conout, output, 10, &actual, nullptr); - - dump_region({ 0, 0, 3, 1 }, "both rows, 3 cols"); - dump_region({ 0, 0, 4, 1 }, "both rows, 4 cols"); - dump_region({ 0, 1, 4, 1 }, "second row"); - dump_region({ 0, 0, 4, 0 }, "first row"); - dump_region({ 1, 0, 4, 0 }, "first row, skip 1"); - dump_region({ 2, 0, 4, 0 }, "first row, skip 2"); - dump_region({ 3, 0, 4, 0 }, "first row, skip 3"); - - set_font(font_name, 14); - - return 0; -} diff --git a/node_modules/node-pty/deps/winpty/ship/build-pty4j-libpty.bat b/node_modules/node-pty/deps/winpty/ship/build-pty4j-libpty.bat deleted file mode 100644 index b6bca7b..0000000 --- a/node_modules/node-pty/deps/winpty/ship/build-pty4j-libpty.bat +++ /dev/null @@ -1,36 +0,0 @@ -@echo off - -setlocal -cd %~dp0.. -set Path=C:\Python27;C:\Program Files\Git\cmd;%Path% - -call "%VS140COMNTOOLS%\VsDevCmd.bat" || goto :fail - -rmdir /s/q build-libpty 2>NUL -mkdir build-libpty\win -mkdir build-libpty\win\x86 -mkdir build-libpty\win\x86_64 -mkdir build-libpty\win\xp - -rmdir /s/q src\Release 2>NUL -rmdir /s/q src\.vs 2>NUL -del src\*.vcxproj src\*.vcxproj.filters src\*.sln src\*.sdf 2>NUL - -call vcbuild.bat --msvc-platform Win32 --gyp-msvs-version 2015 --toolset v140_xp || goto :fail -copy src\Release\Win32\winpty.dll build-libpty\win\xp || goto :fail -copy src\Release\Win32\winpty-agent.exe build-libpty\win\xp || goto :fail - -call vcbuild.bat --msvc-platform Win32 --gyp-msvs-version 2015 || goto :fail -copy src\Release\Win32\winpty.dll build-libpty\win\x86 || goto :fail -copy src\Release\Win32\winpty-agent.exe build-libpty\win\x86 || goto :fail - -call vcbuild.bat --msvc-platform x64 --gyp-msvs-version 2015 || goto :fail -copy src\Release\x64\winpty.dll build-libpty\win\x86_64 || goto :fail -copy src\Release\x64\winpty-agent.exe build-libpty\win\x86_64 || goto :fail - -echo success -goto :EOF - -:fail -echo error: build failed -exit /b 1 diff --git a/node_modules/node-pty/deps/winpty/ship/common_ship.py b/node_modules/node-pty/deps/winpty/ship/common_ship.py deleted file mode 100644 index b46cd5b..0000000 --- a/node_modules/node-pty/deps/winpty/ship/common_ship.py +++ /dev/null @@ -1,53 +0,0 @@ -import os -import sys - -if os.name != "nt": - sys.exit("Error: ship scripts require native Python 2.7. (wrong os.name)") -if sys.version_info[0:2] != (2,7): - sys.exit("Error: ship scripts require native Python 2.7. (wrong version)") - -import glob -import shutil -import subprocess -from distutils.spawn import find_executable - -topDir = os.path.abspath(os.path.dirname(os.path.dirname(__file__))) - -with open(topDir + "/VERSION.txt", "rt") as f: - winptyVersion = f.read().strip() - -def rmrf(patterns): - for pattern in patterns: - for path in glob.glob(pattern): - if os.path.isdir(path) and not os.path.islink(path): - print "+ rm -r " + path - sys.stdout.flush() - shutil.rmtree(path) - elif os.path.isfile(path): - print "+ rm " + path - sys.stdout.flush() - os.remove(path) - -def mkdir(path): - if not os.path.isdir(path): - os.makedirs(path) - -def requireExe(name, guesses): - if find_executable(name) is None: - for guess in guesses: - if os.path.exists(guess): - newDir = os.path.dirname(guess) - print "Adding " + newDir + " to Path to provide " + name - os.environ["Path"] = newDir + ";" + os.environ["Path"] - ret = find_executable(name) - if ret is None: - sys.exit("Error: required EXE is missing from Path: " + name) - return ret - -requireExe("git.exe", [ - "C:\\Program Files\\Git\\cmd\\git.exe", - "C:\\Program Files (x86)\\Git\\cmd\\git.exe" -]) - -commitHash = subprocess.check_output(["git.exe", "rev-parse", "HEAD"]).decode().strip() -defaultPathEnviron = "C:\\Windows\\System32;C:\\Windows" diff --git a/node_modules/node-pty/deps/winpty/ship/make_msvc_package.py b/node_modules/node-pty/deps/winpty/ship/make_msvc_package.py deleted file mode 100644 index 220f02b..0000000 --- a/node_modules/node-pty/deps/winpty/ship/make_msvc_package.py +++ /dev/null @@ -1,165 +0,0 @@ -#!python - -# Copyright (c) 2016 Ryan Prichard -# -# 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. - -# -# Run with native CPython 2.7. -# -# This script looks for MSVC using a version-specific environment variable, -# such as VS140COMNTOOLS for MSVC 2015. -# - -import common_ship - -import argparse -import os -import shutil -import subprocess -import sys - -os.chdir(common_ship.topDir) -ZIP_TOOL = common_ship.requireExe("7z.exe", [ - "C:\\Program Files\\7-Zip\\7z.exe", - "C:\\Program Files (x86)\\7-Zip\\7z.exe", -]) - -MSVC_VERSION_TABLE = { - "2015" : { - "package_name" : "msvc2015", - "gyp_version" : "2015", - "common_tools_env" : "VS140COMNTOOLS", - "xp_toolset" : "v140_xp", - }, - "2013" : { - "package_name" : "msvc2013", - "gyp_version" : "2013", - "common_tools_env" : "VS120COMNTOOLS", - "xp_toolset" : "v120_xp", - }, -} - -ARCH_TABLE = { - "x64" : { - "msvc_platform" : "x64", - }, - "ia32" : { - "msvc_platform" : "Win32", - }, -} - -def readArguments(): - parser = argparse.ArgumentParser() - parser.add_argument("--msvc-version", default="2015") - ret = parser.parse_args() - if ret.msvc_version not in MSVC_VERSION_TABLE: - sys.exit("Error: unrecognized version: " + ret.msvc_version + ". " + - "Versions: " + " ".join(sorted(MSVC_VERSION_TABLE.keys()))) - return ret - -ARGS = readArguments() - -def checkoutGyp(): - if os.path.isdir("build-gyp"): - return - subprocess.check_call([ - "git.exe", - "clone", - "https://chromium.googlesource.com/external/gyp", - "build-gyp" - ]) - -def cleanMsvc(): - common_ship.rmrf(""" - src/Release src/.vs src/gen - src/*.vcxproj src/*.vcxproj.filters src/*.sln src/*.sdf - """.split()) - -def build(arch, packageDir, xp=False): - archInfo = ARCH_TABLE[arch] - versionInfo = MSVC_VERSION_TABLE[ARGS.msvc_version] - - devCmdPath = os.path.join(os.environ[versionInfo["common_tools_env"]], "VsDevCmd.bat") - if not os.path.isfile(devCmdPath): - sys.exit("Error: MSVC environment script missing: " + devCmdPath) - - newEnv = os.environ.copy() - newEnv["PATH"] = os.path.dirname(sys.executable) + ";" + common_ship.defaultPathEnviron - commandLine = ( - '"' + devCmdPath + '" && ' - " vcbuild.bat" + - " --gyp-msvs-version " + versionInfo["gyp_version"] + - " --msvc-platform " + archInfo["msvc_platform"] + - " --commit-hash " + common_ship.commitHash - ) - - subprocess.check_call(commandLine, shell=True, env=newEnv) - - archPackageDir = os.path.join(packageDir, arch) - if xp: - archPackageDir += "_xp" - - common_ship.mkdir(archPackageDir + "/bin") - common_ship.mkdir(archPackageDir + "/lib") - - binSrc = os.path.join(common_ship.topDir, "src/Release", archInfo["msvc_platform"]) - - shutil.copy(binSrc + "/winpty.dll", archPackageDir + "/bin") - shutil.copy(binSrc + "/winpty-agent.exe", archPackageDir + "/bin") - shutil.copy(binSrc + "/winpty-debugserver.exe", archPackageDir + "/bin") - shutil.copy(binSrc + "/winpty.lib", archPackageDir + "/lib") - -def buildPackage(): - versionInfo = MSVC_VERSION_TABLE[ARGS.msvc_version] - - packageName = "winpty-%s-%s" % ( - common_ship.winptyVersion, - versionInfo["package_name"], - ) - - packageRoot = os.path.join(common_ship.topDir, "ship/packages") - packageDir = os.path.join(packageRoot, packageName) - packageFile = packageDir + ".zip" - - common_ship.rmrf([packageDir]) - common_ship.rmrf([packageFile]) - common_ship.mkdir(packageDir) - - checkoutGyp() - cleanMsvc() - build("ia32", packageDir, True) - build("x64", packageDir, True) - cleanMsvc() - build("ia32", packageDir) - build("x64", packageDir) - - topDir = common_ship.topDir - - common_ship.mkdir(packageDir + "/include") - shutil.copy(topDir + "/src/include/winpty.h", packageDir + "/include") - shutil.copy(topDir + "/src/include/winpty_constants.h", packageDir + "/include") - shutil.copy(topDir + "/LICENSE", packageDir) - shutil.copy(topDir + "/README.md", packageDir) - shutil.copy(topDir + "/RELEASES.md", packageDir) - - subprocess.check_call([ZIP_TOOL, "a", packageFile, "."], cwd=packageDir) - -if __name__ == "__main__": - buildPackage() diff --git a/node_modules/node-pty/deps/winpty/ship/ship.py b/node_modules/node-pty/deps/winpty/ship/ship.py deleted file mode 100644 index 12874ba..0000000 --- a/node_modules/node-pty/deps/winpty/ship/ship.py +++ /dev/null @@ -1,108 +0,0 @@ -#!python - -# Copyright (c) 2015 Ryan Prichard -# -# 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. - -# -# Run with native CPython 2.7 on a 64-bit computer. -# -# Each of the targets in BUILD_TARGETS must be installed to the default -# location. Each target must have the appropriate MinGW and non-MinGW -# compilers installed, as well as make and tar. -# - -import common_ship - -import multiprocessing -import os -import shutil -import subprocess -import sys - -os.chdir(common_ship.topDir) - -def dllVersion(path): - version = subprocess.check_output( - ["powershell.exe", - "[System.Diagnostics.FileVersionInfo]::GetVersionInfo(\"" + path + "\").FileVersion"]) - return version.strip() - -# Determine other build parameters. -print "Determining Cygwin/MSYS2 DLL versions..." -sys.stdout.flush() -BUILD_TARGETS = [ - # { - # "name": "msys", - # "path": "C:\\MinGW\\bin;C:\\MinGW\\msys\\1.0\\bin", - # # The parallel make.exe in the original MSYS/MinGW project hangs. - # "make_binary": "mingw32-make.exe", - # }, - { - "name": "msys2-" + dllVersion("C:\\msys32\\usr\\bin\\msys-2.0.dll") + "-ia32", - "path": "C:\\msys32\\mingw32\\bin;C:\\msys32\\usr\\bin", - }, - { - "name": "msys2-" + dllVersion("C:\\msys64\\usr\\bin\\msys-2.0.dll") + "-x64", - "path": "C:\\msys64\\mingw64\\bin;C:\\msys64\\usr\\bin", - }, - { - "name": "cygwin-" + dllVersion("C:\\cygwin\\bin\\cygwin1.dll") + "-ia32", - "path": "C:\\cygwin\\bin", - }, - { - "name": "cygwin-" + dllVersion("C:\\cygwin64\\bin\\cygwin1.dll") + "-x64", - "path": "C:\\cygwin64\\bin", - }, -] - -def buildTarget(target): - packageName = "winpty-" + common_ship.winptyVersion + "-" + target["name"] - if os.path.exists("ship\\packages\\" + packageName): - shutil.rmtree("ship\\packages\\" + packageName) - oldPath = os.environ["PATH"] - os.environ["PATH"] = target["path"] + ";" + common_ship.defaultPathEnviron - subprocess.check_call(["sh.exe", "configure"]) - makeBinary = target.get("make_binary", "make.exe") - subprocess.check_call([makeBinary, "clean"]) - makeBaseCmd = [ - makeBinary, - "USE_PCH=0", - "COMMIT_HASH=" + common_ship.commitHash, - "PREFIX=ship/packages/" + packageName - ] - subprocess.check_call(makeBaseCmd + ["all", "tests", "-j%d" % multiprocessing.cpu_count()]) - subprocess.check_call(["build\\trivial_test.exe"]) - subprocess.check_call(makeBaseCmd + ["install"]) - subprocess.check_call(["tar.exe", "cvfz", - packageName + ".tar.gz", - packageName], cwd=os.path.join(os.getcwd(), "ship", "packages")) - os.environ["PATH"] = oldPath - -def main(): - oldPath = os.environ["PATH"] - for t in BUILD_TARGETS: - os.environ["PATH"] = t["path"] + ";" + common_ship.defaultPathEnviron - subprocess.check_output(["tar.exe", "--help"]) - subprocess.check_output(["make.exe", "--help"]) - for t in BUILD_TARGETS: - buildTarget(t) - -if __name__ == "__main__": - main() diff --git a/node_modules/node-pty/deps/winpty/src/agent/Agent.cc b/node_modules/node-pty/deps/winpty/src/agent/Agent.cc deleted file mode 100644 index a77b644..0000000 --- a/node_modules/node-pty/deps/winpty/src/agent/Agent.cc +++ /dev/null @@ -1,605 +0,0 @@ -// Copyright (c) 2011-2015 Ryan Prichard -// -// 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. - -#include "Agent.h" - -#include - -#include -#include -#include -#include - -#include -#include -#include - -#include "../include/winpty_constants.h" - -#include "../shared/AgentMsg.h" -#include "../shared/Buffer.h" -#include "../shared/DebugClient.h" -#include "../shared/GenRandom.h" -#include "../shared/StringBuilder.h" -#include "../shared/StringUtil.h" -#include "../shared/WindowsVersion.h" -#include "../shared/WinptyAssert.h" - -#include "ConsoleFont.h" -#include "ConsoleInput.h" -#include "NamedPipe.h" -#include "Scraper.h" -#include "Terminal.h" -#include "Win32ConsoleBuffer.h" - -namespace { - -static BOOL WINAPI consoleCtrlHandler(DWORD dwCtrlType) -{ - if (dwCtrlType == CTRL_C_EVENT) { - // Do nothing and claim to have handled the event. - return TRUE; - } - return FALSE; -} - -// We can detect the new Windows 10 console by observing the effect of the -// Mark command. In older consoles, Mark temporarily moves the cursor to the -// top-left of the console window. In the new console, the cursor isn't -// initially moved. -// -// We might like to use Mark to freeze the console, but we can't, because when -// the Mark command ends, the console moves the cursor back to its starting -// point, even if the console application has moved it in the meantime. -static void detectNewWindows10Console( - Win32Console &console, Win32ConsoleBuffer &buffer) -{ - if (!isAtLeastWindows8()) { - return; - } - - ConsoleScreenBufferInfo info = buffer.bufferInfo(); - - // Make sure the window isn't 1x1. AFAIK, this should never happen - // accidentally. It is difficult to make it happen deliberately. - if (info.srWindow.Left == info.srWindow.Right && - info.srWindow.Top == info.srWindow.Bottom) { - trace("detectNewWindows10Console: Initial console window was 1x1 -- " - "expanding for test"); - setSmallFont(buffer.conout(), 400, false); - buffer.moveWindow(SmallRect(0, 0, 1, 1)); - buffer.resizeBuffer(Coord(400, 1)); - buffer.moveWindow(SmallRect(0, 0, 2, 1)); - // This use of GetLargestConsoleWindowSize ought to be unnecessary - // given the behavior I've seen from moveWindow(0, 0, 1, 1), but - // I'd like to be especially sure, considering that this code will - // rarely be tested. - const auto largest = GetLargestConsoleWindowSize(buffer.conout()); - buffer.moveWindow( - SmallRect(0, 0, std::min(largest.X, buffer.bufferSize().X), 1)); - info = buffer.bufferInfo(); - ASSERT(info.srWindow.Right > info.srWindow.Left && - "Could not expand console window from 1x1"); - } - - // Test whether MARK moves the cursor. - const Coord initialPosition(info.srWindow.Right, info.srWindow.Bottom); - buffer.setCursorPosition(initialPosition); - ASSERT(!console.frozen()); - console.setFreezeUsesMark(true); - console.setFrozen(true); - const bool isNewW10 = (buffer.cursorPosition() == initialPosition); - console.setFrozen(false); - buffer.setCursorPosition(Coord(0, 0)); - - trace("Attempting to detect new Windows 10 console using MARK: %s", - isNewW10 ? "detected" : "not detected"); - console.setFreezeUsesMark(false); - console.setNewW10(isNewW10); -} - -static inline WriteBuffer newPacket() { - WriteBuffer packet; - packet.putRawValue(0); // Reserve space for size. - return packet; -} - -static HANDLE duplicateHandle(HANDLE h) { - HANDLE ret = nullptr; - if (!DuplicateHandle( - GetCurrentProcess(), h, - GetCurrentProcess(), &ret, - 0, FALSE, DUPLICATE_SAME_ACCESS)) { - ASSERT(false && "DuplicateHandle failed!"); - } - return ret; -} - -// It's safe to truncate a handle from 64-bits to 32-bits, or to sign-extend it -// back to 64-bits. See the MSDN article, "Interprocess Communication Between -// 32-bit and 64-bit Applications". -// https://msdn.microsoft.com/en-us/library/windows/desktop/aa384203.aspx -static int64_t int64FromHandle(HANDLE h) { - return static_cast(reinterpret_cast(h)); -} - -} // anonymous namespace - -Agent::Agent(LPCWSTR controlPipeName, - uint64_t agentFlags, - int mouseMode, - int initialCols, - int initialRows) : - m_useConerr((agentFlags & WINPTY_FLAG_CONERR) != 0), - m_plainMode((agentFlags & WINPTY_FLAG_PLAIN_OUTPUT) != 0), - m_mouseMode(mouseMode) -{ - trace("Agent::Agent entered"); - - ASSERT(initialCols >= 1 && initialRows >= 1); - initialCols = std::min(initialCols, MAX_CONSOLE_WIDTH); - initialRows = std::min(initialRows, MAX_CONSOLE_HEIGHT); - - const bool outputColor = - !m_plainMode || (agentFlags & WINPTY_FLAG_COLOR_ESCAPES); - const Coord initialSize(initialCols, initialRows); - - auto primaryBuffer = openPrimaryBuffer(); - if (m_useConerr) { - m_errorBuffer = Win32ConsoleBuffer::createErrorBuffer(); - } - - detectNewWindows10Console(m_console, *primaryBuffer); - - m_controlPipe = &connectToControlPipe(controlPipeName); - m_coninPipe = &createDataServerPipe(false, L"conin"); - m_conoutPipe = &createDataServerPipe(true, L"conout"); - if (m_useConerr) { - m_conerrPipe = &createDataServerPipe(true, L"conerr"); - } - - // Send an initial response packet to winpty.dll containing pipe names. - { - auto setupPacket = newPacket(); - setupPacket.putWString(m_coninPipe->name()); - setupPacket.putWString(m_conoutPipe->name()); - if (m_useConerr) { - setupPacket.putWString(m_conerrPipe->name()); - } - writePacket(setupPacket); - } - - std::unique_ptr primaryTerminal; - primaryTerminal.reset(new Terminal(*m_conoutPipe, - m_plainMode, - outputColor)); - m_primaryScraper.reset(new Scraper(m_console, - *primaryBuffer, - std::move(primaryTerminal), - initialSize)); - if (m_useConerr) { - std::unique_ptr errorTerminal; - errorTerminal.reset(new Terminal(*m_conerrPipe, - m_plainMode, - outputColor)); - m_errorScraper.reset(new Scraper(m_console, - *m_errorBuffer, - std::move(errorTerminal), - initialSize)); - } - - m_console.setTitle(m_currentTitle); - - const HANDLE conin = GetStdHandle(STD_INPUT_HANDLE); - m_consoleInput.reset( - new ConsoleInput(conin, m_mouseMode, *this, m_console)); - - // Setup Ctrl-C handling. First restore default handling of Ctrl-C. This - // attribute is inherited by child processes. Then register a custom - // Ctrl-C handler that does nothing. The handler will be called when the - // agent calls GenerateConsoleCtrlEvent. - SetConsoleCtrlHandler(NULL, FALSE); - SetConsoleCtrlHandler(consoleCtrlHandler, TRUE); - - setPollInterval(25); -} - -Agent::~Agent() -{ - trace("Agent::~Agent entered"); - agentShutdown(); - if (m_childProcess != NULL) { - CloseHandle(m_childProcess); - } -} - -// Write a "Device Status Report" command to the terminal. The terminal will -// reply with a row+col escape sequence. Presumably, the DSR reply will not -// split a keypress escape sequence, so it should be safe to assume that the -// bytes before it are complete keypresses. -void Agent::sendDsr() -{ - if (!m_plainMode && !m_conoutPipe->isClosed()) { - m_conoutPipe->write("\x1B[6n"); - } -} - -NamedPipe &Agent::connectToControlPipe(LPCWSTR pipeName) -{ - NamedPipe &pipe = createNamedPipe(); - pipe.connectToServer(pipeName, NamedPipe::OpenMode::Duplex); - pipe.setReadBufferSize(64 * 1024); - return pipe; -} - -// Returns a new server named pipe. It has not yet been connected. -NamedPipe &Agent::createDataServerPipe(bool write, const wchar_t *kind) -{ - const auto name = - (WStringBuilder(128) - << L"\\\\.\\pipe\\winpty-" - << kind << L'-' - << GenRandom().uniqueName()).str_moved(); - NamedPipe &pipe = createNamedPipe(); - pipe.openServerPipe( - name.c_str(), - write ? NamedPipe::OpenMode::Writing - : NamedPipe::OpenMode::Reading, - write ? 8192 : 0, - write ? 0 : 256); - if (!write) { - pipe.setReadBufferSize(64 * 1024); - } - return pipe; -} - -void Agent::onPipeIo(NamedPipe &namedPipe) -{ - if (&namedPipe == m_conoutPipe || &namedPipe == m_conerrPipe) { - autoClosePipesForShutdown(); - } else if (&namedPipe == m_coninPipe) { - pollConinPipe(); - } else if (&namedPipe == m_controlPipe) { - pollControlPipe(); - } -} - -void Agent::pollControlPipe() -{ - if (m_controlPipe->isClosed()) { - trace("Agent exiting (control pipe is closed)"); - shutdown(); - return; - } - - while (true) { - uint64_t packetSize = 0; - const auto amt1 = - m_controlPipe->peek(&packetSize, sizeof(packetSize)); - if (amt1 < sizeof(packetSize)) { - break; - } - ASSERT(packetSize >= sizeof(packetSize) && packetSize <= SIZE_MAX); - if (m_controlPipe->bytesAvailable() < packetSize) { - if (m_controlPipe->readBufferSize() < packetSize) { - m_controlPipe->setReadBufferSize(packetSize); - } - break; - } - std::vector packetData; - packetData.resize(packetSize); - const auto amt2 = m_controlPipe->read(packetData.data(), packetSize); - ASSERT(amt2 == packetSize); - try { - ReadBuffer buffer(std::move(packetData)); - buffer.getRawValue(); // Discard the size. - handlePacket(buffer); - } catch (const ReadBuffer::DecodeError&) { - ASSERT(false && "Decode error"); - } - } -} - -void Agent::handlePacket(ReadBuffer &packet) -{ - const int type = packet.getInt32(); - switch (type) { - case AgentMsg::StartProcess: - handleStartProcessPacket(packet); - break; - case AgentMsg::SetSize: - // TODO: I think it might make sense to collapse consecutive SetSize - // messages. i.e. The terminal process can probably generate SetSize - // messages faster than they can be processed, and some GUIs might - // generate a flood of them, so if we can read multiple SetSize packets - // at once, we can ignore the early ones. - handleSetSizePacket(packet); - break; - case AgentMsg::GetConsoleProcessList: - handleGetConsoleProcessListPacket(packet); - break; - default: - trace("Unrecognized message, id:%d", type); - } -} - -void Agent::writePacket(WriteBuffer &packet) -{ - const auto &bytes = packet.buf(); - packet.replaceRawValue(0, bytes.size()); - m_controlPipe->write(bytes.data(), bytes.size()); -} - -void Agent::handleStartProcessPacket(ReadBuffer &packet) -{ - ASSERT(m_childProcess == nullptr); - ASSERT(!m_closingOutputPipes); - - const uint64_t spawnFlags = packet.getInt64(); - const bool wantProcessHandle = packet.getInt32() != 0; - const bool wantThreadHandle = packet.getInt32() != 0; - const auto program = packet.getWString(); - const auto cmdline = packet.getWString(); - const auto cwd = packet.getWString(); - const auto env = packet.getWString(); - const auto desktop = packet.getWString(); - packet.assertEof(); - - auto cmdlineV = vectorWithNulFromString(cmdline); - auto desktopV = vectorWithNulFromString(desktop); - auto envV = vectorFromString(env); - - LPCWSTR programArg = program.empty() ? nullptr : program.c_str(); - LPWSTR cmdlineArg = cmdline.empty() ? nullptr : cmdlineV.data(); - LPCWSTR cwdArg = cwd.empty() ? nullptr : cwd.c_str(); - LPWSTR envArg = env.empty() ? nullptr : envV.data(); - - STARTUPINFOW sui = {}; - PROCESS_INFORMATION pi = {}; - sui.cb = sizeof(sui); - sui.lpDesktop = desktop.empty() ? nullptr : desktopV.data(); - BOOL inheritHandles = FALSE; - if (m_useConerr) { - inheritHandles = TRUE; - sui.dwFlags |= STARTF_USESTDHANDLES; - sui.hStdInput = GetStdHandle(STD_INPUT_HANDLE); - sui.hStdOutput = GetStdHandle(STD_OUTPUT_HANDLE); - sui.hStdError = m_errorBuffer->conout(); - } - - const BOOL success = - CreateProcessW(programArg, cmdlineArg, nullptr, nullptr, - /*bInheritHandles=*/inheritHandles, - /*dwCreationFlags=*/CREATE_UNICODE_ENVIRONMENT, - envArg, cwdArg, &sui, &pi); - const int lastError = success ? 0 : GetLastError(); - - trace("CreateProcess: %s %u", - (success ? "success" : "fail"), - static_cast(pi.dwProcessId)); - - auto reply = newPacket(); - if (success) { - int64_t replyProcess = 0; - int64_t replyThread = 0; - if (wantProcessHandle) { - replyProcess = int64FromHandle(duplicateHandle(pi.hProcess)); - } - if (wantThreadHandle) { - replyThread = int64FromHandle(duplicateHandle(pi.hThread)); - } - CloseHandle(pi.hThread); - m_childProcess = pi.hProcess; - m_autoShutdown = (spawnFlags & WINPTY_SPAWN_FLAG_AUTO_SHUTDOWN) != 0; - m_exitAfterShutdown = (spawnFlags & WINPTY_SPAWN_FLAG_EXIT_AFTER_SHUTDOWN) != 0; - reply.putInt32(static_cast(StartProcessResult::ProcessCreated)); - reply.putInt64(replyProcess); - reply.putInt64(replyThread); - } else { - reply.putInt32(static_cast(StartProcessResult::CreateProcessFailed)); - reply.putInt32(lastError); - } - writePacket(reply); -} - -void Agent::handleSetSizePacket(ReadBuffer &packet) -{ - const int cols = packet.getInt32(); - const int rows = packet.getInt32(); - packet.assertEof(); - resizeWindow(cols, rows); - auto reply = newPacket(); - writePacket(reply); -} - -void Agent::handleGetConsoleProcessListPacket(ReadBuffer &packet) -{ - packet.assertEof(); - - auto processList = std::vector(64); - auto processCount = GetConsoleProcessList(&processList[0], processList.size()); - if (processList.size() < processCount) { - processList.resize(processCount); - processCount = GetConsoleProcessList(&processList[0], processList.size()); - } - - if (processCount == 0) { - trace("GetConsoleProcessList failed"); - } - - auto reply = newPacket(); - reply.putInt32(processCount); - for (DWORD i = 0; i < processCount; i++) { - reply.putInt32(processList[i]); - } - writePacket(reply); -} - -void Agent::pollConinPipe() -{ - const std::string newData = m_coninPipe->readAllToString(); - if (hasDebugFlag("input_separated_bytes")) { - // This debug flag is intended to help with testing incomplete escape - // sequences and multibyte UTF-8 encodings. (I wonder if the normal - // code path ought to advance a state machine one byte at a time.) - for (size_t i = 0; i < newData.size(); ++i) { - m_consoleInput->writeInput(newData.substr(i, 1)); - } - } else { - m_consoleInput->writeInput(newData); - } -} - -void Agent::onPollTimeout() -{ - m_consoleInput->updateInputFlags(); - const bool enableMouseMode = m_consoleInput->shouldActivateTerminalMouse(); - - // Give the ConsoleInput object a chance to flush input from an incomplete - // escape sequence (e.g. pressing ESC). - m_consoleInput->flushIncompleteEscapeCode(); - - const bool shouldScrapeContent = !m_closingOutputPipes; - - // Check if the child process has exited. - if (m_autoShutdown && - m_childProcess != nullptr && - WaitForSingleObject(m_childProcess, 0) == WAIT_OBJECT_0) { - CloseHandle(m_childProcess); - m_childProcess = nullptr; - - // Close the data socket to signal to the client that the child - // process has exited. If there's any data left to send, send it - // before closing the socket. - m_closingOutputPipes = true; - } - - // Scrape for output *after* the above exit-check to ensure that we collect - // the child process's final output. - if (shouldScrapeContent) { - syncConsoleTitle(); - scrapeBuffers(); - } - - // We must ensure that we disable mouse mode before closing the CONOUT - // pipe, so update the mouse mode here. - m_primaryScraper->terminal().enableMouseMode( - enableMouseMode && !m_closingOutputPipes); - - autoClosePipesForShutdown(); -} - -void Agent::autoClosePipesForShutdown() -{ - if (m_closingOutputPipes) { - // We don't want to close a pipe before it's connected! If we do, the - // libwinpty client may try to connect to a non-existent pipe. This - // case is important for short-lived programs. - if (m_conoutPipe->isConnected() && - m_conoutPipe->bytesToSend() == 0) { - trace("Closing CONOUT pipe (auto-shutdown)"); - m_conoutPipe->closePipe(); - } - if (m_conerrPipe != nullptr && - m_conerrPipe->isConnected() && - m_conerrPipe->bytesToSend() == 0) { - trace("Closing CONERR pipe (auto-shutdown)"); - m_conerrPipe->closePipe(); - } - if (m_exitAfterShutdown && - m_conoutPipe->isClosed() && - (m_conerrPipe == nullptr || m_conerrPipe->isClosed())) { - trace("Agent exiting (exit-after-shutdown)"); - shutdown(); - } - } -} - -std::unique_ptr Agent::openPrimaryBuffer() -{ - // If we're using a separate buffer for stderr, and a program were to - // activate the stderr buffer, then we could accidentally scrape the same - // buffer twice. That probably shouldn't happen in ordinary use, but it - // can be avoided anyway by using the original console screen buffer in - // that mode. - if (!m_useConerr) { - return Win32ConsoleBuffer::openConout(); - } else { - return Win32ConsoleBuffer::openStdout(); - } -} - -void Agent::resizeWindow(int cols, int rows) -{ - ASSERT(cols >= 1 && rows >= 1); - cols = std::min(cols, MAX_CONSOLE_WIDTH); - rows = std::min(rows, MAX_CONSOLE_HEIGHT); - - Win32Console::FreezeGuard guard(m_console, m_console.frozen()); - const Coord newSize(cols, rows); - ConsoleScreenBufferInfo info; - auto primaryBuffer = openPrimaryBuffer(); - m_primaryScraper->resizeWindow(*primaryBuffer, newSize, info); - m_consoleInput->setMouseWindowRect(info.windowRect()); - if (m_errorScraper) { - m_errorScraper->resizeWindow(*m_errorBuffer, newSize, info); - } - - // Synthesize a WINDOW_BUFFER_SIZE_EVENT event. Normally, Windows - // generates this event only when the buffer size changes, not when the - // window size changes. This behavior is undesirable in two ways: - // - When winpty expands the window horizontally, it must expand the - // buffer first, then the window. At least some programs (e.g. the WSL - // bash.exe wrapper) use the window width rather than the buffer width, - // so there is a short timespan during which they can read the wrong - // value. - // - If the window's vertical size is changed, no event is generated, - // even though a typical well-behaved console program cares about the - // *window* height, not the *buffer* height. - // This synthesization works around a design flaw in the console. It's probably - // harmless. See https://github.com/rprichard/winpty/issues/110. - INPUT_RECORD sizeEvent {}; - sizeEvent.EventType = WINDOW_BUFFER_SIZE_EVENT; - sizeEvent.Event.WindowBufferSizeEvent.dwSize = primaryBuffer->bufferSize(); - DWORD actual {}; - WriteConsoleInputW(GetStdHandle(STD_INPUT_HANDLE), &sizeEvent, 1, &actual); -} - -void Agent::scrapeBuffers() -{ - Win32Console::FreezeGuard guard(m_console, m_console.frozen()); - ConsoleScreenBufferInfo info; - m_primaryScraper->scrapeBuffer(*openPrimaryBuffer(), info); - m_consoleInput->setMouseWindowRect(info.windowRect()); - if (m_errorScraper) { - m_errorScraper->scrapeBuffer(*m_errorBuffer, info); - } -} - -void Agent::syncConsoleTitle() -{ - std::wstring newTitle = m_console.title(); - if (newTitle != m_currentTitle) { - std::string command = std::string("\x1b]0;") + - utf8FromWide(newTitle) + "\x07"; - m_conoutPipe->write(command.c_str()); - m_currentTitle = newTitle; - } -} diff --git a/node_modules/node-pty/deps/winpty/src/agent/Agent.h b/node_modules/node-pty/deps/winpty/src/agent/Agent.h deleted file mode 100644 index 1dde48f..0000000 --- a/node_modules/node-pty/deps/winpty/src/agent/Agent.h +++ /dev/null @@ -1,103 +0,0 @@ -// Copyright (c) 2011-2015 Ryan Prichard -// -// 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. - -#ifndef AGENT_H -#define AGENT_H - -#include -#include - -#include -#include - -#include "DsrSender.h" -#include "EventLoop.h" -#include "Win32Console.h" - -class ConsoleInput; -class NamedPipe; -class ReadBuffer; -class Scraper; -class WriteBuffer; -class Win32ConsoleBuffer; - -class Agent : public EventLoop, public DsrSender -{ -public: - Agent(LPCWSTR controlPipeName, - uint64_t agentFlags, - int mouseMode, - int initialCols, - int initialRows); - virtual ~Agent(); - void sendDsr() override; - -private: - NamedPipe &connectToControlPipe(LPCWSTR pipeName); - NamedPipe &createDataServerPipe(bool write, const wchar_t *kind); - -private: - void pollControlPipe(); - void handlePacket(ReadBuffer &packet); - void writePacket(WriteBuffer &packet); - void handleStartProcessPacket(ReadBuffer &packet); - void handleSetSizePacket(ReadBuffer &packet); - void handleGetConsoleProcessListPacket(ReadBuffer &packet); - void pollConinPipe(); - -protected: - virtual void onPollTimeout() override; - virtual void onPipeIo(NamedPipe &namedPipe) override; - -private: - void autoClosePipesForShutdown(); - std::unique_ptr openPrimaryBuffer(); - void resizeWindow(int cols, int rows); - void scrapeBuffers(); - void syncConsoleTitle(); - -private: - const bool m_useConerr; - const bool m_plainMode; - const int m_mouseMode; - Win32Console m_console; - std::unique_ptr m_primaryScraper; - std::unique_ptr m_errorScraper; - std::unique_ptr m_errorBuffer; - NamedPipe *m_controlPipe = nullptr; - NamedPipe *m_coninPipe = nullptr; - NamedPipe *m_conoutPipe = nullptr; - NamedPipe *m_conerrPipe = nullptr; - bool m_autoShutdown = false; - bool m_exitAfterShutdown = false; - bool m_closingOutputPipes = false; - std::unique_ptr m_consoleInput; - HANDLE m_childProcess = nullptr; - - // If the title is initialized to the empty string, then cmd.exe will - // sometimes print this error: - // Not enough storage is available to process this command. - // It happens on Windows 7 when logged into a Cygwin SSH session, for - // example. Using a title of a single space character avoids the problem. - // See https://github.com/rprichard/winpty/issues/74. - std::wstring m_currentTitle = L" "; -}; - -#endif // AGENT_H diff --git a/node_modules/node-pty/deps/winpty/src/agent/AgentCreateDesktop.cc b/node_modules/node-pty/deps/winpty/src/agent/AgentCreateDesktop.cc deleted file mode 100644 index 9ad6503..0000000 --- a/node_modules/node-pty/deps/winpty/src/agent/AgentCreateDesktop.cc +++ /dev/null @@ -1,84 +0,0 @@ -// Copyright (c) 2016 Ryan Prichard -// -// 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. - -#include "AgentCreateDesktop.h" - -#include "../shared/BackgroundDesktop.h" -#include "../shared/Buffer.h" -#include "../shared/DebugClient.h" -#include "../shared/StringUtil.h" - -#include "EventLoop.h" -#include "NamedPipe.h" - -namespace { - -static inline WriteBuffer newPacket() { - WriteBuffer packet; - packet.putRawValue(0); // Reserve space for size. - return packet; -} - -class CreateDesktopLoop : public EventLoop { -public: - CreateDesktopLoop(LPCWSTR controlPipeName); - -protected: - virtual void onPipeIo(NamedPipe &namedPipe) override; - -private: - void writePacket(WriteBuffer &packet); - - BackgroundDesktop m_desktop; - NamedPipe &m_pipe; -}; - -CreateDesktopLoop::CreateDesktopLoop(LPCWSTR controlPipeName) : - m_pipe(createNamedPipe()) { - m_pipe.connectToServer(controlPipeName, NamedPipe::OpenMode::Duplex); - auto packet = newPacket(); - packet.putWString(m_desktop.desktopName()); - writePacket(packet); -} - -void CreateDesktopLoop::writePacket(WriteBuffer &packet) { - const auto &bytes = packet.buf(); - packet.replaceRawValue(0, bytes.size()); - m_pipe.write(bytes.data(), bytes.size()); -} - -void CreateDesktopLoop::onPipeIo(NamedPipe &namedPipe) { - if (m_pipe.isClosed()) { - shutdown(); - } -} - -} // anonymous namespace - -void handleCreateDesktop(LPCWSTR controlPipeName) { - try { - CreateDesktopLoop loop(controlPipeName); - loop.run(); - trace("Agent exiting..."); - } catch (const WinptyException &e) { - trace("handleCreateDesktop: internal error: %s", - utf8FromWide(e.what()).c_str()); - } -} diff --git a/node_modules/node-pty/deps/winpty/src/agent/AgentCreateDesktop.h b/node_modules/node-pty/deps/winpty/src/agent/AgentCreateDesktop.h deleted file mode 100644 index 2ae539c..0000000 --- a/node_modules/node-pty/deps/winpty/src/agent/AgentCreateDesktop.h +++ /dev/null @@ -1,28 +0,0 @@ -// Copyright (c) 2016 Ryan Prichard -// -// 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. - -#ifndef AGENT_CREATE_DESKTOP_H -#define AGENT_CREATE_DESKTOP_H - -#include - -void handleCreateDesktop(LPCWSTR controlPipeName); - -#endif // AGENT_CREATE_DESKTOP_H diff --git a/node_modules/node-pty/deps/winpty/src/agent/ConsoleFont.cc b/node_modules/node-pty/deps/winpty/src/agent/ConsoleFont.cc deleted file mode 100644 index aa1f787..0000000 --- a/node_modules/node-pty/deps/winpty/src/agent/ConsoleFont.cc +++ /dev/null @@ -1,698 +0,0 @@ -// Copyright (c) 2015 Ryan Prichard -// -// 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. - -#include "ConsoleFont.h" - -#include -#include -#include -#include - -#include -#include -#include -#include -#include - -#include "../shared/DebugClient.h" -#include "../shared/OsModule.h" -#include "../shared/StringUtil.h" -#include "../shared/WindowsVersion.h" -#include "../shared/WinptyAssert.h" -#include "../shared/winpty_snprintf.h" - -namespace { - -#define COUNT_OF(x) (sizeof(x) / sizeof((x)[0])) - -// See https://en.wikipedia.org/wiki/List_of_CJK_fonts -const wchar_t kLucidaConsole[] = L"Lucida Console"; -const wchar_t kMSGothic[] = { 0xff2d, 0xff33, 0x0020, 0x30b4, 0x30b7, 0x30c3, 0x30af, 0 }; // 932, Japanese -const wchar_t kNSimSun[] = { 0x65b0, 0x5b8b, 0x4f53, 0 }; // 936, Chinese Simplified -const wchar_t kGulimChe[] = { 0xad74, 0xb9bc, 0xccb4, 0 }; // 949, Korean -const wchar_t kMingLight[] = { 0x7d30, 0x660e, 0x9ad4, 0 }; // 950, Chinese Traditional - -struct FontSize { - short size; - int width; -}; - -struct Font { - const wchar_t *faceName; - unsigned int family; - short size; -}; - -// Ideographs in East Asian languages take two columns rather than one. -// In the console screen buffer, a "full-width" character will occupy two -// cells of the buffer, the first with attribute 0x100 and the second with -// attribute 0x200. -// -// Windows does not correctly identify code points as double-width in all -// configurations. It depends heavily on the code page, the font facename, -// and (somehow) even the font size. In the 437 code page (MS-DOS), for -// example, no codepoints are interpreted as double-width. When the console -// is in an East Asian code page (932, 936, 949, or 950), then sometimes -// selecting a "Western" facename like "Lucida Console" or "Consolas" doesn't -// register, or if the font *can* be chosen, then the console doesn't handle -// double-width correctly. I tested the double-width handling by writing -// several code points with WriteConsole and checking whether one or two cells -// were filled. -// -// In the Japanese code page (932), Microsoft's default font is MS Gothic. -// MS Gothic double-width handling seems to be broken with console versions -// prior to Windows 10 (including Windows 10's legacy mode), and it's -// especially broken in Windows 8 and 8.1. -// -// Test by running: misc/Utf16Echo A2 A3 2014 3044 30FC 4000 -// -// The first three codepoints are always rendered as half-width with the -// Windows Japanese fonts. (Of these, the first two must be half-width, -// but U+2014 could be either.) The last three are rendered as full-width, -// and they are East_Asian_Width=Wide. -// -// Windows 7 fails by modeling all codepoints as full-width with font -// sizes 22 and above. -// -// Windows 8 gets U+00A2, U+00A3, U+2014, U+30FC, and U+4000 wrong, but -// using a point size not listed in the console properties dialog -// (e.g. "9") is less wrong: -// -// | code point | -// font | 00A2 00A3 2014 3044 30FC 4000 | cell size -// ------------+---------------------------------+---------- -// 8 | F F F F H H | 4x8 -// 9 | F F F F F F | 5x9 -// 16 | F F F F H H | 8x16 -// raster 6x13 | H H H F F H(*) | 6x13 -// -// (*) The Raster Font renders U+4000 as a white box (i.e. an unsupported -// character). -// - -// See: -// - misc/Font-Report-June2016 directory for per-size details -// - misc/font-notes.txt -// - misc/Utf16Echo.cc, misc/FontSurvey.cc, misc/SetFont.cc, misc/GetFont.cc - -const FontSize kLucidaFontSizes[] = { - { 5, 3 }, - { 6, 4 }, - { 8, 5 }, - { 10, 6 }, - { 12, 7 }, - { 14, 8 }, - { 16, 10 }, - { 18, 11 }, - { 20, 12 }, - { 36, 22 }, - { 48, 29 }, - { 60, 36 }, - { 72, 43 }, -}; - -// Japanese. Used on Vista and Windows 7. -const FontSize k932GothicVista[] = { - { 6, 3 }, - { 8, 4 }, - { 10, 5 }, - { 12, 6 }, - { 13, 7 }, - { 15, 8 }, - { 17, 9 }, - { 19, 10 }, - { 21, 11 }, - // All larger fonts are more broken w.r.t. full-size East Asian characters. -}; - -// Japanese. Used on Windows 8, 8.1, and the legacy 10 console. -const FontSize k932GothicWin8[] = { - // All of these characters are broken w.r.t. full-size East Asian - // characters, but they're equally broken. - { 5, 3 }, - { 7, 4 }, - { 9, 5 }, - { 11, 6 }, - { 13, 7 }, - { 15, 8 }, - { 17, 9 }, - { 20, 10 }, - { 22, 11 }, - { 24, 12 }, - // include extra-large fonts for small terminals - { 36, 18 }, - { 48, 24 }, - { 60, 30 }, - { 72, 36 }, -}; - -// Japanese. Used on the new Windows 10 console. -const FontSize k932GothicWin10[] = { - { 6, 3 }, - { 8, 4 }, - { 10, 5 }, - { 12, 6 }, - { 14, 7 }, - { 16, 8 }, - { 18, 9 }, - { 20, 10 }, - { 22, 11 }, - { 24, 12 }, - // include extra-large fonts for small terminals - { 36, 18 }, - { 48, 24 }, - { 60, 30 }, - { 72, 36 }, -}; - -// Chinese Simplified. -const FontSize k936SimSun[] = { - { 6, 3 }, - { 8, 4 }, - { 10, 5 }, - { 12, 6 }, - { 14, 7 }, - { 16, 8 }, - { 18, 9 }, - { 20, 10 }, - { 22, 11 }, - { 24, 12 }, - // include extra-large fonts for small terminals - { 36, 18 }, - { 48, 24 }, - { 60, 30 }, - { 72, 36 }, -}; - -// Korean. -const FontSize k949GulimChe[] = { - { 6, 3 }, - { 8, 4 }, - { 10, 5 }, - { 12, 6 }, - { 14, 7 }, - { 16, 8 }, - { 18, 9 }, - { 20, 10 }, - { 22, 11 }, - { 24, 12 }, - // include extra-large fonts for small terminals - { 36, 18 }, - { 48, 24 }, - { 60, 30 }, - { 72, 36 }, -}; - -// Chinese Traditional. -const FontSize k950MingLight[] = { - { 6, 3 }, - { 8, 4 }, - { 10, 5 }, - { 12, 6 }, - { 14, 7 }, - { 16, 8 }, - { 18, 9 }, - { 20, 10 }, - { 22, 11 }, - { 24, 12 }, - // include extra-large fonts for small terminals - { 36, 18 }, - { 48, 24 }, - { 60, 30 }, - { 72, 36 }, -}; - -// Some of these types and functions are missing from the MinGW headers. -// Others are undocumented. - -struct AGENT_CONSOLE_FONT_INFO { - DWORD nFont; - COORD dwFontSize; -}; - -struct AGENT_CONSOLE_FONT_INFOEX { - ULONG cbSize; - DWORD nFont; - COORD dwFontSize; - UINT FontFamily; - UINT FontWeight; - WCHAR FaceName[LF_FACESIZE]; -}; - -// undocumented XP API -typedef BOOL WINAPI SetConsoleFont_t( - HANDLE hOutput, - DWORD dwFontIndex); - -// undocumented XP API -typedef DWORD WINAPI GetNumberOfConsoleFonts_t(); - -// XP and up -typedef BOOL WINAPI GetCurrentConsoleFont_t( - HANDLE hOutput, - BOOL bMaximumWindow, - AGENT_CONSOLE_FONT_INFO *lpConsoleCurrentFont); - -// XP and up -typedef COORD WINAPI GetConsoleFontSize_t( - HANDLE hConsoleOutput, - DWORD nFont); - -// Vista and up -typedef BOOL WINAPI GetCurrentConsoleFontEx_t( - HANDLE hConsoleOutput, - BOOL bMaximumWindow, - AGENT_CONSOLE_FONT_INFOEX *lpConsoleCurrentFontEx); - -// Vista and up -typedef BOOL WINAPI SetCurrentConsoleFontEx_t( - HANDLE hConsoleOutput, - BOOL bMaximumWindow, - AGENT_CONSOLE_FONT_INFOEX *lpConsoleCurrentFontEx); - -#define GET_MODULE_PROC(mod, funcName) \ - m_##funcName = reinterpret_cast((mod).proc(#funcName)); \ - -#define DEFINE_ACCESSOR(funcName) \ - funcName##_t &funcName() const { \ - ASSERT(valid()); \ - return *m_##funcName; \ - } - -class XPFontAPI { -public: - XPFontAPI() : m_kernel32(L"kernel32.dll") { - GET_MODULE_PROC(m_kernel32, GetCurrentConsoleFont); - GET_MODULE_PROC(m_kernel32, GetConsoleFontSize); - } - - bool valid() const { - return m_GetCurrentConsoleFont != NULL && - m_GetConsoleFontSize != NULL; - } - - DEFINE_ACCESSOR(GetCurrentConsoleFont) - DEFINE_ACCESSOR(GetConsoleFontSize) - -private: - OsModule m_kernel32; - GetCurrentConsoleFont_t *m_GetCurrentConsoleFont; - GetConsoleFontSize_t *m_GetConsoleFontSize; -}; - -class UndocumentedXPFontAPI : public XPFontAPI { -public: - UndocumentedXPFontAPI() : m_kernel32(L"kernel32.dll") { - GET_MODULE_PROC(m_kernel32, SetConsoleFont); - GET_MODULE_PROC(m_kernel32, GetNumberOfConsoleFonts); - } - - bool valid() const { - return this->XPFontAPI::valid() && - m_SetConsoleFont != NULL && - m_GetNumberOfConsoleFonts != NULL; - } - - DEFINE_ACCESSOR(SetConsoleFont) - DEFINE_ACCESSOR(GetNumberOfConsoleFonts) - -private: - OsModule m_kernel32; - SetConsoleFont_t *m_SetConsoleFont; - GetNumberOfConsoleFonts_t *m_GetNumberOfConsoleFonts; -}; - -class VistaFontAPI : public XPFontAPI { -public: - VistaFontAPI() : m_kernel32(L"kernel32.dll") { - GET_MODULE_PROC(m_kernel32, GetCurrentConsoleFontEx); - GET_MODULE_PROC(m_kernel32, SetCurrentConsoleFontEx); - } - - bool valid() const { - return this->XPFontAPI::valid() && - m_GetCurrentConsoleFontEx != NULL && - m_SetCurrentConsoleFontEx != NULL; - } - - DEFINE_ACCESSOR(GetCurrentConsoleFontEx) - DEFINE_ACCESSOR(SetCurrentConsoleFontEx) - -private: - OsModule m_kernel32; - GetCurrentConsoleFontEx_t *m_GetCurrentConsoleFontEx; - SetCurrentConsoleFontEx_t *m_SetCurrentConsoleFontEx; -}; - -static std::vector > readFontTable( - XPFontAPI &api, HANDLE conout, DWORD maxCount) { - std::vector > ret; - for (DWORD i = 0; i < maxCount; ++i) { - COORD size = api.GetConsoleFontSize()(conout, i); - if (size.X == 0 && size.Y == 0) { - break; - } - ret.push_back(std::make_pair(i, size)); - } - return ret; -} - -static void dumpFontTable(HANDLE conout, const char *prefix) { - const int kMaxCount = 1000; - if (!isTracingEnabled()) { - return; - } - XPFontAPI api; - if (!api.valid()) { - trace("dumpFontTable: cannot dump font table -- missing APIs"); - return; - } - std::vector > table = - readFontTable(api, conout, kMaxCount); - std::string line; - char tmp[128]; - size_t first = 0; - while (first < table.size()) { - size_t last = std::min(table.size() - 1, first + 10 - 1); - winpty_snprintf(tmp, "%sfonts %02u-%02u:", - prefix, static_cast(first), static_cast(last)); - line = tmp; - for (size_t i = first; i <= last; ++i) { - if (i % 10 == 5) { - line += " - "; - } - winpty_snprintf(tmp, " %2dx%-2d", - table[i].second.X, table[i].second.Y); - line += tmp; - } - trace("%s", line.c_str()); - first = last + 1; - } - if (table.size() == kMaxCount) { - trace("%sfonts: ... stopped reading at %d fonts ...", - prefix, kMaxCount); - } -} - -static std::string stringToCodePoints(const std::wstring &str) { - std::string ret = "("; - for (size_t i = 0; i < str.size(); ++i) { - char tmp[32]; - winpty_snprintf(tmp, "%X", str[i]); - if (ret.size() > 1) { - ret.push_back(' '); - } - ret += tmp; - } - ret.push_back(')'); - return ret; -} - -static void dumpFontInfoEx( - const AGENT_CONSOLE_FONT_INFOEX &infoex, - const char *prefix) { - if (!isTracingEnabled()) { - return; - } - std::wstring faceName(infoex.FaceName, - winpty_wcsnlen(infoex.FaceName, COUNT_OF(infoex.FaceName))); - trace("%snFont=%u dwFontSize=(%d,%d) " - "FontFamily=0x%x FontWeight=%u FaceName=%s %s", - prefix, - static_cast(infoex.nFont), - infoex.dwFontSize.X, infoex.dwFontSize.Y, - infoex.FontFamily, infoex.FontWeight, utf8FromWide(faceName).c_str(), - stringToCodePoints(faceName).c_str()); -} - -static void dumpVistaFont(VistaFontAPI &api, HANDLE conout, const char *prefix) { - if (!isTracingEnabled()) { - return; - } - AGENT_CONSOLE_FONT_INFOEX infoex = {0}; - infoex.cbSize = sizeof(infoex); - if (!api.GetCurrentConsoleFontEx()(conout, FALSE, &infoex)) { - trace("GetCurrentConsoleFontEx call failed"); - return; - } - dumpFontInfoEx(infoex, prefix); -} - -static void dumpXPFont(XPFontAPI &api, HANDLE conout, const char *prefix) { - if (!isTracingEnabled()) { - return; - } - AGENT_CONSOLE_FONT_INFO info = {0}; - if (!api.GetCurrentConsoleFont()(conout, FALSE, &info)) { - trace("GetCurrentConsoleFont call failed"); - return; - } - trace("%snFont=%u dwFontSize=(%d,%d)", - prefix, - static_cast(info.nFont), - info.dwFontSize.X, info.dwFontSize.Y); -} - -static bool setFontVista( - VistaFontAPI &api, - HANDLE conout, - const Font &font) { - AGENT_CONSOLE_FONT_INFOEX infoex = {}; - infoex.cbSize = sizeof(AGENT_CONSOLE_FONT_INFOEX); - infoex.dwFontSize.Y = font.size; - infoex.FontFamily = font.family; - infoex.FontWeight = 400; - winpty_wcsncpy_nul(infoex.FaceName, font.faceName); - dumpFontInfoEx(infoex, "setFontVista: setting font to: "); - if (!api.SetCurrentConsoleFontEx()(conout, FALSE, &infoex)) { - trace("setFontVista: SetCurrentConsoleFontEx call failed"); - return false; - } - memset(&infoex, 0, sizeof(infoex)); - infoex.cbSize = sizeof(infoex); - if (!api.GetCurrentConsoleFontEx()(conout, FALSE, &infoex)) { - trace("setFontVista: GetCurrentConsoleFontEx call failed"); - return false; - } - if (wcsncmp(infoex.FaceName, font.faceName, - COUNT_OF(infoex.FaceName)) != 0) { - trace("setFontVista: face name was not set"); - dumpFontInfoEx(infoex, "setFontVista: post-call font: "); - return false; - } - // We'd like to verify that the new font size is correct, but we can't - // predict what it will be, even though we just set it to `pxSize` through - // an apprently symmetric interface. For the Chinese and Korean fonts, the - // new `infoex.dwFontSize.Y` value can be slightly larger than the height - // we specified. - return true; -} - -static Font selectSmallFont(int codePage, int columns, bool isNewW10) { - // Iterate over a set of font sizes according to the code page, and select - // one. - - const wchar_t *faceName = nullptr; - unsigned int fontFamily = 0; - const FontSize *table = nullptr; - size_t tableSize = 0; - - switch (codePage) { - case 932: // Japanese - faceName = kMSGothic; - fontFamily = 0x36; - if (isNewW10) { - table = k932GothicWin10; - tableSize = COUNT_OF(k932GothicWin10); - } else if (isAtLeastWindows8()) { - table = k932GothicWin8; - tableSize = COUNT_OF(k932GothicWin8); - } else { - table = k932GothicVista; - tableSize = COUNT_OF(k932GothicVista); - } - break; - case 936: // Chinese Simplified - faceName = kNSimSun; - fontFamily = 0x36; - table = k936SimSun; - tableSize = COUNT_OF(k936SimSun); - break; - case 949: // Korean - faceName = kGulimChe; - fontFamily = 0x36; - table = k949GulimChe; - tableSize = COUNT_OF(k949GulimChe); - break; - case 950: // Chinese Traditional - faceName = kMingLight; - fontFamily = 0x36; - table = k950MingLight; - tableSize = COUNT_OF(k950MingLight); - break; - default: - faceName = kLucidaConsole; - fontFamily = 0x36; - table = kLucidaFontSizes; - tableSize = COUNT_OF(kLucidaFontSizes); - break; - } - - size_t bestIndex = static_cast(-1); - std::tuple bestScore = std::make_tuple(-1, -1); - - // We might want to pick the smallest possible font, because we don't know - // how large the monitor is (and the monitor size can change). We might - // want to pick a larger font to accommodate console programs that resize - // the console on their own, like DOS edit.com, which tends to resize the - // console to 80 columns. - - for (size_t i = 0; i < tableSize; ++i) { - const int width = table[i].width * columns; - - // In general, we'd like to pick a font size where cutting the number - // of columns in half doesn't immediately violate the minimum width - // constraint. (e.g. To run DOS edit.com, a user might resize their - // terminal to ~100 columns so it's big enough to show the 80 columns - // post-resize.) To achieve this, give priority to fonts that allow - // this halving. We don't want to encourage *very* large fonts, - // though, so disable the effect as the number of columns scales from - // 80 to 40. - const int halfColumns = std::min(columns, std::max(40, columns / 2)); - const int halfWidth = table[i].width * halfColumns; - - std::tuple thisScore = std::make_tuple(-1, -1); - if (width >= 160 && halfWidth >= 160) { - // Both sizes are good. Prefer the smaller fonts. - thisScore = std::make_tuple(2, -width); - } else if (width >= 160) { - // Prefer the smaller fonts. - thisScore = std::make_tuple(1, -width); - } else { - // Otherwise, prefer the largest font in our table. - thisScore = std::make_tuple(0, width); - } - if (thisScore > bestScore) { - bestIndex = i; - bestScore = thisScore; - } - } - - ASSERT(bestIndex != static_cast(-1)); - return Font { faceName, fontFamily, table[bestIndex].size }; -} - -static void setSmallFontVista(VistaFontAPI &api, HANDLE conout, - int columns, bool isNewW10) { - int codePage = GetConsoleOutputCP(); - const auto font = selectSmallFont(codePage, columns, isNewW10); - if (setFontVista(api, conout, font)) { - trace("setSmallFontVista: success"); - return; - } - if (codePage == 932 || codePage == 936 || - codePage == 949 || codePage == 950) { - trace("setSmallFontVista: falling back to default codepage font instead"); - const auto fontFB = selectSmallFont(0, columns, isNewW10); - if (setFontVista(api, conout, fontFB)) { - trace("setSmallFontVista: fallback was successful"); - return; - } - } - trace("setSmallFontVista: failure"); -} - -struct FontSizeComparator { - bool operator()(const std::pair &obj1, - const std::pair &obj2) const { - int score1 = obj1.second.X + obj1.second.Y; - int score2 = obj2.second.X + obj2.second.Y; - return score1 < score2; - } -}; - -static void setSmallFontXP(UndocumentedXPFontAPI &api, HANDLE conout) { - // Read the console font table and sort it from smallest to largest. - const DWORD fontCount = api.GetNumberOfConsoleFonts()(); - trace("setSmallFontXP: number of console fonts: %u", - static_cast(fontCount)); - std::vector > table = - readFontTable(api, conout, fontCount); - std::sort(table.begin(), table.end(), FontSizeComparator()); - for (size_t i = 0; i < table.size(); ++i) { - // Skip especially narrow fonts to permit narrower terminals. - if (table[i].second.X < 4) { - continue; - } - trace("setSmallFontXP: setting font to %u", - static_cast(table[i].first)); - if (!api.SetConsoleFont()(conout, table[i].first)) { - trace("setSmallFontXP: SetConsoleFont call failed"); - continue; - } - AGENT_CONSOLE_FONT_INFO info; - if (!api.GetCurrentConsoleFont()(conout, FALSE, &info)) { - trace("setSmallFontXP: GetCurrentConsoleFont call failed"); - return; - } - if (info.nFont != table[i].first) { - trace("setSmallFontXP: font was not set"); - dumpXPFont(api, conout, "setSmallFontXP: post-call font: "); - continue; - } - trace("setSmallFontXP: success"); - return; - } - trace("setSmallFontXP: failure"); -} - -} // anonymous namespace - -// A Windows console window can never be larger than the desktop window. To -// maximize the possible size of the console in rows*cols, try to configure -// the console with a small font. Unfortunately, we cannot make the font *too* -// small, because there is also a minimum window size in pixels. -void setSmallFont(HANDLE conout, int columns, bool isNewW10) { - trace("setSmallFont: attempting to set a small font for %d columns " - "(CP=%u OutputCP=%u)", - columns, - static_cast(GetConsoleCP()), - static_cast(GetConsoleOutputCP())); - VistaFontAPI vista; - if (vista.valid()) { - dumpVistaFont(vista, conout, "previous font: "); - dumpFontTable(conout, "previous font table: "); - setSmallFontVista(vista, conout, columns, isNewW10); - dumpVistaFont(vista, conout, "new font: "); - dumpFontTable(conout, "new font table: "); - return; - } - UndocumentedXPFontAPI xp; - if (xp.valid()) { - dumpXPFont(xp, conout, "previous font: "); - dumpFontTable(conout, "previous font table: "); - setSmallFontXP(xp, conout); - dumpXPFont(xp, conout, "new font: "); - dumpFontTable(conout, "new font table: "); - return; - } - trace("setSmallFont: neither Vista nor XP APIs detected -- giving up"); - dumpFontTable(conout, "font table: "); -} diff --git a/node_modules/node-pty/deps/winpty/src/agent/ConsoleFont.h b/node_modules/node-pty/deps/winpty/src/agent/ConsoleFont.h deleted file mode 100644 index 99cb106..0000000 --- a/node_modules/node-pty/deps/winpty/src/agent/ConsoleFont.h +++ /dev/null @@ -1,28 +0,0 @@ -// Copyright (c) 2015 Ryan Prichard -// -// 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. - -#ifndef CONSOLEFONT_H -#define CONSOLEFONT_H - -#include - -void setSmallFont(HANDLE conout, int columns, bool isNewW10); - -#endif // CONSOLEFONT_H diff --git a/node_modules/node-pty/deps/winpty/src/agent/ConsoleInput.cc b/node_modules/node-pty/deps/winpty/src/agent/ConsoleInput.cc deleted file mode 100644 index 192cac2..0000000 --- a/node_modules/node-pty/deps/winpty/src/agent/ConsoleInput.cc +++ /dev/null @@ -1,852 +0,0 @@ -// Copyright (c) 2011-2015 Ryan Prichard -// -// 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. - -#include "ConsoleInput.h" - -#include -#include - -#include -#include - -#include "../include/winpty_constants.h" - -#include "../shared/DebugClient.h" -#include "../shared/StringBuilder.h" -#include "../shared/UnixCtrlChars.h" - -#include "ConsoleInputReencoding.h" -#include "DebugShowInput.h" -#include "DefaultInputMap.h" -#include "DsrSender.h" -#include "UnicodeEncoding.h" -#include "Win32Console.h" - -// MAPVK_VK_TO_VSC isn't defined by the old MinGW. -#ifndef MAPVK_VK_TO_VSC -#define MAPVK_VK_TO_VSC 0 -#endif - -namespace { - -struct MouseRecord { - bool release; - int flags; - COORD coord; - - std::string toString() const; -}; - -std::string MouseRecord::toString() const { - StringBuilder sb(40); - sb << "pos=" << coord.X << ',' << coord.Y - << " flags=0x" << hexOfInt(flags); - if (release) { - sb << " release"; - } - return sb.str_moved(); -} - -const unsigned int kIncompleteEscapeTimeoutMs = 1000u; - -#define CHECK(cond) \ - do { \ - if (!(cond)) { return 0; } \ - } while(0) - -#define ADVANCE() \ - do { \ - pch++; \ - if (pch == stop) { return -1; } \ - } while(0) - -#define SCAN_INT(out, maxLen) \ - do { \ - (out) = 0; \ - CHECK(isdigit(*pch)); \ - const char *begin = pch; \ - do { \ - CHECK(pch - begin + 1 < maxLen); \ - (out) = (out) * 10 + *pch - '0'; \ - ADVANCE(); \ - } while (isdigit(*pch)); \ - } while(0) - -#define SCAN_SIGNED_INT(out, maxLen) \ - do { \ - bool negative = false; \ - if (*pch == '-') { \ - negative = true; \ - ADVANCE(); \ - } \ - SCAN_INT(out, maxLen); \ - if (negative) { \ - (out) = -(out); \ - } \ - } while(0) - -// Match the Device Status Report console input: ESC [ nn ; mm R -// Returns: -// 0 no match -// >0 match, returns length of match -// -1 incomplete match -static int matchDsr(const char *input, int inputSize) -{ - int32_t dummy = 0; - const char *pch = input; - const char *stop = input + inputSize; - CHECK(*pch == '\x1B'); ADVANCE(); - CHECK(*pch == '['); ADVANCE(); - SCAN_INT(dummy, 8); - CHECK(*pch == ';'); ADVANCE(); - SCAN_INT(dummy, 8); - CHECK(*pch == 'R'); - return pch - input + 1; -} - -static int matchMouseDefault(const char *input, int inputSize, - MouseRecord &out) -{ - const char *pch = input; - const char *stop = input + inputSize; - CHECK(*pch == '\x1B'); ADVANCE(); - CHECK(*pch == '['); ADVANCE(); - CHECK(*pch == 'M'); ADVANCE(); - out.flags = (*pch - 32) & 0xFF; ADVANCE(); - out.coord.X = (*pch - '!') & 0xFF; - ADVANCE(); - out.coord.Y = (*pch - '!') & 0xFF; - out.release = false; - return pch - input + 1; -} - -static int matchMouse1006(const char *input, int inputSize, MouseRecord &out) -{ - const char *pch = input; - const char *stop = input + inputSize; - int32_t temp; - CHECK(*pch == '\x1B'); ADVANCE(); - CHECK(*pch == '['); ADVANCE(); - CHECK(*pch == '<'); ADVANCE(); - SCAN_INT(out.flags, 8); - CHECK(*pch == ';'); ADVANCE(); - SCAN_SIGNED_INT(temp, 8); out.coord.X = temp - 1; - CHECK(*pch == ';'); ADVANCE(); - SCAN_SIGNED_INT(temp, 8); out.coord.Y = temp - 1; - CHECK(*pch == 'M' || *pch == 'm'); - out.release = (*pch == 'm'); - return pch - input + 1; -} - -static int matchMouse1015(const char *input, int inputSize, MouseRecord &out) -{ - const char *pch = input; - const char *stop = input + inputSize; - int32_t temp; - CHECK(*pch == '\x1B'); ADVANCE(); - CHECK(*pch == '['); ADVANCE(); - SCAN_INT(out.flags, 8); out.flags -= 32; - CHECK(*pch == ';'); ADVANCE(); - SCAN_SIGNED_INT(temp, 8); out.coord.X = temp - 1; - CHECK(*pch == ';'); ADVANCE(); - SCAN_SIGNED_INT(temp, 8); out.coord.Y = temp - 1; - CHECK(*pch == 'M'); - out.release = false; - return pch - input + 1; -} - -// Match a mouse input escape sequence of any kind. -// 0 no match -// >0 match, returns length of match -// -1 incomplete match -static int matchMouseRecord(const char *input, int inputSize, MouseRecord &out) -{ - memset(&out, 0, sizeof(out)); - int ret; - if ((ret = matchMouse1006(input, inputSize, out)) != 0) { return ret; } - if ((ret = matchMouse1015(input, inputSize, out)) != 0) { return ret; } - if ((ret = matchMouseDefault(input, inputSize, out)) != 0) { return ret; } - return 0; -} - -#undef CHECK -#undef ADVANCE -#undef SCAN_INT - -} // anonymous namespace - -ConsoleInput::ConsoleInput(HANDLE conin, int mouseMode, DsrSender &dsrSender, - Win32Console &console) : - m_console(console), - m_conin(conin), - m_mouseMode(mouseMode), - m_dsrSender(dsrSender) -{ - addDefaultEntriesToInputMap(m_inputMap); - if (hasDebugFlag("dump_input_map")) { - m_inputMap.dumpInputMap(); - } - - // Configure Quick Edit mode according to the mouse mode. Enable - // InsertMode for two reasons: - // - If it's OFF, it's difficult for the user to turn it ON. The - // properties dialog is inaccesible. winpty still faithfully handles - // the Insert key, which toggles between the insertion and overwrite - // modes. - // - When we modify the QuickEdit setting, if ExtendedFlags is OFF, - // then we must choose the InsertMode setting. I don't *think* this - // case happens, though, because a new console always has ExtendedFlags - // ON. - // See misc/EnableExtendedFlags.txt. - DWORD mode = 0; - if (!GetConsoleMode(conin, &mode)) { - trace("Agent startup: GetConsoleMode failed"); - } else { - mode |= ENABLE_EXTENDED_FLAGS; - mode |= ENABLE_INSERT_MODE; - if (m_mouseMode == WINPTY_MOUSE_MODE_AUTO) { - mode |= ENABLE_QUICK_EDIT_MODE; - } else { - mode &= ~ENABLE_QUICK_EDIT_MODE; - } - if (!SetConsoleMode(conin, mode)) { - trace("Agent startup: SetConsoleMode failed"); - } - } - - updateInputFlags(true); -} - -void ConsoleInput::writeInput(const std::string &input) -{ - if (input.size() == 0) { - return; - } - - if (isTracingEnabled()) { - static bool debugInput = hasDebugFlag("input"); - if (debugInput) { - std::string dumpString; - for (size_t i = 0; i < input.size(); ++i) { - const char ch = input[i]; - const char ctrl = decodeUnixCtrlChar(ch); - if (ctrl != '\0') { - dumpString += '^'; - dumpString += ctrl; - } else { - dumpString += ch; - } - } - dumpString += " ("; - for (size_t i = 0; i < input.size(); ++i) { - if (i > 0) { - dumpString += ' '; - } - const unsigned char uch = input[i]; - char buf[32]; - winpty_snprintf(buf, "%02X", uch); - dumpString += buf; - } - dumpString += ')'; - trace("input chars: %s", dumpString.c_str()); - } - } - - m_byteQueue.append(input); - doWrite(false); - if (!m_byteQueue.empty() && !m_dsrSent) { - trace("send DSR"); - m_dsrSender.sendDsr(); - m_dsrSent = true; - } - m_lastWriteTick = GetTickCount(); -} - -void ConsoleInput::flushIncompleteEscapeCode() -{ - if (!m_byteQueue.empty() && - (GetTickCount() - m_lastWriteTick) > kIncompleteEscapeTimeoutMs) { - doWrite(true); - m_byteQueue.clear(); - } -} - -void ConsoleInput::updateInputFlags(bool forceTrace) -{ - const DWORD mode = inputConsoleMode(); - const bool newFlagEE = (mode & ENABLE_EXTENDED_FLAGS) != 0; - const bool newFlagMI = (mode & ENABLE_MOUSE_INPUT) != 0; - const bool newFlagQE = (mode & ENABLE_QUICK_EDIT_MODE) != 0; - const bool newFlagEI = (mode & 0x200) != 0; - if (forceTrace || - newFlagEE != m_enableExtendedEnabled || - newFlagMI != m_mouseInputEnabled || - newFlagQE != m_quickEditEnabled || - newFlagEI != m_escapeInputEnabled) { - trace("CONIN modes: Extended=%s, MouseInput=%s QuickEdit=%s EscapeInput=%s", - newFlagEE ? "on" : "off", - newFlagMI ? "on" : "off", - newFlagQE ? "on" : "off", - newFlagEI ? "on" : "off"); - } - m_enableExtendedEnabled = newFlagEE; - m_mouseInputEnabled = newFlagMI; - m_quickEditEnabled = newFlagQE; - m_escapeInputEnabled = newFlagEI; -} - -bool ConsoleInput::shouldActivateTerminalMouse() -{ - // Return whether the agent should activate the terminal's mouse mode. - if (m_mouseMode == WINPTY_MOUSE_MODE_AUTO) { - // Some programs (e.g. Cygwin command-line programs like bash.exe and - // python2.7.exe) turn off ENABLE_EXTENDED_FLAGS and turn on - // ENABLE_MOUSE_INPUT, but do not turn off QuickEdit mode and do not - // actually care about mouse input. Only enable the terminal mouse - // mode if ENABLE_EXTENDED_FLAGS is on. See - // misc/EnableExtendedFlags.txt. - return m_mouseInputEnabled && !m_quickEditEnabled && - m_enableExtendedEnabled; - } else if (m_mouseMode == WINPTY_MOUSE_MODE_FORCE) { - return true; - } else { - return false; - } -} - -void ConsoleInput::doWrite(bool isEof) -{ - const char *data = m_byteQueue.c_str(); - std::vector records; - size_t idx = 0; - while (idx < m_byteQueue.size()) { - int charSize = scanInput(records, &data[idx], m_byteQueue.size() - idx, isEof); - if (charSize == -1) - break; - idx += charSize; - } - m_byteQueue.erase(0, idx); - flushInputRecords(records); -} - -void ConsoleInput::flushInputRecords(std::vector &records) -{ - if (records.size() == 0) { - return; - } - DWORD actual = 0; - if (!WriteConsoleInputW(m_conin, records.data(), records.size(), &actual)) { - trace("WriteConsoleInputW failed"); - } - records.clear(); -} - -// This behavior isn't strictly correct, because the keypresses (probably?) -// adopt the keyboard state (e.g. Ctrl/Alt/Shift modifiers) of the current -// window station's keyboard, which has no necessary relationship to the winpty -// instance. It's unlikely to be an issue in practice, but it's conceivable. -// (Imagine a foreground SSH server, where the local user holds down Ctrl, -// while the remote user tries to use WSL navigation keys.) I suspect using -// the BackgroundDesktop mechanism in winpty would fix the problem. -// -// https://github.com/rprichard/winpty/issues/116 -static void sendKeyMessage(HWND hwnd, bool isKeyDown, uint16_t virtualKey) -{ - uint32_t scanCode = MapVirtualKey(virtualKey, MAPVK_VK_TO_VSC); - if (scanCode > 255) { - scanCode = 0; - } - SendMessage(hwnd, isKeyDown ? WM_KEYDOWN : WM_KEYUP, virtualKey, - (scanCode << 16) | 1u | (isKeyDown ? 0u : 0xc0000000u)); -} - -int ConsoleInput::scanInput(std::vector &records, - const char *input, - int inputSize, - bool isEof) -{ - ASSERT(inputSize >= 1); - - // Ctrl-C. - // - // In processed mode, use GenerateConsoleCtrlEvent so that Ctrl-C handlers - // are called. GenerateConsoleCtrlEvent unfortunately doesn't interrupt - // ReadConsole calls[1]. Using WM_KEYDOWN/UP fixes the ReadConsole - // problem, but breaks in background window stations/desktops. - // - // In unprocessed mode, there's an entry for Ctrl-C in the SimpleEncoding - // table in DefaultInputMap. - // - // [1] https://github.com/rprichard/winpty/issues/116 - if (input[0] == '\x03' && (inputConsoleMode() & ENABLE_PROCESSED_INPUT)) { - flushInputRecords(records); - trace("Ctrl-C"); - const BOOL ret = GenerateConsoleCtrlEvent(CTRL_C_EVENT, 0); - trace("GenerateConsoleCtrlEvent: %d", ret); - return 1; - } - - if (input[0] == '\x1B') { - // Attempt to match the Device Status Report (DSR) reply. - int dsrLen = matchDsr(input, inputSize); - if (dsrLen > 0) { - trace("Received a DSR reply"); - m_dsrSent = false; - return dsrLen; - } else if (!isEof && dsrLen == -1) { - // Incomplete DSR match. - trace("Incomplete DSR match"); - return -1; - } - - int mouseLen = scanMouseInput(records, input, inputSize); - if (mouseLen > 0 || (!isEof && mouseLen == -1)) { - return mouseLen; - } - } - - // Search the input map. - InputMap::Key match; - bool incomplete; - int matchLen = m_inputMap.lookupKey(input, inputSize, match, incomplete); - if (!isEof && incomplete) { - // Incomplete match -- need more characters (or wait for a - // timeout to signify flushed input). - trace("Incomplete escape sequence"); - return -1; - } else if (matchLen > 0) { - uint32_t winCodePointDn = match.unicodeChar; - if ((match.keyState & LEFT_CTRL_PRESSED) && (match.keyState & LEFT_ALT_PRESSED)) { - winCodePointDn = '\0'; - } - uint32_t winCodePointUp = winCodePointDn; - if (match.keyState & LEFT_ALT_PRESSED) { - winCodePointUp = '\0'; - } - appendKeyPress(records, match.virtualKey, - winCodePointDn, winCodePointUp, match.keyState, - match.unicodeChar, match.keyState); - return matchLen; - } - - // Recognize Alt-. - // - // This code doesn't match Alt-ESC, which is encoded as `ESC ESC`, but - // maybe it should. I was concerned that pressing ESC rapidly enough could - // accidentally trigger Alt-ESC. (e.g. The user would have to be faster - // than the DSR flushing mechanism or use a decrepit terminal. The user - // might be on a slow network connection.) - if (input[0] == '\x1B' && inputSize >= 2 && input[1] != '\x1B') { - const int len = utf8CharLength(input[1]); - if (len > 0) { - if (1 + len > inputSize) { - // Incomplete character. - trace("Incomplete UTF-8 character in Alt-"); - return -1; - } - appendUtf8Char(records, &input[1], len, true); - return 1 + len; - } - } - - // A UTF-8 character. - const int len = utf8CharLength(input[0]); - if (len == 0) { - static bool debugInput = isTracingEnabled() && hasDebugFlag("input"); - if (debugInput) { - trace("Discarding invalid input byte: %02X", - static_cast(input[0])); - } - return 1; - } - if (len > inputSize) { - // Incomplete character. - trace("Incomplete UTF-8 character"); - return -1; - } - appendUtf8Char(records, &input[0], len, false); - return len; -} - -int ConsoleInput::scanMouseInput(std::vector &records, - const char *input, - int inputSize) -{ - MouseRecord record; - const int len = matchMouseRecord(input, inputSize, record); - if (len <= 0) { - return len; - } - - if (isTracingEnabled()) { - static bool debugInput = hasDebugFlag("input"); - if (debugInput) { - trace("mouse input: %s", record.toString().c_str()); - } - } - - const int button = record.flags & 0x03; - INPUT_RECORD newRecord = {0}; - newRecord.EventType = MOUSE_EVENT; - MOUSE_EVENT_RECORD &mer = newRecord.Event.MouseEvent; - - mer.dwMousePosition.X = - m_mouseWindowRect.Left + - std::max(0, std::min(record.coord.X, - m_mouseWindowRect.width() - 1)); - - mer.dwMousePosition.Y = - m_mouseWindowRect.Top + - std::max(0, std::min(record.coord.Y, - m_mouseWindowRect.height() - 1)); - - // The modifier state is neatly independent of everything else. - if (record.flags & 0x04) { mer.dwControlKeyState |= SHIFT_PRESSED; } - if (record.flags & 0x08) { mer.dwControlKeyState |= LEFT_ALT_PRESSED; } - if (record.flags & 0x10) { mer.dwControlKeyState |= LEFT_CTRL_PRESSED; } - - if (record.flags & 0x40) { - // Mouse wheel - mer.dwEventFlags |= MOUSE_WHEELED; - if (button == 0) { - // up - mer.dwButtonState |= 0x00780000; - } else if (button == 1) { - // down - mer.dwButtonState |= 0xff880000; - } else { - // Invalid -- do nothing - return len; - } - } else { - // Ordinary mouse event - if (record.flags & 0x20) { mer.dwEventFlags |= MOUSE_MOVED; } - if (button == 3) { - m_mouseButtonState = 0; - // Potentially advance double-click detection. - m_doubleClick.released = true; - } else { - const DWORD relevantFlag = - (button == 0) ? FROM_LEFT_1ST_BUTTON_PRESSED : - (button == 1) ? FROM_LEFT_2ND_BUTTON_PRESSED : - (button == 2) ? RIGHTMOST_BUTTON_PRESSED : - 0; - ASSERT(relevantFlag != 0); - if (record.release) { - m_mouseButtonState &= ~relevantFlag; - if (relevantFlag == m_doubleClick.button) { - // Potentially advance double-click detection. - m_doubleClick.released = true; - } else { - // End double-click detection. - m_doubleClick = DoubleClickDetection(); - } - } else if ((m_mouseButtonState & relevantFlag) == 0) { - // The button has been newly pressed. - m_mouseButtonState |= relevantFlag; - // Detect a double-click. This code looks for an exact - // coordinate match, which is stricter than what Windows does, - // but Windows has pixel coordinates, and we only have terminal - // coordinates. - if (m_doubleClick.button == relevantFlag && - m_doubleClick.pos == record.coord && - (GetTickCount() - m_doubleClick.tick < - GetDoubleClickTime())) { - // Record a double-click and end double-click detection. - mer.dwEventFlags |= DOUBLE_CLICK; - m_doubleClick = DoubleClickDetection(); - } else { - // Begin double-click detection. - m_doubleClick.button = relevantFlag; - m_doubleClick.pos = record.coord; - m_doubleClick.tick = GetTickCount(); - } - } - } - } - - mer.dwButtonState |= m_mouseButtonState; - - if (m_mouseInputEnabled && !m_quickEditEnabled) { - if (isTracingEnabled()) { - static bool debugInput = hasDebugFlag("input"); - if (debugInput) { - trace("mouse event: %s", mouseEventToString(mer).c_str()); - } - } - - records.push_back(newRecord); - } - - return len; -} - -void ConsoleInput::appendUtf8Char(std::vector &records, - const char *charBuffer, - const int charLen, - const bool terminalAltEscape) -{ - const uint32_t codePoint = decodeUtf8(charBuffer); - if (codePoint == static_cast(-1)) { - static bool debugInput = isTracingEnabled() && hasDebugFlag("input"); - if (debugInput) { - StringBuilder error(64); - error << "Discarding invalid UTF-8 sequence:"; - for (int i = 0; i < charLen; ++i) { - error << ' '; - error << hexOfInt(charBuffer[i]); - } - trace("%s", error.c_str()); - } - return; - } - - const short charScan = codePoint > 0xFFFF ? -1 : VkKeyScan(codePoint); - uint16_t virtualKey = 0; - uint16_t winKeyState = 0; - uint32_t winCodePointDn = codePoint; - uint32_t winCodePointUp = codePoint; - uint16_t vtKeyState = 0; - - if (charScan != -1) { - virtualKey = charScan & 0xFF; - if (charScan & 0x100) { - winKeyState |= SHIFT_PRESSED; - } - if (charScan & 0x200) { - winKeyState |= LEFT_CTRL_PRESSED; - } - if (charScan & 0x400) { - winKeyState |= RIGHT_ALT_PRESSED; - } - if (terminalAltEscape && (winKeyState & LEFT_CTRL_PRESSED)) { - // If the terminal escapes a Ctrl- with Alt, then set the - // codepoint to 0. On the other hand, if a character requires - // AltGr (like U+00B2 on a German layout), then VkKeyScan will - // report both Ctrl and Alt pressed, and we should keep the - // codepoint. See https://github.com/rprichard/winpty/issues/109. - winCodePointDn = 0; - winCodePointUp = 0; - } - } - if (terminalAltEscape) { - winCodePointUp = 0; - winKeyState |= LEFT_ALT_PRESSED; - vtKeyState |= LEFT_ALT_PRESSED; - } - - appendKeyPress(records, virtualKey, - winCodePointDn, winCodePointUp, winKeyState, - codePoint, vtKeyState); -} - -void ConsoleInput::appendKeyPress(std::vector &records, - const uint16_t virtualKey, - const uint32_t winCodePointDn, - const uint32_t winCodePointUp, - const uint16_t winKeyState, - const uint32_t vtCodePoint, - const uint16_t vtKeyState) -{ - const bool ctrl = (winKeyState & LEFT_CTRL_PRESSED) != 0; - const bool leftAlt = (winKeyState & LEFT_ALT_PRESSED) != 0; - const bool rightAlt = (winKeyState & RIGHT_ALT_PRESSED) != 0; - const bool shift = (winKeyState & SHIFT_PRESSED) != 0; - const bool enhanced = (winKeyState & ENHANCED_KEY) != 0; - bool hasDebugInput = false; - - if (isTracingEnabled()) { - static bool debugInput = hasDebugFlag("input"); - if (debugInput) { - hasDebugInput = true; - InputMap::Key key = { virtualKey, winCodePointDn, winKeyState }; - trace("keypress: %s", key.toString().c_str()); - } - } - - if (m_escapeInputEnabled && - (virtualKey == VK_UP || - virtualKey == VK_DOWN || - virtualKey == VK_LEFT || - virtualKey == VK_RIGHT || - virtualKey == VK_HOME || - virtualKey == VK_END) && - !ctrl && !leftAlt && !rightAlt && !shift) { - flushInputRecords(records); - if (hasDebugInput) { - trace("sending keypress to console HWND"); - } - sendKeyMessage(m_console.hwnd(), true, virtualKey); - sendKeyMessage(m_console.hwnd(), false, virtualKey); - return; - } - - uint16_t stepKeyState = 0; - if (ctrl) { - stepKeyState |= LEFT_CTRL_PRESSED; - appendInputRecord(records, TRUE, VK_CONTROL, 0, stepKeyState); - } - if (leftAlt) { - stepKeyState |= LEFT_ALT_PRESSED; - appendInputRecord(records, TRUE, VK_MENU, 0, stepKeyState); - } - if (rightAlt) { - stepKeyState |= RIGHT_ALT_PRESSED; - appendInputRecord(records, TRUE, VK_MENU, 0, stepKeyState | ENHANCED_KEY); - } - if (shift) { - stepKeyState |= SHIFT_PRESSED; - appendInputRecord(records, TRUE, VK_SHIFT, 0, stepKeyState); - } - if (enhanced) { - stepKeyState |= ENHANCED_KEY; - } - if (m_escapeInputEnabled) { - reencodeEscapedKeyPress(records, virtualKey, vtCodePoint, vtKeyState); - } else { - appendCPInputRecords(records, TRUE, virtualKey, winCodePointDn, stepKeyState); - } - appendCPInputRecords(records, FALSE, virtualKey, winCodePointUp, stepKeyState); - if (enhanced) { - stepKeyState &= ~ENHANCED_KEY; - } - if (shift) { - stepKeyState &= ~SHIFT_PRESSED; - appendInputRecord(records, FALSE, VK_SHIFT, 0, stepKeyState); - } - if (rightAlt) { - stepKeyState &= ~RIGHT_ALT_PRESSED; - appendInputRecord(records, FALSE, VK_MENU, 0, stepKeyState | ENHANCED_KEY); - } - if (leftAlt) { - stepKeyState &= ~LEFT_ALT_PRESSED; - appendInputRecord(records, FALSE, VK_MENU, 0, stepKeyState); - } - if (ctrl) { - stepKeyState &= ~LEFT_CTRL_PRESSED; - appendInputRecord(records, FALSE, VK_CONTROL, 0, stepKeyState); - } -} - -void ConsoleInput::appendCPInputRecords(std::vector &records, - BOOL keyDown, - uint16_t virtualKey, - uint32_t codePoint, - uint16_t keyState) -{ - // This behavior really doesn't match that of the Windows console (in - // normal, non-escape-mode). Judging by the copy-and-paste behavior, - // Windows apparently handles everything outside of the keyboard layout by - // first sending a sequence of Alt+KeyPad events, then finally a key-up - // event whose UnicodeChar has the appropriate value. For U+00A2 (CENT - // SIGN): - // - // key: dn rpt=1 scn=56 LAlt-MENU ch=0 - // key: dn rpt=1 scn=79 LAlt-NUMPAD1 ch=0 - // key: up rpt=1 scn=79 LAlt-NUMPAD1 ch=0 - // key: dn rpt=1 scn=76 LAlt-NUMPAD5 ch=0 - // key: up rpt=1 scn=76 LAlt-NUMPAD5 ch=0 - // key: dn rpt=1 scn=76 LAlt-NUMPAD5 ch=0 - // key: up rpt=1 scn=76 LAlt-NUMPAD5 ch=0 - // key: up rpt=1 scn=56 MENU ch=0xa2 - // - // The Alt+155 value matches the encoding of U+00A2 in CP-437. Curiously, - // if I use "chcp 1252" to change the encoding, then copy-and-pasting - // produces Alt+162 instead. (U+00A2 is 162 in CP-1252.) However, typing - // Alt+155 or Alt+162 produce the same characters regardless of console - // code page. (That is, they use CP-437 and yield U+00A2 and U+00F3.) - // - // For characters outside the BMP, Windows repeats the process for both - // UTF-16 code units, e.g, for U+1F300 (CYCLONE): - // - // key: dn rpt=1 scn=56 LAlt-MENU ch=0 - // key: dn rpt=1 scn=77 LAlt-NUMPAD6 ch=0 - // key: up rpt=1 scn=77 LAlt-NUMPAD6 ch=0 - // key: dn rpt=1 scn=81 LAlt-NUMPAD3 ch=0 - // key: up rpt=1 scn=81 LAlt-NUMPAD3 ch=0 - // key: up rpt=1 scn=56 MENU ch=0xd83c - // key: dn rpt=1 scn=56 LAlt-MENU ch=0 - // key: dn rpt=1 scn=77 LAlt-NUMPAD6 ch=0 - // key: up rpt=1 scn=77 LAlt-NUMPAD6 ch=0 - // key: dn rpt=1 scn=81 LAlt-NUMPAD3 ch=0 - // key: up rpt=1 scn=81 LAlt-NUMPAD3 ch=0 - // key: up rpt=1 scn=56 MENU ch=0xdf00 - // - // In this case, it sends Alt+63 twice, which signifies '?'. Apparently - // CMD and Cygwin bash are both able to decode this. - // - // Also note that typing Alt+NNN still works if NumLock is off, e.g.: - // - // key: dn rpt=1 scn=56 LAlt-MENU ch=0 - // key: dn rpt=1 scn=79 LAlt-END ch=0 - // key: up rpt=1 scn=79 LAlt-END ch=0 - // key: dn rpt=1 scn=76 LAlt-CLEAR ch=0 - // key: up rpt=1 scn=76 LAlt-CLEAR ch=0 - // key: dn rpt=1 scn=76 LAlt-CLEAR ch=0 - // key: up rpt=1 scn=76 LAlt-CLEAR ch=0 - // key: up rpt=1 scn=56 MENU ch=0xa2 - // - // Evidently, the Alt+NNN key events are not intended to be decoded to a - // character. Maybe programs are looking for a key-up ALT/MENU event with - // a non-zero character? - - wchar_t ws[2]; - const int wslen = encodeUtf16(ws, codePoint); - - if (wslen == 1) { - appendInputRecord(records, keyDown, virtualKey, ws[0], keyState); - } else if (wslen == 2) { - appendInputRecord(records, keyDown, virtualKey, ws[0], keyState); - appendInputRecord(records, keyDown, virtualKey, ws[1], keyState); - } else { - // This situation isn't that bad, but it should never happen, - // because invalid codepoints shouldn't reach this point. - trace("INTERNAL ERROR: appendInputRecordCP: invalid codePoint: " - "U+%04X", codePoint); - } -} - -void ConsoleInput::appendInputRecord(std::vector &records, - BOOL keyDown, - uint16_t virtualKey, - wchar_t utf16Char, - uint16_t keyState) -{ - INPUT_RECORD ir = {}; - ir.EventType = KEY_EVENT; - ir.Event.KeyEvent.bKeyDown = keyDown; - ir.Event.KeyEvent.wRepeatCount = 1; - ir.Event.KeyEvent.wVirtualKeyCode = virtualKey; - ir.Event.KeyEvent.wVirtualScanCode = - MapVirtualKey(virtualKey, MAPVK_VK_TO_VSC); - ir.Event.KeyEvent.uChar.UnicodeChar = utf16Char; - ir.Event.KeyEvent.dwControlKeyState = keyState; - records.push_back(ir); -} - -DWORD ConsoleInput::inputConsoleMode() -{ - DWORD mode = 0; - if (!GetConsoleMode(m_conin, &mode)) { - trace("GetConsoleMode failed"); - return 0; - } - return mode; -} diff --git a/node_modules/node-pty/deps/winpty/src/agent/ConsoleInput.h b/node_modules/node-pty/deps/winpty/src/agent/ConsoleInput.h deleted file mode 100644 index e807d97..0000000 --- a/node_modules/node-pty/deps/winpty/src/agent/ConsoleInput.h +++ /dev/null @@ -1,109 +0,0 @@ -// Copyright (c) 2011-2015 Ryan Prichard -// -// 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. - -#ifndef CONSOLEINPUT_H -#define CONSOLEINPUT_H - -#include -#include - -#include -#include -#include - -#include "Coord.h" -#include "InputMap.h" -#include "SmallRect.h" - -class Win32Console; -class DsrSender; - -class ConsoleInput -{ -public: - ConsoleInput(HANDLE conin, int mouseMode, DsrSender &dsrSender, - Win32Console &console); - void writeInput(const std::string &input); - void flushIncompleteEscapeCode(); - void setMouseWindowRect(SmallRect val) { m_mouseWindowRect = val; } - void updateInputFlags(bool forceTrace=false); - bool shouldActivateTerminalMouse(); - -private: - void doWrite(bool isEof); - void flushInputRecords(std::vector &records); - int scanInput(std::vector &records, - const char *input, - int inputSize, - bool isEof); - int scanMouseInput(std::vector &records, - const char *input, - int inputSize); - void appendUtf8Char(std::vector &records, - const char *charBuffer, - int charLen, - bool terminalAltEscape); - void appendKeyPress(std::vector &records, - uint16_t virtualKey, - uint32_t winCodePointDn, - uint32_t winCodePointUp, - uint16_t winKeyState, - uint32_t vtCodePoint, - uint16_t vtKeyState); - -public: - static void appendCPInputRecords(std::vector &records, - BOOL keyDown, - uint16_t virtualKey, - uint32_t codePoint, - uint16_t keyState); - static void appendInputRecord(std::vector &records, - BOOL keyDown, - uint16_t virtualKey, - wchar_t utf16Char, - uint16_t keyState); - -private: - DWORD inputConsoleMode(); - -private: - Win32Console &m_console; - HANDLE m_conin = nullptr; - int m_mouseMode = 0; - DsrSender &m_dsrSender; - bool m_dsrSent = false; - std::string m_byteQueue; - InputMap m_inputMap; - DWORD m_lastWriteTick = 0; - DWORD m_mouseButtonState = 0; - struct DoubleClickDetection { - DWORD button = 0; - Coord pos; - DWORD tick = 0; - bool released = false; - } m_doubleClick; - bool m_enableExtendedEnabled = false; - bool m_mouseInputEnabled = false; - bool m_quickEditEnabled = false; - bool m_escapeInputEnabled = false; - SmallRect m_mouseWindowRect; -}; - -#endif // CONSOLEINPUT_H diff --git a/node_modules/node-pty/deps/winpty/src/agent/ConsoleInputReencoding.cc b/node_modules/node-pty/deps/winpty/src/agent/ConsoleInputReencoding.cc deleted file mode 100644 index b79545e..0000000 --- a/node_modules/node-pty/deps/winpty/src/agent/ConsoleInputReencoding.cc +++ /dev/null @@ -1,121 +0,0 @@ -// Copyright (c) 2016 Ryan Prichard -// -// 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. - -#include "ConsoleInputReencoding.h" - -#include "ConsoleInput.h" - -namespace { - -static void outch(std::vector &out, wchar_t ch) { - ConsoleInput::appendInputRecord(out, TRUE, 0, ch, 0); -} - -} // anonymous namespace - -void reencodeEscapedKeyPress( - std::vector &out, - uint16_t virtualKey, - uint32_t codePoint, - uint16_t keyState) { - - struct EscapedKey { - enum { None, Numeric, Letter } kind; - wchar_t content[2]; - }; - - EscapedKey escapeCode = {}; - switch (virtualKey) { - case VK_UP: escapeCode = { EscapedKey::Letter, {'A'} }; break; - case VK_DOWN: escapeCode = { EscapedKey::Letter, {'B'} }; break; - case VK_RIGHT: escapeCode = { EscapedKey::Letter, {'C'} }; break; - case VK_LEFT: escapeCode = { EscapedKey::Letter, {'D'} }; break; - case VK_CLEAR: escapeCode = { EscapedKey::Letter, {'E'} }; break; - case VK_F1: escapeCode = { EscapedKey::Numeric, {'1', '1'} }; break; - case VK_F2: escapeCode = { EscapedKey::Numeric, {'1', '2'} }; break; - case VK_F3: escapeCode = { EscapedKey::Numeric, {'1', '3'} }; break; - case VK_F4: escapeCode = { EscapedKey::Numeric, {'1', '4'} }; break; - case VK_F5: escapeCode = { EscapedKey::Numeric, {'1', '5'} }; break; - case VK_F6: escapeCode = { EscapedKey::Numeric, {'1', '7'} }; break; - case VK_F7: escapeCode = { EscapedKey::Numeric, {'1', '8'} }; break; - case VK_F8: escapeCode = { EscapedKey::Numeric, {'1', '9'} }; break; - case VK_F9: escapeCode = { EscapedKey::Numeric, {'2', '0'} }; break; - case VK_F10: escapeCode = { EscapedKey::Numeric, {'2', '1'} }; break; - case VK_F11: escapeCode = { EscapedKey::Numeric, {'2', '3'} }; break; - case VK_F12: escapeCode = { EscapedKey::Numeric, {'2', '4'} }; break; - case VK_HOME: escapeCode = { EscapedKey::Letter, {'H'} }; break; - case VK_INSERT: escapeCode = { EscapedKey::Numeric, {'2'} }; break; - case VK_DELETE: escapeCode = { EscapedKey::Numeric, {'3'} }; break; - case VK_END: escapeCode = { EscapedKey::Letter, {'F'} }; break; - case VK_PRIOR: escapeCode = { EscapedKey::Numeric, {'5'} }; break; - case VK_NEXT: escapeCode = { EscapedKey::Numeric, {'6'} }; break; - } - if (escapeCode.kind != EscapedKey::None) { - int flags = 0; - if (keyState & SHIFT_PRESSED) { flags |= 0x1; } - if (keyState & LEFT_ALT_PRESSED) { flags |= 0x2; } - if (keyState & LEFT_CTRL_PRESSED) { flags |= 0x4; } - outch(out, L'\x1b'); - outch(out, L'['); - if (escapeCode.kind == EscapedKey::Numeric) { - for (wchar_t ch : escapeCode.content) { - if (ch != L'\0') { - outch(out, ch); - } - } - } else if (flags != 0) { - outch(out, L'1'); - } - if (flags != 0) { - outch(out, L';'); - outch(out, L'1' + flags); - } - if (escapeCode.kind == EscapedKey::Numeric) { - outch(out, L'~'); - } else { - outch(out, escapeCode.content[0]); - } - return; - } - - switch (virtualKey) { - case VK_BACK: - if (keyState & LEFT_ALT_PRESSED) { - outch(out, L'\x1b'); - } - outch(out, L'\x7f'); - return; - case VK_TAB: - if (keyState & SHIFT_PRESSED) { - outch(out, L'\x1b'); - outch(out, L'['); - outch(out, L'Z'); - return; - } - break; - } - - if (codePoint != 0) { - if (keyState & LEFT_ALT_PRESSED) { - outch(out, L'\x1b'); - } - ConsoleInput::appendCPInputRecords(out, TRUE, 0, codePoint, 0); - } -} diff --git a/node_modules/node-pty/deps/winpty/src/agent/ConsoleInputReencoding.h b/node_modules/node-pty/deps/winpty/src/agent/ConsoleInputReencoding.h deleted file mode 100644 index 63bc006..0000000 --- a/node_modules/node-pty/deps/winpty/src/agent/ConsoleInputReencoding.h +++ /dev/null @@ -1,36 +0,0 @@ -// Copyright (c) 2016 Ryan Prichard -// -// 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. - -#ifndef AGENT_CONSOLE_INPUT_REENCODING_H -#define AGENT_CONSOLE_INPUT_REENCODING_H - -#include - -#include - -#include - -void reencodeEscapedKeyPress( - std::vector &records, - uint16_t virtualKey, - uint32_t codePoint, - uint16_t keyState); - -#endif // AGENT_CONSOLE_INPUT_REENCODING_H diff --git a/node_modules/node-pty/deps/winpty/src/agent/ConsoleLine.cc b/node_modules/node-pty/deps/winpty/src/agent/ConsoleLine.cc deleted file mode 100644 index 1d2bcb7..0000000 --- a/node_modules/node-pty/deps/winpty/src/agent/ConsoleLine.cc +++ /dev/null @@ -1,152 +0,0 @@ -// Copyright (c) 2015 Ryan Prichard -// -// 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. - -// -// ConsoleLine -// -// This data structure keep tracks of the previous CHAR_INFO content of an -// output line and determines when a line has changed. Detecting line changes -// is made complicated by terminal resizing. -// - -#include "ConsoleLine.h" - -#include - -#include "../shared/WinptyAssert.h" - -static CHAR_INFO blankChar(WORD attributes) -{ - // N.B.: As long as we write to UnicodeChar rather than AsciiChar, there - // are no padding bytes that could contain uninitialized bytes. This fact - // is important for efficient comparison. - CHAR_INFO ret; - ret.Attributes = attributes; - ret.Char.UnicodeChar = L' '; - return ret; -} - -static bool isLineBlank(const CHAR_INFO *line, int length, WORD attributes) -{ - for (int col = 0; col < length; ++col) { - if (line[col].Attributes != attributes || - line[col].Char.UnicodeChar != L' ') { - return false; - } - } - return true; -} - -static inline bool areLinesEqual( - const CHAR_INFO *line1, - const CHAR_INFO *line2, - int length) -{ - return memcmp(line1, line2, sizeof(CHAR_INFO) * length) == 0; -} - -ConsoleLine::ConsoleLine() : m_prevLength(0) -{ -} - -void ConsoleLine::reset() -{ - m_prevLength = 0; - m_prevData.clear(); -} - -// Determines whether the given line is sufficiently different from the -// previously seen line as to justify reoutputting the line. The function -// also sets the `ConsoleLine` to the given line, exactly as if `setLine` had -// been called. -bool ConsoleLine::detectChangeAndSetLine(const CHAR_INFO *const line, const int newLength) -{ - ASSERT(newLength >= 1); - ASSERT(m_prevLength <= static_cast(m_prevData.size())); - - if (newLength == m_prevLength) { - bool equalLines = areLinesEqual(m_prevData.data(), line, newLength); - if (!equalLines) { - setLine(line, newLength); - } - return !equalLines; - } else { - if (m_prevLength == 0) { - setLine(line, newLength); - return true; - } - - ASSERT(m_prevLength >= 1); - const WORD prevBlank = m_prevData[m_prevLength - 1].Attributes; - const WORD newBlank = line[newLength - 1].Attributes; - - bool equalLines = false; - if (newLength < m_prevLength) { - // The line has become shorter. The lines are equal if the common - // part is equal, and if the newly truncated characters were blank. - equalLines = - areLinesEqual(m_prevData.data(), line, newLength) && - isLineBlank(m_prevData.data() + newLength, - m_prevLength - newLength, - newBlank); - } else { - // - // The line has become longer. The lines are equal if the common - // part is equal, and if both the extra characters and any - // potentially reexposed characters are blank. - // - // Two of the most relevant terminals for winpty--mintty and - // jediterm--don't (currently) erase the obscured content when a - // line is cleared, so we should anticipate its existence when - // making a terminal wider and reoutput the line. See: - // - // * https://github.com/mintty/mintty/issues/480 - // * https://github.com/JetBrains/jediterm/issues/118 - // - ASSERT(newLength > m_prevLength); - equalLines = - areLinesEqual(m_prevData.data(), line, m_prevLength) && - isLineBlank(m_prevData.data() + m_prevLength, - std::min(m_prevData.size(), newLength) - m_prevLength, - prevBlank) && - isLineBlank(line + m_prevLength, - newLength - m_prevLength, - prevBlank); - } - setLine(line, newLength); - return !equalLines; - } -} - -void ConsoleLine::setLine(const CHAR_INFO *const line, const int newLength) -{ - if (static_cast(m_prevData.size()) < newLength) { - m_prevData.resize(newLength); - } - memcpy(m_prevData.data(), line, sizeof(CHAR_INFO) * newLength); - m_prevLength = newLength; -} - -void ConsoleLine::blank(WORD attributes) -{ - m_prevData.resize(1); - m_prevData[0] = blankChar(attributes); - m_prevLength = 1; -} diff --git a/node_modules/node-pty/deps/winpty/src/agent/ConsoleLine.h b/node_modules/node-pty/deps/winpty/src/agent/ConsoleLine.h deleted file mode 100644 index 802c189..0000000 --- a/node_modules/node-pty/deps/winpty/src/agent/ConsoleLine.h +++ /dev/null @@ -1,41 +0,0 @@ -// Copyright (c) 2015 Ryan Prichard -// -// 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. - -#ifndef CONSOLE_LINE_H -#define CONSOLE_LINE_H - -#include - -#include - -class ConsoleLine -{ -public: - ConsoleLine(); - void reset(); - bool detectChangeAndSetLine(const CHAR_INFO *line, int newLength); - void setLine(const CHAR_INFO *line, int newLength); - void blank(WORD attributes); -private: - int m_prevLength; - std::vector m_prevData; -}; - -#endif // CONSOLE_LINE_H diff --git a/node_modules/node-pty/deps/winpty/src/agent/Coord.h b/node_modules/node-pty/deps/winpty/src/agent/Coord.h deleted file mode 100644 index 74c98ad..0000000 --- a/node_modules/node-pty/deps/winpty/src/agent/Coord.h +++ /dev/null @@ -1,87 +0,0 @@ -// Copyright (c) 2011-2012 Ryan Prichard -// -// 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. - -#ifndef COORD_H -#define COORD_H - -#include - -#include - -#include "../shared/winpty_snprintf.h" - -struct Coord : COORD { - Coord() - { - X = 0; - Y = 0; - } - - Coord(SHORT x, SHORT y) - { - X = x; - Y = y; - } - - Coord(COORD other) - { - *(COORD*)this = other; - } - - Coord(const Coord &other) - { - *(COORD*)this = *(const COORD*)&other; - } - - Coord &operator=(const Coord &other) - { - *(COORD*)this = *(const COORD*)&other; - return *this; - } - - bool operator==(const Coord &other) const - { - return X == other.X && Y == other.Y; - } - - bool operator!=(const Coord &other) const - { - return !(*this == other); - } - - Coord operator+(const Coord &other) const - { - return Coord(X + other.X, Y + other.Y); - } - - bool isEmpty() const - { - return X <= 0 || Y <= 0; - } - - std::string toString() const - { - char ret[32]; - winpty_snprintf(ret, "(%d,%d)", X, Y); - return std::string(ret); - } -}; - -#endif // COORD_H diff --git a/node_modules/node-pty/deps/winpty/src/agent/DebugShowInput.cc b/node_modules/node-pty/deps/winpty/src/agent/DebugShowInput.cc deleted file mode 100644 index 191b2e1..0000000 --- a/node_modules/node-pty/deps/winpty/src/agent/DebugShowInput.cc +++ /dev/null @@ -1,239 +0,0 @@ -// Copyright (c) 2015 Ryan Prichard -// -// 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. - -#include "DebugShowInput.h" - -#include -#include -#include -#include - -#include - -#include "../shared/StringBuilder.h" -#include "InputMap.h" - -namespace { - -struct Flag { - DWORD value; - const char *text; -}; - -static const Flag kButtonStates[] = { - { FROM_LEFT_1ST_BUTTON_PRESSED, "1" }, - { FROM_LEFT_2ND_BUTTON_PRESSED, "2" }, - { FROM_LEFT_3RD_BUTTON_PRESSED, "3" }, - { FROM_LEFT_4TH_BUTTON_PRESSED, "4" }, - { RIGHTMOST_BUTTON_PRESSED, "R" }, -}; - -static const Flag kControlKeyStates[] = { - { CAPSLOCK_ON, "CapsLock" }, - { ENHANCED_KEY, "Enhanced" }, - { LEFT_ALT_PRESSED, "LAlt" }, - { LEFT_CTRL_PRESSED, "LCtrl" }, - { NUMLOCK_ON, "NumLock" }, - { RIGHT_ALT_PRESSED, "RAlt" }, - { RIGHT_CTRL_PRESSED, "RCtrl" }, - { SCROLLLOCK_ON, "ScrollLock" }, - { SHIFT_PRESSED, "Shift" }, -}; - -static const Flag kMouseEventFlags[] = { - { DOUBLE_CLICK, "Double" }, - { 8/*MOUSE_HWHEELED*/, "HWheel" }, - { MOUSE_MOVED, "Move" }, - { MOUSE_WHEELED, "Wheel" }, -}; - -static void writeFlags(StringBuilder &out, DWORD flags, - const char *remainderName, - const Flag *table, size_t tableSize, - char pre, char sep, char post) { - DWORD remaining = flags; - bool wroteSomething = false; - for (size_t i = 0; i < tableSize; ++i) { - const Flag &f = table[i]; - if ((f.value & flags) == f.value) { - if (!wroteSomething && pre != '\0') { - out << pre; - } else if (wroteSomething && sep != '\0') { - out << sep; - } - out << f.text; - wroteSomething = true; - remaining &= ~f.value; - } - } - if (remaining != 0) { - if (!wroteSomething && pre != '\0') { - out << pre; - } else if (wroteSomething && sep != '\0') { - out << sep; - } - out << remainderName << "(0x" << hexOfInt(remaining) << ')'; - wroteSomething = true; - } - if (wroteSomething && post != '\0') { - out << post; - } -} - -template -static void writeFlags(StringBuilder &out, DWORD flags, - const char *remainderName, - const Flag (&table)[n], - char pre, char sep, char post) { - writeFlags(out, flags, remainderName, table, n, pre, sep, post); -} - -} // anonymous namespace - -std::string controlKeyStatePrefix(DWORD controlKeyState) { - StringBuilder sb; - writeFlags(sb, controlKeyState, - "keyState", kControlKeyStates, '\0', '-', '-'); - return sb.str_moved(); -} - -std::string mouseEventToString(const MOUSE_EVENT_RECORD &mer) { - const uint16_t buttons = mer.dwButtonState & 0xFFFF; - const int16_t wheel = mer.dwButtonState >> 16; - StringBuilder sb; - sb << "pos=" << mer.dwMousePosition.X << ',' - << mer.dwMousePosition.Y; - writeFlags(sb, mer.dwControlKeyState, "keyState", kControlKeyStates, ' ', ' ', '\0'); - writeFlags(sb, mer.dwEventFlags, "flags", kMouseEventFlags, ' ', ' ', '\0'); - writeFlags(sb, buttons, "buttons", kButtonStates, ' ', ' ', '\0'); - if (wheel != 0) { - sb << " wheel=" << wheel; - } - return sb.str_moved(); -} - -void debugShowInput(bool enableMouse, bool escapeInput) { - HANDLE conin = GetStdHandle(STD_INPUT_HANDLE); - DWORD origConsoleMode = 0; - if (!GetConsoleMode(conin, &origConsoleMode)) { - fprintf(stderr, "Error: could not read console mode -- " - "is STDIN a console handle?\n"); - exit(1); - } - DWORD restoreConsoleMode = origConsoleMode; - if (enableMouse && !(restoreConsoleMode & ENABLE_EXTENDED_FLAGS)) { - // We need to disable QuickEdit mode, because it blocks mouse events. - // If ENABLE_EXTENDED_FLAGS wasn't originally in the console mode, then - // we have no way of knowning whether QuickEdit or InsertMode are - // currently enabled. Enable them both (eventually), because they're - // sensible defaults. This case shouldn't happen typically. See - // misc/EnableExtendedFlags.txt. - restoreConsoleMode |= ENABLE_EXTENDED_FLAGS; - restoreConsoleMode |= ENABLE_QUICK_EDIT_MODE; - restoreConsoleMode |= ENABLE_INSERT_MODE; - } - DWORD newConsoleMode = restoreConsoleMode; - newConsoleMode &= ~ENABLE_PROCESSED_INPUT; - newConsoleMode &= ~ENABLE_LINE_INPUT; - newConsoleMode &= ~ENABLE_ECHO_INPUT; - newConsoleMode |= ENABLE_WINDOW_INPUT; - if (enableMouse) { - newConsoleMode |= ENABLE_MOUSE_INPUT; - newConsoleMode &= ~ENABLE_QUICK_EDIT_MODE; - } else { - newConsoleMode &= ~ENABLE_MOUSE_INPUT; - } - if (escapeInput) { - // As of this writing (2016-06-05), Microsoft has shipped two preview - // builds of Windows 10 (14316 and 14342) that include a new "Windows - // Subsystem for Linux" that runs Ubuntu in a new subsystem. Running - // bash in this subsystem requires the non-legacy console mode, and the - // console input buffer is put into a special mode where escape - // sequences are written into the console input buffer. This mode is - // enabled with the 0x200 flag, which is as-yet undocumented. - // See https://github.com/rprichard/winpty/issues/82. - newConsoleMode |= 0x200; - } - if (!SetConsoleMode(conin, newConsoleMode)) { - fprintf(stderr, "Error: could not set console mode " - "(0x%x -> 0x%x -> 0x%x)\n", - static_cast(origConsoleMode), - static_cast(newConsoleMode), - static_cast(restoreConsoleMode)); - exit(1); - } - printf("\nPress any keys -- Ctrl-D exits\n\n"); - INPUT_RECORD records[32]; - DWORD actual = 0; - bool finished = false; - while (!finished && - ReadConsoleInputW(conin, records, 32, &actual) && actual >= 1) { - StringBuilder sb; - for (DWORD i = 0; i < actual; ++i) { - const INPUT_RECORD &record = records[i]; - if (record.EventType == KEY_EVENT) { - const KEY_EVENT_RECORD &ker = record.Event.KeyEvent; - InputMap::Key key = { - ker.wVirtualKeyCode, - ker.uChar.UnicodeChar, - static_cast(ker.dwControlKeyState), - }; - sb << "key: " << (ker.bKeyDown ? "dn" : "up") - << " rpt=" << ker.wRepeatCount - << " scn=" << (ker.wVirtualScanCode ? "0x" : "") << hexOfInt(ker.wVirtualScanCode) - << ' ' << key.toString() << '\n'; - if ((ker.dwControlKeyState & - (LEFT_CTRL_PRESSED | RIGHT_CTRL_PRESSED)) && - ker.wVirtualKeyCode == 'D') { - finished = true; - break; - } else if (ker.wVirtualKeyCode == 0 && - ker.wVirtualScanCode == 0 && - ker.uChar.UnicodeChar == 4) { - // Also look for a zeroed-out Ctrl-D record generated for - // ENABLE_VIRTUAL_TERMINAL_INPUT. - finished = true; - break; - } - } else if (record.EventType == MOUSE_EVENT) { - const MOUSE_EVENT_RECORD &mer = record.Event.MouseEvent; - sb << "mouse: " << mouseEventToString(mer) << '\n'; - } else if (record.EventType == WINDOW_BUFFER_SIZE_EVENT) { - const WINDOW_BUFFER_SIZE_RECORD &wbsr = - record.Event.WindowBufferSizeEvent; - sb << "buffer-resized: dwSize=(" - << wbsr.dwSize.X << ',' - << wbsr.dwSize.Y << ")\n"; - } else if (record.EventType == MENU_EVENT) { - const MENU_EVENT_RECORD &mer = record.Event.MenuEvent; - sb << "menu-event: commandId=0x" - << hexOfInt(mer.dwCommandId) << '\n'; - } else if (record.EventType == FOCUS_EVENT) { - const FOCUS_EVENT_RECORD &fer = record.Event.FocusEvent; - sb << "focus: " << (fer.bSetFocus ? "gained" : "lost") << '\n'; - } - } - - const auto str = sb.str_moved(); - fwrite(str.data(), 1, str.size(), stdout); - fflush(stdout); - } - SetConsoleMode(conin, restoreConsoleMode); -} diff --git a/node_modules/node-pty/deps/winpty/src/agent/DebugShowInput.h b/node_modules/node-pty/deps/winpty/src/agent/DebugShowInput.h deleted file mode 100644 index 4fa1360..0000000 --- a/node_modules/node-pty/deps/winpty/src/agent/DebugShowInput.h +++ /dev/null @@ -1,32 +0,0 @@ -// Copyright (c) 2015 Ryan Prichard -// -// 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. - -#ifndef AGENT_DEBUG_SHOW_INPUT_H -#define AGENT_DEBUG_SHOW_INPUT_H - -#include - -#include - -std::string controlKeyStatePrefix(DWORD controlKeyState); -std::string mouseEventToString(const MOUSE_EVENT_RECORD &mer); -void debugShowInput(bool enableMouse, bool escapeInput); - -#endif // AGENT_DEBUG_SHOW_INPUT_H diff --git a/node_modules/node-pty/deps/winpty/src/agent/DefaultInputMap.cc b/node_modules/node-pty/deps/winpty/src/agent/DefaultInputMap.cc deleted file mode 100644 index 5e29d98..0000000 --- a/node_modules/node-pty/deps/winpty/src/agent/DefaultInputMap.cc +++ /dev/null @@ -1,422 +0,0 @@ -// Copyright (c) 2015 Ryan Prichard -// -// 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. - -#include "DefaultInputMap.h" - -#include -#include - -#include - -#include "../shared/StringBuilder.h" -#include "../shared/WinptyAssert.h" -#include "InputMap.h" - -#define ESC "\x1B" -#define DIM(x) (sizeof(x) / sizeof((x)[0])) - -namespace { - -struct EscapeEncoding { - bool alt_prefix_allowed; - char prefix; - char id; - int modifiers; - InputMap::Key key; -}; - -// Modifiers. A "modifier" is an integer from 2 to 8 that conveys the status -// of Shift(1), Alt(2), and Ctrl(4). The value is constructed by OR'ing the -// appropriate value for each active modifier, then adding 1. -// -// Details: -// - kBare: expands to: ESC -// - kSemiMod: expands to: ESC ; -// - kBareMod: expands to: ESC -const int kBare = 0x01; -const int kSemiMod = 0x02; -const int kBareMod = 0x04; - -// Numeric escape sequences suffixes: -// - with no flag: accept: ~ -// - kSuffixCtrl: accept: ~ ^ -// - kSuffixShift: accept: ~ $ -// - kSuffixBoth: accept: ~ ^ $ @ -const int kSuffixCtrl = 0x08; -const int kSuffixShift = 0x10; -const int kSuffixBoth = kSuffixCtrl | kSuffixShift; - -static const EscapeEncoding escapeLetterEncodings[] = { - // Conventional arrow keys - // kBareMod: Ubuntu /etc/inputrc and IntelliJ/JediTerm use escapes like: ESC [ n ABCD - { true, '[', 'A', kBare | kBareMod | kSemiMod, { VK_UP, '\0', 0 } }, - { true, '[', 'B', kBare | kBareMod | kSemiMod, { VK_DOWN, '\0', 0 } }, - { true, '[', 'C', kBare | kBareMod | kSemiMod, { VK_RIGHT, '\0', 0 } }, - { true, '[', 'D', kBare | kBareMod | kSemiMod, { VK_LEFT, '\0', 0 } }, - - // putty. putty uses this sequence for Ctrl-Arrow, Shift-Arrow, and - // Ctrl-Shift-Arrow, but I can only decode to one choice, so I'm just - // leaving the modifier off altogether. - { true, 'O', 'A', kBare, { VK_UP, '\0', 0 } }, - { true, 'O', 'B', kBare, { VK_DOWN, '\0', 0 } }, - { true, 'O', 'C', kBare, { VK_RIGHT, '\0', 0 } }, - { true, 'O', 'D', kBare, { VK_LEFT, '\0', 0 } }, - - // rxvt, rxvt-unicode - // Shift-Ctrl-Arrow can't be identified. It's the same as Shift-Arrow. - { true, '[', 'a', kBare, { VK_UP, '\0', SHIFT_PRESSED } }, - { true, '[', 'b', kBare, { VK_DOWN, '\0', SHIFT_PRESSED } }, - { true, '[', 'c', kBare, { VK_RIGHT, '\0', SHIFT_PRESSED } }, - { true, '[', 'd', kBare, { VK_LEFT, '\0', SHIFT_PRESSED } }, - { true, 'O', 'a', kBare, { VK_UP, '\0', LEFT_CTRL_PRESSED } }, - { true, 'O', 'b', kBare, { VK_DOWN, '\0', LEFT_CTRL_PRESSED } }, - { true, 'O', 'c', kBare, { VK_RIGHT, '\0', LEFT_CTRL_PRESSED } }, - { true, 'O', 'd', kBare, { VK_LEFT, '\0', LEFT_CTRL_PRESSED } }, - - // Numpad 5 with NumLock off - // * xterm, mintty, and gnome-terminal use `ESC [ E`. - // * putty, TERM=cygwin, TERM=linux all use `ESC [ G` for 5 - // * putty uses `ESC O G` for Ctrl-5 and Shift-5. Omit the modifier - // as with putty's arrow keys. - // * I never saw modifiers inserted into these escapes, but I think - // it should be completely OK with the CSI escapes. - { true, '[', 'E', kBare | kSemiMod, { VK_CLEAR, '\0', 0 } }, - { true, '[', 'G', kBare | kSemiMod, { VK_CLEAR, '\0', 0 } }, - { true, 'O', 'G', kBare, { VK_CLEAR, '\0', 0 } }, - - // Home/End, letter version - // * gnome-terminal uses `ESC O [HF]`. I never saw it modified. - // kBareMod: IntelliJ/JediTerm uses escapes like: ESC [ n HF - { true, '[', 'H', kBare | kBareMod | kSemiMod, { VK_HOME, '\0', 0 } }, - { true, '[', 'F', kBare | kBareMod | kSemiMod, { VK_END, '\0', 0 } }, - { true, 'O', 'H', kBare, { VK_HOME, '\0', 0 } }, - { true, 'O', 'F', kBare, { VK_END, '\0', 0 } }, - - // F1-F4, letter version (xterm, VTE, konsole) - { true, '[', 'P', kSemiMod, { VK_F1, '\0', 0 } }, - { true, '[', 'Q', kSemiMod, { VK_F2, '\0', 0 } }, - { true, '[', 'R', kSemiMod, { VK_F3, '\0', 0 } }, - { true, '[', 'S', kSemiMod, { VK_F4, '\0', 0 } }, - - // GNOME VTE and Konsole have special encodings for modified F1-F4: - // * [VTE] ESC O 1 ; n [PQRS] - // * [Konsole] ESC O n [PQRS] - { false, 'O', 'P', kBare | kBareMod | kSemiMod, { VK_F1, '\0', 0 } }, - { false, 'O', 'Q', kBare | kBareMod | kSemiMod, { VK_F2, '\0', 0 } }, - { false, 'O', 'R', kBare | kBareMod | kSemiMod, { VK_F3, '\0', 0 } }, - { false, 'O', 'S', kBare | kBareMod | kSemiMod, { VK_F4, '\0', 0 } }, - - // Handle the "application numpad" escape sequences. - // - // Terminals output these codes under various circumstances: - // * rxvt-unicode: numpad, hold down SHIFT - // * rxvt: numpad, by default - // * xterm: numpad, after enabling app-mode using DECPAM (`ESC =`). xterm - // generates `ESC O ` for modified numpad presses, - // necessitating kBareMod. - // * mintty: by combining Ctrl with various keys such as '1' or ','. - // Handling those keys is difficult, because mintty is generating the - // same sequence for Ctrl-1 and Ctrl-NumPadEnd -- should the virtualKey - // be '1' or VK_HOME? - - { true, 'O', 'M', kBare | kBareMod, { VK_RETURN, '\r', 0 } }, - { true, 'O', 'j', kBare | kBareMod, { VK_MULTIPLY, '*', 0 } }, - { true, 'O', 'k', kBare | kBareMod, { VK_ADD, '+', 0 } }, - { true, 'O', 'm', kBare | kBareMod, { VK_SUBTRACT, '-', 0 } }, - { true, 'O', 'n', kBare | kBareMod, { VK_DELETE, '\0', 0 } }, - { true, 'O', 'o', kBare | kBareMod, { VK_DIVIDE, '/', 0 } }, - { true, 'O', 'p', kBare | kBareMod, { VK_INSERT, '\0', 0 } }, - { true, 'O', 'q', kBare | kBareMod, { VK_END, '\0', 0 } }, - { true, 'O', 'r', kBare | kBareMod, { VK_DOWN, '\0', 0 } }, - { true, 'O', 's', kBare | kBareMod, { VK_NEXT, '\0', 0 } }, - { true, 'O', 't', kBare | kBareMod, { VK_LEFT, '\0', 0 } }, - { true, 'O', 'u', kBare | kBareMod, { VK_CLEAR, '\0', 0 } }, - { true, 'O', 'v', kBare | kBareMod, { VK_RIGHT, '\0', 0 } }, - { true, 'O', 'w', kBare | kBareMod, { VK_HOME, '\0', 0 } }, - { true, 'O', 'x', kBare | kBareMod, { VK_UP, '\0', 0 } }, - { true, 'O', 'y', kBare | kBareMod, { VK_PRIOR, '\0', 0 } }, - - { true, '[', 'M', kBare | kSemiMod, { VK_RETURN, '\r', 0 } }, - { true, '[', 'j', kBare | kSemiMod, { VK_MULTIPLY, '*', 0 } }, - { true, '[', 'k', kBare | kSemiMod, { VK_ADD, '+', 0 } }, - { true, '[', 'm', kBare | kSemiMod, { VK_SUBTRACT, '-', 0 } }, - { true, '[', 'n', kBare | kSemiMod, { VK_DELETE, '\0', 0 } }, - { true, '[', 'o', kBare | kSemiMod, { VK_DIVIDE, '/', 0 } }, - { true, '[', 'p', kBare | kSemiMod, { VK_INSERT, '\0', 0 } }, - { true, '[', 'q', kBare | kSemiMod, { VK_END, '\0', 0 } }, - { true, '[', 'r', kBare | kSemiMod, { VK_DOWN, '\0', 0 } }, - { true, '[', 's', kBare | kSemiMod, { VK_NEXT, '\0', 0 } }, - { true, '[', 't', kBare | kSemiMod, { VK_LEFT, '\0', 0 } }, - { true, '[', 'u', kBare | kSemiMod, { VK_CLEAR, '\0', 0 } }, - { true, '[', 'v', kBare | kSemiMod, { VK_RIGHT, '\0', 0 } }, - { true, '[', 'w', kBare | kSemiMod, { VK_HOME, '\0', 0 } }, - { true, '[', 'x', kBare | kSemiMod, { VK_UP, '\0', 0 } }, - { true, '[', 'y', kBare | kSemiMod, { VK_PRIOR, '\0', 0 } }, - - { false, '[', 'Z', kBare, { VK_TAB, '\t', SHIFT_PRESSED } }, -}; - -static const EscapeEncoding escapeNumericEncodings[] = { - { true, '[', 1, kBare | kSemiMod | kSuffixBoth, { VK_HOME, '\0', 0 } }, - { true, '[', 2, kBare | kSemiMod | kSuffixBoth, { VK_INSERT, '\0', 0 } }, - { true, '[', 3, kBare | kSemiMod | kSuffixBoth, { VK_DELETE, '\0', 0 } }, - { true, '[', 4, kBare | kSemiMod | kSuffixBoth, { VK_END, '\0', 0 } }, - { true, '[', 5, kBare | kSemiMod | kSuffixBoth, { VK_PRIOR, '\0', 0 } }, - { true, '[', 6, kBare | kSemiMod | kSuffixBoth, { VK_NEXT, '\0', 0 } }, - { true, '[', 7, kBare | kSemiMod | kSuffixBoth, { VK_HOME, '\0', 0 } }, - { true, '[', 8, kBare | kSemiMod | kSuffixBoth, { VK_END, '\0', 0 } }, - { true, '[', 11, kBare | kSemiMod | kSuffixBoth, { VK_F1, '\0', 0 } }, - { true, '[', 12, kBare | kSemiMod | kSuffixBoth, { VK_F2, '\0', 0 } }, - { true, '[', 13, kBare | kSemiMod | kSuffixBoth, { VK_F3, '\0', 0 } }, - { true, '[', 14, kBare | kSemiMod | kSuffixBoth, { VK_F4, '\0', 0 } }, - { true, '[', 15, kBare | kSemiMod | kSuffixBoth, { VK_F5, '\0', 0 } }, - { true, '[', 17, kBare | kSemiMod | kSuffixBoth, { VK_F6, '\0', 0 } }, - { true, '[', 18, kBare | kSemiMod | kSuffixBoth, { VK_F7, '\0', 0 } }, - { true, '[', 19, kBare | kSemiMod | kSuffixBoth, { VK_F8, '\0', 0 } }, - { true, '[', 20, kBare | kSemiMod | kSuffixBoth, { VK_F9, '\0', 0 } }, - { true, '[', 21, kBare | kSemiMod | kSuffixBoth, { VK_F10, '\0', 0 } }, - { true, '[', 23, kBare | kSemiMod | kSuffixBoth, { VK_F11, '\0', 0 } }, - { true, '[', 24, kBare | kSemiMod | kSuffixBoth, { VK_F12, '\0', 0 } }, - { true, '[', 25, kBare | kSemiMod | kSuffixBoth, { VK_F3, '\0', SHIFT_PRESSED } }, - { true, '[', 26, kBare | kSemiMod | kSuffixBoth, { VK_F4, '\0', SHIFT_PRESSED } }, - { true, '[', 28, kBare | kSemiMod | kSuffixBoth, { VK_F5, '\0', SHIFT_PRESSED } }, - { true, '[', 29, kBare | kSemiMod | kSuffixBoth, { VK_F6, '\0', SHIFT_PRESSED } }, - { true, '[', 31, kBare | kSemiMod | kSuffixBoth, { VK_F7, '\0', SHIFT_PRESSED } }, - { true, '[', 32, kBare | kSemiMod | kSuffixBoth, { VK_F8, '\0', SHIFT_PRESSED } }, - { true, '[', 33, kBare | kSemiMod | kSuffixBoth, { VK_F9, '\0', SHIFT_PRESSED } }, - { true, '[', 34, kBare | kSemiMod | kSuffixBoth, { VK_F10, '\0', SHIFT_PRESSED } }, -}; - -const int kCsiShiftModifier = 1; -const int kCsiAltModifier = 2; -const int kCsiCtrlModifier = 4; - -static inline bool useEnhancedForVirtualKey(uint16_t vk) { - switch (vk) { - case VK_UP: - case VK_DOWN: - case VK_LEFT: - case VK_RIGHT: - case VK_INSERT: - case VK_DELETE: - case VK_HOME: - case VK_END: - case VK_PRIOR: - case VK_NEXT: - return true; - default: - return false; - } -} - -static void addSimpleEntries(InputMap &inputMap) { - struct SimpleEncoding { - const char *encoding; - InputMap::Key key; - }; - - static const SimpleEncoding simpleEncodings[] = { - // Ctrl- seems to be handled OK by the default code path. - - { "\x7F", { VK_BACK, '\x08', 0, } }, - { ESC "\x7F", { VK_BACK, '\x08', LEFT_ALT_PRESSED, } }, - { "\x03", { 'C', '\x03', LEFT_CTRL_PRESSED, } }, - - // Handle special F1-F5 for TERM=linux and TERM=cygwin. - { ESC "[[A", { VK_F1, '\0', 0 } }, - { ESC "[[B", { VK_F2, '\0', 0 } }, - { ESC "[[C", { VK_F3, '\0', 0 } }, - { ESC "[[D", { VK_F4, '\0', 0 } }, - { ESC "[[E", { VK_F5, '\0', 0 } }, - - { ESC ESC "[[A", { VK_F1, '\0', LEFT_ALT_PRESSED } }, - { ESC ESC "[[B", { VK_F2, '\0', LEFT_ALT_PRESSED } }, - { ESC ESC "[[C", { VK_F3, '\0', LEFT_ALT_PRESSED } }, - { ESC ESC "[[D", { VK_F4, '\0', LEFT_ALT_PRESSED } }, - { ESC ESC "[[E", { VK_F5, '\0', LEFT_ALT_PRESSED } }, - }; - - for (size_t i = 0; i < DIM(simpleEncodings); ++i) { - auto k = simpleEncodings[i].key; - if (useEnhancedForVirtualKey(k.virtualKey)) { - k.keyState |= ENHANCED_KEY; - } - inputMap.set(simpleEncodings[i].encoding, - strlen(simpleEncodings[i].encoding), - k); - } -} - -struct ExpandContext { - InputMap &inputMap; - const EscapeEncoding &e; - char *buffer; - char *bufferEnd; -}; - -static inline void setEncoding(const ExpandContext &ctx, char *end, - uint16_t extraKeyState) { - InputMap::Key k = ctx.e.key; - k.keyState |= extraKeyState; - if (k.keyState & LEFT_CTRL_PRESSED) { - switch (k.virtualKey) { - case VK_ADD: - case VK_DIVIDE: - case VK_MULTIPLY: - case VK_SUBTRACT: - k.unicodeChar = '\0'; - break; - case VK_RETURN: - k.unicodeChar = '\n'; - break; - } - } - if (useEnhancedForVirtualKey(k.virtualKey)) { - k.keyState |= ENHANCED_KEY; - } - ctx.inputMap.set(ctx.buffer, end - ctx.buffer, k); -} - -static inline uint16_t keyStateForMod(int mod) { - int ret = 0; - if ((mod - 1) & kCsiShiftModifier) ret |= SHIFT_PRESSED; - if ((mod - 1) & kCsiAltModifier) ret |= LEFT_ALT_PRESSED; - if ((mod - 1) & kCsiCtrlModifier) ret |= LEFT_CTRL_PRESSED; - return ret; -} - -static void expandNumericEncodingSuffix(const ExpandContext &ctx, char *p, - uint16_t extraKeyState) { - ASSERT(p <= ctx.bufferEnd - 1); - { - char *q = p; - *q++ = '~'; - setEncoding(ctx, q, extraKeyState); - } - if (ctx.e.modifiers & kSuffixShift) { - char *q = p; - *q++ = '$'; - setEncoding(ctx, q, extraKeyState | SHIFT_PRESSED); - } - if (ctx.e.modifiers & kSuffixCtrl) { - char *q = p; - *q++ = '^'; - setEncoding(ctx, q, extraKeyState | LEFT_CTRL_PRESSED); - } - if (ctx.e.modifiers & (kSuffixCtrl | kSuffixShift)) { - char *q = p; - *q++ = '@'; - setEncoding(ctx, q, extraKeyState | SHIFT_PRESSED | LEFT_CTRL_PRESSED); - } -} - -template -static inline void expandEncodingAfterAltPrefix( - const ExpandContext &ctx, char *p, uint16_t extraKeyState) { - auto appendId = [&](char *&ptr) { - const auto idstr = decOfInt(ctx.e.id); - ASSERT(ptr <= ctx.bufferEnd - idstr.size()); - std::copy(idstr.data(), idstr.data() + idstr.size(), ptr); - ptr += idstr.size(); - }; - ASSERT(p <= ctx.bufferEnd - 2); - *p++ = '\x1b'; - *p++ = ctx.e.prefix; - if (ctx.e.modifiers & kBare) { - char *q = p; - if (is_numeric) { - appendId(q); - expandNumericEncodingSuffix(ctx, q, extraKeyState); - } else { - ASSERT(q <= ctx.bufferEnd - 1); - *q++ = ctx.e.id; - setEncoding(ctx, q, extraKeyState); - } - } - if (ctx.e.modifiers & kBareMod) { - ASSERT(!is_numeric && "kBareMod is invalid with numeric sequences"); - for (int mod = 2; mod <= 8; ++mod) { - char *q = p; - ASSERT(q <= ctx.bufferEnd - 2); - *q++ = '0' + mod; - *q++ = ctx.e.id; - setEncoding(ctx, q, extraKeyState | keyStateForMod(mod)); - } - } - if (ctx.e.modifiers & kSemiMod) { - for (int mod = 2; mod <= 8; ++mod) { - char *q = p; - if (is_numeric) { - appendId(q); - ASSERT(q <= ctx.bufferEnd - 2); - *q++ = ';'; - *q++ = '0' + mod; - expandNumericEncodingSuffix( - ctx, q, extraKeyState | keyStateForMod(mod)); - } else { - ASSERT(q <= ctx.bufferEnd - 4); - *q++ = '1'; - *q++ = ';'; - *q++ = '0' + mod; - *q++ = ctx.e.id; - setEncoding(ctx, q, extraKeyState | keyStateForMod(mod)); - } - } - } -} - -template -static inline void expandEncoding(const ExpandContext &ctx) { - if (ctx.e.alt_prefix_allowed) { - // For better or for worse, this code expands all of: - // * ESC [ -- - // * ESC ESC [ -- Alt- - // * ESC [ 1 ; 3 -- Alt- - // * ESC ESC [ 1 ; 3 -- Alt- specified twice - // I suspect no terminal actually emits the last one (i.e. specifying - // the Alt modifier using both methods), but I have seen a terminal - // that emitted a prefix ESC for Alt and a non-Alt modifier. - char *p = ctx.buffer; - ASSERT(p <= ctx.bufferEnd - 1); - *p++ = '\x1b'; - expandEncodingAfterAltPrefix(ctx, p, LEFT_ALT_PRESSED); - } - expandEncodingAfterAltPrefix(ctx, ctx.buffer, 0); -} - -template -static void addEscapes(InputMap &inputMap, const EscapeEncoding (&encodings)[N]) { - char buffer[32]; - for (size_t i = 0; i < DIM(encodings); ++i) { - ExpandContext ctx = { - inputMap, encodings[i], - buffer, buffer + sizeof(buffer) - }; - expandEncoding(ctx); - } -} - -} // anonymous namespace - -void addDefaultEntriesToInputMap(InputMap &inputMap) { - addEscapes(inputMap, escapeLetterEncodings); - addEscapes(inputMap, escapeNumericEncodings); - addSimpleEntries(inputMap); -} diff --git a/node_modules/node-pty/deps/winpty/src/agent/DefaultInputMap.h b/node_modules/node-pty/deps/winpty/src/agent/DefaultInputMap.h deleted file mode 100644 index c4b9083..0000000 --- a/node_modules/node-pty/deps/winpty/src/agent/DefaultInputMap.h +++ /dev/null @@ -1,28 +0,0 @@ -// Copyright (c) 2015 Ryan Prichard -// -// 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. - -#ifndef DEFAULT_INPUT_MAP_H -#define DEFAULT_INPUT_MAP_H - -class InputMap; - -void addDefaultEntriesToInputMap(InputMap &inputMap); - -#endif // DEFAULT_INPUT_MAP_H diff --git a/node_modules/node-pty/deps/winpty/src/agent/DsrSender.h b/node_modules/node-pty/deps/winpty/src/agent/DsrSender.h deleted file mode 100644 index 1ec0a97..0000000 --- a/node_modules/node-pty/deps/winpty/src/agent/DsrSender.h +++ /dev/null @@ -1,30 +0,0 @@ -// Copyright (c) 2011-2012 Ryan Prichard -// -// 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. - -#ifndef DSRSENDER_H -#define DSRSENDER_H - -class DsrSender -{ -public: - virtual void sendDsr() = 0; -}; - -#endif // DSRSENDER_H diff --git a/node_modules/node-pty/deps/winpty/src/agent/EventLoop.cc b/node_modules/node-pty/deps/winpty/src/agent/EventLoop.cc deleted file mode 100644 index ba5cf18..0000000 --- a/node_modules/node-pty/deps/winpty/src/agent/EventLoop.cc +++ /dev/null @@ -1,99 +0,0 @@ -// Copyright (c) 2011-2012 Ryan Prichard -// -// 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. - -#include "EventLoop.h" - -#include - -#include "NamedPipe.h" -#include "../shared/DebugClient.h" -#include "../shared/WinptyAssert.h" - -EventLoop::~EventLoop() { - for (NamedPipe *pipe : m_pipes) { - delete pipe; - } - m_pipes.clear(); -} - -// Enter the event loop. Runs until the I/O or timeout handler calls exit(). -void EventLoop::run() -{ - std::vector waitHandles; - DWORD lastTime = GetTickCount(); - while (!m_exiting) { - bool didSomething = false; - - // Attempt to make progress with the pipes. - waitHandles.clear(); - for (size_t i = 0; i < m_pipes.size(); ++i) { - if (m_pipes[i]->serviceIo(&waitHandles)) { - onPipeIo(*m_pipes[i]); - didSomething = true; - } - } - - // Call the timeout if enough time has elapsed. - if (m_pollInterval > 0) { - int elapsed = GetTickCount() - lastTime; - if (elapsed >= m_pollInterval) { - onPollTimeout(); - lastTime = GetTickCount(); - didSomething = true; - } - } - - if (didSomething) - continue; - - // If there's nothing to do, wait. - DWORD timeout = INFINITE; - if (m_pollInterval > 0) - timeout = std::max(0, (int)(lastTime + m_pollInterval - GetTickCount())); - if (waitHandles.size() == 0) { - ASSERT(timeout != INFINITE); - if (timeout > 0) - Sleep(timeout); - } else { - DWORD result = WaitForMultipleObjects(waitHandles.size(), - waitHandles.data(), - FALSE, - timeout); - ASSERT(result != WAIT_FAILED); - } - } -} - -NamedPipe &EventLoop::createNamedPipe() -{ - NamedPipe *ret = new NamedPipe(); - m_pipes.push_back(ret); - return *ret; -} - -void EventLoop::setPollInterval(int ms) -{ - m_pollInterval = ms; -} - -void EventLoop::shutdown() -{ - m_exiting = true; -} diff --git a/node_modules/node-pty/deps/winpty/src/agent/EventLoop.h b/node_modules/node-pty/deps/winpty/src/agent/EventLoop.h deleted file mode 100644 index eddb0f6..0000000 --- a/node_modules/node-pty/deps/winpty/src/agent/EventLoop.h +++ /dev/null @@ -1,47 +0,0 @@ -// Copyright (c) 2011-2012 Ryan Prichard -// -// 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. - -#ifndef EVENTLOOP_H -#define EVENTLOOP_H - -#include - -class NamedPipe; - -class EventLoop -{ -public: - virtual ~EventLoop(); - void run(); - -protected: - NamedPipe &createNamedPipe(); - void setPollInterval(int ms); - void shutdown(); - virtual void onPollTimeout() {} - virtual void onPipeIo(NamedPipe &namedPipe) {} - -private: - bool m_exiting = false; - std::vector m_pipes; - int m_pollInterval = 0; -}; - -#endif // EVENTLOOP_H diff --git a/node_modules/node-pty/deps/winpty/src/agent/InputMap.cc b/node_modules/node-pty/deps/winpty/src/agent/InputMap.cc deleted file mode 100644 index b1fbfc2..0000000 --- a/node_modules/node-pty/deps/winpty/src/agent/InputMap.cc +++ /dev/null @@ -1,246 +0,0 @@ -// Copyright (c) 2011-2015 Ryan Prichard -// -// 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. - -#include "InputMap.h" - -#include -#include -#include -#include - -#include "DebugShowInput.h" -#include "SimplePool.h" -#include "../shared/DebugClient.h" -#include "../shared/UnixCtrlChars.h" -#include "../shared/WinptyAssert.h" -#include "../shared/winpty_snprintf.h" - -namespace { - -static const char *getVirtualKeyString(int virtualKey) -{ - switch (virtualKey) { -#define WINPTY_GVKS_KEY(x) case VK_##x: return #x; - WINPTY_GVKS_KEY(RBUTTON) WINPTY_GVKS_KEY(F9) - WINPTY_GVKS_KEY(CANCEL) WINPTY_GVKS_KEY(F10) - WINPTY_GVKS_KEY(MBUTTON) WINPTY_GVKS_KEY(F11) - WINPTY_GVKS_KEY(XBUTTON1) WINPTY_GVKS_KEY(F12) - WINPTY_GVKS_KEY(XBUTTON2) WINPTY_GVKS_KEY(F13) - WINPTY_GVKS_KEY(BACK) WINPTY_GVKS_KEY(F14) - WINPTY_GVKS_KEY(TAB) WINPTY_GVKS_KEY(F15) - WINPTY_GVKS_KEY(CLEAR) WINPTY_GVKS_KEY(F16) - WINPTY_GVKS_KEY(RETURN) WINPTY_GVKS_KEY(F17) - WINPTY_GVKS_KEY(SHIFT) WINPTY_GVKS_KEY(F18) - WINPTY_GVKS_KEY(CONTROL) WINPTY_GVKS_KEY(F19) - WINPTY_GVKS_KEY(MENU) WINPTY_GVKS_KEY(F20) - WINPTY_GVKS_KEY(PAUSE) WINPTY_GVKS_KEY(F21) - WINPTY_GVKS_KEY(CAPITAL) WINPTY_GVKS_KEY(F22) - WINPTY_GVKS_KEY(HANGUL) WINPTY_GVKS_KEY(F23) - WINPTY_GVKS_KEY(JUNJA) WINPTY_GVKS_KEY(F24) - WINPTY_GVKS_KEY(FINAL) WINPTY_GVKS_KEY(NUMLOCK) - WINPTY_GVKS_KEY(KANJI) WINPTY_GVKS_KEY(SCROLL) - WINPTY_GVKS_KEY(ESCAPE) WINPTY_GVKS_KEY(LSHIFT) - WINPTY_GVKS_KEY(CONVERT) WINPTY_GVKS_KEY(RSHIFT) - WINPTY_GVKS_KEY(NONCONVERT) WINPTY_GVKS_KEY(LCONTROL) - WINPTY_GVKS_KEY(ACCEPT) WINPTY_GVKS_KEY(RCONTROL) - WINPTY_GVKS_KEY(MODECHANGE) WINPTY_GVKS_KEY(LMENU) - WINPTY_GVKS_KEY(SPACE) WINPTY_GVKS_KEY(RMENU) - WINPTY_GVKS_KEY(PRIOR) WINPTY_GVKS_KEY(BROWSER_BACK) - WINPTY_GVKS_KEY(NEXT) WINPTY_GVKS_KEY(BROWSER_FORWARD) - WINPTY_GVKS_KEY(END) WINPTY_GVKS_KEY(BROWSER_REFRESH) - WINPTY_GVKS_KEY(HOME) WINPTY_GVKS_KEY(BROWSER_STOP) - WINPTY_GVKS_KEY(LEFT) WINPTY_GVKS_KEY(BROWSER_SEARCH) - WINPTY_GVKS_KEY(UP) WINPTY_GVKS_KEY(BROWSER_FAVORITES) - WINPTY_GVKS_KEY(RIGHT) WINPTY_GVKS_KEY(BROWSER_HOME) - WINPTY_GVKS_KEY(DOWN) WINPTY_GVKS_KEY(VOLUME_MUTE) - WINPTY_GVKS_KEY(SELECT) WINPTY_GVKS_KEY(VOLUME_DOWN) - WINPTY_GVKS_KEY(PRINT) WINPTY_GVKS_KEY(VOLUME_UP) - WINPTY_GVKS_KEY(EXECUTE) WINPTY_GVKS_KEY(MEDIA_NEXT_TRACK) - WINPTY_GVKS_KEY(SNAPSHOT) WINPTY_GVKS_KEY(MEDIA_PREV_TRACK) - WINPTY_GVKS_KEY(INSERT) WINPTY_GVKS_KEY(MEDIA_STOP) - WINPTY_GVKS_KEY(DELETE) WINPTY_GVKS_KEY(MEDIA_PLAY_PAUSE) - WINPTY_GVKS_KEY(HELP) WINPTY_GVKS_KEY(LAUNCH_MAIL) - WINPTY_GVKS_KEY(LWIN) WINPTY_GVKS_KEY(LAUNCH_MEDIA_SELECT) - WINPTY_GVKS_KEY(RWIN) WINPTY_GVKS_KEY(LAUNCH_APP1) - WINPTY_GVKS_KEY(APPS) WINPTY_GVKS_KEY(LAUNCH_APP2) - WINPTY_GVKS_KEY(SLEEP) WINPTY_GVKS_KEY(OEM_1) - WINPTY_GVKS_KEY(NUMPAD0) WINPTY_GVKS_KEY(OEM_PLUS) - WINPTY_GVKS_KEY(NUMPAD1) WINPTY_GVKS_KEY(OEM_COMMA) - WINPTY_GVKS_KEY(NUMPAD2) WINPTY_GVKS_KEY(OEM_MINUS) - WINPTY_GVKS_KEY(NUMPAD3) WINPTY_GVKS_KEY(OEM_PERIOD) - WINPTY_GVKS_KEY(NUMPAD4) WINPTY_GVKS_KEY(OEM_2) - WINPTY_GVKS_KEY(NUMPAD5) WINPTY_GVKS_KEY(OEM_3) - WINPTY_GVKS_KEY(NUMPAD6) WINPTY_GVKS_KEY(OEM_4) - WINPTY_GVKS_KEY(NUMPAD7) WINPTY_GVKS_KEY(OEM_5) - WINPTY_GVKS_KEY(NUMPAD8) WINPTY_GVKS_KEY(OEM_6) - WINPTY_GVKS_KEY(NUMPAD9) WINPTY_GVKS_KEY(OEM_7) - WINPTY_GVKS_KEY(MULTIPLY) WINPTY_GVKS_KEY(OEM_8) - WINPTY_GVKS_KEY(ADD) WINPTY_GVKS_KEY(OEM_102) - WINPTY_GVKS_KEY(SEPARATOR) WINPTY_GVKS_KEY(PROCESSKEY) - WINPTY_GVKS_KEY(SUBTRACT) WINPTY_GVKS_KEY(PACKET) - WINPTY_GVKS_KEY(DECIMAL) WINPTY_GVKS_KEY(ATTN) - WINPTY_GVKS_KEY(DIVIDE) WINPTY_GVKS_KEY(CRSEL) - WINPTY_GVKS_KEY(F1) WINPTY_GVKS_KEY(EXSEL) - WINPTY_GVKS_KEY(F2) WINPTY_GVKS_KEY(EREOF) - WINPTY_GVKS_KEY(F3) WINPTY_GVKS_KEY(PLAY) - WINPTY_GVKS_KEY(F4) WINPTY_GVKS_KEY(ZOOM) - WINPTY_GVKS_KEY(F5) WINPTY_GVKS_KEY(NONAME) - WINPTY_GVKS_KEY(F6) WINPTY_GVKS_KEY(PA1) - WINPTY_GVKS_KEY(F7) WINPTY_GVKS_KEY(OEM_CLEAR) - WINPTY_GVKS_KEY(F8) -#undef WINPTY_GVKS_KEY - default: return NULL; - } -} - -} // anonymous namespace - -std::string InputMap::Key::toString() const { - std::string ret; - ret += controlKeyStatePrefix(keyState); - char buf[256]; - const char *vkString = getVirtualKeyString(virtualKey); - if (vkString != NULL) { - ret += vkString; - } else if ((virtualKey >= 'A' && virtualKey <= 'Z') || - (virtualKey >= '0' && virtualKey <= '9')) { - ret += static_cast(virtualKey); - } else { - winpty_snprintf(buf, "%#x", virtualKey); - ret += buf; - } - if (unicodeChar >= 32 && unicodeChar <= 126) { - winpty_snprintf(buf, " ch='%c'", - static_cast(unicodeChar)); - } else { - winpty_snprintf(buf, " ch=%#x", - static_cast(unicodeChar)); - } - ret += buf; - return ret; -} - -void InputMap::set(const char *encoding, int encodingLen, const Key &key) { - ASSERT(encodingLen > 0); - setHelper(m_root, encoding, encodingLen, key); -} - -void InputMap::setHelper(Node &node, const char *encoding, int encodingLen, const Key &key) { - if (encodingLen == 0) { - node.key = key; - } else { - setHelper(getOrCreateChild(node, encoding[0]), encoding + 1, encodingLen - 1, key); - } -} - -InputMap::Node &InputMap::getOrCreateChild(Node &node, unsigned char ch) { - Node *ret = getChild(node, ch); - if (ret != NULL) { - return *ret; - } - if (node.childCount < Node::kTinyCount) { - // Maintain sorted order for the sake of the InputMap dumping. - int insertIndex = node.childCount; - for (int i = 0; i < node.childCount; ++i) { - if (ch < node.u.tiny.values[i]) { - insertIndex = i; - break; - } - } - for (int j = node.childCount; j > insertIndex; --j) { - node.u.tiny.values[j] = node.u.tiny.values[j - 1]; - node.u.tiny.children[j] = node.u.tiny.children[j - 1]; - } - node.u.tiny.values[insertIndex] = ch; - node.u.tiny.children[insertIndex] = ret = m_nodePool.alloc(); - ++node.childCount; - return *ret; - } - if (node.childCount == Node::kTinyCount) { - Branch *branch = m_branchPool.alloc(); - for (int i = 0; i < node.childCount; ++i) { - branch->children[node.u.tiny.values[i]] = node.u.tiny.children[i]; - } - node.u.branch = branch; - } - node.u.branch->children[ch] = ret = m_nodePool.alloc(); - ++node.childCount; - return *ret; -} - -// Find the longest matching key and node. -int InputMap::lookupKey(const char *input, int inputSize, - Key &keyOut, bool &incompleteOut) const { - keyOut = kKeyZero; - incompleteOut = false; - - const Node *node = &m_root; - InputMap::Key longestMatch = kKeyZero; - int longestMatchLen = 0; - - for (int i = 0; i < inputSize; ++i) { - unsigned char ch = input[i]; - node = getChild(*node, ch); - if (node == NULL) { - keyOut = longestMatch; - return longestMatchLen; - } else if (node->hasKey()) { - longestMatchLen = i + 1; - longestMatch = node->key; - } - } - keyOut = longestMatch; - incompleteOut = node->childCount > 0; - return longestMatchLen; -} - -void InputMap::dumpInputMap() const { - std::string encoding; - dumpInputMapHelper(m_root, encoding); -} - -void InputMap::dumpInputMapHelper( - const Node &node, std::string &encoding) const { - if (node.hasKey()) { - trace("%s -> %s", - encoding.c_str(), - node.key.toString().c_str()); - } - for (int i = 0; i < 256; ++i) { - const Node *child = getChild(node, i); - if (child != NULL) { - size_t oldSize = encoding.size(); - if (!encoding.empty()) { - encoding.push_back(' '); - } - char ctrlChar = decodeUnixCtrlChar(i); - if (ctrlChar != '\0') { - encoding.push_back('^'); - encoding.push_back(static_cast(ctrlChar)); - } else if (i == ' ') { - encoding.append("' '"); - } else { - encoding.push_back(static_cast(i)); - } - dumpInputMapHelper(*child, encoding); - encoding.resize(oldSize); - } - } -} diff --git a/node_modules/node-pty/deps/winpty/src/agent/InputMap.h b/node_modules/node-pty/deps/winpty/src/agent/InputMap.h deleted file mode 100644 index 9a666c7..0000000 --- a/node_modules/node-pty/deps/winpty/src/agent/InputMap.h +++ /dev/null @@ -1,114 +0,0 @@ -// Copyright (c) 2011-2015 Ryan Prichard -// -// 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. - -#ifndef INPUT_MAP_H -#define INPUT_MAP_H - -#include -#include -#include - -#include - -#include "SimplePool.h" -#include "../shared/WinptyAssert.h" - -class InputMap { -public: - struct Key { - uint16_t virtualKey; - uint32_t unicodeChar; - uint16_t keyState; - - std::string toString() const; - }; - -private: - struct Node; - - struct Branch { - Branch() { - memset(&children, 0, sizeof(children)); - } - - Node *children[256]; - }; - - struct Node { - Node() : childCount(0) { - Key zeroKey = { 0, 0, 0 }; - key = zeroKey; - } - - Key key; - int childCount; - enum { kTinyCount = 8 }; - union { - Branch *branch; - struct { - unsigned char values[kTinyCount]; - Node *children[kTinyCount]; - } tiny; - } u; - - bool hasKey() const { - return key.virtualKey != 0 || key.unicodeChar != 0; - } - }; - -private: - SimplePool m_nodePool; - SimplePool m_branchPool; - Node m_root; - -public: - void set(const char *encoding, int encodingLen, const Key &key); - int lookupKey(const char *input, int inputSize, - Key &keyOut, bool &incompleteOut) const; - void dumpInputMap() const; - -private: - Node *getChild(Node &node, unsigned char ch) { - return const_cast(getChild(static_cast(node), ch)); - } - - const Node *getChild(const Node &node, unsigned char ch) const { - if (node.childCount <= Node::kTinyCount) { - for (int i = 0; i < node.childCount; ++i) { - if (node.u.tiny.values[i] == ch) { - return node.u.tiny.children[i]; - } - } - return NULL; - } else { - return node.u.branch->children[ch]; - } - } - - void setHelper(Node &node, const char *encoding, int encodingLen, const Key &key); - Node &getOrCreateChild(Node &node, unsigned char ch); - void dumpInputMapHelper(const Node &node, std::string &encoding) const; -}; - -const InputMap::Key kKeyZero = { 0, 0, 0 }; - -void dumpInputMap(InputMap &inputMap); - -#endif // INPUT_MAP_H diff --git a/node_modules/node-pty/deps/winpty/src/agent/LargeConsoleRead.cc b/node_modules/node-pty/deps/winpty/src/agent/LargeConsoleRead.cc deleted file mode 100644 index 80ac640..0000000 --- a/node_modules/node-pty/deps/winpty/src/agent/LargeConsoleRead.cc +++ /dev/null @@ -1,71 +0,0 @@ -// Copyright (c) 2015 Ryan Prichard -// -// 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. - -#include "LargeConsoleRead.h" - -#include - -#include "../shared/WindowsVersion.h" -#include "Scraper.h" -#include "Win32ConsoleBuffer.h" - -LargeConsoleReadBuffer::LargeConsoleReadBuffer() : - m_rect(0, 0, 0, 0), m_rectWidth(0) -{ -} - -void largeConsoleRead(LargeConsoleReadBuffer &out, - Win32ConsoleBuffer &buffer, - const SmallRect &readArea, - WORD attributesMask) { - ASSERT(readArea.Left >= 0 && - readArea.Top >= 0 && - readArea.Right >= readArea.Left && - readArea.Bottom >= readArea.Top && - readArea.width() <= MAX_CONSOLE_WIDTH); - const size_t count = readArea.width() * readArea.height(); - if (out.m_data.size() < count) { - out.m_data.resize(count); - } - out.m_rect = readArea; - out.m_rectWidth = readArea.width(); - - static const bool useLargeReads = isAtLeastWindows8(); - if (useLargeReads) { - buffer.read(readArea, out.m_data.data()); - } else { - const int maxReadLines = std::max(1, MAX_CONSOLE_WIDTH / readArea.width()); - int curLine = readArea.Top; - while (curLine <= readArea.Bottom) { - const SmallRect subReadArea( - readArea.Left, - curLine, - readArea.width(), - std::min(maxReadLines, readArea.Bottom + 1 - curLine)); - buffer.read(subReadArea, out.lineDataMut(curLine)); - curLine = subReadArea.Bottom + 1; - } - } - if (attributesMask != static_cast(~0)) { - for (size_t i = 0; i < count; ++i) { - out.m_data[i].Attributes &= attributesMask; - } - } -} diff --git a/node_modules/node-pty/deps/winpty/src/agent/LargeConsoleRead.h b/node_modules/node-pty/deps/winpty/src/agent/LargeConsoleRead.h deleted file mode 100644 index 1bcf2c0..0000000 --- a/node_modules/node-pty/deps/winpty/src/agent/LargeConsoleRead.h +++ /dev/null @@ -1,68 +0,0 @@ -// Copyright (c) 2015 Ryan Prichard -// -// 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. - -#ifndef LARGE_CONSOLE_READ_H -#define LARGE_CONSOLE_READ_H - -#include -#include - -#include - -#include "SmallRect.h" -#include "../shared/DebugClient.h" -#include "../shared/WinptyAssert.h" - -class Win32ConsoleBuffer; - -class LargeConsoleReadBuffer { -public: - LargeConsoleReadBuffer(); - const SmallRect &rect() const { return m_rect; } - const CHAR_INFO *lineData(int line) const { - validateLineNumber(line); - return &m_data[(line - m_rect.Top) * m_rectWidth]; - } - -private: - CHAR_INFO *lineDataMut(int line) { - validateLineNumber(line); - return &m_data[(line - m_rect.Top) * m_rectWidth]; - } - - void validateLineNumber(int line) const { - if (line < m_rect.Top || line > m_rect.Bottom) { - trace("Fatal error: LargeConsoleReadBuffer: invalid line %d for " - "read rect %s", line, m_rect.toString().c_str()); - abort(); - } - } - - SmallRect m_rect; - int m_rectWidth; - std::vector m_data; - - friend void largeConsoleRead(LargeConsoleReadBuffer &out, - Win32ConsoleBuffer &buffer, - const SmallRect &readArea, - WORD attributesMask); -}; - -#endif // LARGE_CONSOLE_READ_H diff --git a/node_modules/node-pty/deps/winpty/src/agent/NamedPipe.cc b/node_modules/node-pty/deps/winpty/src/agent/NamedPipe.cc deleted file mode 100644 index 64044e6..0000000 --- a/node_modules/node-pty/deps/winpty/src/agent/NamedPipe.cc +++ /dev/null @@ -1,378 +0,0 @@ -// Copyright (c) 2011-2012 Ryan Prichard -// -// 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. - -#include - -#include - -#include "EventLoop.h" -#include "NamedPipe.h" -#include "../shared/DebugClient.h" -#include "../shared/StringUtil.h" -#include "../shared/WindowsSecurity.h" -#include "../shared/WinptyAssert.h" - -// Returns true if anything happens (data received, data sent, pipe error). -bool NamedPipe::serviceIo(std::vector *waitHandles) -{ - bool justConnected = false; - const auto kError = ServiceResult::Error; - const auto kProgress = ServiceResult::Progress; - const auto kNoProgress = ServiceResult::NoProgress; - if (m_handle == NULL) { - return false; - } - if (m_connectEvent.get() != nullptr) { - // We're still connecting this server pipe. Check whether the pipe is - // now connected. If it isn't, add the pipe to the list of handles to - // wait on. - DWORD actual = 0; - BOOL success = - GetOverlappedResult(m_handle, &m_connectOver, &actual, FALSE); - if (!success && GetLastError() == ERROR_PIPE_CONNECTED) { - // I'm not sure this can happen, but it's easy to handle if it - // does. - success = TRUE; - } - if (!success) { - ASSERT(GetLastError() == ERROR_IO_INCOMPLETE && - "Pended ConnectNamedPipe call failed"); - waitHandles->push_back(m_connectEvent.get()); - } else { - TRACE("Server pipe [%s] connected", - utf8FromWide(m_name).c_str()); - m_connectEvent.dispose(); - startPipeWorkers(); - justConnected = true; - } - } - const auto readProgress = m_inputWorker ? m_inputWorker->service() : kNoProgress; - const auto writeProgress = m_outputWorker ? m_outputWorker->service() : kNoProgress; - if (readProgress == kError || writeProgress == kError) { - closePipe(); - return true; - } - if (m_inputWorker && m_inputWorker->getWaitEvent() != nullptr) { - waitHandles->push_back(m_inputWorker->getWaitEvent()); - } - if (m_outputWorker && m_outputWorker->getWaitEvent() != nullptr) { - waitHandles->push_back(m_outputWorker->getWaitEvent()); - } - return justConnected - || readProgress == kProgress - || writeProgress == kProgress; -} - -// manual reset, initially unset -static OwnedHandle createEvent() { - HANDLE ret = CreateEventW(nullptr, TRUE, FALSE, nullptr); - ASSERT(ret != nullptr && "CreateEventW failed"); - return OwnedHandle(ret); -} - -NamedPipe::IoWorker::IoWorker(NamedPipe &namedPipe) : - m_namedPipe(namedPipe), - m_event(createEvent()) -{ -} - -NamedPipe::ServiceResult NamedPipe::IoWorker::service() -{ - ServiceResult progress = ServiceResult::NoProgress; - if (m_pending) { - DWORD actual = 0; - BOOL ret = GetOverlappedResult(m_namedPipe.m_handle, &m_over, &actual, FALSE); - if (!ret) { - if (GetLastError() == ERROR_IO_INCOMPLETE) { - // There is a pending I/O. - return progress; - } else { - // Pipe error. - return ServiceResult::Error; - } - } - ResetEvent(m_event.get()); - m_pending = false; - completeIo(actual); - m_currentIoSize = 0; - progress = ServiceResult::Progress; - } - DWORD nextSize = 0; - bool isRead = false; - while (shouldIssueIo(&nextSize, &isRead)) { - m_currentIoSize = nextSize; - DWORD actual = 0; - memset(&m_over, 0, sizeof(m_over)); - m_over.hEvent = m_event.get(); - BOOL ret = isRead - ? ReadFile(m_namedPipe.m_handle, m_buffer, nextSize, &actual, &m_over) - : WriteFile(m_namedPipe.m_handle, m_buffer, nextSize, &actual, &m_over); - if (!ret) { - if (GetLastError() == ERROR_IO_PENDING) { - // There is a pending I/O. - m_pending = true; - return progress; - } else { - // Pipe error. - return ServiceResult::Error; - } - } - ResetEvent(m_event.get()); - completeIo(actual); - m_currentIoSize = 0; - progress = ServiceResult::Progress; - } - return progress; -} - -// This function is called after CancelIo has returned. We need to block until -// the I/O operations have completed, which should happen very quickly. -// https://blogs.msdn.microsoft.com/oldnewthing/20110202-00/?p=11613 -void NamedPipe::IoWorker::waitForCanceledIo() -{ - if (m_pending) { - DWORD actual = 0; - GetOverlappedResult(m_namedPipe.m_handle, &m_over, &actual, TRUE); - m_pending = false; - } -} - -HANDLE NamedPipe::IoWorker::getWaitEvent() -{ - return m_pending ? m_event.get() : NULL; -} - -void NamedPipe::InputWorker::completeIo(DWORD size) -{ - m_namedPipe.m_inQueue.append(m_buffer, size); -} - -bool NamedPipe::InputWorker::shouldIssueIo(DWORD *size, bool *isRead) -{ - *isRead = true; - ASSERT(!m_namedPipe.isConnecting()); - if (m_namedPipe.isClosed()) { - return false; - } else if (m_namedPipe.m_inQueue.size() < m_namedPipe.readBufferSize()) { - *size = kIoSize; - return true; - } else { - return false; - } -} - -void NamedPipe::OutputWorker::completeIo(DWORD size) -{ - ASSERT(size == m_currentIoSize); -} - -bool NamedPipe::OutputWorker::shouldIssueIo(DWORD *size, bool *isRead) -{ - *isRead = false; - if (!m_namedPipe.m_outQueue.empty()) { - auto &out = m_namedPipe.m_outQueue; - const DWORD writeSize = std::min(out.size(), kIoSize); - std::copy(&out[0], &out[writeSize], m_buffer); - out.erase(0, writeSize); - *size = writeSize; - return true; - } else { - return false; - } -} - -DWORD NamedPipe::OutputWorker::getPendingIoSize() -{ - return m_pending ? m_currentIoSize : 0; -} - -void NamedPipe::openServerPipe(LPCWSTR pipeName, OpenMode::t openMode, - int outBufferSize, int inBufferSize) { - ASSERT(isClosed()); - ASSERT((openMode & OpenMode::Duplex) != 0); - const DWORD winOpenMode = - ((openMode & OpenMode::Reading) ? PIPE_ACCESS_INBOUND : 0) - | ((openMode & OpenMode::Writing) ? PIPE_ACCESS_OUTBOUND : 0) - | FILE_FLAG_FIRST_PIPE_INSTANCE - | FILE_FLAG_OVERLAPPED; - const auto sd = createPipeSecurityDescriptorOwnerFullControl(); - ASSERT(sd && "error creating data pipe SECURITY_DESCRIPTOR"); - SECURITY_ATTRIBUTES sa = {}; - sa.nLength = sizeof(sa); - sa.lpSecurityDescriptor = sd.get(); - HANDLE handle = CreateNamedPipeW( - pipeName, - /*dwOpenMode=*/winOpenMode, - /*dwPipeMode=*/rejectRemoteClientsPipeFlag(), - /*nMaxInstances=*/1, - /*nOutBufferSize=*/outBufferSize, - /*nInBufferSize=*/inBufferSize, - /*nDefaultTimeOut=*/30000, - &sa); - TRACE("opened server pipe [%s], handle == %p", - utf8FromWide(pipeName).c_str(), handle); - ASSERT(handle != INVALID_HANDLE_VALUE && "Could not open server pipe"); - m_name = pipeName; - m_handle = handle; - m_openMode = openMode; - - // Start an asynchronous connection attempt. - m_connectEvent = createEvent(); - memset(&m_connectOver, 0, sizeof(m_connectOver)); - m_connectOver.hEvent = m_connectEvent.get(); - BOOL success = ConnectNamedPipe(m_handle, &m_connectOver); - const auto err = GetLastError(); - if (!success && err == ERROR_PIPE_CONNECTED) { - success = TRUE; - } - if (success) { - TRACE("Server pipe [%s] connected", utf8FromWide(pipeName).c_str()); - m_connectEvent.dispose(); - startPipeWorkers(); - } else if (err != ERROR_IO_PENDING) { - ASSERT(false && "ConnectNamedPipe call failed"); - } -} - -void NamedPipe::connectToServer(LPCWSTR pipeName, OpenMode::t openMode) -{ - ASSERT(isClosed()); - ASSERT((openMode & OpenMode::Duplex) != 0); - HANDLE handle = CreateFileW( - pipeName, - GENERIC_READ | GENERIC_WRITE, - 0, - NULL, - OPEN_EXISTING, - SECURITY_SQOS_PRESENT | SECURITY_IDENTIFICATION | FILE_FLAG_OVERLAPPED, - NULL); - TRACE("connected to [%s], handle == %p", - utf8FromWide(pipeName).c_str(), handle); - ASSERT(handle != INVALID_HANDLE_VALUE && "Could not connect to pipe"); - m_name = pipeName; - m_handle = handle; - m_openMode = openMode; - startPipeWorkers(); -} - -void NamedPipe::startPipeWorkers() -{ - if (m_openMode & OpenMode::Reading) { - m_inputWorker.reset(new InputWorker(*this)); - } - if (m_openMode & OpenMode::Writing) { - m_outputWorker.reset(new OutputWorker(*this)); - } -} - -size_t NamedPipe::bytesToSend() -{ - ASSERT(m_openMode & OpenMode::Writing); - auto ret = m_outQueue.size(); - if (m_outputWorker != NULL) { - ret += m_outputWorker->getPendingIoSize(); - } - return ret; -} - -void NamedPipe::write(const void *data, size_t size) -{ - ASSERT(m_openMode & OpenMode::Writing); - m_outQueue.append(reinterpret_cast(data), size); -} - -void NamedPipe::write(const char *text) -{ - write(text, strlen(text)); -} - -size_t NamedPipe::readBufferSize() -{ - ASSERT(m_openMode & OpenMode::Reading); - return m_readBufferSize; -} - -void NamedPipe::setReadBufferSize(size_t size) -{ - ASSERT(m_openMode & OpenMode::Reading); - m_readBufferSize = size; -} - -size_t NamedPipe::bytesAvailable() -{ - ASSERT(m_openMode & OpenMode::Reading); - return m_inQueue.size(); -} - -size_t NamedPipe::peek(void *data, size_t size) -{ - ASSERT(m_openMode & OpenMode::Reading); - const auto out = reinterpret_cast(data); - const size_t ret = std::min(size, m_inQueue.size()); - std::copy(&m_inQueue[0], &m_inQueue[ret], out); - return ret; -} - -size_t NamedPipe::read(void *data, size_t size) -{ - size_t ret = peek(data, size); - m_inQueue.erase(0, ret); - return ret; -} - -std::string NamedPipe::readToString(size_t size) -{ - ASSERT(m_openMode & OpenMode::Reading); - size_t retSize = std::min(size, m_inQueue.size()); - std::string ret = m_inQueue.substr(0, retSize); - m_inQueue.erase(0, retSize); - return ret; -} - -std::string NamedPipe::readAllToString() -{ - ASSERT(m_openMode & OpenMode::Reading); - std::string ret = m_inQueue; - m_inQueue.clear(); - return ret; -} - -void NamedPipe::closePipe() -{ - if (m_handle == NULL) { - return; - } - CancelIo(m_handle); - if (m_connectEvent.get() != nullptr) { - DWORD actual = 0; - GetOverlappedResult(m_handle, &m_connectOver, &actual, TRUE); - m_connectEvent.dispose(); - } - if (m_inputWorker) { - m_inputWorker->waitForCanceledIo(); - m_inputWorker.reset(); - } - if (m_outputWorker) { - m_outputWorker->waitForCanceledIo(); - m_outputWorker.reset(); - } - CloseHandle(m_handle); - m_handle = NULL; -} diff --git a/node_modules/node-pty/deps/winpty/src/agent/NamedPipe.h b/node_modules/node-pty/deps/winpty/src/agent/NamedPipe.h deleted file mode 100644 index 0a4d8b0..0000000 --- a/node_modules/node-pty/deps/winpty/src/agent/NamedPipe.h +++ /dev/null @@ -1,125 +0,0 @@ -// Copyright (c) 2011-2012 Ryan Prichard -// -// 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. - -#ifndef NAMEDPIPE_H -#define NAMEDPIPE_H - -#include - -#include -#include -#include - -#include "../shared/OwnedHandle.h" - -class EventLoop; - -class NamedPipe -{ -private: - // The EventLoop uses these private members. - friend class EventLoop; - NamedPipe() {} - ~NamedPipe() { closePipe(); } - bool serviceIo(std::vector *waitHandles); - void startPipeWorkers(); - - enum class ServiceResult { NoProgress, Error, Progress }; - -private: - class IoWorker - { - public: - IoWorker(NamedPipe &namedPipe); - virtual ~IoWorker() {} - ServiceResult service(); - void waitForCanceledIo(); - HANDLE getWaitEvent(); - protected: - NamedPipe &m_namedPipe; - bool m_pending = false; - DWORD m_currentIoSize = 0; - OwnedHandle m_event; - OVERLAPPED m_over = {}; - enum { kIoSize = 64 * 1024 }; - char m_buffer[kIoSize]; - virtual void completeIo(DWORD size) = 0; - virtual bool shouldIssueIo(DWORD *size, bool *isRead) = 0; - }; - - class InputWorker : public IoWorker - { - public: - InputWorker(NamedPipe &namedPipe) : IoWorker(namedPipe) {} - protected: - virtual void completeIo(DWORD size) override; - virtual bool shouldIssueIo(DWORD *size, bool *isRead) override; - }; - - class OutputWorker : public IoWorker - { - public: - OutputWorker(NamedPipe &namedPipe) : IoWorker(namedPipe) {} - DWORD getPendingIoSize(); - protected: - virtual void completeIo(DWORD size) override; - virtual bool shouldIssueIo(DWORD *size, bool *isRead) override; - }; - -public: - struct OpenMode { - typedef int t; - enum { None = 0, Reading = 1, Writing = 2, Duplex = 3 }; - }; - - std::wstring name() const { return m_name; } - void openServerPipe(LPCWSTR pipeName, OpenMode::t openMode, - int outBufferSize, int inBufferSize); - void connectToServer(LPCWSTR pipeName, OpenMode::t openMode); - size_t bytesToSend(); - void write(const void *data, size_t size); - void write(const char *text); - size_t readBufferSize(); - void setReadBufferSize(size_t size); - size_t bytesAvailable(); - size_t peek(void *data, size_t size); - size_t read(void *data, size_t size); - std::string readToString(size_t size); - std::string readAllToString(); - void closePipe(); - bool isClosed() { return m_handle == nullptr; } - bool isConnected() { return !isClosed() && !isConnecting(); } - bool isConnecting() { return m_connectEvent.get() != nullptr; } - -private: - // Input/output buffers - std::wstring m_name; - OVERLAPPED m_connectOver = {}; - OwnedHandle m_connectEvent; - OpenMode::t m_openMode = OpenMode::None; - size_t m_readBufferSize = 64 * 1024; - std::string m_inQueue; - std::string m_outQueue; - HANDLE m_handle = nullptr; - std::unique_ptr m_inputWorker; - std::unique_ptr m_outputWorker; -}; - -#endif // NAMEDPIPE_H diff --git a/node_modules/node-pty/deps/winpty/src/agent/Scraper.cc b/node_modules/node-pty/deps/winpty/src/agent/Scraper.cc deleted file mode 100644 index 21f9c67..0000000 --- a/node_modules/node-pty/deps/winpty/src/agent/Scraper.cc +++ /dev/null @@ -1,699 +0,0 @@ -// Copyright (c) 2011-2016 Ryan Prichard -// -// 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. - -#include "Scraper.h" - -#include - -#include - -#include -#include - -#include "../shared/WinptyAssert.h" -#include "../shared/winpty_snprintf.h" - -#include "ConsoleFont.h" -#include "Win32Console.h" -#include "Win32ConsoleBuffer.h" - -namespace { - -template -T constrained(T min, T val, T max) { - ASSERT(min <= max); - return std::min(std::max(min, val), max); -} - -} // anonymous namespace - -Scraper::Scraper( - Win32Console &console, - Win32ConsoleBuffer &buffer, - std::unique_ptr terminal, - Coord initialSize) : - m_console(console), - m_terminal(std::move(terminal)), - m_ptySize(initialSize) -{ - m_consoleBuffer = &buffer; - - resetConsoleTracking(Terminal::OmitClear, buffer.windowRect().top()); - - m_bufferData.resize(BUFFER_LINE_COUNT); - - // Setup the initial screen buffer and window size. - // - // Use SetConsoleWindowInfo to shrink the console window as much as - // possible -- to a 1x1 cell at the top-left. This call always succeeds. - // Prior to the new Windows 10 console, it also actually resizes the GUI - // window to 1x1 cell. Nevertheless, even though the GUI window can - // therefore be narrower than its minimum, calling - // SetConsoleScreenBufferSize with a 1x1 size still fails. - // - // While the small font intends to support large buffers, a user could - // still hit a limit imposed by their monitor width, so cap the new window - // size to GetLargestConsoleWindowSize(). - setSmallFont(buffer.conout(), initialSize.X, m_console.isNewW10()); - buffer.moveWindow(SmallRect(0, 0, 1, 1)); - buffer.resizeBufferRange(Coord(initialSize.X, BUFFER_LINE_COUNT)); - const auto largest = GetLargestConsoleWindowSize(buffer.conout()); - buffer.moveWindow(SmallRect( - 0, 0, - std::min(initialSize.X, largest.X), - std::min(initialSize.Y, largest.Y))); - buffer.setCursorPosition(Coord(0, 0)); - - // For the sake of the color translation heuristic, set the console color - // to LtGray-on-Black. - buffer.setTextAttribute(Win32ConsoleBuffer::kDefaultAttributes); - buffer.clearAllLines(m_consoleBuffer->bufferInfo()); - - m_consoleBuffer = nullptr; -} - -Scraper::~Scraper() -{ -} - -// Whether or not the agent is frozen on entry, it will be frozen on exit. -void Scraper::resizeWindow(Win32ConsoleBuffer &buffer, - Coord newSize, - ConsoleScreenBufferInfo &finalInfoOut) -{ - m_consoleBuffer = &buffer; - m_ptySize = newSize; - syncConsoleContentAndSize(true, finalInfoOut); - m_consoleBuffer = nullptr; -} - -// This function may freeze the agent, but it will not unfreeze it. -void Scraper::scrapeBuffer(Win32ConsoleBuffer &buffer, - ConsoleScreenBufferInfo &finalInfoOut) -{ - m_consoleBuffer = &buffer; - syncConsoleContentAndSize(false, finalInfoOut); - m_consoleBuffer = nullptr; -} - -void Scraper::resetConsoleTracking( - Terminal::SendClearFlag sendClear, int64_t scrapedLineCount) -{ - for (ConsoleLine &line : m_bufferData) { - line.reset(); - } - m_syncRow = -1; - m_scrapedLineCount = scrapedLineCount; - m_scrolledCount = 0; - m_maxBufferedLine = -1; - m_dirtyWindowTop = -1; - m_dirtyLineCount = 0; - m_terminal->reset(sendClear, m_scrapedLineCount); -} - -// Detect window movement. If the window moves down (presumably as a -// result of scrolling), then assume that all screen buffer lines down to -// the bottom of the window are dirty. -void Scraper::markEntireWindowDirty(const SmallRect &windowRect) -{ - m_dirtyLineCount = std::max(m_dirtyLineCount, - windowRect.top() + windowRect.height()); -} - -// Scan the screen buffer and advance the dirty line count when we find -// non-empty lines. -void Scraper::scanForDirtyLines(const SmallRect &windowRect) -{ - const int w = m_readBuffer.rect().width(); - ASSERT(m_dirtyLineCount >= 1); - const CHAR_INFO *const prevLine = - m_readBuffer.lineData(m_dirtyLineCount - 1); - WORD prevLineAttr = prevLine[w - 1].Attributes; - const int stopLine = windowRect.top() + windowRect.height(); - - for (int line = m_dirtyLineCount; line < stopLine; ++line) { - const CHAR_INFO *lineData = m_readBuffer.lineData(line); - for (int col = 0; col < w; ++col) { - const WORD colAttr = lineData[col].Attributes; - if (lineData[col].Char.UnicodeChar != L' ' || - colAttr != prevLineAttr) { - m_dirtyLineCount = line + 1; - break; - } - } - prevLineAttr = lineData[w - 1].Attributes; - } -} - -// Clear lines in the line buffer. The `firstRow` parameter is in -// screen-buffer coordinates. -void Scraper::clearBufferLines( - const int firstRow, - const int count) -{ - ASSERT(!m_directMode); - for (int row = firstRow; row < firstRow + count; ++row) { - const int64_t bufLine = row + m_scrolledCount; - m_maxBufferedLine = std::max(m_maxBufferedLine, bufLine); - m_bufferData[bufLine % BUFFER_LINE_COUNT].blank( - Win32ConsoleBuffer::kDefaultAttributes); - } -} - -static bool cursorInWindow(const ConsoleScreenBufferInfo &info) -{ - return info.dwCursorPosition.Y >= info.srWindow.Top && - info.dwCursorPosition.Y <= info.srWindow.Bottom; -} - -void Scraper::resizeImpl(const ConsoleScreenBufferInfo &origInfo) -{ - ASSERT(m_console.frozen()); - const int cols = m_ptySize.X; - const int rows = m_ptySize.Y; - Coord finalBufferSize; - - { - // - // To accommodate Windows 10, erase all lines up to the top of the - // visible window. It's hard to tell whether this is strictly - // necessary. It ensures that the sync marker won't move downward, - // and it ensures that we won't repeat lines that have already scrolled - // up into the scrollback. - // - // It *is* possible for these blank lines to reappear in the visible - // window (e.g. if the window is made taller), but because we blanked - // the lines in the line buffer, we still don't output them again. - // - const Coord origBufferSize = origInfo.bufferSize(); - const SmallRect origWindowRect = origInfo.windowRect(); - - if (m_directMode) { - for (ConsoleLine &line : m_bufferData) { - line.reset(); - } - } else { - m_consoleBuffer->clearLines(0, origWindowRect.Top, origInfo); - clearBufferLines(0, origWindowRect.Top); - if (m_syncRow != -1) { - createSyncMarker(std::min( - m_syncRow, - BUFFER_LINE_COUNT - rows - - SYNC_MARKER_LEN - - SYNC_MARKER_MARGIN)); - } - } - - finalBufferSize = Coord( - cols, - // If there was previously no scrollback (e.g. a full-screen app - // in direct mode) and we're reducing the window height, then - // reduce the console buffer's height too. - (origWindowRect.height() == origBufferSize.Y) - ? rows - : std::max(rows, origBufferSize.Y)); - - // Reset the console font size. We need to do this before shrinking - // the window, because we might need to make the font bigger to permit - // a smaller window width. Making the font smaller could expand the - // screen buffer, which would hang the conhost process in the - // Windows 10 (10240 build) if the console selection is in progress, so - // unfreeze it first. - m_console.setFrozen(false); - setSmallFont(m_consoleBuffer->conout(), cols, m_console.isNewW10()); - } - - // We try to make the font small enough so that the entire screen buffer - // fits on the monitor, but it can't be guaranteed. - const auto largest = - GetLargestConsoleWindowSize(m_consoleBuffer->conout()); - const short visibleCols = std::min(cols, largest.X); - const short visibleRows = std::min(rows, largest.Y); - - { - // Make the window small enough. We want the console frozen during - // this step so we don't accidentally move the window above the cursor. - m_console.setFrozen(true); - const auto info = m_consoleBuffer->bufferInfo(); - const auto &bufferSize = info.dwSize; - const int tmpWindowWidth = std::min(bufferSize.X, visibleCols); - const int tmpWindowHeight = std::min(bufferSize.Y, visibleRows); - SmallRect tmpWindowRect( - 0, - std::min(bufferSize.Y - tmpWindowHeight, - info.windowRect().Top), - tmpWindowWidth, - tmpWindowHeight); - if (cursorInWindow(info)) { - tmpWindowRect = tmpWindowRect.ensureLineIncluded( - info.cursorPosition().Y); - } - m_consoleBuffer->moveWindow(tmpWindowRect); - } - - { - // Resize the buffer to the final desired size. - m_console.setFrozen(false); - m_consoleBuffer->resizeBufferRange(finalBufferSize); - } - - { - // Expand the window to its full size. - m_console.setFrozen(true); - const ConsoleScreenBufferInfo info = m_consoleBuffer->bufferInfo(); - - SmallRect finalWindowRect( - 0, - std::min(info.bufferSize().Y - visibleRows, - info.windowRect().Top), - visibleCols, - visibleRows); - - // - // Once a line in the screen buffer is "dirty", it should stay visible - // in the console window, so that we continue to update its content in - // the terminal. This code is particularly (only?) necessary on - // Windows 10, where making the buffer wider can rewrap lines and move - // the console window upward. - // - if (!m_directMode && m_dirtyLineCount > finalWindowRect.Bottom + 1) { - // In theory, we avoid ensureLineIncluded, because, a massive - // amount of output could have occurred while the console was - // unfrozen, so that the *top* of the window is now below the - // dirtiest tracked line. - finalWindowRect = SmallRect( - 0, m_dirtyLineCount - visibleRows, - visibleCols, visibleRows); - } - - // Highest priority constraint: ensure that the cursor remains visible. - if (cursorInWindow(info)) { - finalWindowRect = finalWindowRect.ensureLineIncluded( - info.cursorPosition().Y); - } - - m_consoleBuffer->moveWindow(finalWindowRect); - m_dirtyWindowTop = finalWindowRect.Top; - } - - ASSERT(m_console.frozen()); -} - -void Scraper::syncConsoleContentAndSize( - bool forceResize, - ConsoleScreenBufferInfo &finalInfoOut) -{ - // We'll try to avoid freezing the console by reading large chunks (or - // all!) of the screen buffer without otherwise attempting to synchronize - // with the console application. We can only do this on Windows 10 and up - // because: - // - Prior to Windows 8, the size of a ReadConsoleOutputW call was limited - // by the ~32KB RPC buffer. - // - Prior to Windows 10, an out-of-range read region crashes the caller. - // (See misc/WindowsBugCrashReader.cc.) - // - if (!m_console.isNewW10() || forceResize) { - m_console.setFrozen(true); - } - - const ConsoleScreenBufferInfo info = m_consoleBuffer->bufferInfo(); - bool cursorVisible = true; - CONSOLE_CURSOR_INFO cursorInfo = {}; - if (!GetConsoleCursorInfo(GetStdHandle(STD_OUTPUT_HANDLE), &cursorInfo)) { - trace("GetConsoleCursorInfo failed"); - } else { - cursorVisible = cursorInfo.bVisible != 0; - } - - // If an app resizes the buffer height, then we enter "direct mode", where - // we stop trying to track incremental console changes. - const bool newDirectMode = (info.bufferSize().Y != BUFFER_LINE_COUNT); - if (newDirectMode != m_directMode) { - trace("Entering %s mode", newDirectMode ? "direct" : "scrolling"); - resetConsoleTracking(Terminal::SendClear, - newDirectMode ? 0 : info.windowRect().top()); - m_directMode = newDirectMode; - - // When we switch from direct->scrolling mode, make sure the console is - // the right size. - if (!m_directMode) { - m_console.setFrozen(true); - forceResize = true; - } - } - - if (m_directMode) { - // In direct-mode, resizing the console redraws the terminal, so do it - // before scraping. - if (forceResize) { - resizeImpl(info); - } - directScrapeOutput(info, cursorVisible); - } else { - if (!m_console.frozen()) { - if (!scrollingScrapeOutput(info, cursorVisible, true)) { - m_console.setFrozen(true); - } - } - if (m_console.frozen()) { - scrollingScrapeOutput(info, cursorVisible, false); - } - // In scrolling mode, we want to scrape before resizing, because we'll - // erase everything in the console buffer up to the top of the console - // window. - if (forceResize) { - resizeImpl(info); - } - } - - finalInfoOut = forceResize ? m_consoleBuffer->bufferInfo() : info; -} - -// Try to match Windows' behavior w.r.t. to the LVB attribute flags. In some -// situations, Windows ignores the LVB flags on a character cell because of -// backwards compatibility -- apparently some programs set the flags without -// intending to enable reverse-video or underscores. -// -// [rprichard 2017-01-15] I haven't actually noticed any old programs that need -// this treatment -- the motivation for this function comes from the MSDN -// documentation for SetConsoleMode and ENABLE_LVB_GRID_WORLDWIDE. -WORD Scraper::attributesMask() -{ - const auto WINPTY_ENABLE_VIRTUAL_TERMINAL_PROCESSING = 0x4u; - const auto WINPTY_ENABLE_LVB_GRID_WORLDWIDE = 0x10u; - const auto WINPTY_COMMON_LVB_REVERSE_VIDEO = 0x4000u; - const auto WINPTY_COMMON_LVB_UNDERSCORE = 0x8000u; - - const auto cp = GetConsoleOutputCP(); - const auto isCjk = (cp == 932 || cp == 936 || cp == 949 || cp == 950); - - const DWORD outputMode = [this]{ - ASSERT(this->m_consoleBuffer != nullptr); - DWORD mode = 0; - if (!GetConsoleMode(this->m_consoleBuffer->conout(), &mode)) { - mode = 0; - } - return mode; - }(); - const bool hasEnableLvbGridWorldwide = - (outputMode & WINPTY_ENABLE_LVB_GRID_WORLDWIDE) != 0; - const bool hasEnableVtProcessing = - (outputMode & WINPTY_ENABLE_VIRTUAL_TERMINAL_PROCESSING) != 0; - - // The new Windows 10 console (as of 14393) seems to respect - // COMMON_LVB_REVERSE_VIDEO even in CP437 w/o the other enabling modes, so - // try to match that behavior. - const auto isReverseSupported = - isCjk || hasEnableLvbGridWorldwide || hasEnableVtProcessing || m_console.isNewW10(); - const auto isUnderscoreSupported = - isCjk || hasEnableLvbGridWorldwide || hasEnableVtProcessing; - - WORD mask = ~0; - if (!isReverseSupported) { mask &= ~WINPTY_COMMON_LVB_REVERSE_VIDEO; } - if (!isUnderscoreSupported) { mask &= ~WINPTY_COMMON_LVB_UNDERSCORE; } - return mask; -} - -void Scraper::directScrapeOutput(const ConsoleScreenBufferInfo &info, - bool consoleCursorVisible) -{ - const SmallRect windowRect = info.windowRect(); - - const SmallRect scrapeRect( - windowRect.left(), windowRect.top(), - std::min(std::min(windowRect.width(), m_ptySize.X), - MAX_CONSOLE_WIDTH), - std::min(std::min(windowRect.height(), m_ptySize.Y), - BUFFER_LINE_COUNT)); - const int w = scrapeRect.width(); - const int h = scrapeRect.height(); - - const Coord cursor = info.cursorPosition(); - const bool showTerminalCursor = - consoleCursorVisible && scrapeRect.contains(cursor); - const int cursorColumn = !showTerminalCursor ? -1 : cursor.X - scrapeRect.Left; - const int cursorLine = !showTerminalCursor ? -1 : cursor.Y - scrapeRect.Top; - - if (!showTerminalCursor) { - m_terminal->hideTerminalCursor(); - } - - largeConsoleRead(m_readBuffer, *m_consoleBuffer, scrapeRect, attributesMask()); - - for (int line = 0; line < h; ++line) { - const CHAR_INFO *const curLine = - m_readBuffer.lineData(scrapeRect.top() + line); - ConsoleLine &bufLine = m_bufferData[line]; - if (bufLine.detectChangeAndSetLine(curLine, w)) { - const int lineCursorColumn = - line == cursorLine ? cursorColumn : -1; - m_terminal->sendLine(line, curLine, w, lineCursorColumn); - } - } - - if (showTerminalCursor) { - m_terminal->showTerminalCursor(cursorColumn, cursorLine); - } -} - -bool Scraper::scrollingScrapeOutput(const ConsoleScreenBufferInfo &info, - bool consoleCursorVisible, - bool tentative) -{ - const Coord cursor = info.cursorPosition(); - const SmallRect windowRect = info.windowRect(); - - if (m_syncRow != -1) { - // If a synchronizing marker was placed into the history, look for it - // and adjust the scroll count. - const int markerRow = findSyncMarker(); - if (markerRow == -1) { - if (tentative) { - // I *think* it's possible to keep going, but it's simple to - // bail out. - return false; - } - // Something has happened. Reset the terminal. - trace("Sync marker has disappeared -- resetting the terminal" - " (m_syncCounter=%u)", - m_syncCounter); - resetConsoleTracking(Terminal::SendClear, windowRect.top()); - } else if (markerRow != m_syncRow) { - ASSERT(markerRow < m_syncRow); - m_scrolledCount += (m_syncRow - markerRow); - m_syncRow = markerRow; - // If the buffer has scrolled, then the entire window is dirty. - markEntireWindowDirty(windowRect); - } - } - - // Creating a new sync row requires clearing part of the console buffer, so - // avoid doing it if there's already a sync row that's good enough. - const int newSyncRow = - static_cast(windowRect.top()) - SYNC_MARKER_LEN - SYNC_MARKER_MARGIN; - const bool shouldCreateSyncRow = - newSyncRow >= m_syncRow + SYNC_MARKER_LEN + SYNC_MARKER_MARGIN; - if (tentative && shouldCreateSyncRow) { - // It's difficult even in principle to put down a new marker if the - // console can scroll an arbitrarily amount while we're writing. - return false; - } - - // Update the dirty line count: - // - If the window has moved, the entire window is dirty. - // - Everything up to the cursor is dirty. - // - All lines above the window are dirty. - // - Any non-blank lines are dirty. - if (m_dirtyWindowTop != -1) { - if (windowRect.top() > m_dirtyWindowTop) { - // The window has moved down, presumably as a result of scrolling. - markEntireWindowDirty(windowRect); - } else if (windowRect.top() < m_dirtyWindowTop) { - if (tentative) { - // I *think* it's possible to keep going, but it's simple to - // bail out. - return false; - } - // The window has moved upward. This is generally not expected to - // happen, but the CMD/PowerShell CLS command will move the window - // to the top as part of clearing everything else in the console. - trace("Window moved upward -- resetting the terminal" - " (m_syncCounter=%u)", - m_syncCounter); - resetConsoleTracking(Terminal::SendClear, windowRect.top()); - } - } - m_dirtyWindowTop = windowRect.top(); - m_dirtyLineCount = std::max(m_dirtyLineCount, cursor.Y + 1); - m_dirtyLineCount = std::max(m_dirtyLineCount, (int)windowRect.top()); - - // There will be at least one dirty line, because there is a cursor. - ASSERT(m_dirtyLineCount >= 1); - - // The first line to scrape, in virtual line coordinates. - const int64_t firstVirtLine = std::min(m_scrapedLineCount, - windowRect.top() + m_scrolledCount); - - // Read all the data we will need from the console. Start reading with the - // first line to scrape, but adjust the the read area upward to account for - // scanForDirtyLines' need to read the previous attribute. Read to the - // bottom of the window. (It's not clear to me whether the - // m_dirtyLineCount adjustment here is strictly necessary. It isn't - // necessary so long as the cursor is inside the current window.) - const int firstReadLine = std::min(firstVirtLine - m_scrolledCount, - m_dirtyLineCount - 1); - const int stopReadLine = std::max(windowRect.top() + windowRect.height(), - m_dirtyLineCount); - ASSERT(firstReadLine >= 0 && stopReadLine > firstReadLine); - largeConsoleRead(m_readBuffer, - *m_consoleBuffer, - SmallRect(0, firstReadLine, - std::min(info.bufferSize().X, - MAX_CONSOLE_WIDTH), - stopReadLine - firstReadLine), - attributesMask()); - - // If we're scraping the buffer without freezing it, we have to query the - // buffer position data separately from the buffer content, so the two - // could easily be out-of-sync. If they *are* out-of-sync, abort the - // scrape operation and restart it frozen. (We may have updated the - // dirty-line high-water-mark, but that should be OK.) - if (tentative) { - const auto infoCheck = m_consoleBuffer->bufferInfo(); - if (info.bufferSize() != infoCheck.bufferSize() || - info.windowRect() != infoCheck.windowRect() || - info.cursorPosition() != infoCheck.cursorPosition()) { - return false; - } - if (m_syncRow != -1 && m_syncRow != findSyncMarker()) { - return false; - } - } - - if (shouldCreateSyncRow) { - ASSERT(!tentative); - createSyncMarker(newSyncRow); - } - - // At this point, we're finished interacting (reading or writing) the - // console, and we just need to convert our collected data into terminal - // output. - - scanForDirtyLines(windowRect); - - // Note that it's possible for all the lines on the current window to - // be non-dirty. - - // The line to stop scraping at, in virtual line coordinates. - const int64_t stopVirtLine = - std::min(m_dirtyLineCount, windowRect.top() + windowRect.height()) + - m_scrolledCount; - - const bool showTerminalCursor = - consoleCursorVisible && windowRect.contains(cursor); - const int64_t cursorLine = !showTerminalCursor ? -1 : cursor.Y + m_scrolledCount; - const int cursorColumn = !showTerminalCursor ? -1 : cursor.X; - - if (!showTerminalCursor) { - m_terminal->hideTerminalCursor(); - } - - bool sawModifiedLine = false; - - const int w = m_readBuffer.rect().width(); - for (int64_t line = firstVirtLine; line < stopVirtLine; ++line) { - const CHAR_INFO *curLine = - m_readBuffer.lineData(line - m_scrolledCount); - ConsoleLine &bufLine = m_bufferData[line % BUFFER_LINE_COUNT]; - if (line > m_maxBufferedLine) { - m_maxBufferedLine = line; - sawModifiedLine = true; - } - if (sawModifiedLine) { - bufLine.setLine(curLine, w); - } else { - sawModifiedLine = bufLine.detectChangeAndSetLine(curLine, w); - } - if (sawModifiedLine) { - const int lineCursorColumn = - line == cursorLine ? cursorColumn : -1; - m_terminal->sendLine(line, curLine, w, lineCursorColumn); - } - } - - m_scrapedLineCount = windowRect.top() + m_scrolledCount; - - if (showTerminalCursor) { - m_terminal->showTerminalCursor(cursorColumn, cursorLine); - } - - return true; -} - -void Scraper::syncMarkerText(CHAR_INFO (&output)[SYNC_MARKER_LEN]) -{ - // XXX: The marker text generated here could easily collide with ordinary - // console output. Does it make sense to try to avoid the collision? - char str[SYNC_MARKER_LEN + 1]; - winpty_snprintf(str, "S*Y*N*C*%08x", m_syncCounter); - for (int i = 0; i < SYNC_MARKER_LEN; ++i) { - output[i].Char.UnicodeChar = str[i]; - output[i].Attributes = 7; - } -} - -int Scraper::findSyncMarker() -{ - ASSERT(m_syncRow >= 0); - CHAR_INFO marker[SYNC_MARKER_LEN]; - CHAR_INFO column[BUFFER_LINE_COUNT]; - syncMarkerText(marker); - SmallRect rect(0, 0, 1, m_syncRow + SYNC_MARKER_LEN); - m_consoleBuffer->read(rect, column); - int i; - for (i = m_syncRow; i >= 0; --i) { - int j; - for (j = 0; j < SYNC_MARKER_LEN; ++j) { - if (column[i + j].Char.UnicodeChar != marker[j].Char.UnicodeChar) - break; - } - if (j == SYNC_MARKER_LEN) - return i; - } - return -1; -} - -void Scraper::createSyncMarker(int row) -{ - ASSERT(row >= 1); - - // Clear the lines around the marker to ensure that Windows 10's rewrapping - // does not affect the marker. - m_consoleBuffer->clearLines(row - 1, SYNC_MARKER_LEN + 1, - m_consoleBuffer->bufferInfo()); - - // Write a new marker. - m_syncCounter++; - CHAR_INFO marker[SYNC_MARKER_LEN]; - syncMarkerText(marker); - m_syncRow = row; - SmallRect markerRect(0, m_syncRow, 1, SYNC_MARKER_LEN); - m_consoleBuffer->write(markerRect, marker); -} diff --git a/node_modules/node-pty/deps/winpty/src/agent/Scraper.h b/node_modules/node-pty/deps/winpty/src/agent/Scraper.h deleted file mode 100644 index 9c10d80..0000000 --- a/node_modules/node-pty/deps/winpty/src/agent/Scraper.h +++ /dev/null @@ -1,103 +0,0 @@ -// Copyright (c) 2011-2016 Ryan Prichard -// -// 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. - -#ifndef AGENT_SCRAPER_H -#define AGENT_SCRAPER_H - -#include - -#include - -#include -#include - -#include "ConsoleLine.h" -#include "Coord.h" -#include "LargeConsoleRead.h" -#include "SmallRect.h" -#include "Terminal.h" - -class ConsoleScreenBufferInfo; -class Win32Console; -class Win32ConsoleBuffer; - -// We must be able to issue a single ReadConsoleOutputW call of -// MAX_CONSOLE_WIDTH characters, and a single read of approximately several -// hundred fewer characters than BUFFER_LINE_COUNT. -const int BUFFER_LINE_COUNT = 3000; -const int MAX_CONSOLE_WIDTH = 2500; -const int MAX_CONSOLE_HEIGHT = 2000; -const int SYNC_MARKER_LEN = 16; -const int SYNC_MARKER_MARGIN = 200; - -class Scraper { -public: - Scraper( - Win32Console &console, - Win32ConsoleBuffer &buffer, - std::unique_ptr terminal, - Coord initialSize); - ~Scraper(); - void resizeWindow(Win32ConsoleBuffer &buffer, - Coord newSize, - ConsoleScreenBufferInfo &finalInfoOut); - void scrapeBuffer(Win32ConsoleBuffer &buffer, - ConsoleScreenBufferInfo &finalInfoOut); - Terminal &terminal() { return *m_terminal; } - -private: - void resetConsoleTracking( - Terminal::SendClearFlag sendClear, int64_t scrapedLineCount); - void markEntireWindowDirty(const SmallRect &windowRect); - void scanForDirtyLines(const SmallRect &windowRect); - void clearBufferLines(int firstRow, int count); - void resizeImpl(const ConsoleScreenBufferInfo &origInfo); - void syncConsoleContentAndSize(bool forceResize, - ConsoleScreenBufferInfo &finalInfoOut); - WORD attributesMask(); - void directScrapeOutput(const ConsoleScreenBufferInfo &info, - bool consoleCursorVisible); - bool scrollingScrapeOutput(const ConsoleScreenBufferInfo &info, - bool consoleCursorVisible, - bool tentative); - void syncMarkerText(CHAR_INFO (&output)[SYNC_MARKER_LEN]); - int findSyncMarker(); - void createSyncMarker(int row); - -private: - Win32Console &m_console; - Win32ConsoleBuffer *m_consoleBuffer = nullptr; - std::unique_ptr m_terminal; - - int m_syncRow = -1; - unsigned int m_syncCounter = 0; - - bool m_directMode = false; - Coord m_ptySize; - int64_t m_scrapedLineCount = 0; - int64_t m_scrolledCount = 0; - int64_t m_maxBufferedLine = -1; - LargeConsoleReadBuffer m_readBuffer; - std::vector m_bufferData; - int m_dirtyWindowTop = -1; - int m_dirtyLineCount = 0; -}; - -#endif // AGENT_SCRAPER_H diff --git a/node_modules/node-pty/deps/winpty/src/agent/SimplePool.h b/node_modules/node-pty/deps/winpty/src/agent/SimplePool.h deleted file mode 100644 index 41ff94a..0000000 --- a/node_modules/node-pty/deps/winpty/src/agent/SimplePool.h +++ /dev/null @@ -1,75 +0,0 @@ -// Copyright (c) 2015 Ryan Prichard -// -// 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. - -#ifndef SIMPLE_POOL_H -#define SIMPLE_POOL_H - -#include - -#include - -#include "../shared/WinptyAssert.h" - -template -class SimplePool { -public: - ~SimplePool(); - T *alloc(); - void clear(); -private: - struct Chunk { - size_t count; - T *data; - }; - std::vector m_chunks; -}; - -template -SimplePool::~SimplePool() { - clear(); -} - -template -void SimplePool::clear() { - for (size_t ci = 0; ci < m_chunks.size(); ++ci) { - Chunk &chunk = m_chunks[ci]; - for (size_t ti = 0; ti < chunk.count; ++ti) { - chunk.data[ti].~T(); - } - free(chunk.data); - } - m_chunks.clear(); -} - -template -T *SimplePool::alloc() { - if (m_chunks.empty() || m_chunks.back().count == chunkSize) { - T *newData = reinterpret_cast(malloc(sizeof(T) * chunkSize)); - ASSERT(newData != NULL); - Chunk newChunk = { 0, newData }; - m_chunks.push_back(newChunk); - } - Chunk &chunk = m_chunks.back(); - T *ret = &chunk.data[chunk.count++]; - new (ret) T(); - return ret; -} - -#endif // SIMPLE_POOL_H diff --git a/node_modules/node-pty/deps/winpty/src/agent/SmallRect.h b/node_modules/node-pty/deps/winpty/src/agent/SmallRect.h deleted file mode 100644 index bad0b88..0000000 --- a/node_modules/node-pty/deps/winpty/src/agent/SmallRect.h +++ /dev/null @@ -1,143 +0,0 @@ -// Copyright (c) 2011-2012 Ryan Prichard -// -// 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. - -#ifndef SMALLRECT_H -#define SMALLRECT_H - -#include - -#include -#include - -#include "../shared/winpty_snprintf.h" -#include "Coord.h" - -struct SmallRect : SMALL_RECT -{ - SmallRect() - { - Left = Right = Top = Bottom = 0; - } - - SmallRect(SHORT x, SHORT y, SHORT width, SHORT height) - { - Left = x; - Top = y; - Right = x + width - 1; - Bottom = y + height - 1; - } - - SmallRect(const COORD &topLeft, const COORD &size) - { - Left = topLeft.X; - Top = topLeft.Y; - Right = Left + size.X - 1; - Bottom = Top + size.Y - 1; - } - - SmallRect(const SMALL_RECT &other) - { - *(SMALL_RECT*)this = other; - } - - SmallRect(const SmallRect &other) - { - *(SMALL_RECT*)this = *(const SMALL_RECT*)&other; - } - - SmallRect &operator=(const SmallRect &other) - { - *(SMALL_RECT*)this = *(const SMALL_RECT*)&other; - return *this; - } - - bool contains(const SmallRect &other) const - { - return other.Left >= Left && - other.Right <= Right && - other.Top >= Top && - other.Bottom <= Bottom; - } - - bool contains(const Coord &other) const - { - return other.X >= Left && - other.X <= Right && - other.Y >= Top && - other.Y <= Bottom; - } - - SmallRect intersected(const SmallRect &other) const - { - int x1 = std::max(Left, other.Left); - int x2 = std::min(Right, other.Right); - int y1 = std::max(Top, other.Top); - int y2 = std::min(Bottom, other.Bottom); - return SmallRect(x1, - y1, - std::max(0, x2 - x1 + 1), - std::max(0, y2 - y1 + 1)); - } - - SmallRect ensureLineIncluded(SHORT line) const - { - const SHORT h = height(); - if (line < Top) { - return SmallRect(Left, line, width(), h); - } else if (line > Bottom) { - return SmallRect(Left, line - h + 1, width(), h); - } else { - return *this; - } - } - - SHORT top() const { return Top; } - SHORT left() const { return Left; } - SHORT width() const { return Right - Left + 1; } - SHORT height() const { return Bottom - Top + 1; } - void setTop(SHORT top) { Top = top; } - void setLeft(SHORT left) { Left = left; } - void setWidth(SHORT width) { Right = Left + width - 1; } - void setHeight(SHORT height) { Bottom = Top + height - 1; } - Coord size() const { return Coord(width(), height()); } - - bool operator==(const SmallRect &other) const - { - return Left == other.Left && - Right == other.Right && - Top == other.Top && - Bottom == other.Bottom; - } - - bool operator!=(const SmallRect &other) const - { - return !(*this == other); - } - - std::string toString() const - { - char ret[64]; - winpty_snprintf(ret, "(x=%d,y=%d,w=%d,h=%d)", - Left, Top, width(), height()); - return std::string(ret); - } -}; - -#endif // SMALLRECT_H diff --git a/node_modules/node-pty/deps/winpty/src/agent/Terminal.cc b/node_modules/node-pty/deps/winpty/src/agent/Terminal.cc deleted file mode 100644 index afa0a36..0000000 --- a/node_modules/node-pty/deps/winpty/src/agent/Terminal.cc +++ /dev/null @@ -1,535 +0,0 @@ -// Copyright (c) 2011-2015 Ryan Prichard -// -// 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. - -#include "Terminal.h" - -#include -#include -#include - -#include - -#include "NamedPipe.h" -#include "UnicodeEncoding.h" -#include "../shared/DebugClient.h" -#include "../shared/WinptyAssert.h" -#include "../shared/winpty_snprintf.h" - -#define CSI "\x1b[" - -// Work around the old MinGW, which lacks COMMON_LVB_LEADING_BYTE and -// COMMON_LVB_TRAILING_BYTE. -const int WINPTY_COMMON_LVB_LEADING_BYTE = 0x100; -const int WINPTY_COMMON_LVB_TRAILING_BYTE = 0x200; -const int WINPTY_COMMON_LVB_REVERSE_VIDEO = 0x4000; -const int WINPTY_COMMON_LVB_UNDERSCORE = 0x8000; - -const int COLOR_ATTRIBUTE_MASK = - FOREGROUND_BLUE | - FOREGROUND_GREEN | - FOREGROUND_RED | - FOREGROUND_INTENSITY | - BACKGROUND_BLUE | - BACKGROUND_GREEN | - BACKGROUND_RED | - BACKGROUND_INTENSITY | - WINPTY_COMMON_LVB_REVERSE_VIDEO | - WINPTY_COMMON_LVB_UNDERSCORE; - -const int FLAG_RED = 1; -const int FLAG_GREEN = 2; -const int FLAG_BLUE = 4; -const int FLAG_BRIGHT = 8; - -const int BLACK = 0; -const int DKGRAY = BLACK | FLAG_BRIGHT; -const int LTGRAY = FLAG_RED | FLAG_GREEN | FLAG_BLUE; -const int WHITE = LTGRAY | FLAG_BRIGHT; - -// SGR parameters (Select Graphic Rendition) -const int SGR_FORE = 30; -const int SGR_FORE_HI = 90; -const int SGR_BACK = 40; -const int SGR_BACK_HI = 100; - -namespace { - -static void outUInt(std::string &out, unsigned int n) -{ - char buf[32]; - char *pbuf = &buf[32]; - *(--pbuf) = '\0'; - do { - *(--pbuf) = '0' + n % 10; - n /= 10; - } while (n != 0); - out.append(pbuf); -} - -static void outputSetColorSgrParams(std::string &out, bool isFore, int color) -{ - out.push_back(';'); - const int sgrBase = isFore ? SGR_FORE : SGR_BACK; - if (color & FLAG_BRIGHT) { - // Some terminals don't support the 9X/10X "intensive" color parameters - // (e.g. the Eclipse TM terminal as of this writing). Those terminals - // will quietly ignore a 9X/10X code, and the other terminals will - // ignore a 3X/4X code if it's followed by a 9X/10X code. Therefore, - // output a 3X/4X code as a fallback, then override it. - const int colorBase = color & ~FLAG_BRIGHT; - outUInt(out, sgrBase + colorBase); - out.push_back(';'); - outUInt(out, sgrBase + (SGR_FORE_HI - SGR_FORE) + colorBase); - } else { - outUInt(out, sgrBase + color); - } -} - -static void outputSetColor(std::string &out, int color) -{ - int fore = 0; - int back = 0; - if (color & FOREGROUND_RED) fore |= FLAG_RED; - if (color & FOREGROUND_GREEN) fore |= FLAG_GREEN; - if (color & FOREGROUND_BLUE) fore |= FLAG_BLUE; - if (color & FOREGROUND_INTENSITY) fore |= FLAG_BRIGHT; - if (color & BACKGROUND_RED) back |= FLAG_RED; - if (color & BACKGROUND_GREEN) back |= FLAG_GREEN; - if (color & BACKGROUND_BLUE) back |= FLAG_BLUE; - if (color & BACKGROUND_INTENSITY) back |= FLAG_BRIGHT; - - if (color & WINPTY_COMMON_LVB_REVERSE_VIDEO) { - // n.b.: The COMMON_LVB_REVERSE_VIDEO flag also swaps - // FOREGROUND_INTENSITY and BACKGROUND_INTENSITY. Tested on - // Windows 10 v14393. - std::swap(fore, back); - } - - // Translate the fore/back colors into terminal escape codes using - // a heuristic that works OK with common white-on-black or - // black-on-white color schemes. We don't know which color scheme - // the terminal is using. It is ugly to force white-on-black text - // on a black-on-white terminal, and it's even ugly to force the - // matching scheme. It's probably relevant that the default - // fore/back terminal colors frequently do not match any of the 16 - // palette colors. - - // Typical default terminal color schemes (according to palette, - // when possible): - // - mintty: LtGray-on-Black(A) - // - putty: LtGray-on-Black(A) - // - xterm: LtGray-on-Black(A) - // - Konsole: LtGray-on-Black(A) - // - JediTerm/JetBrains: Black-on-White(B) - // - rxvt: Black-on-White(B) - - // If the background is the default color (black), then it will - // map to Black(A) or White(B). If we translate White to White, - // then a Black background and a White background in the console - // are both White with (B). Therefore, we should translate White - // using SGR 7 (Invert). The typical finished mapping table for - // background grayscale colors is: - // - // (A) White => LtGray(fore) - // (A) Black => Black(back) - // (A) LtGray => LtGray - // (A) DkGray => DkGray - // - // (B) White => Black(fore) - // (B) Black => White(back) - // (B) LtGray => LtGray - // (B) DkGray => DkGray - // - - out.append(CSI "0"); - if (back == BLACK) { - if (fore == LTGRAY) { - // The "default" foreground color. Use the terminal's - // default colors. - } else if (fore == WHITE) { - // Sending the literal color white would behave poorly if - // the terminal were black-on-white. Sending Bold is not - // guaranteed to alter the color, but it will make the text - // visually distinct, so do that instead. - out.append(";1"); - } else if (fore == DKGRAY) { - // Set the foreground color to DkGray(90) with a fallback - // of LtGray(37) for terminals that don't handle the 9X SGR - // parameters (e.g. Eclipse's TM Terminal as of this - // writing). - out.append(";37;90"); - } else { - outputSetColorSgrParams(out, true, fore); - } - } else if (back == WHITE) { - // Set the background color using Invert on the default - // foreground color, and set the foreground color by setting a - // background color. - - // Use the terminal's inverted colors. - out.append(";7"); - if (fore == LTGRAY || fore == BLACK) { - // We're likely mapping Console White to terminal LtGray or - // Black. If they are the Console foreground color, then - // don't set a terminal foreground color to avoid creating - // invisible text. - } else { - outputSetColorSgrParams(out, false, fore); - } - } else { - // Set the foreground and background to match exactly that in - // the Windows console. - outputSetColorSgrParams(out, true, fore); - outputSetColorSgrParams(out, false, back); - } - if (fore == back) { - // The foreground and background colors are exactly equal, so - // attempt to hide the text using the Conceal SGR parameter, - // which some terminals support. - out.append(";8"); - } - if (color & WINPTY_COMMON_LVB_UNDERSCORE) { - out.append(";4"); - } - out.push_back('m'); -} - -static inline unsigned int fixSpecialCharacters(unsigned int ch) -{ - if (ch <= 0x1b) { - switch (ch) { - // The Windows Console has a popup window (e.g. that appears with - // F7) that is sometimes bordered with box-drawing characters. - // With the Japanese and Korean system locales (CP932 and CP949), - // the UnicodeChar values for the box-drawing characters are 1 - // through 6. Detect this and map the values to the correct - // Unicode values. - // - // N.B. In the English locale, the UnicodeChar values are correct, - // and they identify single-line characters rather than - // double-line. In the Chinese Simplified and Traditional locales, - // the popups use ASCII characters instead. - case 1: return 0x2554; // BOX DRAWINGS DOUBLE DOWN AND RIGHT - case 2: return 0x2557; // BOX DRAWINGS DOUBLE DOWN AND LEFT - case 3: return 0x255A; // BOX DRAWINGS DOUBLE UP AND RIGHT - case 4: return 0x255D; // BOX DRAWINGS DOUBLE UP AND LEFT - case 5: return 0x2551; // BOX DRAWINGS DOUBLE VERTICAL - case 6: return 0x2550; // BOX DRAWINGS DOUBLE HORIZONTAL - - // Convert an escape character to some other character. This - // conversion only applies to console cells containing an escape - // character. In newer versions of Windows 10 (e.g. 10.0.10586), - // the non-legacy console recognizes escape sequences in - // WriteConsole and interprets them without writing them to the - // cells of the screen buffer. In that case, the conversion here - // does not apply. - case 0x1b: return '?'; - } - } - return ch; -} - -static inline bool isFullWidthCharacter(const CHAR_INFO *data, int width) -{ - if (width < 2) { - return false; - } - return - (data[0].Attributes & WINPTY_COMMON_LVB_LEADING_BYTE) && - (data[1].Attributes & WINPTY_COMMON_LVB_TRAILING_BYTE) && - data[0].Char.UnicodeChar == data[1].Char.UnicodeChar; -} - -// Scan to find a single Unicode Scalar Value. Full-width characters occupy -// two console cells, and this code also tries to handle UTF-16 surrogate -// pairs. -// -// Windows expands at least some wide characters outside the Basic -// Multilingual Plane into four cells, such as U+20000: -// 1. 0xD840, attr=0x107 -// 2. 0xD840, attr=0x207 -// 3. 0xDC00, attr=0x107 -// 4. 0xDC00, attr=0x207 -// Even in the Traditional Chinese locale on Windows 10, this text is rendered -// as two boxes, but if those boxes are copied-and-pasted, the character is -// copied correctly. -static inline void scanUnicodeScalarValue( - const CHAR_INFO *data, int width, - int &outCellCount, unsigned int &outCharValue) -{ - ASSERT(width >= 1); - - const int w1 = isFullWidthCharacter(data, width) ? 2 : 1; - const wchar_t c1 = data[0].Char.UnicodeChar; - - if ((c1 & 0xF800) == 0xD800) { - // The first cell is either a leading or trailing surrogate pair. - if ((c1 & 0xFC00) != 0xD800 || - width <= w1 || - ((data[w1].Char.UnicodeChar & 0xFC00) != 0xDC00)) { - // Invalid surrogate pair - outCellCount = w1; - outCharValue = '?'; - } else { - // Valid surrogate pair - outCellCount = w1 + (isFullWidthCharacter(&data[w1], width - w1) ? 2 : 1); - outCharValue = decodeSurrogatePair(c1, data[w1].Char.UnicodeChar); - } - } else { - outCellCount = w1; - outCharValue = c1; - } -} - -} // anonymous namespace - -void Terminal::reset(SendClearFlag sendClearFirst, int64_t newLine) -{ - if (sendClearFirst == SendClear && !m_plainMode) { - // 0m ==> reset SGR parameters - // 1;1H ==> move cursor to top-left position - // 2J ==> clear the entire screen - m_output.write(CSI "0m" CSI "1;1H" CSI "2J"); - } - m_remoteLine = newLine; - m_remoteColumn = 0; - m_lineData.clear(); - m_cursorHidden = false; - m_remoteColor = -1; -} - -void Terminal::sendLine(int64_t line, const CHAR_INFO *lineData, int width, - int cursorColumn) -{ - ASSERT(width >= 1); - - moveTerminalToLine(line); - - // If possible, see if we can append to what we've already output for this - // line. - if (m_lineDataValid) { - ASSERT(m_lineData.size() == static_cast(m_remoteColumn)); - if (m_remoteColumn > 0) { - // In normal mode, if m_lineData.size() equals `width`, then we - // will have trouble outputing the "erase rest of line" command, - // which must be output before reaching the end of the line. In - // plain mode, we don't output that command, so we're OK with a - // full line. - bool okWidth = false; - if (m_plainMode) { - okWidth = static_cast(width) >= m_lineData.size(); - } else { - okWidth = static_cast(width) > m_lineData.size(); - } - if (!okWidth || - memcmp(m_lineData.data(), lineData, - sizeof(CHAR_INFO) * m_lineData.size()) != 0) { - m_lineDataValid = false; - } - } - } - if (!m_lineDataValid) { - // We can't reuse, so we must reset this line. - hideTerminalCursor(); - if (m_plainMode) { - // We can't backtrack, so repeat this line. - m_output.write("\r\n"); - } else { - m_output.write("\r"); - } - m_lineDataValid = true; - m_lineData.clear(); - m_remoteColumn = 0; - } - - std::string &termLine = m_termLineWorkingBuffer; - termLine.clear(); - size_t trimmedLineLength = 0; - int trimmedCellCount = m_lineData.size(); - bool alreadyErasedLine = false; - - int cellCount = 1; - for (int i = m_lineData.size(); i < width; i += cellCount) { - if (m_outputColor) { - int color = lineData[i].Attributes & COLOR_ATTRIBUTE_MASK; - if (color != m_remoteColor) { - outputSetColor(termLine, color); - trimmedLineLength = termLine.size(); - m_remoteColor = color; - - // All the cells just up to this color change will be output. - trimmedCellCount = i; - } - } - unsigned int ch; - scanUnicodeScalarValue(&lineData[i], width - i, cellCount, ch); - if (ch == ' ') { - // Tentatively add this space character. We'll only output it if - // we see something interesting after it. - termLine.push_back(' '); - } else { - if (i + cellCount == width) { - // We'd like to erase the line after outputting all non-blank - // characters, but this doesn't work if the last cell in the - // line is non-blank. At the point, the cursor is positioned - // just past the end of the line, but in many terminals, - // issuing a CSI 0K at that point also erases the last cell in - // the line. Work around this behavior by issuing the erase - // one character early in that case. - if (!m_plainMode) { - termLine.append(CSI "0K"); // Erase from cursor to EOL - } - alreadyErasedLine = true; - } - ch = fixSpecialCharacters(ch); - char enc[4]; - int enclen = encodeUtf8(enc, ch); - if (enclen == 0) { - enc[0] = '?'; - enclen = 1; - } - termLine.append(enc, enclen); - trimmedLineLength = termLine.size(); - - // All the cells up to and including this cell will be output. - trimmedCellCount = i + cellCount; - } - } - - if (cursorColumn != -1 && trimmedCellCount > cursorColumn) { - // The line content would run past the cursor, so hide it before we - // output. - hideTerminalCursor(); - } - - m_output.write(termLine.data(), trimmedLineLength); - if (!alreadyErasedLine && !m_plainMode) { - m_output.write(CSI "0K"); // Erase from cursor to EOL - } - - ASSERT(trimmedCellCount <= width); - m_lineData.insert(m_lineData.end(), - &lineData[m_lineData.size()], - &lineData[trimmedCellCount]); - m_remoteColumn = trimmedCellCount; -} - -void Terminal::showTerminalCursor(int column, int64_t line) -{ - moveTerminalToLine(line); - if (!m_plainMode) { - if (m_remoteColumn != column) { - char buffer[32]; - winpty_snprintf(buffer, CSI "%dG", column + 1); - m_output.write(buffer); - m_lineDataValid = (column == 0); - m_lineData.clear(); - m_remoteColumn = column; - } - if (m_cursorHidden) { - m_output.write(CSI "?25h"); - m_cursorHidden = false; - } - } -} - -void Terminal::hideTerminalCursor() -{ - if (!m_plainMode) { - if (m_cursorHidden) { - return; - } - m_output.write(CSI "?25l"); - m_cursorHidden = true; - } -} - -void Terminal::moveTerminalToLine(int64_t line) -{ - if (line == m_remoteLine) { - return; - } - - // Do not use CPL or CNL. Konsole 2.5.4 does not support Cursor Previous - // Line (CPL) -- there are "Undecodable sequence" errors. gnome-terminal - // 2.32.0 does handle it. Cursor Next Line (CNL) does nothing if the - // cursor is on the last line already. - - hideTerminalCursor(); - - if (line < m_remoteLine) { - if (m_plainMode) { - // We can't backtrack, so instead repeat the lines again. - m_output.write("\r\n"); - m_remoteLine = line; - } else { - // Backtrack and overwrite previous lines. - // CUrsor Up (CUU) - char buffer[32]; - winpty_snprintf(buffer, "\r" CSI "%uA", - static_cast(m_remoteLine - line)); - m_output.write(buffer); - m_remoteLine = line; - } - } else if (line > m_remoteLine) { - while (line > m_remoteLine) { - m_output.write("\r\n"); - m_remoteLine++; - } - } - - m_lineDataValid = true; - m_lineData.clear(); - m_remoteColumn = 0; -} - -void Terminal::enableMouseMode(bool enabled) -{ - if (m_mouseModeEnabled == enabled || m_plainMode) { - return; - } - m_mouseModeEnabled = enabled; - if (enabled) { - // Start by disabling UTF-8 coordinate mode (1005), just in case we - // have a terminal that does not support 1006/1015 modes, and 1005 - // happens to be enabled. The UTF-8 coordinates can't be unambiguously - // decoded. - // - // Enable basic mouse support first (1000), then try to switch to - // button-move mode (1002), then try full mouse-move mode (1003). - // Terminals that don't support a mode will be stuck at the highest - // mode they do support. - // - // Enable encoding mode 1015 first, then try to switch to 1006. On - // some terminals, both modes will be enabled, but 1006 will have - // priority. On other terminals, 1006 wins because it's listed last. - // - // See misc/MouseInputNotes.txt for details. - m_output.write( - CSI "?1005l" - CSI "?1000h" CSI "?1002h" CSI "?1003h" CSI "?1015h" CSI "?1006h"); - } else { - // Resetting both encoding modes (1006 and 1015) is necessary, but - // apparently we only need to use reset on one of the 100[023] modes. - // Doing both doesn't hurt. - m_output.write( - CSI "?1006l" CSI "?1015l" CSI "?1003l" CSI "?1002l" CSI "?1000l"); - } -} diff --git a/node_modules/node-pty/deps/winpty/src/agent/Terminal.h b/node_modules/node-pty/deps/winpty/src/agent/Terminal.h deleted file mode 100644 index 058eb26..0000000 --- a/node_modules/node-pty/deps/winpty/src/agent/Terminal.h +++ /dev/null @@ -1,69 +0,0 @@ -// Copyright (c) 2011-2015 Ryan Prichard -// -// 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. - -#ifndef TERMINAL_H -#define TERMINAL_H - -#include -#include - -#include -#include - -#include "Coord.h" - -class NamedPipe; - -class Terminal -{ -public: - explicit Terminal(NamedPipe &output, bool plainMode, bool outputColor) - : m_output(output), m_plainMode(plainMode), m_outputColor(outputColor) - { - } - - enum SendClearFlag { OmitClear, SendClear }; - void reset(SendClearFlag sendClearFirst, int64_t newLine); - void sendLine(int64_t line, const CHAR_INFO *lineData, int width, - int cursorColumn); - void showTerminalCursor(int column, int64_t line); - void hideTerminalCursor(); - -private: - void moveTerminalToLine(int64_t line); - -public: - void enableMouseMode(bool enabled); - -private: - NamedPipe &m_output; - int64_t m_remoteLine = 0; - int m_remoteColumn = 0; - bool m_lineDataValid = true; - std::vector m_lineData; - bool m_cursorHidden = false; - int m_remoteColor = -1; - std::string m_termLineWorkingBuffer; - bool m_plainMode = false; - bool m_outputColor = true; - bool m_mouseModeEnabled = false; -}; - -#endif // TERMINAL_H diff --git a/node_modules/node-pty/deps/winpty/src/agent/UnicodeEncoding.h b/node_modules/node-pty/deps/winpty/src/agent/UnicodeEncoding.h deleted file mode 100644 index 6b0de3e..0000000 --- a/node_modules/node-pty/deps/winpty/src/agent/UnicodeEncoding.h +++ /dev/null @@ -1,157 +0,0 @@ -// Copyright (c) 2015 Ryan Prichard -// -// 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. - -#ifndef UNICODE_ENCODING_H -#define UNICODE_ENCODING_H - -#include - -// Encode the Unicode codepoint with UTF-8. The buffer must be at least 4 -// bytes in size. -static inline int encodeUtf8(char *out, uint32_t code) { - if (code < 0x80) { - out[0] = code; - return 1; - } else if (code < 0x800) { - out[0] = ((code >> 6) & 0x1F) | 0xC0; - out[1] = ((code >> 0) & 0x3F) | 0x80; - return 2; - } else if (code < 0x10000) { - if (code >= 0xD800 && code <= 0xDFFF) { - // The code points 0xD800 to 0xDFFF are reserved for UTF-16 - // surrogate pairs and do not have an encoding in UTF-8. - return 0; - } - out[0] = ((code >> 12) & 0x0F) | 0xE0; - out[1] = ((code >> 6) & 0x3F) | 0x80; - out[2] = ((code >> 0) & 0x3F) | 0x80; - return 3; - } else if (code < 0x110000) { - out[0] = ((code >> 18) & 0x07) | 0xF0; - out[1] = ((code >> 12) & 0x3F) | 0x80; - out[2] = ((code >> 6) & 0x3F) | 0x80; - out[3] = ((code >> 0) & 0x3F) | 0x80; - return 4; - } else { - // Encoding error - return 0; - } -} - -// Encode the Unicode codepoint with UTF-16. The buffer must be large enough -// to hold the output -- either 1 or 2 elements. -static inline int encodeUtf16(wchar_t *out, uint32_t code) { - if (code < 0x10000) { - if (code >= 0xD800 && code <= 0xDFFF) { - // The code points 0xD800 to 0xDFFF are reserved for UTF-16 - // surrogate pairs and do not have an encoding in UTF-16. - return 0; - } - out[0] = code; - return 1; - } else if (code < 0x110000) { - code -= 0x10000; - out[0] = 0xD800 | (code >> 10); - out[1] = 0xDC00 | (code & 0x3FF); - return 2; - } else { - // Encoding error - return 0; - } -} - -// Return the byte size of a UTF-8 character using the value of the first -// byte. -static inline int utf8CharLength(char firstByte) { - // This code would probably be faster if it used __builtin_clz. - if ((firstByte & 0x80) == 0) { - return 1; - } else if ((firstByte & 0xE0) == 0xC0) { - return 2; - } else if ((firstByte & 0xF0) == 0xE0) { - return 3; - } else if ((firstByte & 0xF8) == 0xF0) { - return 4; - } else { - // Malformed UTF-8. - return 0; - } -} - -// The pointer must point to 1-4 bytes, as indicated by the first byte. -// Returns -1 on decoding error. -static inline uint32_t decodeUtf8(const char *in) { - const uint32_t kInvalid = static_cast(-1); - switch (utf8CharLength(in[0])) { - case 1: { - return in[0]; - } - case 2: { - if ((in[1] & 0xC0) != 0x80) { - return kInvalid; - } - uint32_t tmp = 0; - tmp = (in[0] & 0x1F) << 6; - tmp |= (in[1] & 0x3F); - return tmp <= 0x7F ? kInvalid : tmp; - } - case 3: { - if ((in[1] & 0xC0) != 0x80 || - (in[2] & 0xC0) != 0x80) { - return kInvalid; - } - uint32_t tmp = 0; - tmp = (in[0] & 0x0F) << 12; - tmp |= (in[1] & 0x3F) << 6; - tmp |= (in[2] & 0x3F); - if (tmp <= 0x07FF || (tmp >= 0xD800 && tmp <= 0xDFFF)) { - return kInvalid; - } else { - return tmp; - } - } - case 4: { - if ((in[1] & 0xC0) != 0x80 || - (in[2] & 0xC0) != 0x80 || - (in[3] & 0xC0) != 0x80) { - return kInvalid; - } - uint32_t tmp = 0; - tmp = (in[0] & 0x07) << 18; - tmp |= (in[1] & 0x3F) << 12; - tmp |= (in[2] & 0x3F) << 6; - tmp |= (in[3] & 0x3F); - if (tmp <= 0xFFFF || tmp > 0x10FFFF) { - return kInvalid; - } else { - return tmp; - } - } - default: { - return kInvalid; - } - } -} - -static inline uint32_t decodeSurrogatePair(wchar_t ch1, wchar_t ch2) { - return ((ch1 - 0xD800) << 10) + (ch2 - 0xDC00) + 0x10000; -} - -#endif // UNICODE_ENCODING_H diff --git a/node_modules/node-pty/deps/winpty/src/agent/UnicodeEncodingTest.cc b/node_modules/node-pty/deps/winpty/src/agent/UnicodeEncodingTest.cc deleted file mode 100644 index cd4abeb..0000000 --- a/node_modules/node-pty/deps/winpty/src/agent/UnicodeEncodingTest.cc +++ /dev/null @@ -1,189 +0,0 @@ -// Copyright (c) 2015 Ryan Prichard -// -// 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. - -// Encode every code-point using this module and verify that it matches the -// encoding generated using Windows WideCharToMultiByte. - -#include "UnicodeEncoding.h" - -#include -#include -#include -#include -#include - -static void correctnessByCode() -{ - char mbstr1[4]; - char mbstr2[4]; - wchar_t wch[2]; - for (unsigned int code = 0; code < 0x110000; ++code) { - - // Surrogate pair reserved region. - const bool isReserved = (code >= 0xD800 && code <= 0xDFFF); - - int mblen1 = encodeUtf8(mbstr1, code); - if (isReserved ? mblen1 != 0 : mblen1 <= 0) { - printf("Error: 0x%04X: mblen1=%d\n", code, mblen1); - continue; - } - - int wlen = encodeUtf16(wch, code); - if (isReserved ? wlen != 0 : wlen <= 0) { - printf("Error: 0x%04X: wlen=%d\n", code, wlen); - continue; - } - - if (isReserved) { - continue; - } - - if (mblen1 != utf8CharLength(mbstr1[0])) { - printf("Error: 0x%04X: mblen1=%d, utf8CharLength(mbstr1[0])=%d\n", - code, mblen1, utf8CharLength(mbstr1[0])); - continue; - } - - if (code != decodeUtf8(mbstr1)) { - printf("Error: 0x%04X: decodeUtf8(mbstr1)=%u\n", - code, decodeUtf8(mbstr1)); - continue; - } - - int mblen2 = WideCharToMultiByte(CP_UTF8, 0, wch, wlen, mbstr2, 4, NULL, NULL); - if (mblen1 != mblen2) { - printf("Error: 0x%04X: mblen1=%d, mblen2=%d\n", code, mblen1, mblen2); - continue; - } - - if (memcmp(mbstr1, mbstr2, mblen1) != 0) { - printf("Error: 0x%04x: encodings are different\n", code); - continue; - } - } -} - -static const char *encodingStr(char (&output)[128], char (&buf)[4]) -{ - sprintf(output, "Encoding %02X %02X %02X %02X", - static_cast(buf[0]), - static_cast(buf[1]), - static_cast(buf[2]), - static_cast(buf[3])); - return output; -} - -// This test can take a couple of minutes to run. -static void correctnessByUtf8Encoding() -{ - for (uint64_t encoding = 0; encoding <= 0xFFFFFFFF; ++encoding) { - - char mb[4]; - mb[0] = encoding; - mb[1] = encoding >> 8; - mb[2] = encoding >> 16; - mb[3] = encoding >> 24; - - const int mblen = utf8CharLength(mb[0]); - if (mblen == 0) { - continue; - } - - // Test this module. - const uint32_t code1 = decodeUtf8(mb); - wchar_t ws1[2] = {}; - const int wslen1 = encodeUtf16(ws1, code1); - - // Test using Windows. We can't decode a codepoint directly; we have - // to do UTF8->UTF16, then decode the surrogate pair. - wchar_t ws2[2] = {}; - const int wslen2 = MultiByteToWideChar( - CP_UTF8, MB_ERR_INVALID_CHARS, mb, mblen, ws2, 2); - const uint32_t code2 = - (wslen2 == 1 ? ws2[0] : - wslen2 == 2 ? decodeSurrogatePair(ws2[0], ws2[1]) : - static_cast(-1)); - - // Verify that the two implementations match. - char prefix[128]; - if (code1 != code2) { - printf("%s: code1=0x%04x code2=0x%04x\n", - encodingStr(prefix, mb), - code1, code2); - continue; - } - if (wslen1 != wslen2) { - printf("%s: wslen1=%d wslen2=%d\n", - encodingStr(prefix, mb), - wslen1, wslen2); - continue; - } - if (memcmp(ws1, ws2, wslen1 * sizeof(wchar_t)) != 0) { - printf("%s: ws1 != ws2\n", encodingStr(prefix, mb)); - continue; - } - } -} - -wchar_t g_wch_TEST[] = { 0xD840, 0xDC00 }; -char g_ch_TEST[4]; -wchar_t *volatile g_pwch = g_wch_TEST; -char *volatile g_pch = g_ch_TEST; -unsigned int volatile g_code = 0xA2000; - -static void performance() -{ - { - clock_t start = clock(); - for (long long i = 0; i < 250000000LL; ++i) { - int mblen = WideCharToMultiByte(CP_UTF8, 0, g_pwch, 2, g_pch, 4, NULL, NULL); - assert(mblen == 4); - } - clock_t stop = clock(); - printf("%.3fns per char\n", (double)(stop - start) / CLOCKS_PER_SEC * 4.0); - } - - { - clock_t start = clock(); - for (long long i = 0; i < 3000000000LL; ++i) { - int mblen = encodeUtf8(g_pch, g_code); - assert(mblen == 4); - } - clock_t stop = clock(); - printf("%.3fns per char\n", (double)(stop - start) / CLOCKS_PER_SEC / 3.0); - } -} - -int main() -{ - printf("Testing correctnessByCode...\n"); - fflush(stdout); - correctnessByCode(); - - printf("Testing correctnessByUtf8Encoding... (may take a couple minutes)\n"); - fflush(stdout); - correctnessByUtf8Encoding(); - - printf("Testing performance...\n"); - fflush(stdout); - performance(); - - return 0; -} diff --git a/node_modules/node-pty/deps/winpty/src/agent/Win32Console.cc b/node_modules/node-pty/deps/winpty/src/agent/Win32Console.cc deleted file mode 100644 index d53de02..0000000 --- a/node_modules/node-pty/deps/winpty/src/agent/Win32Console.cc +++ /dev/null @@ -1,107 +0,0 @@ -// Copyright (c) 2011-2016 Ryan Prichard -// -// 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. - -#include "Win32Console.h" - -#include -#include - -#include - -#include "../shared/DebugClient.h" -#include "../shared/WinptyAssert.h" - -Win32Console::Win32Console() : m_titleWorkBuf(16) -{ - // The console window must be non-NULL. It is used for two purposes: - // (1) "Freezing" the console to detect the exact number of lines that - // have scrolled. - // (2) Killing processes attached to the console, by posting a WM_CLOSE - // message to the console window. - m_hwnd = GetConsoleWindow(); - ASSERT(m_hwnd != nullptr); -} - -std::wstring Win32Console::title() -{ - while (true) { - // Calling GetConsoleTitleW is tricky, because its behavior changed - // from XP->Vista, then again from Win7->Win8. The Vista+Win7 behavior - // is especially broken. - // - // The MSDN documentation documents nSize as the "size of the buffer - // pointed to by the lpConsoleTitle parameter, in characters" and the - // successful return value as "the length of the console window's - // title, in characters." - // - // On XP, the function returns the title length, AFTER truncation - // (excluding the NUL terminator). If the title is blank, the API - // returns 0 and does not NUL-terminate the buffer. To accommodate - // XP, the function must: - // * Terminate the buffer itself. - // * Double the size of the title buffer in a loop. - // - // On Vista and up, the function returns the non-truncated title - // length (excluding the NUL terminator). - // - // On Vista and Windows 7, there is a bug where the buffer size is - // interpreted as a byte count rather than a wchar_t count. To - // work around this, we must pass GetConsoleTitleW a buffer that is - // twice as large as what is actually needed. - // - // See misc/*/Test_GetConsoleTitleW.cc for tests demonstrating Windows' - // behavior. - - DWORD count = GetConsoleTitleW(m_titleWorkBuf.data(), - m_titleWorkBuf.size()); - const size_t needed = (count + 1) * sizeof(wchar_t); - if (m_titleWorkBuf.size() < needed) { - m_titleWorkBuf.resize(needed); - continue; - } - m_titleWorkBuf[count] = L'\0'; - return m_titleWorkBuf.data(); - } -} - -void Win32Console::setTitle(const std::wstring &title) -{ - if (!SetConsoleTitleW(title.c_str())) { - trace("SetConsoleTitleW failed"); - } -} - -void Win32Console::setFrozen(bool frozen) { - const int SC_CONSOLE_MARK = 0xFFF2; - const int SC_CONSOLE_SELECT_ALL = 0xFFF5; - if (frozen == m_frozen) { - // Do nothing. - } else if (frozen) { - // Enter selection mode by activating either Mark or SelectAll. - const int command = m_freezeUsesMark ? SC_CONSOLE_MARK - : SC_CONSOLE_SELECT_ALL; - SendMessage(m_hwnd, WM_SYSCOMMAND, command, 0); - m_frozen = true; - } else { - // Send Escape to cancel the selection. - SendMessage(m_hwnd, WM_CHAR, 27, 0x00010001); - m_frozen = false; - } -} diff --git a/node_modules/node-pty/deps/winpty/src/agent/Win32Console.h b/node_modules/node-pty/deps/winpty/src/agent/Win32Console.h deleted file mode 100644 index ed83877..0000000 --- a/node_modules/node-pty/deps/winpty/src/agent/Win32Console.h +++ /dev/null @@ -1,67 +0,0 @@ -// Copyright (c) 2011-2016 Ryan Prichard -// -// 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. - -#ifndef AGENT_WIN32_CONSOLE_H -#define AGENT_WIN32_CONSOLE_H - -#include - -#include -#include - -class Win32Console -{ -public: - class FreezeGuard { - public: - FreezeGuard(Win32Console &console, bool frozen) : - m_console(console), m_previous(console.frozen()) { - m_console.setFrozen(frozen); - } - ~FreezeGuard() { - m_console.setFrozen(m_previous); - } - FreezeGuard(const FreezeGuard &other) = delete; - FreezeGuard &operator=(const FreezeGuard &other) = delete; - private: - Win32Console &m_console; - bool m_previous; - }; - - Win32Console(); - - HWND hwnd() { return m_hwnd; } - std::wstring title(); - void setTitle(const std::wstring &title); - void setFreezeUsesMark(bool useMark) { m_freezeUsesMark = useMark; } - void setNewW10(bool isNewW10) { m_isNewW10 = isNewW10; } - bool isNewW10() { return m_isNewW10; } - void setFrozen(bool frozen=true); - bool frozen() { return m_frozen; } - -private: - HWND m_hwnd = nullptr; - bool m_frozen = false; - bool m_freezeUsesMark = false; - bool m_isNewW10 = false; - std::vector m_titleWorkBuf; -}; - -#endif // AGENT_WIN32_CONSOLE_H diff --git a/node_modules/node-pty/deps/winpty/src/agent/Win32ConsoleBuffer.cc b/node_modules/node-pty/deps/winpty/src/agent/Win32ConsoleBuffer.cc deleted file mode 100644 index ed93f40..0000000 --- a/node_modules/node-pty/deps/winpty/src/agent/Win32ConsoleBuffer.cc +++ /dev/null @@ -1,193 +0,0 @@ -// Copyright (c) 2011-2016 Ryan Prichard -// -// 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. - -#include "Win32ConsoleBuffer.h" - -#include - -#include "../shared/DebugClient.h" -#include "../shared/StringBuilder.h" -#include "../shared/WinptyAssert.h" - -std::unique_ptr Win32ConsoleBuffer::openStdout() { - return std::unique_ptr( - new Win32ConsoleBuffer(GetStdHandle(STD_OUTPUT_HANDLE), false)); -} - -std::unique_ptr Win32ConsoleBuffer::openConout() { - const HANDLE conout = CreateFileW(L"CONOUT$", - GENERIC_READ | GENERIC_WRITE, - FILE_SHARE_READ | FILE_SHARE_WRITE, - NULL, OPEN_EXISTING, 0, NULL); - ASSERT(conout != INVALID_HANDLE_VALUE); - return std::unique_ptr( - new Win32ConsoleBuffer(conout, true)); -} - -std::unique_ptr Win32ConsoleBuffer::createErrorBuffer() { - SECURITY_ATTRIBUTES sa = {}; - sa.nLength = sizeof(sa); - sa.bInheritHandle = TRUE; - const HANDLE conout = - CreateConsoleScreenBuffer(GENERIC_READ | GENERIC_WRITE, - FILE_SHARE_READ | FILE_SHARE_WRITE, - &sa, - CONSOLE_TEXTMODE_BUFFER, - nullptr); - ASSERT(conout != INVALID_HANDLE_VALUE); - return std::unique_ptr( - new Win32ConsoleBuffer(conout, true)); -} - -HANDLE Win32ConsoleBuffer::conout() { - return m_conout; -} - -void Win32ConsoleBuffer::clearLines( - int row, - int count, - const ConsoleScreenBufferInfo &info) { - // TODO: error handling - const int width = info.bufferSize().X; - DWORD actual = 0; - if (!FillConsoleOutputCharacterW( - m_conout, L' ', width * count, Coord(0, row), - &actual) || static_cast(actual) != width * count) { - trace("FillConsoleOutputCharacterW failed"); - } - if (!FillConsoleOutputAttribute( - m_conout, kDefaultAttributes, width * count, Coord(0, row), - &actual) || static_cast(actual) != width * count) { - trace("FillConsoleOutputAttribute failed"); - } -} - -void Win32ConsoleBuffer::clearAllLines(const ConsoleScreenBufferInfo &info) { - clearLines(0, info.bufferSize().Y, info); -} - -ConsoleScreenBufferInfo Win32ConsoleBuffer::bufferInfo() { - // TODO: error handling - ConsoleScreenBufferInfo info; - if (!GetConsoleScreenBufferInfo(m_conout, &info)) { - trace("GetConsoleScreenBufferInfo failed"); - } - return info; -} - -Coord Win32ConsoleBuffer::bufferSize() { - return bufferInfo().bufferSize(); -} - -SmallRect Win32ConsoleBuffer::windowRect() { - return bufferInfo().windowRect(); -} - -bool Win32ConsoleBuffer::resizeBufferRange(const Coord &initialSize, - Coord &finalSize) { - if (SetConsoleScreenBufferSize(m_conout, initialSize)) { - finalSize = initialSize; - return true; - } - // The font might be too small to accommodate a very narrow console window. - // In that case, rather than simply give up, it's better to try wider - // buffer sizes until the call succeeds. - Coord size = initialSize; - while (size.X < 20) { - size.X++; - if (SetConsoleScreenBufferSize(m_conout, size)) { - finalSize = size; - trace("SetConsoleScreenBufferSize: initial size (%d,%d) failed, " - "but wider size (%d,%d) succeeded", - initialSize.X, initialSize.Y, - finalSize.X, finalSize.Y); - return true; - } - } - trace("SetConsoleScreenBufferSize failed: " - "tried (%d,%d) through (%d,%d)", - initialSize.X, initialSize.Y, - size.X, size.Y); - return false; -} - -void Win32ConsoleBuffer::resizeBuffer(const Coord &size) { - // TODO: error handling - if (!SetConsoleScreenBufferSize(m_conout, size)) { - trace("SetConsoleScreenBufferSize failed: size=(%d,%d)", - size.X, size.Y); - } -} - -void Win32ConsoleBuffer::moveWindow(const SmallRect &rect) { - // TODO: error handling - if (!SetConsoleWindowInfo(m_conout, TRUE, &rect)) { - trace("SetConsoleWindowInfo failed"); - } -} - -Coord Win32ConsoleBuffer::cursorPosition() { - return bufferInfo().dwCursorPosition; -} - -void Win32ConsoleBuffer::setCursorPosition(const Coord &coord) { - // TODO: error handling - if (!SetConsoleCursorPosition(m_conout, coord)) { - trace("SetConsoleCursorPosition failed"); - } -} - -void Win32ConsoleBuffer::read(const SmallRect &rect, CHAR_INFO *data) { - // TODO: error handling - SmallRect tmp(rect); - if (!ReadConsoleOutputW(m_conout, data, rect.size(), Coord(), &tmp) && - isTracingEnabled()) { - StringBuilder sb(256); - auto outStruct = [&](const SMALL_RECT &sr) { - sb << "{L=" << sr.Left << ",T=" << sr.Top - << ",R=" << sr.Right << ",B=" << sr.Bottom << '}'; - }; - sb << "Win32ConsoleBuffer::read: ReadConsoleOutput failed: readRegion="; - outStruct(rect); - CONSOLE_SCREEN_BUFFER_INFO info = {}; - if (GetConsoleScreenBufferInfo(m_conout, &info)) { - sb << ", dwSize=(" << info.dwSize.X << ',' << info.dwSize.Y - << "), srWindow="; - outStruct(info.srWindow); - } else { - sb << ", GetConsoleScreenBufferInfo also failed"; - } - trace("%s", sb.c_str()); - } -} - -void Win32ConsoleBuffer::write(const SmallRect &rect, const CHAR_INFO *data) { - // TODO: error handling - SmallRect tmp(rect); - if (!WriteConsoleOutputW(m_conout, data, rect.size(), Coord(), &tmp)) { - trace("WriteConsoleOutput failed"); - } -} - -void Win32ConsoleBuffer::setTextAttribute(WORD attributes) { - if (!SetConsoleTextAttribute(m_conout, attributes)) { - trace("SetConsoleTextAttribute failed"); - } -} diff --git a/node_modules/node-pty/deps/winpty/src/agent/Win32ConsoleBuffer.h b/node_modules/node-pty/deps/winpty/src/agent/Win32ConsoleBuffer.h deleted file mode 100644 index a68d8d3..0000000 --- a/node_modules/node-pty/deps/winpty/src/agent/Win32ConsoleBuffer.h +++ /dev/null @@ -1,99 +0,0 @@ -// Copyright (c) 2011-2016 Ryan Prichard -// -// 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. - -#ifndef AGENT_WIN32_CONSOLE_BUFFER_H -#define AGENT_WIN32_CONSOLE_BUFFER_H - -#include - -#include - -#include - -#include "Coord.h" -#include "SmallRect.h" - -class ConsoleScreenBufferInfo : public CONSOLE_SCREEN_BUFFER_INFO { -public: - ConsoleScreenBufferInfo() - { - memset(this, 0, sizeof(*this)); - } - - Coord bufferSize() const { return dwSize; } - SmallRect windowRect() const { return srWindow; } - Coord cursorPosition() const { return dwCursorPosition; } -}; - -class Win32ConsoleBuffer { -private: - Win32ConsoleBuffer(HANDLE conout, bool owned) : - m_conout(conout), m_owned(owned) - { - } - -public: - static const int kDefaultAttributes = 7; - - ~Win32ConsoleBuffer() { - if (m_owned) { - CloseHandle(m_conout); - } - } - - static std::unique_ptr openStdout(); - static std::unique_ptr openConout(); - static std::unique_ptr createErrorBuffer(); - - Win32ConsoleBuffer(const Win32ConsoleBuffer &other) = delete; - Win32ConsoleBuffer &operator=(const Win32ConsoleBuffer &other) = delete; - - HANDLE conout(); - void clearLines(int row, int count, const ConsoleScreenBufferInfo &info); - void clearAllLines(const ConsoleScreenBufferInfo &info); - - // Buffer and window sizes. - ConsoleScreenBufferInfo bufferInfo(); - Coord bufferSize(); - SmallRect windowRect(); - void resizeBuffer(const Coord &size); - bool resizeBufferRange(const Coord &initialSize, Coord &finalSize); - bool resizeBufferRange(const Coord &initialSize) { - Coord dummy; - return resizeBufferRange(initialSize, dummy); - } - void moveWindow(const SmallRect &rect); - - // Cursor. - Coord cursorPosition(); - void setCursorPosition(const Coord &point); - - // Screen content. - void read(const SmallRect &rect, CHAR_INFO *data); - void write(const SmallRect &rect, const CHAR_INFO *data); - - void setTextAttribute(WORD attributes); - -private: - HANDLE m_conout = nullptr; - bool m_owned = false; -}; - -#endif // AGENT_WIN32_CONSOLE_BUFFER_H diff --git a/node_modules/node-pty/deps/winpty/src/agent/main.cc b/node_modules/node-pty/deps/winpty/src/agent/main.cc deleted file mode 100644 index 2420fde..0000000 --- a/node_modules/node-pty/deps/winpty/src/agent/main.cc +++ /dev/null @@ -1,114 +0,0 @@ -// Copyright (c) 2011-2015 Ryan Prichard -// -// 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. - -#include -#include -#include -#include - -#include "../shared/StringUtil.h" -#include "../shared/WindowsVersion.h" -#include "../shared/WinptyAssert.h" -#include "../shared/WinptyVersion.h" - -#include "Agent.h" -#include "AgentCreateDesktop.h" -#include "DebugShowInput.h" - -const char USAGE[] = -"Usage: %ls controlPipeName flags mouseMode cols rows\n" -"Usage: %ls controlPipeName --create-desktop\n" -"\n" -"Ordinarily, this program is launched by winpty.dll and is not directly\n" -"useful to winpty users. However, it also has options intended for\n" -"debugging winpty.\n" -"\n" -"Usage: %ls [options]\n" -"\n" -"Options:\n" -" --show-input [--with-mouse] [--escape-input]\n" -" Dump INPUT_RECORDs from the console input buffer\n" -" --with-mouse: Include MOUSE_INPUT_RECORDs in the dump\n" -" output\n" -" --escape-input: Direct the new Windows 10 console to use\n" -" escape sequences for input\n" -" --version Print the winpty version\n"; - -static uint64_t winpty_atoi64(const char *str) { - return strtoll(str, NULL, 10); -} - -int main() { - dumpWindowsVersion(); - dumpVersionToTrace(); - - // Technically, we should free the CommandLineToArgvW return value using - // a single call to LocalFree, but the call will never actually happen in - // the normal case. - int argc = 0; - wchar_t *cmdline = GetCommandLineW(); - ASSERT(cmdline != nullptr && "GetCommandLineW returned NULL"); - wchar_t **argv = CommandLineToArgvW(cmdline, &argc); - ASSERT(argv != nullptr && "CommandLineToArgvW returned NULL"); - - if (argc == 2 && !wcscmp(argv[1], L"--version")) { - dumpVersionToStdout(); - return 0; - } - - if (argc >= 2 && !wcscmp(argv[1], L"--show-input")) { - bool withMouse = false; - bool escapeInput = false; - for (int i = 2; i < argc; ++i) { - if (!wcscmp(argv[i], L"--with-mouse")) { - withMouse = true; - } else if (!wcscmp(argv[i], L"--escape-input")) { - escapeInput = true; - } else { - fprintf(stderr, "Unrecognized --show-input option: %ls\n", - argv[i]); - return 1; - } - } - debugShowInput(withMouse, escapeInput); - return 0; - } - - if (argc == 3 && !wcscmp(argv[2], L"--create-desktop")) { - handleCreateDesktop(argv[1]); - return 0; - } - - if (argc != 6) { - fprintf(stderr, USAGE, argv[0], argv[0], argv[0]); - return 1; - } - - Agent agent(argv[1], - winpty_atoi64(utf8FromWide(argv[2]).c_str()), - atoi(utf8FromWide(argv[3]).c_str()), - atoi(utf8FromWide(argv[4]).c_str()), - atoi(utf8FromWide(argv[5]).c_str())); - agent.run(); - - // The Agent destructor shouldn't return, but if it does, exit - // unsuccessfully. - return 1; -} diff --git a/node_modules/node-pty/deps/winpty/src/agent/subdir.mk b/node_modules/node-pty/deps/winpty/src/agent/subdir.mk deleted file mode 100644 index 1c7d37e..0000000 --- a/node_modules/node-pty/deps/winpty/src/agent/subdir.mk +++ /dev/null @@ -1,61 +0,0 @@ -# Copyright (c) 2011-2015 Ryan Prichard -# -# 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. - -ALL_TARGETS += build/winpty-agent.exe - -$(eval $(call def_mingw_target,agent,-DWINPTY_AGENT_ASSERT)) - -AGENT_OBJECTS = \ - build/agent/agent/Agent.o \ - build/agent/agent/AgentCreateDesktop.o \ - build/agent/agent/ConsoleFont.o \ - build/agent/agent/ConsoleInput.o \ - build/agent/agent/ConsoleInputReencoding.o \ - build/agent/agent/ConsoleLine.o \ - build/agent/agent/DebugShowInput.o \ - build/agent/agent/DefaultInputMap.o \ - build/agent/agent/EventLoop.o \ - build/agent/agent/InputMap.o \ - build/agent/agent/LargeConsoleRead.o \ - build/agent/agent/NamedPipe.o \ - build/agent/agent/Scraper.o \ - build/agent/agent/Terminal.o \ - build/agent/agent/Win32Console.o \ - build/agent/agent/Win32ConsoleBuffer.o \ - build/agent/agent/main.o \ - build/agent/shared/BackgroundDesktop.o \ - build/agent/shared/Buffer.o \ - build/agent/shared/DebugClient.o \ - build/agent/shared/GenRandom.o \ - build/agent/shared/OwnedHandle.o \ - build/agent/shared/StringUtil.o \ - build/agent/shared/WindowsSecurity.o \ - build/agent/shared/WindowsVersion.o \ - build/agent/shared/WinptyAssert.o \ - build/agent/shared/WinptyException.o \ - build/agent/shared/WinptyVersion.o - -build/agent/shared/WinptyVersion.o : build/gen/GenVersion.h - -build/winpty-agent.exe : $(AGENT_OBJECTS) - $(info Linking $@) - @$(MINGW_CXX) $(MINGW_LDFLAGS) -o $@ $^ - --include $(AGENT_OBJECTS:.o=.d) diff --git a/node_modules/node-pty/deps/winpty/src/configurations.gypi b/node_modules/node-pty/deps/winpty/src/configurations.gypi deleted file mode 100644 index e990a60..0000000 --- a/node_modules/node-pty/deps/winpty/src/configurations.gypi +++ /dev/null @@ -1,60 +0,0 @@ -# By default gyp/msbuild build for 32-bit Windows. This gyp include file -# defines configurations for both 32-bit and 64-bit Windows. To use it, run: -# -# C:\...\winpty\src>gyp -I configurations.gypi -# -# This command generates Visual Studio project files with a Release -# configuration and two Platforms--Win32 and x64. Both can be built: -# -# C:\...\winpty\src>msbuild winpty.sln /p:Platform=Win32 -# C:\...\winpty\src>msbuild winpty.sln /p:Platform=x64 -# -# The output is placed in: -# -# C:\...\winpty\src\Release\Win32 -# C:\...\winpty\src\Release\x64 -# -# Windows XP note: By default, the project files will use the default "toolset" -# for the given MSVC version. For MSVC 2013 and MSVC 2015, the default toolset -# generates binaries that do not run on Windows XP. To target Windows XP, -# select the XP-specific toolset by passing -# -D WINPTY_MSBUILD_TOOLSET={v120_xp,v140_xp} to gyp (v120_xp == MSVC 2013, -# v140_xp == MSVC 2015). Unfortunately, it isn't possible to have a single -# project file with configurations for both XP and post-XP. This seems to be a -# limitation of the MSVC project file format. -# -# This file is not included by default, because I suspect it would interfere -# with node-gyp, which has a different system for building 32-vs-64-bit -# binaries. It uses a common.gypi, and the project files it generates can only -# build a single architecture, the output paths are not differentiated by -# architecture. - -{ - 'variables': { - 'WINPTY_MSBUILD_TOOLSET%': '', - }, - 'target_defaults': { - 'default_configuration': 'Release_Win32', - 'configurations': { - 'Release_Win32': { - 'msvs_configuration_platform': 'Win32', - }, - 'Release_x64': { - 'msvs_configuration_platform': 'x64', - }, - }, - 'msvs_configuration_attributes': { - 'OutputDirectory': '$(SolutionDir)$(ConfigurationName)\\$(Platform)', - 'IntermediateDirectory': '$(ConfigurationName)\\$(Platform)\\obj\\$(ProjectName)', - }, - 'msvs_settings': { - 'VCLinkerTool': { - 'SubSystem': '1', # /SUBSYSTEM:CONSOLE - }, - 'VCCLCompilerTool': { - 'RuntimeLibrary': '0', # MultiThreaded (/MT) - }, - }, - 'msbuild_toolset' : '<(WINPTY_MSBUILD_TOOLSET)', - } -} diff --git a/node_modules/node-pty/deps/winpty/src/debugserver/DebugServer.cc b/node_modules/node-pty/deps/winpty/src/debugserver/DebugServer.cc deleted file mode 100644 index 353d31c..0000000 --- a/node_modules/node-pty/deps/winpty/src/debugserver/DebugServer.cc +++ /dev/null @@ -1,117 +0,0 @@ -// Copyright (c) 2015 Ryan Prichard -// -// 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. - -#include -#include - -#include - -#include "../shared/WindowsSecurity.h" -#include "../shared/WinptyException.h" - -const wchar_t *kPipeName = L"\\\\.\\pipe\\DebugServer"; - -// A message may not be larger than this size. -const int MSG_SIZE = 4096; - -static void usage(const char *program, int code) { - printf("Usage: %s [--everyone]\n" - "\n" - "Creates the named pipe %ls and reads messages. Prints each\n" - "message to stdout. By default, only the current user can send messages.\n" - "Pass --everyone to let anyone send a message.\n" - "\n" - "Use the WINPTY_DEBUG environment variable to enable winpty trace output.\n" - "(e.g. WINPTY_DEBUG=trace for the default trace output.) Set WINPTYDBG=1\n" - "to enable trace with older winpty versions.\n", - program, kPipeName); - exit(code); -} - -int main(int argc, char *argv[]) { - bool everyone = false; - for (int i = 1; i < argc; ++i) { - std::string arg = argv[i]; - if (arg == "--everyone") { - everyone = true; - } else if (arg == "-h" || arg == "--help") { - usage(argv[0], 0); - } else { - usage(argv[0], 1); - } - } - - SecurityDescriptor sd; - PSECURITY_ATTRIBUTES psa = nullptr; - SECURITY_ATTRIBUTES sa = {}; - if (everyone) { - try { - sd = createPipeSecurityDescriptorOwnerFullControlEveryoneWrite(); - } catch (const WinptyException &e) { - fprintf(stderr, - "error creating security descriptor: %ls\n", e.what()); - exit(1); - } - sa.nLength = sizeof(sa); - sa.lpSecurityDescriptor = sd.get(); - psa = &sa; - } - - HANDLE serverPipe = CreateNamedPipeW( - kPipeName, - /*dwOpenMode=*/PIPE_ACCESS_DUPLEX | FILE_FLAG_FIRST_PIPE_INSTANCE, - /*dwPipeMode=*/PIPE_TYPE_MESSAGE | PIPE_READMODE_MESSAGE | - rejectRemoteClientsPipeFlag(), - /*nMaxInstances=*/1, - /*nOutBufferSize=*/MSG_SIZE, - /*nInBufferSize=*/MSG_SIZE, - /*nDefaultTimeOut=*/10 * 1000, - psa); - - if (serverPipe == INVALID_HANDLE_VALUE) { - fprintf(stderr, "error: could not create %ls pipe: error %u\n", - kPipeName, static_cast(GetLastError())); - exit(1); - } - - char msgBuffer[MSG_SIZE + 1]; - - while (true) { - if (!ConnectNamedPipe(serverPipe, nullptr)) { - fprintf(stderr, "error: ConnectNamedPipe failed\n"); - fflush(stderr); - exit(1); - } - DWORD bytesRead = 0; - if (!ReadFile(serverPipe, msgBuffer, MSG_SIZE, &bytesRead, nullptr)) { - fprintf(stderr, "error: ReadFile on pipe failed\n"); - fflush(stderr); - DisconnectNamedPipe(serverPipe); - continue; - } - msgBuffer[bytesRead] = '\n'; - fwrite(msgBuffer, 1, bytesRead + 1, stdout); - fflush(stdout); - - DWORD bytesWritten = 0; - WriteFile(serverPipe, "OK", 2, &bytesWritten, nullptr); - DisconnectNamedPipe(serverPipe); - } -} diff --git a/node_modules/node-pty/deps/winpty/src/debugserver/subdir.mk b/node_modules/node-pty/deps/winpty/src/debugserver/subdir.mk deleted file mode 100644 index beed1bd..0000000 --- a/node_modules/node-pty/deps/winpty/src/debugserver/subdir.mk +++ /dev/null @@ -1,41 +0,0 @@ -# Copyright (c) 2015 Ryan Prichard -# -# 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. - -ALL_TARGETS += build/winpty-debugserver.exe - -$(eval $(call def_mingw_target,debugserver,)) - -DEBUGSERVER_OBJECTS = \ - build/debugserver/debugserver/DebugServer.o \ - build/debugserver/shared/DebugClient.o \ - build/debugserver/shared/OwnedHandle.o \ - build/debugserver/shared/StringUtil.o \ - build/debugserver/shared/WindowsSecurity.o \ - build/debugserver/shared/WindowsVersion.o \ - build/debugserver/shared/WinptyAssert.o \ - build/debugserver/shared/WinptyException.o - -build/debugserver/shared/WindowsVersion.o : build/gen/GenVersion.h - -build/winpty-debugserver.exe : $(DEBUGSERVER_OBJECTS) - $(info Linking $@) - @$(MINGW_CXX) $(MINGW_LDFLAGS) -o $@ $^ - --include $(DEBUGSERVER_OBJECTS:.o=.d) diff --git a/node_modules/node-pty/deps/winpty/src/include/winpty.h b/node_modules/node-pty/deps/winpty/src/include/winpty.h deleted file mode 100644 index fdfe4bc..0000000 --- a/node_modules/node-pty/deps/winpty/src/include/winpty.h +++ /dev/null @@ -1,242 +0,0 @@ -/* - * Copyright (c) 2011-2016 Ryan Prichard - * - * 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. - */ - -#ifndef WINPTY_H -#define WINPTY_H - -#include - -#include "winpty_constants.h" - -/* On 32-bit Windows, winpty functions have the default __cdecl (not __stdcall) - * calling convention. (64-bit Windows has only a single calling convention.) - * When compiled with __declspec(dllexport), with either MinGW or MSVC, the - * winpty functions are unadorned--no underscore prefix or '@nn' suffix--so - * GetProcAddress can be used easily. */ -#ifdef COMPILING_WINPTY_DLL -#define WINPTY_API __declspec(dllexport) -#else -#define WINPTY_API __declspec(dllimport) -#endif - -#ifdef __cplusplus -extern "C" { -#endif - -/* The winpty API uses wide characters, instead of UTF-8, to avoid conversion - * complications related to surrogates. Windows generally tolerates unpaired - * surrogates in text, which makes conversion to and from UTF-8 ambiguous and - * complicated. (There are different UTF-8 variants that deal with UTF-16 - * surrogates differently.) */ - - - -/***************************************************************************** - * Error handling. */ - -/* All the APIs have an optional winpty_error_t output parameter. If a - * non-NULL argument is specified, then either the API writes NULL to the - * value (on success) or writes a newly allocated winpty_error_t object. The - * object must be freed using winpty_error_free. */ - -/* An error object. */ -typedef struct winpty_error_s winpty_error_t; -typedef winpty_error_t *winpty_error_ptr_t; - -/* An error code -- one of WINPTY_ERROR_xxx. */ -typedef DWORD winpty_result_t; - -/* Gets the error code from the error object. */ -WINPTY_API winpty_result_t winpty_error_code(winpty_error_ptr_t err); - -/* Returns a textual representation of the error. The string is freed when - * the error is freed. */ -WINPTY_API LPCWSTR winpty_error_msg(winpty_error_ptr_t err); - -/* Free the error object. Every error returned from the winpty API must be - * freed. */ -WINPTY_API void winpty_error_free(winpty_error_ptr_t err); - - - -/***************************************************************************** - * Configuration of a new agent. */ - -/* The winpty_config_t object is not thread-safe. */ -typedef struct winpty_config_s winpty_config_t; - -/* Allocate a winpty_config_t value. Returns NULL on error. There are no - * required settings -- the object may immediately be used. agentFlags is a - * set of zero or more WINPTY_FLAG_xxx values. An unrecognized flag results - * in an assertion failure. */ -WINPTY_API winpty_config_t * -winpty_config_new(UINT64 agentFlags, winpty_error_ptr_t *err /*OPTIONAL*/); - -/* Free the cfg object after passing it to winpty_open. */ -WINPTY_API void winpty_config_free(winpty_config_t *cfg); - -WINPTY_API void -winpty_config_set_initial_size(winpty_config_t *cfg, int cols, int rows); - -/* Set the mouse mode to one of the WINPTY_MOUSE_MODE_xxx constants. */ -WINPTY_API void -winpty_config_set_mouse_mode(winpty_config_t *cfg, int mouseMode); - -/* Amount of time to wait for the agent to startup and to wait for any given - * agent RPC request. Must be greater than 0. Can be INFINITE. */ -WINPTY_API void -winpty_config_set_agent_timeout(winpty_config_t *cfg, DWORD timeoutMs); - - - -/***************************************************************************** - * Start the agent. */ - -/* The winpty_t object is thread-safe. */ -typedef struct winpty_s winpty_t; - -/* Starts the agent. Returns NULL on error. This process will connect to the - * agent over a control pipe, and the agent will open data pipes (e.g. CONIN - * and CONOUT). */ -WINPTY_API winpty_t * -winpty_open(const winpty_config_t *cfg, - winpty_error_ptr_t *err /*OPTIONAL*/); - -/* A handle to the agent process. This value is valid for the lifetime of the - * winpty_t object. Do not close it. */ -WINPTY_API HANDLE winpty_agent_process(winpty_t *wp); - - - -/***************************************************************************** - * I/O pipes. */ - -/* Returns the names of named pipes used for terminal I/O. Each input or - * output direction uses a different half-duplex pipe. The agent creates - * these pipes, and the client can connect to them using ordinary I/O methods. - * The strings are freed when the winpty_t object is freed. - * - * winpty_conerr_name returns NULL unless WINPTY_FLAG_CONERR is specified. - * - * N.B.: CreateFile does not block when connecting to a local server pipe. If - * the server pipe does not exist or is already connected, then it fails - * instantly. */ -WINPTY_API LPCWSTR winpty_conin_name(winpty_t *wp); -WINPTY_API LPCWSTR winpty_conout_name(winpty_t *wp); -WINPTY_API LPCWSTR winpty_conerr_name(winpty_t *wp); - - - -/***************************************************************************** - * winpty agent RPC call: process creation. */ - -/* The winpty_spawn_config_t object is not thread-safe. */ -typedef struct winpty_spawn_config_s winpty_spawn_config_t; - -/* winpty_spawn_config strings do not need to live as long as the config - * object. They are copied. Returns NULL on error. spawnFlags is a set of - * zero or more WINPTY_SPAWN_FLAG_xxx values. An unrecognized flag results in - * an assertion failure. - * - * env is a a pointer to an environment block like that passed to - * CreateProcess--a contiguous array of NUL-terminated "VAR=VAL" strings - * followed by a final NUL terminator. - * - * N.B.: If you want to gather all of the child's output, you may want the - * WINPTY_SPAWN_FLAG_AUTO_SHUTDOWN flag. - */ -WINPTY_API winpty_spawn_config_t * -winpty_spawn_config_new(UINT64 spawnFlags, - LPCWSTR appname /*OPTIONAL*/, - LPCWSTR cmdline /*OPTIONAL*/, - LPCWSTR cwd /*OPTIONAL*/, - LPCWSTR env /*OPTIONAL*/, - winpty_error_ptr_t *err /*OPTIONAL*/); - -/* Free the cfg object after passing it to winpty_spawn. */ -WINPTY_API void winpty_spawn_config_free(winpty_spawn_config_t *cfg); - -/* - * Spawns the new process. - * - * The function initializes all output parameters to zero or NULL. - * - * On success, the function returns TRUE. For each of process_handle and - * thread_handle that is non-NULL, the HANDLE returned from CreateProcess is - * duplicated from the agent and returned to the winpty client. The client is - * responsible for closing these HANDLES. - * - * On failure, the function returns FALSE, and if err is non-NULL, then *err - * is set to an error object. - * - * If the agent's CreateProcess call failed, then *create_process_error is set - * to GetLastError(), and the WINPTY_ERROR_SPAWN_CREATE_PROCESS_FAILED error - * is returned. - * - * winpty_spawn can only be called once per winpty_t object. If it is called - * before the output data pipe(s) is/are connected, then collected output is - * buffered until the pipes are connected, rather than being discarded. - * - * N.B.: GetProcessId works even if the process has exited. The PID is not - * recycled until the NT process object is freed. - * (https://blogs.msdn.microsoft.com/oldnewthing/20110107-00/?p=11803) - */ -WINPTY_API BOOL -winpty_spawn(winpty_t *wp, - const winpty_spawn_config_t *cfg, - HANDLE *process_handle /*OPTIONAL*/, - HANDLE *thread_handle /*OPTIONAL*/, - DWORD *create_process_error /*OPTIONAL*/, - winpty_error_ptr_t *err /*OPTIONAL*/); - - - -/***************************************************************************** - * winpty agent RPC calls: everything else */ - -/* Change the size of the Windows console window. */ -WINPTY_API BOOL -winpty_set_size(winpty_t *wp, int cols, int rows, - winpty_error_ptr_t *err /*OPTIONAL*/); - -/* Gets a list of processes attached to the console. */ -WINPTY_API int -winpty_get_console_process_list(winpty_t *wp, int *processList, const int processCount, - winpty_error_ptr_t *err /*OPTIONAL*/); - -/* Frees the winpty_t object and the OS resources contained in it. This - * call breaks the connection with the agent, which should then close its - * console, terminating the processes attached to it. - * - * This function must not be called if any other threads are using the - * winpty_t object. Undefined behavior results. */ -WINPTY_API void winpty_free(winpty_t *wp); - - - -/****************************************************************************/ - -#ifdef __cplusplus -} -#endif - -#endif /* WINPTY_H */ diff --git a/node_modules/node-pty/deps/winpty/src/include/winpty_constants.h b/node_modules/node-pty/deps/winpty/src/include/winpty_constants.h deleted file mode 100644 index 11e34cf..0000000 --- a/node_modules/node-pty/deps/winpty/src/include/winpty_constants.h +++ /dev/null @@ -1,131 +0,0 @@ -/* - * Copyright (c) 2016 Ryan Prichard - * - * 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. - */ - -#ifndef WINPTY_CONSTANTS_H -#define WINPTY_CONSTANTS_H - -/* - * You may want to include winpty.h instead, which includes this header. - * - * This file is split out from winpty.h so that the agent can access the - * winpty flags without also declaring the libwinpty APIs. - */ - -/***************************************************************************** - * Error codes. */ - -#define WINPTY_ERROR_SUCCESS 0 -#define WINPTY_ERROR_OUT_OF_MEMORY 1 -#define WINPTY_ERROR_SPAWN_CREATE_PROCESS_FAILED 2 -#define WINPTY_ERROR_LOST_CONNECTION 3 -#define WINPTY_ERROR_AGENT_EXE_MISSING 4 -#define WINPTY_ERROR_UNSPECIFIED 5 -#define WINPTY_ERROR_AGENT_DIED 6 -#define WINPTY_ERROR_AGENT_TIMEOUT 7 -#define WINPTY_ERROR_AGENT_CREATION_FAILED 8 - - - -/***************************************************************************** - * Configuration of a new agent. */ - -/* Create a new screen buffer (connected to the "conerr" terminal pipe) and - * pass it to child processes as the STDERR handle. This flag also prevents - * the agent from reopening CONOUT$ when it polls -- regardless of whether the - * active screen buffer changes, winpty continues to monitor the original - * primary screen buffer. */ -#define WINPTY_FLAG_CONERR 0x1ull - -/* Don't output escape sequences. */ -#define WINPTY_FLAG_PLAIN_OUTPUT 0x2ull - -/* Do output color escape sequences. These escapes are output by default, but - * are suppressed with WINPTY_FLAG_PLAIN_OUTPUT. Use this flag to reenable - * them. */ -#define WINPTY_FLAG_COLOR_ESCAPES 0x4ull - -/* On XP and Vista, winpty needs to put the hidden console on a desktop in a - * service window station so that its polling does not interfere with other - * (visible) console windows. To create this desktop, it must change the - * process' window station (i.e. SetProcessWindowStation) for the duration of - * the winpty_open call. In theory, this change could interfere with the - * winpty client (e.g. other threads, spawning children), so winpty by default - * spawns a special agent process to create the hidden desktop. Spawning - * processes on Windows is slow, though, so if - * WINPTY_FLAG_ALLOW_CURPROC_DESKTOP_CREATION is set, winpty changes this - * process' window station instead. - * See https://github.com/rprichard/winpty/issues/58. */ -#define WINPTY_FLAG_ALLOW_CURPROC_DESKTOP_CREATION 0x8ull - -#define WINPTY_FLAG_MASK (0ull \ - | WINPTY_FLAG_CONERR \ - | WINPTY_FLAG_PLAIN_OUTPUT \ - | WINPTY_FLAG_COLOR_ESCAPES \ - | WINPTY_FLAG_ALLOW_CURPROC_DESKTOP_CREATION \ -) - -/* QuickEdit mode is initially disabled, and the agent does not send mouse - * mode sequences to the terminal. If it receives mouse input, though, it - * still writes MOUSE_EVENT_RECORD values into CONIN. */ -#define WINPTY_MOUSE_MODE_NONE 0 - -/* QuickEdit mode is initially enabled. As CONIN enters or leaves mouse - * input mode (i.e. where ENABLE_MOUSE_INPUT is on and ENABLE_QUICK_EDIT_MODE - * is off), the agent enables or disables mouse input on the terminal. - * - * This is the default mode. */ -#define WINPTY_MOUSE_MODE_AUTO 1 - -/* QuickEdit mode is initially disabled, and the agent enables the terminal's - * mouse input mode. It does not disable terminal mouse mode (until exit). */ -#define WINPTY_MOUSE_MODE_FORCE 2 - - - -/***************************************************************************** - * winpty agent RPC call: process creation. */ - -/* If the spawn is marked "auto-shutdown", then the agent shuts down console - * output once the process exits. The agent stops polling for new console - * output, and once all pending data has been written to the output pipe, the - * agent closes the pipe. (At that point, the pipe may still have data in it, - * which the client may read. Once all the data has been read, further reads - * return EOF.) */ -#define WINPTY_SPAWN_FLAG_AUTO_SHUTDOWN 1ull - -/* After the agent shuts down output, and after all output has been written - * into the pipe(s), exit the agent by closing the console. If there any - * surviving processes still attached to the console, they are killed. - * - * Note: With this flag, an RPC call (e.g. winpty_set_size) issued after the - * agent exits will fail with an I/O or dead-agent error. */ -#define WINPTY_SPAWN_FLAG_EXIT_AFTER_SHUTDOWN 2ull - -/* All the spawn flags. */ -#define WINPTY_SPAWN_FLAG_MASK (0ull \ - | WINPTY_SPAWN_FLAG_AUTO_SHUTDOWN \ - | WINPTY_SPAWN_FLAG_EXIT_AFTER_SHUTDOWN \ -) - - - -#endif /* WINPTY_CONSTANTS_H */ diff --git a/node_modules/node-pty/deps/winpty/src/libwinpty/AgentLocation.cc b/node_modules/node-pty/deps/winpty/src/libwinpty/AgentLocation.cc deleted file mode 100644 index 82d00b2..0000000 --- a/node_modules/node-pty/deps/winpty/src/libwinpty/AgentLocation.cc +++ /dev/null @@ -1,75 +0,0 @@ -// Copyright (c) 2011-2016 Ryan Prichard -// -// 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. - -#include "AgentLocation.h" - -#include - -#include - -#include "../shared/WinptyAssert.h" - -#include "LibWinptyException.h" - -#define AGENT_EXE L"winpty-agent.exe" - -static HMODULE getCurrentModule() { - HMODULE module; - if (!GetModuleHandleExW( - GET_MODULE_HANDLE_EX_FLAG_FROM_ADDRESS | - GET_MODULE_HANDLE_EX_FLAG_UNCHANGED_REFCOUNT, - reinterpret_cast(getCurrentModule), - &module)) { - ASSERT(false && "GetModuleHandleEx failed"); - } - return module; -} - -static std::wstring getModuleFileName(HMODULE module) { - const int bufsize = 4096; - wchar_t path[bufsize]; - int size = GetModuleFileNameW(module, path, bufsize); - ASSERT(size != 0 && size != bufsize); - return std::wstring(path); -} - -static std::wstring dirname(const std::wstring &path) { - std::wstring::size_type pos = path.find_last_of(L"\\/"); - if (pos == std::wstring::npos) { - return L""; - } else { - return path.substr(0, pos); - } -} - -static bool pathExists(const std::wstring &path) { - return GetFileAttributesW(path.c_str()) != 0xFFFFFFFF; -} - -std::wstring findAgentProgram() { - std::wstring progDir = dirname(getModuleFileName(getCurrentModule())); - std::wstring ret = progDir + (L"\\" AGENT_EXE); - if (!pathExists(ret)) { - throw LibWinptyException( - WINPTY_ERROR_AGENT_EXE_MISSING, - (L"agent executable does not exist: '" + ret + L"'").c_str()); - } - return ret; -} diff --git a/node_modules/node-pty/deps/winpty/src/libwinpty/AgentLocation.h b/node_modules/node-pty/deps/winpty/src/libwinpty/AgentLocation.h deleted file mode 100644 index a96b854..0000000 --- a/node_modules/node-pty/deps/winpty/src/libwinpty/AgentLocation.h +++ /dev/null @@ -1,28 +0,0 @@ -// Copyright (c) 2011-2016 Ryan Prichard -// -// 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. - -#ifndef LIBWINPTY_AGENT_LOCATION_H -#define LIBWINPTY_AGENT_LOCATION_H - -#include - -std::wstring findAgentProgram(); - -#endif // LIBWINPTY_AGENT_LOCATION_H diff --git a/node_modules/node-pty/deps/winpty/src/libwinpty/LibWinptyException.h b/node_modules/node-pty/deps/winpty/src/libwinpty/LibWinptyException.h deleted file mode 100644 index 2274798..0000000 --- a/node_modules/node-pty/deps/winpty/src/libwinpty/LibWinptyException.h +++ /dev/null @@ -1,54 +0,0 @@ -// Copyright (c) 2016 Ryan Prichard -// -// 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. - -#ifndef LIB_WINPTY_EXCEPTION_H -#define LIB_WINPTY_EXCEPTION_H - -#include "../include/winpty.h" - -#include "../shared/WinptyException.h" - -#include -#include - -class LibWinptyException : public WinptyException { -public: - LibWinptyException(winpty_result_t code, const wchar_t *what) : - m_code(code), m_what(std::make_shared(what)) {} - - winpty_result_t code() const WINPTY_NOEXCEPT { - return m_code; - } - - const wchar_t *what() const WINPTY_NOEXCEPT override { - return m_what->c_str(); - } - - std::shared_ptr whatSharedStr() const WINPTY_NOEXCEPT { - return m_what; - } - -private: - winpty_result_t m_code; - // Using a shared_ptr ensures that copying the object raises no exception. - std::shared_ptr m_what; -}; - -#endif // LIB_WINPTY_EXCEPTION_H diff --git a/node_modules/node-pty/deps/winpty/src/libwinpty/WinptyInternal.h b/node_modules/node-pty/deps/winpty/src/libwinpty/WinptyInternal.h deleted file mode 100644 index 93e992d..0000000 --- a/node_modules/node-pty/deps/winpty/src/libwinpty/WinptyInternal.h +++ /dev/null @@ -1,72 +0,0 @@ -// Copyright (c) 2016 Ryan Prichard -// -// 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. - -#ifndef LIBWINPTY_WINPTY_INTERNAL_H -#define LIBWINPTY_WINPTY_INTERNAL_H - -#include -#include - -#include "../include/winpty.h" - -#include "../shared/Mutex.h" -#include "../shared/OwnedHandle.h" - -// The structures in this header are not intended to be accessed directly by -// client programs. - -struct winpty_error_s { - winpty_result_t code; - const wchar_t *msgStatic; - // Use a pointer to a std::shared_ptr so that the struct remains simple - // enough to statically initialize, for the benefit of static error - // objects like kOutOfMemory. - std::shared_ptr *msgDynamic; -}; - -struct winpty_config_s { - uint64_t flags = 0; - int cols = 80; - int rows = 25; - int mouseMode = WINPTY_MOUSE_MODE_AUTO; - DWORD timeoutMs = 30000; -}; - -struct winpty_s { - Mutex mutex; - OwnedHandle agentProcess; - OwnedHandle controlPipe; - DWORD agentTimeoutMs = 0; - OwnedHandle ioEvent; - std::wstring spawnDesktopName; - std::wstring coninPipeName; - std::wstring conoutPipeName; - std::wstring conerrPipeName; -}; - -struct winpty_spawn_config_s { - uint64_t winptyFlags = 0; - std::wstring appname; - std::wstring cmdline; - std::wstring cwd; - std::wstring env; -}; - -#endif // LIBWINPTY_WINPTY_INTERNAL_H diff --git a/node_modules/node-pty/deps/winpty/src/libwinpty/subdir.mk b/node_modules/node-pty/deps/winpty/src/libwinpty/subdir.mk deleted file mode 100644 index ba32bad..0000000 --- a/node_modules/node-pty/deps/winpty/src/libwinpty/subdir.mk +++ /dev/null @@ -1,46 +0,0 @@ -# Copyright (c) 2011-2015 Ryan Prichard -# -# 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. - -ALL_TARGETS += build/winpty.dll - -$(eval $(call def_mingw_target,libwinpty,-DCOMPILING_WINPTY_DLL)) - -LIBWINPTY_OBJECTS = \ - build/libwinpty/libwinpty/AgentLocation.o \ - build/libwinpty/libwinpty/winpty.o \ - build/libwinpty/shared/BackgroundDesktop.o \ - build/libwinpty/shared/Buffer.o \ - build/libwinpty/shared/DebugClient.o \ - build/libwinpty/shared/GenRandom.o \ - build/libwinpty/shared/OwnedHandle.o \ - build/libwinpty/shared/StringUtil.o \ - build/libwinpty/shared/WindowsSecurity.o \ - build/libwinpty/shared/WindowsVersion.o \ - build/libwinpty/shared/WinptyAssert.o \ - build/libwinpty/shared/WinptyException.o \ - build/libwinpty/shared/WinptyVersion.o - -build/libwinpty/shared/WinptyVersion.o : build/gen/GenVersion.h - -build/winpty.dll : $(LIBWINPTY_OBJECTS) - $(info Linking $@) - @$(MINGW_CXX) $(MINGW_LDFLAGS) -shared -o $@ $^ -Wl,--out-implib,build/winpty.lib - --include $(LIBWINPTY_OBJECTS:.o=.d) diff --git a/node_modules/node-pty/deps/winpty/src/libwinpty/winpty.cc b/node_modules/node-pty/deps/winpty/src/libwinpty/winpty.cc deleted file mode 100644 index 3d97749..0000000 --- a/node_modules/node-pty/deps/winpty/src/libwinpty/winpty.cc +++ /dev/null @@ -1,970 +0,0 @@ -// Copyright (c) 2011-2016 Ryan Prichard -// -// 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. - -#include - -#include -#include -#include - -#include -#include -#include - -#include "../include/winpty.h" - -#include "../shared/AgentMsg.h" -#include "../shared/BackgroundDesktop.h" -#include "../shared/Buffer.h" -#include "../shared/DebugClient.h" -#include "../shared/GenRandom.h" -#include "../shared/OwnedHandle.h" -#include "../shared/StringBuilder.h" -#include "../shared/StringUtil.h" -#include "../shared/WindowsSecurity.h" -#include "../shared/WindowsVersion.h" -#include "../shared/WinptyAssert.h" -#include "../shared/WinptyException.h" -#include "../shared/WinptyVersion.h" - -#include "AgentLocation.h" -#include "LibWinptyException.h" -#include "WinptyInternal.h" - - - -/***************************************************************************** - * Error handling -- translate C++ exceptions to an optional error object - * output and log the result. */ - -static const winpty_error_s kOutOfMemory = { - WINPTY_ERROR_OUT_OF_MEMORY, - L"Out of memory", - nullptr -}; - -static const winpty_error_s kBadRpcPacket = { - WINPTY_ERROR_UNSPECIFIED, - L"Bad RPC packet", - nullptr -}; - -static const winpty_error_s kUncaughtException = { - WINPTY_ERROR_UNSPECIFIED, - L"Uncaught C++ exception", - nullptr -}; - -/* Gets the error code from the error object. */ -WINPTY_API winpty_result_t winpty_error_code(winpty_error_ptr_t err) { - return err != nullptr ? err->code : WINPTY_ERROR_SUCCESS; -} - -/* Returns a textual representation of the error. The string is freed when - * the error is freed. */ -WINPTY_API LPCWSTR winpty_error_msg(winpty_error_ptr_t err) { - if (err != nullptr) { - if (err->msgStatic != nullptr) { - return err->msgStatic; - } else { - ASSERT(err->msgDynamic != nullptr); - std::wstring *msgPtr = err->msgDynamic->get(); - ASSERT(msgPtr != nullptr); - return msgPtr->c_str(); - } - } else { - return L"Success"; - } -} - -/* Free the error object. Every error returned from the winpty API must be - * freed. */ -WINPTY_API void winpty_error_free(winpty_error_ptr_t err) { - if (err != nullptr && err->msgDynamic != nullptr) { - delete err->msgDynamic; - delete err; - } -} - -static void translateException(winpty_error_ptr_t *&err) { - winpty_error_ptr_t ret = nullptr; - try { - try { - throw; - } catch (const ReadBuffer::DecodeError&) { - ret = const_cast(&kBadRpcPacket); - } catch (const LibWinptyException &e) { - std::unique_ptr obj(new winpty_error_t); - obj->code = e.code(); - obj->msgStatic = nullptr; - obj->msgDynamic = - new std::shared_ptr(e.whatSharedStr()); - ret = obj.release(); - } catch (const WinptyException &e) { - std::unique_ptr obj(new winpty_error_t); - std::shared_ptr msg(new std::wstring(e.what())); - obj->code = WINPTY_ERROR_UNSPECIFIED; - obj->msgStatic = nullptr; - obj->msgDynamic = new std::shared_ptr(msg); - ret = obj.release(); - } - } catch (const std::bad_alloc&) { - ret = const_cast(&kOutOfMemory); - } catch (...) { - ret = const_cast(&kUncaughtException); - } - trace("libwinpty error: code=%u msg='%s'", - static_cast(ret->code), - utf8FromWide(winpty_error_msg(ret)).c_str()); - if (err != nullptr) { - *err = ret; - } else { - winpty_error_free(ret); - } -} - -#define API_TRY \ - if (err != nullptr) { *err = nullptr; } \ - try - -#define API_CATCH(ret) \ - catch (...) { translateException(err); return (ret); } - - - -/***************************************************************************** - * Configuration of a new agent. */ - -WINPTY_API winpty_config_t * -winpty_config_new(UINT64 flags, winpty_error_ptr_t *err /*OPTIONAL*/) { - API_TRY { - ASSERT((flags & WINPTY_FLAG_MASK) == flags); - std::unique_ptr ret(new winpty_config_t); - ret->flags = flags; - return ret.release(); - } API_CATCH(nullptr) -} - -WINPTY_API void winpty_config_free(winpty_config_t *cfg) { - delete cfg; -} - -WINPTY_API void -winpty_config_set_initial_size(winpty_config_t *cfg, int cols, int rows) { - ASSERT(cfg != nullptr && cols > 0 && rows > 0); - cfg->cols = cols; - cfg->rows = rows; -} - -WINPTY_API void -winpty_config_set_mouse_mode(winpty_config_t *cfg, int mouseMode) { - ASSERT(cfg != nullptr && - mouseMode >= WINPTY_MOUSE_MODE_NONE && - mouseMode <= WINPTY_MOUSE_MODE_FORCE); - cfg->mouseMode = mouseMode; -} - -WINPTY_API void -winpty_config_set_agent_timeout(winpty_config_t *cfg, DWORD timeoutMs) { - ASSERT(cfg != nullptr && timeoutMs > 0); - cfg->timeoutMs = timeoutMs; -} - - - -/***************************************************************************** - * Agent I/O. */ - -namespace { - -// Once an I/O operation fails with ERROR_IO_PENDING, the caller *must* wait -// for it to complete, even after calling CancelIo on it! See -// https://blogs.msdn.microsoft.com/oldnewthing/20110202-00/?p=11613. This -// class enforces that requirement. -class PendingIo { - HANDLE m_file; - OVERLAPPED &m_over; - bool m_finished; -public: - // The file handle and OVERLAPPED object must live as long as the PendingIo - // object. - PendingIo(HANDLE file, OVERLAPPED &over) : - m_file(file), m_over(over), m_finished(false) {} - ~PendingIo() { - if (!m_finished) { - // We're not usually that interested in CancelIo's return value. - // In any case, we must not throw an exception in this dtor. - CancelIo(m_file); - waitForCompletion(); - } - } - std::tuple waitForCompletion(DWORD &actual) WINPTY_NOEXCEPT { - m_finished = true; - const BOOL success = - GetOverlappedResult(m_file, &m_over, &actual, TRUE); - return std::make_tuple(success, GetLastError()); - } - std::tuple waitForCompletion() WINPTY_NOEXCEPT { - DWORD actual = 0; - return waitForCompletion(actual); - } -}; - -} // anonymous namespace - -static void handlePendingIo(winpty_t &wp, OVERLAPPED &over, BOOL &success, - DWORD &lastError, DWORD &actual) { - if (!success && lastError == ERROR_IO_PENDING) { - PendingIo io(wp.controlPipe.get(), over); - const HANDLE waitHandles[2] = { wp.ioEvent.get(), - wp.agentProcess.get() }; - DWORD waitRet = WaitForMultipleObjects( - 2, waitHandles, FALSE, wp.agentTimeoutMs); - if (waitRet != WAIT_OBJECT_0) { - // The I/O is still pending. Cancel it, close the I/O event, and - // throw an exception. - if (waitRet == WAIT_OBJECT_0 + 1) { - throw LibWinptyException(WINPTY_ERROR_AGENT_DIED, L"agent died"); - } else if (waitRet == WAIT_TIMEOUT) { - throw LibWinptyException(WINPTY_ERROR_AGENT_TIMEOUT, - L"agent timed out"); - } else if (waitRet == WAIT_FAILED) { - throwWindowsError(L"WaitForMultipleObjects failed"); - } else { - ASSERT(false && - "unexpected WaitForMultipleObjects return value"); - } - } - std::tie(success, lastError) = io.waitForCompletion(actual); - } -} - -static void handlePendingIo(winpty_t &wp, OVERLAPPED &over, BOOL &success, - DWORD &lastError) { - DWORD actual = 0; - handlePendingIo(wp, over, success, lastError, actual); -} - -static void handleReadWriteErrors(winpty_t &wp, BOOL success, DWORD lastError, - const wchar_t *genericErrMsg) { - if (!success) { - // If the pipe connection is broken after it's been connected, then - // later I/O operations fail with ERROR_BROKEN_PIPE (reads) or - // ERROR_NO_DATA (writes). With Wine, they may also fail with - // ERROR_PIPE_NOT_CONNECTED. See this gist[1]. - // - // [1] https://gist.github.com/rprichard/8dd8ca134b39534b7da2733994aa07ba - if (lastError == ERROR_BROKEN_PIPE || lastError == ERROR_NO_DATA || - lastError == ERROR_PIPE_NOT_CONNECTED) { - throw LibWinptyException(WINPTY_ERROR_LOST_CONNECTION, - L"lost connection to agent"); - } else { - throwWindowsError(genericErrMsg, lastError); - } - } -} - -// Calls ConnectNamedPipe to wait until the agent connects to the control pipe. -static void -connectControlPipe(winpty_t &wp) { - OVERLAPPED over = {}; - over.hEvent = wp.ioEvent.get(); - BOOL success = ConnectNamedPipe(wp.controlPipe.get(), &over); - DWORD lastError = GetLastError(); - handlePendingIo(wp, over, success, lastError); - if (!success && lastError == ERROR_PIPE_CONNECTED) { - success = TRUE; - } - if (!success) { - throwWindowsError(L"ConnectNamedPipe failed", lastError); - } -} - -static void writeData(winpty_t &wp, const void *data, size_t amount) { - // Perform a single pipe write. - DWORD actual = 0; - OVERLAPPED over = {}; - over.hEvent = wp.ioEvent.get(); - BOOL success = WriteFile(wp.controlPipe.get(), data, amount, - &actual, &over); - DWORD lastError = GetLastError(); - if (!success) { - handlePendingIo(wp, over, success, lastError, actual); - handleReadWriteErrors(wp, success, lastError, L"WriteFile failed"); - ASSERT(success); - } - // TODO: Can a partial write actually happen somehow? - ASSERT(actual == amount && "WriteFile wrote fewer bytes than requested"); -} - -static inline WriteBuffer newPacket() { - WriteBuffer packet; - packet.putRawValue(0); // Reserve space for size. - return packet; -} - -static void writePacket(winpty_t &wp, WriteBuffer &packet) { - const auto &buf = packet.buf(); - packet.replaceRawValue(0, buf.size()); - writeData(wp, buf.data(), buf.size()); -} - -static size_t readData(winpty_t &wp, void *data, size_t amount) { - DWORD actual = 0; - OVERLAPPED over = {}; - over.hEvent = wp.ioEvent.get(); - BOOL success = ReadFile(wp.controlPipe.get(), data, amount, - &actual, &over); - DWORD lastError = GetLastError(); - if (!success) { - handlePendingIo(wp, over, success, lastError, actual); - handleReadWriteErrors(wp, success, lastError, L"ReadFile failed"); - } - return actual; -} - -static void readAll(winpty_t &wp, void *data, size_t amount) { - while (amount > 0) { - const size_t chunk = readData(wp, data, amount); - ASSERT(chunk <= amount && "readData result is larger than amount"); - data = reinterpret_cast(data) + chunk; - amount -= chunk; - } -} - -static uint64_t readUInt64(winpty_t &wp) { - uint64_t ret = 0; - readAll(wp, &ret, sizeof(ret)); - return ret; -} - -// Returns a reply packet's payload. -static ReadBuffer readPacket(winpty_t &wp) { - const uint64_t packetSize = readUInt64(wp); - if (packetSize < sizeof(packetSize) || packetSize > SIZE_MAX) { - throwWinptyException(L"Agent RPC error: invalid packet size"); - } - const size_t payloadSize = packetSize - sizeof(packetSize); - std::vector bytes(payloadSize); - readAll(wp, bytes.data(), bytes.size()); - return ReadBuffer(std::move(bytes)); -} - -static OwnedHandle createControlPipe(const std::wstring &name) { - const auto sd = createPipeSecurityDescriptorOwnerFullControl(); - if (!sd) { - throwWinptyException( - L"could not create the control pipe's SECURITY_DESCRIPTOR"); - } - SECURITY_ATTRIBUTES sa = {}; - sa.nLength = sizeof(sa); - sa.lpSecurityDescriptor = sd.get(); - HANDLE ret = CreateNamedPipeW(name.c_str(), - /*dwOpenMode=*/ - PIPE_ACCESS_DUPLEX | - FILE_FLAG_FIRST_PIPE_INSTANCE | - FILE_FLAG_OVERLAPPED, - /*dwPipeMode=*/rejectRemoteClientsPipeFlag(), - /*nMaxInstances=*/1, - /*nOutBufferSize=*/8192, - /*nInBufferSize=*/256, - /*nDefaultTimeOut=*/30000, - &sa); - if (ret == INVALID_HANDLE_VALUE) { - throwWindowsError(L"CreateNamedPipeW failed"); - } - return OwnedHandle(ret); -} - - - -/***************************************************************************** - * Start the agent. */ - -static OwnedHandle createEvent() { - // manual reset, initially unset - HANDLE h = CreateEventW(nullptr, TRUE, FALSE, nullptr); - if (h == nullptr) { - throwWindowsError(L"CreateEventW failed"); - } - return OwnedHandle(h); -} - -// For debugging purposes, provide a way to keep the console on the main window -// station, visible. -static bool shouldShowConsoleWindow() { - char buf[32]; - return GetEnvironmentVariableA("WINPTY_SHOW_CONSOLE", buf, sizeof(buf)) > 0; -} - -static bool shouldCreateBackgroundDesktop(bool &createUsingAgent) { - // Prior to Windows 7, winpty's repeated selection-deselection loop - // prevented the user from interacting with their *visible* console - // windows, unless we placed the console onto a background desktop. - // The SetProcessWindowStation call interferes with the clipboard and - // isn't thread-safe, though[1]. The call should perhaps occur in a - // special agent subprocess. Spawning a process in a background desktop - // also breaks ConEmu, but marking the process SW_HIDE seems to correct - // that[2]. - // - // Windows 7 moved a lot of console handling out of csrss.exe and into - // a per-console conhost.exe process, which may explain why it isn't - // affected. - // - // This is a somewhat risky change, so there are low-level flags to - // assist in debugging if there are issues. - // - // [1] https://github.com/rprichard/winpty/issues/58 - // [2] https://github.com/rprichard/winpty/issues/70 - bool ret = !shouldShowConsoleWindow() && !isAtLeastWindows7(); - const bool force = hasDebugFlag("force_desktop"); - const bool force_spawn = hasDebugFlag("force_desktop_spawn"); - const bool force_curproc = hasDebugFlag("force_desktop_curproc"); - const bool suppress = hasDebugFlag("no_desktop"); - if (force + force_spawn + force_curproc + suppress > 1) { - trace("error: Only one of force_desktop, force_desktop_spawn, " - "force_desktop_curproc, and no_desktop may be set"); - } else if (force) { - ret = true; - } else if (force_spawn) { - ret = true; - createUsingAgent = true; - } else if (force_curproc) { - ret = true; - createUsingAgent = false; - } else if (suppress) { - ret = false; - } - return ret; -} - -static bool shouldSpecifyHideFlag() { - const bool force = hasDebugFlag("force_sw_hide"); - const bool suppress = hasDebugFlag("no_sw_hide"); - bool ret = !shouldShowConsoleWindow(); - if (force && suppress) { - trace("error: Both the force_sw_hide and no_sw_hide flags are set"); - } else if (force) { - ret = true; - } else if (suppress) { - ret = false; - } - return ret; -} - -static OwnedHandle startAgentProcess( - const std::wstring &desktop, - const std::wstring &controlPipeName, - const std::wstring ¶ms, - DWORD creationFlags, - DWORD &agentPid) { - const std::wstring exePath = findAgentProgram(); - const std::wstring cmdline = - (WStringBuilder(256) - << L"\"" << exePath << L"\" " - << controlPipeName << L' ' - << params).str_moved(); - - auto cmdlineV = vectorWithNulFromString(cmdline); - auto desktopV = vectorWithNulFromString(desktop); - - // Start the agent. - STARTUPINFOW sui = {}; - sui.cb = sizeof(sui); - sui.lpDesktop = desktop.empty() ? nullptr : desktopV.data(); - - if (shouldSpecifyHideFlag()) { - sui.dwFlags |= STARTF_USESHOWWINDOW; - sui.wShowWindow = SW_HIDE; - } - PROCESS_INFORMATION pi = {}; - const BOOL success = - CreateProcessW(exePath.c_str(), - cmdlineV.data(), - nullptr, nullptr, - /*bInheritHandles=*/FALSE, - /*dwCreationFlags=*/creationFlags, - nullptr, nullptr, - &sui, &pi); - if (!success) { - const DWORD lastError = GetLastError(); - const auto errStr = - (WStringBuilder(256) - << L"winpty-agent CreateProcess failed: cmdline='" << cmdline - << L"' err=0x" << whexOfInt(lastError)).str_moved(); - throw LibWinptyException( - WINPTY_ERROR_AGENT_CREATION_FAILED, errStr.c_str()); - } - CloseHandle(pi.hThread); - TRACE("Created agent successfully, pid=%u, cmdline=%s", - static_cast(pi.dwProcessId), - utf8FromWide(cmdline).c_str()); - agentPid = pi.dwProcessId; - return OwnedHandle(pi.hProcess); -} - -static void verifyPipeClientPid(HANDLE serverPipe, DWORD agentPid) { - const auto client = getNamedPipeClientProcessId(serverPipe); - const auto success = std::get<0>(client); - const auto lastError = std::get<2>(client); - if (success == GetNamedPipeClientProcessId_Result::Success) { - const auto clientPid = std::get<1>(client); - if (clientPid != agentPid) { - WStringBuilder errMsg; - errMsg << L"Security check failed: pipe client pid (" << clientPid - << L") does not match agent pid (" << agentPid << L")"; - throwWinptyException(errMsg.c_str()); - } - } else if (success == GetNamedPipeClientProcessId_Result::UnsupportedOs) { - trace("Pipe client PID security check skipped: " - "GetNamedPipeClientProcessId unsupported on this OS version"); - } else { - throwWindowsError(L"GetNamedPipeClientProcessId failed", lastError); - } -} - -static std::unique_ptr -createAgentSession(const winpty_config_t *cfg, - const std::wstring &desktop, - const std::wstring ¶ms, - DWORD creationFlags) { - std::unique_ptr wp(new winpty_t); - wp->agentTimeoutMs = cfg->timeoutMs; - wp->ioEvent = createEvent(); - - // Create control server pipe. - const auto pipeName = - L"\\\\.\\pipe\\winpty-control-" + GenRandom().uniqueName(); - wp->controlPipe = createControlPipe(pipeName); - - DWORD agentPid = 0; - wp->agentProcess = startAgentProcess( - desktop, pipeName, params, creationFlags, agentPid); - connectControlPipe(*wp.get()); - verifyPipeClientPid(wp->controlPipe.get(), agentPid); - - return std::move(wp); -} - -namespace { - -class AgentDesktop { -public: - virtual std::wstring name() = 0; - virtual ~AgentDesktop() {} -}; - -class AgentDesktopDirect : public AgentDesktop { -public: - AgentDesktopDirect(BackgroundDesktop &&desktop) : - m_desktop(std::move(desktop)) - { - } - std::wstring name() override { return m_desktop.desktopName(); } -private: - BackgroundDesktop m_desktop; -}; - -class AgentDesktopIndirect : public AgentDesktop { -public: - AgentDesktopIndirect(std::unique_ptr &&wp, - std::wstring &&desktopName) : - m_wp(std::move(wp)), - m_desktopName(std::move(desktopName)) - { - } - std::wstring name() override { return m_desktopName; } -private: - std::unique_ptr m_wp; - std::wstring m_desktopName; -}; - -} // anonymous namespace - -std::unique_ptr -setupBackgroundDesktop(const winpty_config_t *cfg) { - bool useDesktopAgent = - !(cfg->flags & WINPTY_FLAG_ALLOW_CURPROC_DESKTOP_CREATION); - const bool useDesktop = shouldCreateBackgroundDesktop(useDesktopAgent); - - if (!useDesktop) { - return std::unique_ptr(); - } - - if (useDesktopAgent) { - auto wp = createAgentSession( - cfg, std::wstring(), L"--create-desktop", DETACHED_PROCESS); - - // Read the desktop name. - auto packet = readPacket(*wp.get()); - auto desktopName = packet.getWString(); - packet.assertEof(); - - if (desktopName.empty()) { - return std::unique_ptr(); - } else { - return std::unique_ptr( - new AgentDesktopIndirect(std::move(wp), - std::move(desktopName))); - } - } else { - try { - BackgroundDesktop desktop; - return std::unique_ptr(new AgentDesktopDirect( - std::move(desktop))); - } catch (const WinptyException &e) { - trace("Error: failed to create background desktop, " - "using original desktop instead: %s", - utf8FromWide(e.what()).c_str()); - return std::unique_ptr(); - } - } -} - -WINPTY_API winpty_t * -winpty_open(const winpty_config_t *cfg, - winpty_error_ptr_t *err /*OPTIONAL*/) { - API_TRY { - ASSERT(cfg != nullptr); - dumpWindowsVersion(); - dumpVersionToTrace(); - - // Setup a background desktop for the agent. - auto desktop = setupBackgroundDesktop(cfg); - const auto desktopName = desktop ? desktop->name() : std::wstring(); - - // Start the primary agent session. - const auto params = - (WStringBuilder(128) - << cfg->flags << L' ' - << cfg->mouseMode << L' ' - << cfg->cols << L' ' - << cfg->rows).str_moved(); - auto wp = createAgentSession(cfg, desktopName, params, - CREATE_NEW_CONSOLE); - - // Close handles to the background desktop and restore the original - // window station. This must wait until we know the agent is running - // -- if we close these handles too soon, then the desktop and - // windowstation will be destroyed before the agent can connect with - // them. - // - // If we used a separate agent process to create the desktop, we - // disconnect from that process here, allowing it to exit. - desktop.reset(); - - // If we ran the agent process on a background desktop, then when we - // spawn a child process from the agent, it will need to be explicitly - // placed back onto the original desktop. - if (!desktopName.empty()) { - wp->spawnDesktopName = getCurrentDesktopName(); - } - - // Get the CONIN/CONOUT pipe names. - auto packet = readPacket(*wp.get()); - wp->coninPipeName = packet.getWString(); - wp->conoutPipeName = packet.getWString(); - if (cfg->flags & WINPTY_FLAG_CONERR) { - wp->conerrPipeName = packet.getWString(); - } - packet.assertEof(); - - return wp.release(); - } API_CATCH(nullptr) -} - -WINPTY_API HANDLE winpty_agent_process(winpty_t *wp) { - ASSERT(wp != nullptr); - return wp->agentProcess.get(); -} - - - -/***************************************************************************** - * I/O pipes. */ - -static const wchar_t *cstrFromWStringOrNull(const std::wstring &str) { - try { - return str.c_str(); - } catch (const std::bad_alloc&) { - return nullptr; - } -} - -WINPTY_API LPCWSTR winpty_conin_name(winpty_t *wp) { - ASSERT(wp != nullptr); - return cstrFromWStringOrNull(wp->coninPipeName); -} - -WINPTY_API LPCWSTR winpty_conout_name(winpty_t *wp) { - ASSERT(wp != nullptr); - return cstrFromWStringOrNull(wp->conoutPipeName); -} - -WINPTY_API LPCWSTR winpty_conerr_name(winpty_t *wp) { - ASSERT(wp != nullptr); - if (wp->conerrPipeName.empty()) { - return nullptr; - } else { - return cstrFromWStringOrNull(wp->conerrPipeName); - } -} - - - -/***************************************************************************** - * winpty agent RPC calls. */ - -namespace { - -// Close the control pipe if something goes wrong with the pipe communication, -// which could leave the control pipe in an inconsistent state. -class RpcOperation { -public: - RpcOperation(winpty_t &wp) : m_wp(wp) { - if (m_wp.controlPipe.get() == nullptr) { - throwWinptyException(L"Agent shutdown due to RPC failure"); - } - } - ~RpcOperation() { - if (!m_success) { - trace("~RpcOperation: Closing control pipe"); - m_wp.controlPipe.dispose(true); - } - } - void success() { m_success = true; } -private: - winpty_t &m_wp; - bool m_success = false; -}; - -} // anonymous namespace - - - -/***************************************************************************** - * winpty agent RPC call: process creation. */ - -// Return a std::wstring containing every character of the environment block. -// Typically, the block is non-empty, so the std::wstring returned ends with -// two NUL terminators. (These two terminators are counted in size(), so -// calling c_str() produces a triply-terminated string.) -static std::wstring wstringFromEnvBlock(const wchar_t *env) { - std::wstring envStr; - if (env != NULL) { - const wchar_t *p = env; - while (*p != L'\0') { - p += wcslen(p) + 1; - } - p++; - envStr.assign(env, p); - - // Assuming the environment was non-empty, envStr now ends with two NUL - // terminators. - // - // If the environment were empty, though, then envStr would only be - // singly terminated, but the MSDN documentation thinks an env block is - // always doubly-terminated, so add an extra NUL just in case it - // matters. - const auto envStrSz = envStr.size(); - if (envStrSz == 1) { - ASSERT(envStr[0] == L'\0'); - envStr.push_back(L'\0'); - } else { - ASSERT(envStrSz >= 3); - ASSERT(envStr[envStrSz - 3] != L'\0'); - ASSERT(envStr[envStrSz - 2] == L'\0'); - ASSERT(envStr[envStrSz - 1] == L'\0'); - } - } - return envStr; -} - -WINPTY_API winpty_spawn_config_t * -winpty_spawn_config_new(UINT64 winptyFlags, - LPCWSTR appname /*OPTIONAL*/, - LPCWSTR cmdline /*OPTIONAL*/, - LPCWSTR cwd /*OPTIONAL*/, - LPCWSTR env /*OPTIONAL*/, - winpty_error_ptr_t *err /*OPTIONAL*/) { - API_TRY { - ASSERT((winptyFlags & WINPTY_SPAWN_FLAG_MASK) == winptyFlags); - std::unique_ptr cfg(new winpty_spawn_config_t); - cfg->winptyFlags = winptyFlags; - if (appname != nullptr) { cfg->appname = appname; } - if (cmdline != nullptr) { cfg->cmdline = cmdline; } - if (cwd != nullptr) { cfg->cwd = cwd; } - if (env != nullptr) { cfg->env = wstringFromEnvBlock(env); } - return cfg.release(); - } API_CATCH(nullptr) -} - -WINPTY_API void winpty_spawn_config_free(winpty_spawn_config_t *cfg) { - delete cfg; -} - -// It's safe to truncate a handle from 64-bits to 32-bits, or to sign-extend it -// back to 64-bits. See the MSDN article, "Interprocess Communication Between -// 32-bit and 64-bit Applications". -// https://msdn.microsoft.com/en-us/library/windows/desktop/aa384203.aspx -static inline HANDLE handleFromInt64(int64_t i) { - return reinterpret_cast(static_cast(i)); -} - -// Given a process and a handle in that process, duplicate the handle into the -// current process and close it in the originating process. -static inline OwnedHandle stealHandle(HANDLE process, HANDLE handle) { - HANDLE result = nullptr; - if (!DuplicateHandle(process, handle, - GetCurrentProcess(), - &result, 0, FALSE, - DUPLICATE_CLOSE_SOURCE | DUPLICATE_SAME_ACCESS)) { - throwWindowsError(L"DuplicateHandle of process handle"); - } - return OwnedHandle(result); -} - -WINPTY_API BOOL -winpty_spawn(winpty_t *wp, - const winpty_spawn_config_t *cfg, - HANDLE *process_handle /*OPTIONAL*/, - HANDLE *thread_handle /*OPTIONAL*/, - DWORD *create_process_error /*OPTIONAL*/, - winpty_error_ptr_t *err /*OPTIONAL*/) { - API_TRY { - ASSERT(wp != nullptr && cfg != nullptr); - - if (process_handle != nullptr) { *process_handle = nullptr; } - if (thread_handle != nullptr) { *thread_handle = nullptr; } - if (create_process_error != nullptr) { *create_process_error = 0; } - - LockGuard lock(wp->mutex); - RpcOperation rpc(*wp); - - // Send spawn request. - auto packet = newPacket(); - packet.putInt32(AgentMsg::StartProcess); - packet.putInt64(cfg->winptyFlags); - packet.putInt32(process_handle != nullptr); - packet.putInt32(thread_handle != nullptr); - packet.putWString(cfg->appname); - packet.putWString(cfg->cmdline); - packet.putWString(cfg->cwd); - packet.putWString(cfg->env); - packet.putWString(wp->spawnDesktopName); - writePacket(*wp, packet); - - // Receive reply. - auto reply = readPacket(*wp); - const auto result = static_cast(reply.getInt32()); - if (result == StartProcessResult::CreateProcessFailed) { - const DWORD lastError = reply.getInt32(); - reply.assertEof(); - if (create_process_error != nullptr) { - *create_process_error = lastError; - } - rpc.success(); - throw LibWinptyException(WINPTY_ERROR_SPAWN_CREATE_PROCESS_FAILED, - L"CreateProcess failed"); - } else if (result == StartProcessResult::ProcessCreated) { - const HANDLE remoteProcess = handleFromInt64(reply.getInt64()); - const HANDLE remoteThread = handleFromInt64(reply.getInt64()); - reply.assertEof(); - OwnedHandle localProcess; - OwnedHandle localThread; - if (remoteProcess != nullptr) { - localProcess = - stealHandle(wp->agentProcess.get(), remoteProcess); - } - if (remoteThread != nullptr) { - localThread = - stealHandle(wp->agentProcess.get(), remoteThread); - } - if (process_handle != nullptr) { - *process_handle = localProcess.release(); - } - if (thread_handle != nullptr) { - *thread_handle = localThread.release(); - } - rpc.success(); - } else { - throwWinptyException( - L"Agent RPC error: invalid StartProcessResult"); - } - return TRUE; - } API_CATCH(FALSE) -} - - - -/***************************************************************************** - * winpty agent RPC calls: everything else */ - -WINPTY_API BOOL -winpty_set_size(winpty_t *wp, int cols, int rows, - winpty_error_ptr_t *err /*OPTIONAL*/) { - API_TRY { - ASSERT(wp != nullptr && cols > 0 && rows > 0); - LockGuard lock(wp->mutex); - RpcOperation rpc(*wp); - auto packet = newPacket(); - packet.putInt32(AgentMsg::SetSize); - packet.putInt32(cols); - packet.putInt32(rows); - writePacket(*wp, packet); - readPacket(*wp).assertEof(); - rpc.success(); - return TRUE; - } API_CATCH(FALSE) -} - -WINPTY_API int -winpty_get_console_process_list(winpty_t *wp, int *processList, const int processCount, - winpty_error_ptr_t *err /*OPTIONAL*/) { - API_TRY { - ASSERT(wp != nullptr); - ASSERT(processList != nullptr); - LockGuard lock(wp->mutex); - RpcOperation rpc(*wp); - auto packet = newPacket(); - packet.putInt32(AgentMsg::GetConsoleProcessList); - writePacket(*wp, packet); - auto reply = readPacket(*wp); - - auto actualProcessCount = reply.getInt32(); - - if (actualProcessCount <= processCount) { - for (auto i = 0; i < actualProcessCount; i++) { - processList[i] = reply.getInt32(); - } - } - - reply.assertEof(); - rpc.success(); - return actualProcessCount; - } API_CATCH(0) -} - -WINPTY_API void winpty_free(winpty_t *wp) { - // At least in principle, CloseHandle can fail, so this deletion can - // fail. It won't throw an exception, but maybe there's an error that - // should be propagated? - delete wp; -} diff --git a/node_modules/node-pty/deps/winpty/src/shared/AgentMsg.h b/node_modules/node-pty/deps/winpty/src/shared/AgentMsg.h deleted file mode 100644 index ab60c6b..0000000 --- a/node_modules/node-pty/deps/winpty/src/shared/AgentMsg.h +++ /dev/null @@ -1,38 +0,0 @@ -// Copyright (c) 2011-2012 Ryan Prichard -// -// 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. - -#ifndef WINPTY_SHARED_AGENT_MSG_H -#define WINPTY_SHARED_AGENT_MSG_H - -struct AgentMsg -{ - enum Type { - StartProcess, - SetSize, - GetConsoleProcessList, - }; -}; - -enum class StartProcessResult { - CreateProcessFailed, - ProcessCreated, -}; - -#endif // WINPTY_SHARED_AGENT_MSG_H diff --git a/node_modules/node-pty/deps/winpty/src/shared/BackgroundDesktop.cc b/node_modules/node-pty/deps/winpty/src/shared/BackgroundDesktop.cc deleted file mode 100644 index 1bea7e5..0000000 --- a/node_modules/node-pty/deps/winpty/src/shared/BackgroundDesktop.cc +++ /dev/null @@ -1,122 +0,0 @@ -// Copyright (c) 2011-2016 Ryan Prichard -// -// 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. - -#include "BackgroundDesktop.h" - -#include - -#include "DebugClient.h" -#include "StringUtil.h" -#include "WinptyException.h" - -namespace { - -static std::wstring getObjectName(HANDLE object) { - BOOL success; - DWORD lengthNeeded = 0; - GetUserObjectInformationW(object, UOI_NAME, - nullptr, 0, - &lengthNeeded); - ASSERT(lengthNeeded % sizeof(wchar_t) == 0); - std::unique_ptr tmp( - new wchar_t[lengthNeeded / sizeof(wchar_t)]); - success = GetUserObjectInformationW(object, UOI_NAME, - tmp.get(), lengthNeeded, - nullptr); - if (!success) { - throwWindowsError(L"GetUserObjectInformationW failed"); - } - return std::wstring(tmp.get()); -} - -static std::wstring getDesktopName(HWINSTA winsta, HDESK desk) { - return getObjectName(winsta) + L"\\" + getObjectName(desk); -} - -} // anonymous namespace - -// Get a non-interactive window station for the agent. -// TODO: review security w.r.t. windowstation and desktop. -BackgroundDesktop::BackgroundDesktop() { - try { - m_originalStation = GetProcessWindowStation(); - if (m_originalStation == nullptr) { - throwWindowsError( - L"BackgroundDesktop ctor: " - L"GetProcessWindowStation returned NULL"); - } - m_newStation = - CreateWindowStationW(nullptr, 0, WINSTA_ALL_ACCESS, nullptr); - if (m_newStation == nullptr) { - throwWindowsError( - L"BackgroundDesktop ctor: CreateWindowStationW returned NULL"); - } - if (!SetProcessWindowStation(m_newStation)) { - throwWindowsError( - L"BackgroundDesktop ctor: SetProcessWindowStation failed"); - } - m_newDesktop = CreateDesktopW( - L"Default", nullptr, nullptr, 0, GENERIC_ALL, nullptr); - if (m_newDesktop == nullptr) { - throwWindowsError( - L"BackgroundDesktop ctor: CreateDesktopW failed"); - } - m_newDesktopName = getDesktopName(m_newStation, m_newDesktop); - TRACE("Created background desktop: %s", - utf8FromWide(m_newDesktopName).c_str()); - } catch (...) { - dispose(); - throw; - } -} - -void BackgroundDesktop::dispose() WINPTY_NOEXCEPT { - if (m_originalStation != nullptr) { - SetProcessWindowStation(m_originalStation); - m_originalStation = nullptr; - } - if (m_newDesktop != nullptr) { - CloseDesktop(m_newDesktop); - m_newDesktop = nullptr; - } - if (m_newStation != nullptr) { - CloseWindowStation(m_newStation); - m_newStation = nullptr; - } -} - -std::wstring getCurrentDesktopName() { - // MSDN says that the handles returned by GetProcessWindowStation and - // GetThreadDesktop do not need to be passed to CloseWindowStation and - // CloseDesktop, respectively. - const HWINSTA winsta = GetProcessWindowStation(); - if (winsta == nullptr) { - throwWindowsError( - L"getCurrentDesktopName: " - L"GetProcessWindowStation returned NULL"); - } - const HDESK desk = GetThreadDesktop(GetCurrentThreadId()); - if (desk == nullptr) { - throwWindowsError( - L"getCurrentDesktopName: " - L"GetThreadDesktop returned NULL"); - } - return getDesktopName(winsta, desk); -} diff --git a/node_modules/node-pty/deps/winpty/src/shared/BackgroundDesktop.h b/node_modules/node-pty/deps/winpty/src/shared/BackgroundDesktop.h deleted file mode 100644 index c692e57..0000000 --- a/node_modules/node-pty/deps/winpty/src/shared/BackgroundDesktop.h +++ /dev/null @@ -1,73 +0,0 @@ -// Copyright (c) 2011-2016 Ryan Prichard -// -// 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. - -#ifndef WINPTY_SHARED_BACKGROUND_DESKTOP_H -#define WINPTY_SHARED_BACKGROUND_DESKTOP_H - -#include - -#include - -#include "WinptyException.h" - -class BackgroundDesktop { -public: - BackgroundDesktop(); - ~BackgroundDesktop() { dispose(); } - void dispose() WINPTY_NOEXCEPT; - const std::wstring &desktopName() const { return m_newDesktopName; } - - BackgroundDesktop(const BackgroundDesktop &other) = delete; - BackgroundDesktop &operator=(const BackgroundDesktop &other) = delete; - - // We can't default the move constructor and assignment operator with - // MSVC 2013. We *could* if we required at least MSVC 2015 to build. - - BackgroundDesktop(BackgroundDesktop &&other) : - m_originalStation(other.m_originalStation), - m_newStation(other.m_newStation), - m_newDesktop(other.m_newDesktop), - m_newDesktopName(std::move(other.m_newDesktopName)) { - other.m_originalStation = nullptr; - other.m_newStation = nullptr; - other.m_newDesktop = nullptr; - } - BackgroundDesktop &operator=(BackgroundDesktop &&other) { - dispose(); - m_originalStation = other.m_originalStation; - m_newStation = other.m_newStation; - m_newDesktop = other.m_newDesktop; - m_newDesktopName = std::move(other.m_newDesktopName); - other.m_originalStation = nullptr; - other.m_newStation = nullptr; - other.m_newDesktop = nullptr; - return *this; - } - -private: - HWINSTA m_originalStation = nullptr; - HWINSTA m_newStation = nullptr; - HDESK m_newDesktop = nullptr; - std::wstring m_newDesktopName; -}; - -std::wstring getCurrentDesktopName(); - -#endif // WINPTY_SHARED_BACKGROUND_DESKTOP_H diff --git a/node_modules/node-pty/deps/winpty/src/shared/Buffer.cc b/node_modules/node-pty/deps/winpty/src/shared/Buffer.cc deleted file mode 100644 index 158a629..0000000 --- a/node_modules/node-pty/deps/winpty/src/shared/Buffer.cc +++ /dev/null @@ -1,103 +0,0 @@ -// Copyright (c) 2011-2016 Ryan Prichard -// -// 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. - -#include "Buffer.h" - -#include - -#include "DebugClient.h" -#include "WinptyAssert.h" - -// Define the READ_BUFFER_CHECK() macro. It *must* evaluate its condition, -// exactly once. -#define READ_BUFFER_CHECK(cond) \ - do { \ - if (!(cond)) { \ - trace("decode error: %s", #cond); \ - throw DecodeError(); \ - } \ - } while (false) - -enum class Piece : uint8_t { Int32, Int64, WString }; - -void WriteBuffer::putRawData(const void *data, size_t len) { - const auto p = reinterpret_cast(data); - m_buf.insert(m_buf.end(), p, p + len); -} - -void WriteBuffer::replaceRawData(size_t pos, const void *data, size_t len) { - ASSERT(pos <= m_buf.size() && len <= m_buf.size() - pos); - const auto p = reinterpret_cast(data); - std::copy(p, p + len, &m_buf[pos]); -} - -void WriteBuffer::putInt32(int32_t i) { - putRawValue(Piece::Int32); - putRawValue(i); -} - -void WriteBuffer::putInt64(int64_t i) { - putRawValue(Piece::Int64); - putRawValue(i); -} - -// len is in characters, excluding NUL, i.e. the number of wchar_t elements -void WriteBuffer::putWString(const wchar_t *str, size_t len) { - putRawValue(Piece::WString); - putRawValue(static_cast(len)); - putRawData(str, sizeof(wchar_t) * len); -} - -void ReadBuffer::getRawData(void *data, size_t len) { - ASSERT(m_off <= m_buf.size()); - READ_BUFFER_CHECK(len <= m_buf.size() - m_off); - const char *const inp = &m_buf[m_off]; - std::copy(inp, inp + len, reinterpret_cast(data)); - m_off += len; -} - -int32_t ReadBuffer::getInt32() { - READ_BUFFER_CHECK(getRawValue() == Piece::Int32); - return getRawValue(); -} - -int64_t ReadBuffer::getInt64() { - READ_BUFFER_CHECK(getRawValue() == Piece::Int64); - return getRawValue(); -} - -std::wstring ReadBuffer::getWString() { - READ_BUFFER_CHECK(getRawValue() == Piece::WString); - const uint64_t charLen = getRawValue(); - READ_BUFFER_CHECK(charLen <= SIZE_MAX / sizeof(wchar_t)); - // To be strictly conforming, we can't use the convenient wstring - // constructor, because the string in m_buf mightn't be aligned. - std::wstring ret; - if (charLen > 0) { - const size_t byteLen = charLen * sizeof(wchar_t); - ret.resize(charLen); - getRawData(&ret[0], byteLen); - } - return ret; -} - -void ReadBuffer::assertEof() { - READ_BUFFER_CHECK(m_off == m_buf.size()); -} diff --git a/node_modules/node-pty/deps/winpty/src/shared/Buffer.h b/node_modules/node-pty/deps/winpty/src/shared/Buffer.h deleted file mode 100644 index c2dd382..0000000 --- a/node_modules/node-pty/deps/winpty/src/shared/Buffer.h +++ /dev/null @@ -1,102 +0,0 @@ -// Copyright (c) 2011-2016 Ryan Prichard -// -// 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. - -#ifndef WINPTY_SHARED_BUFFER_H -#define WINPTY_SHARED_BUFFER_H - -#include -#include - -#include -#include -#include -#include - -#include "WinptyException.h" - -class WriteBuffer { -private: - std::vector m_buf; - -public: - WriteBuffer() {} - - template void putRawValue(const T &t) { - putRawData(&t, sizeof(t)); - } - template void replaceRawValue(size_t pos, const T &t) { - replaceRawData(pos, &t, sizeof(t)); - } - - void putRawData(const void *data, size_t len); - void replaceRawData(size_t pos, const void *data, size_t len); - void putInt32(int32_t i); - void putInt64(int64_t i); - void putWString(const wchar_t *str, size_t len); - void putWString(const wchar_t *str) { putWString(str, wcslen(str)); } - void putWString(const std::wstring &str) { putWString(str.data(), str.size()); } - std::vector &buf() { return m_buf; } - - // MSVC 2013 does not generate these automatically, so help it out. - WriteBuffer(WriteBuffer &&other) : m_buf(std::move(other.m_buf)) {} - WriteBuffer &operator=(WriteBuffer &&other) { - m_buf = std::move(other.m_buf); - return *this; - } -}; - -class ReadBuffer { -public: - class DecodeError : public WinptyException { - virtual const wchar_t *what() const WINPTY_NOEXCEPT override { - return L"DecodeError: RPC message decoding error"; - } - }; - -private: - std::vector m_buf; - size_t m_off = 0; - -public: - explicit ReadBuffer(std::vector &&buf) : m_buf(std::move(buf)) {} - - template T getRawValue() { - T ret = {}; - getRawData(&ret, sizeof(ret)); - return ret; - } - - void getRawData(void *data, size_t len); - int32_t getInt32(); - int64_t getInt64(); - std::wstring getWString(); - void assertEof(); - - // MSVC 2013 does not generate these automatically, so help it out. - ReadBuffer(ReadBuffer &&other) : - m_buf(std::move(other.m_buf)), m_off(other.m_off) {} - ReadBuffer &operator=(ReadBuffer &&other) { - m_buf = std::move(other.m_buf); - m_off = other.m_off; - return *this; - } -}; - -#endif // WINPTY_SHARED_BUFFER_H diff --git a/node_modules/node-pty/deps/winpty/src/shared/DebugClient.cc b/node_modules/node-pty/deps/winpty/src/shared/DebugClient.cc deleted file mode 100644 index bafe0c8..0000000 --- a/node_modules/node-pty/deps/winpty/src/shared/DebugClient.cc +++ /dev/null @@ -1,187 +0,0 @@ -// Copyright (c) 2011-2012 Ryan Prichard -// -// 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. - -#include "DebugClient.h" - -#include -#include -#include -#include - -#include -#include - -#include "winpty_snprintf.h" - -const wchar_t *const kPipeName = L"\\\\.\\pipe\\DebugServer"; - -void *volatile g_debugConfig; - -namespace { - -// It would be easy to accidentally trample on the Windows LastError value -// by adding logging/debugging code. Ensure that can't happen by saving and -// restoring the value. This saving and restoring doesn't happen along the -// fast path. -class PreserveLastError { -public: - PreserveLastError() : m_lastError(GetLastError()) {} - ~PreserveLastError() { SetLastError(m_lastError); } -private: - DWORD m_lastError; -}; - -} // anonymous namespace - -static void sendToDebugServer(const char *message) -{ - HANDLE tracePipe = INVALID_HANDLE_VALUE; - - do { - // The default impersonation level is SECURITY_IMPERSONATION, which allows - // a sufficiently authorized named pipe server to impersonate the client. - // There's no need for impersonation in this debugging system, so reduce - // the impersonation level to SECURITY_IDENTIFICATION, which allows a - // server to merely identify us. - tracePipe = CreateFileW( - kPipeName, - GENERIC_READ | GENERIC_WRITE, - 0, NULL, OPEN_EXISTING, - SECURITY_SQOS_PRESENT | SECURITY_IDENTIFICATION, - NULL); - } while (tracePipe == INVALID_HANDLE_VALUE && - GetLastError() == ERROR_PIPE_BUSY && - WaitNamedPipeW(kPipeName, NMPWAIT_WAIT_FOREVER)); - - if (tracePipe != INVALID_HANDLE_VALUE) { - DWORD newMode = PIPE_READMODE_MESSAGE; - SetNamedPipeHandleState(tracePipe, &newMode, NULL, NULL); - char response[16]; - DWORD actual = 0; - TransactNamedPipe(tracePipe, - const_cast(message), strlen(message), - response, sizeof(response), &actual, NULL); - CloseHandle(tracePipe); - } -} - -// Get the current UTC time as milliseconds from the epoch (ignoring leap -// seconds). Use the Unix epoch for consistency with DebugClient.py. There -// are 134774 days between 1601-01-01 (the Win32 epoch) and 1970-01-01 (the -// Unix epoch). -static long long unixTimeMillis() -{ - FILETIME fileTime; - GetSystemTimeAsFileTime(&fileTime); - long long msTime = (((long long)fileTime.dwHighDateTime << 32) + - fileTime.dwLowDateTime) / 10000; - return msTime - 134774LL * 24 * 3600 * 1000; -} - -static const char *getDebugConfig() -{ - if (g_debugConfig == NULL) { - PreserveLastError preserve; - const int bufSize = 256; - char buf[bufSize]; - DWORD actualSize = - GetEnvironmentVariableA("WINPTY_DEBUG", buf, bufSize); - if (actualSize == 0 || actualSize >= static_cast(bufSize)) { - buf[0] = '\0'; - } - const size_t len = strlen(buf) + 1; - char *newConfig = new char[len]; - std::copy(buf, buf + len, newConfig); - void *oldValue = InterlockedCompareExchangePointer( - &g_debugConfig, newConfig, NULL); - if (oldValue != NULL) { - delete [] newConfig; - } - } - return static_cast(g_debugConfig); -} - -bool isTracingEnabled() -{ - static bool disabled, enabled; - if (disabled) { - return false; - } else if (enabled) { - return true; - } else { - // Recognize WINPTY_DEBUG=1 for backwards compatibility. - PreserveLastError preserve; - bool value = hasDebugFlag("trace") || hasDebugFlag("1"); - disabled = !value; - enabled = value; - return value; - } -} - -bool hasDebugFlag(const char *flag) -{ - if (strchr(flag, ',') != NULL) { - trace("INTERNAL ERROR: hasDebugFlag flag has comma: '%s'", flag); - abort(); - } - const char *const configCStr = getDebugConfig(); - if (configCStr[0] == '\0') { - return false; - } - PreserveLastError preserve; - std::string config(configCStr); - std::string flagStr(flag); - config = "," + config + ","; - flagStr = "," + flagStr + ","; - return config.find(flagStr) != std::string::npos; -} - -void trace(const char *format, ...) -{ - if (!isTracingEnabled()) - return; - - PreserveLastError preserve; - char message[1024]; - - va_list ap; - va_start(ap, format); - winpty_vsnprintf(message, format, ap); - message[sizeof(message) - 1] = '\0'; - va_end(ap); - - const int currentTime = (int)(unixTimeMillis() % (100000 * 1000)); - - char moduleName[1024]; - moduleName[0] = '\0'; - GetModuleFileNameA(NULL, moduleName, sizeof(moduleName)); - const char *baseName = strrchr(moduleName, '\\'); - baseName = (baseName != NULL) ? baseName + 1 : moduleName; - - char fullMessage[1024]; - winpty_snprintf(fullMessage, - "[%05d.%03d %s,p%04d,t%04d]: %s", - currentTime / 1000, currentTime % 1000, - baseName, (int)GetCurrentProcessId(), (int)GetCurrentThreadId(), - message); - fullMessage[sizeof(fullMessage) - 1] = '\0'; - - sendToDebugServer(fullMessage); -} diff --git a/node_modules/node-pty/deps/winpty/src/shared/DebugClient.h b/node_modules/node-pty/deps/winpty/src/shared/DebugClient.h deleted file mode 100644 index b126071..0000000 --- a/node_modules/node-pty/deps/winpty/src/shared/DebugClient.h +++ /dev/null @@ -1,38 +0,0 @@ -// Copyright (c) 2011-2012 Ryan Prichard -// -// 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. - -#ifndef DEBUGCLIENT_H -#define DEBUGCLIENT_H - -#include "winpty_snprintf.h" - -bool isTracingEnabled(); -bool hasDebugFlag(const char *flag); -void trace(const char *format, ...) WINPTY_SNPRINTF_FORMAT(1, 2); - -// This macro calls trace without evaluating the arguments. -#define TRACE(format, ...) \ - do { \ - if (isTracingEnabled()) { \ - trace((format), ## __VA_ARGS__); \ - } \ - } while (false) - -#endif // DEBUGCLIENT_H diff --git a/node_modules/node-pty/deps/winpty/src/shared/GenRandom.cc b/node_modules/node-pty/deps/winpty/src/shared/GenRandom.cc deleted file mode 100644 index 6d79206..0000000 --- a/node_modules/node-pty/deps/winpty/src/shared/GenRandom.cc +++ /dev/null @@ -1,138 +0,0 @@ -// Copyright (c) 2016 Ryan Prichard -// -// 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. - -#include "GenRandom.h" - -#include -#include - -#include "DebugClient.h" -#include "StringBuilder.h" - -static volatile LONG g_pipeCounter; - -GenRandom::GenRandom() : m_advapi32(L"advapi32.dll") { - // First try to use the pseudo-documented RtlGenRandom function from - // advapi32.dll. Creating a CryptoAPI context is slow, and RtlGenRandom - // avoids the overhead. It's documented in this blog post[1] and on - // MSDN[2] with a disclaimer about future breakage. This technique is - // apparently built-in into the MSVC CRT, though, for the rand_s function, - // so perhaps it is stable enough. - // - // [1] http://blogs.msdn.com/b/michael_howard/archive/2005/01/14/353379.aspx - // [2] https://msdn.microsoft.com/en-us/library/windows/desktop/aa387694(v=vs.85).aspx - // - // Both RtlGenRandom and the Crypto API functions exist in XP and up. - m_rtlGenRandom = reinterpret_cast( - m_advapi32.proc("SystemFunction036")); - // The OsModule class logs an error message if the proc is nullptr. - if (m_rtlGenRandom != nullptr) { - return; - } - - // Fall back to the crypto API. - m_cryptProvIsValid = - CryptAcquireContext(&m_cryptProv, nullptr, nullptr, - PROV_RSA_FULL, CRYPT_VERIFYCONTEXT) != 0; - if (!m_cryptProvIsValid) { - trace("GenRandom: CryptAcquireContext failed: %u", - static_cast(GetLastError())); - } -} - -GenRandom::~GenRandom() { - if (m_cryptProvIsValid) { - CryptReleaseContext(m_cryptProv, 0); - } -} - -// Returns false if the context is invalid or the generation fails. -bool GenRandom::fillBuffer(void *buffer, size_t size) { - memset(buffer, 0, size); - bool success = false; - if (m_rtlGenRandom != nullptr) { - success = m_rtlGenRandom(buffer, size) != 0; - if (!success) { - trace("GenRandom: RtlGenRandom/SystemFunction036 failed: %u", - static_cast(GetLastError())); - } - } else if (m_cryptProvIsValid) { - success = - CryptGenRandom(m_cryptProv, size, - reinterpret_cast(buffer)) != 0; - if (!success) { - trace("GenRandom: CryptGenRandom failed, size=%d, lasterror=%u", - static_cast(size), - static_cast(GetLastError())); - } - } - return success; -} - -// Returns an empty string if either of CryptAcquireContext or CryptGenRandom -// fail. -std::string GenRandom::randomBytes(size_t numBytes) { - std::string ret(numBytes, '\0'); - if (!fillBuffer(&ret[0], numBytes)) { - return std::string(); - } - return ret; -} - -std::wstring GenRandom::randomHexString(size_t numBytes) { - const std::string bytes = randomBytes(numBytes); - std::wstring ret(bytes.size() * 2, L'\0'); - for (size_t i = 0; i < bytes.size(); ++i) { - static const wchar_t hex[] = L"0123456789abcdef"; - ret[i * 2] = hex[static_cast(bytes[i]) >> 4]; - ret[i * 2 + 1] = hex[static_cast(bytes[i]) & 0xF]; - } - return ret; -} - -// Returns a 64-bit value representing the number of 100-nanosecond intervals -// since January 1, 1601. -static uint64_t systemTimeAsUInt64() { - FILETIME monotonicTime = {}; - GetSystemTimeAsFileTime(&monotonicTime); - return (static_cast(monotonicTime.dwHighDateTime) << 32) | - static_cast(monotonicTime.dwLowDateTime); -} - -// Generates a unique and hard-to-guess case-insensitive string suitable for -// use in a pipe filename or a Windows object name. -std::wstring GenRandom::uniqueName() { - // First include enough information to avoid collisions assuming - // cooperative software. This code assumes that a process won't die and - // be replaced with a recycled PID within a single GetSystemTimeAsFileTime - // interval. - WStringBuilder sb(64); - sb << GetCurrentProcessId() - << L'-' << InterlockedIncrement(&g_pipeCounter) - << L'-' << whexOfInt(systemTimeAsUInt64()); - // It isn't clear to me how the crypto APIs would fail. It *probably* - // doesn't matter that much anyway? In principle, a predictable pipe name - // is subject to a local denial-of-service attack. - auto random = randomHexString(16); - if (!random.empty()) { - sb << L'-' << random; - } - return sb.str_moved(); -} diff --git a/node_modules/node-pty/deps/winpty/src/shared/GenRandom.h b/node_modules/node-pty/deps/winpty/src/shared/GenRandom.h deleted file mode 100644 index 746cb1e..0000000 --- a/node_modules/node-pty/deps/winpty/src/shared/GenRandom.h +++ /dev/null @@ -1,55 +0,0 @@ -// Copyright (c) 2016 Ryan Prichard -// -// 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. - -#ifndef WINPTY_GEN_RANDOM_H -#define WINPTY_GEN_RANDOM_H - -// The original MinGW requires that we include wincrypt.h. With MinGW-w64 and -// MSVC, including windows.h is sufficient. -#include -#include - -#include - -#include "OsModule.h" - -class GenRandom { - typedef BOOLEAN WINAPI RtlGenRandom_t(PVOID, ULONG); - - OsModule m_advapi32; - RtlGenRandom_t *m_rtlGenRandom = nullptr; - bool m_cryptProvIsValid = false; - HCRYPTPROV m_cryptProv = 0; - -public: - GenRandom(); - ~GenRandom(); - bool fillBuffer(void *buffer, size_t size); - std::string randomBytes(size_t numBytes); - std::wstring randomHexString(size_t numBytes); - std::wstring uniqueName(); - - // Return true if the crypto context was successfully initialized. - bool valid() const { - return m_rtlGenRandom != nullptr || m_cryptProvIsValid; - } -}; - -#endif // WINPTY_GEN_RANDOM_H diff --git a/node_modules/node-pty/deps/winpty/src/shared/GetCommitHash.bat b/node_modules/node-pty/deps/winpty/src/shared/GetCommitHash.bat deleted file mode 100644 index a9f8e9c..0000000 --- a/node_modules/node-pty/deps/winpty/src/shared/GetCommitHash.bat +++ /dev/null @@ -1,13 +0,0 @@ -@echo off - -REM -- Echo the git commit hash. If git isn't available for some reason, -REM -- output nothing instead. - -git rev-parse HEAD >NUL 2>NUL && ( - git rev-parse HEAD -) || ( - echo none -) - -REM -- Set ERRORLEVEL to 0 using this cryptic syntax. -(call ) diff --git a/node_modules/node-pty/deps/winpty/src/shared/Mutex.h b/node_modules/node-pty/deps/winpty/src/shared/Mutex.h deleted file mode 100644 index 9821536..0000000 --- a/node_modules/node-pty/deps/winpty/src/shared/Mutex.h +++ /dev/null @@ -1,54 +0,0 @@ -// Copyright (c) 2015 Ryan Prichard -// -// 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. - -// Recent 4.x MinGW and MinGW-w64 gcc compilers lack std::mutex and -// std::lock_guard. I have a 5.2.0 MinGW-w64 compiler packaged through MSYS2 -// that *is* new enough, but that's one compiler against several deficient -// ones. Wrap CRITICAL_SECTION instead. - -#ifndef WINPTY_SHARED_MUTEX_H -#define WINPTY_SHARED_MUTEX_H - -#include - -class Mutex { - CRITICAL_SECTION m_mutex; -public: - Mutex() { InitializeCriticalSection(&m_mutex); } - ~Mutex() { DeleteCriticalSection(&m_mutex); } - void lock() { EnterCriticalSection(&m_mutex); } - void unlock() { LeaveCriticalSection(&m_mutex); } - - Mutex(const Mutex &other) = delete; - Mutex &operator=(const Mutex &other) = delete; -}; - -template -class LockGuard { - T &m_lock; -public: - LockGuard(T &lock) : m_lock(lock) { m_lock.lock(); } - ~LockGuard() { m_lock.unlock(); } - - LockGuard(const LockGuard &other) = delete; - LockGuard &operator=(const LockGuard &other) = delete; -}; - -#endif // WINPTY_SHARED_MUTEX_H diff --git a/node_modules/node-pty/deps/winpty/src/shared/OsModule.h b/node_modules/node-pty/deps/winpty/src/shared/OsModule.h deleted file mode 100644 index 9713fa2..0000000 --- a/node_modules/node-pty/deps/winpty/src/shared/OsModule.h +++ /dev/null @@ -1,63 +0,0 @@ -// Copyright (c) 2015 Ryan Prichard -// -// 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. - -#ifndef WINPTY_SHARED_OS_MODULE_H -#define WINPTY_SHARED_OS_MODULE_H - -#include - -#include - -#include "DebugClient.h" -#include "WinptyAssert.h" -#include "WinptyException.h" - -class OsModule { - HMODULE m_module; -public: - enum class LoadErrorBehavior { Abort, Throw }; - OsModule(const wchar_t *fileName, - LoadErrorBehavior behavior=LoadErrorBehavior::Abort) { - m_module = LoadLibraryW(fileName); - if (behavior == LoadErrorBehavior::Abort) { - ASSERT(m_module != NULL); - } else { - if (m_module == nullptr) { - const auto err = GetLastError(); - throwWindowsError( - (L"LoadLibraryW error: " + std::wstring(fileName)).c_str(), - err); - } - } - } - ~OsModule() { - FreeLibrary(m_module); - } - HMODULE handle() const { return m_module; } - FARPROC proc(const char *funcName) { - FARPROC ret = GetProcAddress(m_module, funcName); - if (ret == NULL) { - trace("GetProcAddress: %s is missing", funcName); - } - return ret; - } -}; - -#endif // WINPTY_SHARED_OS_MODULE_H diff --git a/node_modules/node-pty/deps/winpty/src/shared/OwnedHandle.cc b/node_modules/node-pty/deps/winpty/src/shared/OwnedHandle.cc deleted file mode 100644 index 7b17353..0000000 --- a/node_modules/node-pty/deps/winpty/src/shared/OwnedHandle.cc +++ /dev/null @@ -1,36 +0,0 @@ -// Copyright (c) 2016 Ryan Prichard -// -// 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. - -#include "OwnedHandle.h" - -#include "DebugClient.h" -#include "WinptyException.h" - -void OwnedHandle::dispose(bool nothrow) { - if (m_h != nullptr && m_h != INVALID_HANDLE_VALUE) { - if (!CloseHandle(m_h)) { - trace("CloseHandle(%p) failed", m_h); - if (!nothrow) { - throwWindowsError(L"CloseHandle failed"); - } - } - } - m_h = nullptr; -} diff --git a/node_modules/node-pty/deps/winpty/src/shared/OwnedHandle.h b/node_modules/node-pty/deps/winpty/src/shared/OwnedHandle.h deleted file mode 100644 index 70a8d61..0000000 --- a/node_modules/node-pty/deps/winpty/src/shared/OwnedHandle.h +++ /dev/null @@ -1,45 +0,0 @@ -// Copyright (c) 2016 Ryan Prichard -// -// 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. - -#ifndef WINPTY_SHARED_OWNED_HANDLE_H -#define WINPTY_SHARED_OWNED_HANDLE_H - -#include - -class OwnedHandle { - HANDLE m_h; -public: - OwnedHandle() : m_h(nullptr) {} - explicit OwnedHandle(HANDLE h) : m_h(h) {} - ~OwnedHandle() { dispose(true); } - void dispose(bool nothrow=false); - HANDLE get() const { return m_h; } - HANDLE release() { HANDLE ret = m_h; m_h = nullptr; return ret; } - OwnedHandle(const OwnedHandle &other) = delete; - OwnedHandle(OwnedHandle &&other) : m_h(other.release()) {} - OwnedHandle &operator=(const OwnedHandle &other) = delete; - OwnedHandle &operator=(OwnedHandle &&other) { - dispose(); - m_h = other.release(); - return *this; - } -}; - -#endif // WINPTY_SHARED_OWNED_HANDLE_H diff --git a/node_modules/node-pty/deps/winpty/src/shared/PrecompiledHeader.h b/node_modules/node-pty/deps/winpty/src/shared/PrecompiledHeader.h deleted file mode 100644 index 7d9b8f8..0000000 --- a/node_modules/node-pty/deps/winpty/src/shared/PrecompiledHeader.h +++ /dev/null @@ -1,43 +0,0 @@ -// Copyright (c) 2016 Ryan Prichard -// -// 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. - -#ifndef WINPTY_PRECOMPILED_HEADER_H -#define WINPTY_PRECOMPILED_HEADER_H - -#include - -#include -#include -#include -#include -#include -#include - -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#endif // WINPTY_PRECOMPILED_HEADER_H diff --git a/node_modules/node-pty/deps/winpty/src/shared/StringBuilder.h b/node_modules/node-pty/deps/winpty/src/shared/StringBuilder.h deleted file mode 100644 index f3155bd..0000000 --- a/node_modules/node-pty/deps/winpty/src/shared/StringBuilder.h +++ /dev/null @@ -1,227 +0,0 @@ -// Copyright (c) 2016 Ryan Prichard -// -// 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. - -// Efficient integer->string conversion and string concatenation. The -// hexadecimal conversion may optionally have leading zeros. Other ways to -// convert integers to strings in C++ suffer these drawbacks: -// -// * std::stringstream: Inefficient, even more so than stdio. -// -// * std::to_string: No hexadecimal output, tends to use heap allocation, not -// supported on Cygwin. -// -// * stdio routines: Requires parsing a format string (inefficient). The -// caller *must* know how large the content is for correctness. The -// string-printf functions are extremely inconsistent on Windows. In -// particular, 64-bit integers, wide strings, and return values are -// problem areas. -// -// StringBuilderTest.cc is a standalone program that tests this header. - -#ifndef WINPTY_STRING_BUILDER_H -#define WINPTY_STRING_BUILDER_H - -#include -#include -#include - -#ifdef STRING_BUILDER_TESTING -#include -#define STRING_BUILDER_CHECK(cond) assert(cond) -#else -#define STRING_BUILDER_CHECK(cond) -#endif // STRING_BUILDER_TESTING - -#include "WinptyAssert.h" - -template -struct ValueString { - std::array m_array; - size_t m_offset; - size_t m_size; - - const C *c_str() const { return m_array.data() + m_offset; } - const C *data() const { return m_array.data() + m_offset; } - size_t size() const { return m_size; } - std::basic_string str() const { - return std::basic_string(data(), m_size); - } -}; - -#ifdef _MSC_VER -// Disable an MSVC /SDL error that forbids unsigned negation. Signed negation -// invokes undefined behavior for INTxx_MIN, so unsigned negation is simpler to -// reason about. (We assume twos-complement in any case.) -#define STRING_BUILDER_ALLOW_UNSIGNED_NEGATE(x) \ - ( \ - __pragma(warning(push)) \ - __pragma(warning(disable:4146)) \ - (x) \ - __pragma(warning(pop)) \ - ) -#else -#define STRING_BUILDER_ALLOW_UNSIGNED_NEGATE(x) (x) -#endif - -// Formats an integer as decimal without leading zeros. -template -ValueString gdecOfInt(const I value) { - typedef typename std::make_unsigned::type U; - auto unsValue = static_cast(value); - const bool isNegative = (value < 0); - if (isNegative) { - unsValue = STRING_BUILDER_ALLOW_UNSIGNED_NEGATE(-unsValue); - } - decltype(gdecOfInt(value)) out; - auto &arr = out.m_array; - C *const endp = arr.data() + arr.size(); - C *outp = endp; - *(--outp) = '\0'; - STRING_BUILDER_CHECK(outp >= arr.data()); - do { - const int digit = unsValue % 10; - unsValue /= 10; - *(--outp) = '0' + digit; - STRING_BUILDER_CHECK(outp >= arr.data()); - } while (unsValue != 0); - if (isNegative) { - *(--outp) = '-'; - STRING_BUILDER_CHECK(outp >= arr.data()); - } - out.m_offset = outp - arr.data(); - out.m_size = endp - outp - 1; - return out; -} - -template decltype(gdecOfInt(0)) decOfInt(I i) { - return gdecOfInt(i); -} - -template decltype(gdecOfInt(0)) wdecOfInt(I i) { - return gdecOfInt(i); -} - -// Formats an integer as hexadecimal, with or without leading zeros. -template -ValueString ghexOfInt(const I value) { - typedef typename std::make_unsigned::type U; - const auto unsValue = static_cast(value); - static const C hex[16] = {'0','1','2','3','4','5','6','7', - '8','9','a','b','c','d','e','f'}; - decltype(ghexOfInt(value)) out; - auto &arr = out.m_array; - C *outp = arr.data(); - int inIndex = 0; - int shift = sizeof(I) * 8 - 4; - const int len = sizeof(I) * 2; - if (!leadingZeros) { - for (; inIndex < len - 1; ++inIndex, shift -= 4) { - STRING_BUILDER_CHECK(shift >= 0 && shift < sizeof(unsValue) * 8); - const int digit = (unsValue >> shift) & 0xF; - if (digit != 0) { - break; - } - } - } - for (; inIndex < len; ++inIndex, shift -= 4) { - const int digit = (unsValue >> shift) & 0xF; - *(outp++) = hex[digit]; - STRING_BUILDER_CHECK(outp <= arr.data() + arr.size()); - } - *(outp++) = '\0'; - STRING_BUILDER_CHECK(outp <= arr.data() + arr.size()); - out.m_offset = 0; - out.m_size = outp - arr.data() - 1; - return out; -} - -template -decltype(ghexOfInt(0)) hexOfInt(I i) { - return ghexOfInt(i); -} - -template -decltype(ghexOfInt(0)) whexOfInt(I i) { - return ghexOfInt(i); -} - -template -class GStringBuilder { -public: - typedef std::basic_string StringType; - - GStringBuilder() {} - GStringBuilder(size_t capacity) { - m_out.reserve(capacity); - } - - GStringBuilder &operator<<(C ch) { m_out.push_back(ch); return *this; } - GStringBuilder &operator<<(const C *str) { m_out.append(str); return *this; } - GStringBuilder &operator<<(const StringType &str) { m_out.append(str); return *this; } - - template - GStringBuilder &operator<<(const ValueString &str) { - m_out.append(str.data(), str.size()); - return *this; - } - -private: - // Forbid output of char/wchar_t for GStringBuilder if the type doesn't - // exactly match the builder element type. The code still allows - // signed char and unsigned char, but I'm a little worried about what - // happens if a user tries to output int8_t or uint8_t. - template - typename std::enable_if< - (std::is_same::value || std::is_same::value) && - !std::is_same::value, GStringBuilder&>::type - operator<<(P ch) { - ASSERT(false && "Method was not supposed to be reachable."); - return *this; - } - -public: - GStringBuilder &operator<<(short i) { return *this << gdecOfInt(i); } - GStringBuilder &operator<<(unsigned short i) { return *this << gdecOfInt(i); } - GStringBuilder &operator<<(int i) { return *this << gdecOfInt(i); } - GStringBuilder &operator<<(unsigned int i) { return *this << gdecOfInt(i); } - GStringBuilder &operator<<(long i) { return *this << gdecOfInt(i); } - GStringBuilder &operator<<(unsigned long i) { return *this << gdecOfInt(i); } - GStringBuilder &operator<<(long long i) { return *this << gdecOfInt(i); } - GStringBuilder &operator<<(unsigned long long i) { return *this << gdecOfInt(i); } - - GStringBuilder &operator<<(const void *p) { - m_out.push_back(static_cast('0')); - m_out.push_back(static_cast('x')); - *this << ghexOfInt(reinterpret_cast(p)); - return *this; - } - - StringType str() { return m_out; } - StringType str_moved() { return std::move(m_out); } - const C *c_str() const { return m_out.c_str(); } - -private: - StringType m_out; -}; - -typedef GStringBuilder StringBuilder; -typedef GStringBuilder WStringBuilder; - -#endif // WINPTY_STRING_BUILDER_H diff --git a/node_modules/node-pty/deps/winpty/src/shared/StringBuilderTest.cc b/node_modules/node-pty/deps/winpty/src/shared/StringBuilderTest.cc deleted file mode 100644 index e6c2d31..0000000 --- a/node_modules/node-pty/deps/winpty/src/shared/StringBuilderTest.cc +++ /dev/null @@ -1,114 +0,0 @@ -// Copyright (c) 2016 Ryan Prichard -// -// 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. - -#define STRING_BUILDER_TESTING - -#include "StringBuilder.h" - -#include -#include - -#include -#include - -void display(const std::string &str) { fprintf(stderr, "%s", str.c_str()); } -void display(const std::wstring &str) { fprintf(stderr, "%ls", str.c_str()); } - -#define CHECK_EQ(x, y) \ - do { \ - const auto xval = (x); \ - const auto yval = (y); \ - if (xval != yval) { \ - fprintf(stderr, "error: %s:%d: %s != %s: ", \ - __FILE__, __LINE__, #x, #y); \ - display(xval); \ - fprintf(stderr, " != "); \ - display(yval); \ - fprintf(stderr, "\n"); \ - } \ - } while(0) - -template -std::basic_string decOfIntSS(const I value) { - // std::to_string and std::to_wstring are missing in Cygwin as of this - // writing (early 2016). - std::basic_stringstream ss; - ss << +value; // We must promote char to print it as an integer. - return ss.str(); -} - - -template -std::basic_string hexOfIntSS(const I value) { - typedef typename std::make_unsigned::type U; - const unsigned long long u64Value = value & static_cast(~0); - std::basic_stringstream ss; - if (leadingZeros) { - ss << std::setfill(static_cast('0')) << std::setw(sizeof(I) * 2); - } - ss << std::hex << u64Value; - return ss.str(); -} - -template -void testValue(I value) { - CHECK_EQ(decOfInt(value).str(), (decOfIntSS(value))); - CHECK_EQ(wdecOfInt(value).str(), (decOfIntSS(value))); - CHECK_EQ((hexOfInt(value).str()), (hexOfIntSS(value))); - CHECK_EQ((hexOfInt(value).str()), (hexOfIntSS(value))); - CHECK_EQ((whexOfInt(value).str()), (hexOfIntSS(value))); - CHECK_EQ((whexOfInt(value).str()), (hexOfIntSS(value))); -} - -template -void testType() { - typedef typename std::make_unsigned::type U; - const U quarter = static_cast(1) << (sizeof(U) * 8 - 2); - for (unsigned quarterIndex = 0; quarterIndex < 4; ++quarterIndex) { - for (int offset = -18; offset <= 18; ++offset) { - const I value = quarter * quarterIndex + static_cast(offset); - testValue(value); - } - } - testValue(static_cast(42)); - testValue(static_cast(123456)); - testValue(static_cast(0xdeadfacecafebeefull)); -} - -int main() { - testType(); - - testType(); - testType(); - testType(); - testType(); - testType(); - - testType(); - testType(); - testType(); - testType(); - testType(); - - StringBuilder() << static_cast("TEST"); - WStringBuilder() << static_cast("TEST"); - - fprintf(stderr, "All tests completed!\n"); -} diff --git a/node_modules/node-pty/deps/winpty/src/shared/StringUtil.cc b/node_modules/node-pty/deps/winpty/src/shared/StringUtil.cc deleted file mode 100644 index 3a85a3e..0000000 --- a/node_modules/node-pty/deps/winpty/src/shared/StringUtil.cc +++ /dev/null @@ -1,55 +0,0 @@ -// Copyright (c) 2015 Ryan Prichard -// -// 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. - -#include "StringUtil.h" - -#include - -#include "WinptyAssert.h" - -// Workaround. MinGW (from mingw.org) does not have wcsnlen. MinGW-w64 *does* -// have wcsnlen, but use this function for consistency. -size_t winpty_wcsnlen(const wchar_t *s, size_t maxlen) { - ASSERT(s != NULL); - for (size_t i = 0; i < maxlen; ++i) { - if (s[i] == L'\0') { - return i; - } - } - return maxlen; -} - -std::string utf8FromWide(const std::wstring &input) { - int mblen = WideCharToMultiByte( - CP_UTF8, 0, - input.data(), input.size(), - NULL, 0, NULL, NULL); - if (mblen <= 0) { - return std::string(); - } - std::vector tmp(mblen); - int mblen2 = WideCharToMultiByte( - CP_UTF8, 0, - input.data(), input.size(), - tmp.data(), tmp.size(), - NULL, NULL); - ASSERT(mblen2 == mblen); - return std::string(tmp.data(), tmp.size()); -} diff --git a/node_modules/node-pty/deps/winpty/src/shared/StringUtil.h b/node_modules/node-pty/deps/winpty/src/shared/StringUtil.h deleted file mode 100644 index e4bf3c9..0000000 --- a/node_modules/node-pty/deps/winpty/src/shared/StringUtil.h +++ /dev/null @@ -1,80 +0,0 @@ -// Copyright (c) 2015 Ryan Prichard -// -// 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. - -#ifndef WINPTY_SHARED_STRING_UTIL_H -#define WINPTY_SHARED_STRING_UTIL_H - -#include -#include -#include - -#include -#include -#include - -#include "WinptyAssert.h" - -size_t winpty_wcsnlen(const wchar_t *s, size_t maxlen); -std::string utf8FromWide(const std::wstring &input); - -// Return a vector containing each character in the string. -template -std::vector vectorFromString(const std::basic_string &str) { - return std::vector(str.begin(), str.end()); -} - -// Return a vector containing each character in the string, followed by a -// NUL terminator. -template -std::vector vectorWithNulFromString(const std::basic_string &str) { - std::vector ret; - ret.reserve(str.size() + 1); - ret.insert(ret.begin(), str.begin(), str.end()); - ret.push_back('\0'); - return ret; -} - -// A safer(?) version of wcsncpy that is accepted by MSVC's /SDL mode. -template -wchar_t *winpty_wcsncpy(wchar_t (&d)[N], const wchar_t *s) { - ASSERT(s != nullptr); - size_t i = 0; - for (; i < N; ++i) { - if (s[i] == L'\0') { - break; - } - d[i] = s[i]; - } - for (; i < N; ++i) { - d[i] = L'\0'; - } - return d; -} - -// Like wcsncpy, but ensure that the destination buffer is NUL-terminated. -template -wchar_t *winpty_wcsncpy_nul(wchar_t (&d)[N], const wchar_t *s) { - static_assert(N > 0, "array cannot be 0-size"); - winpty_wcsncpy(d, s); - d[N - 1] = L'\0'; - return d; -} - -#endif // WINPTY_SHARED_STRING_UTIL_H diff --git a/node_modules/node-pty/deps/winpty/src/shared/TimeMeasurement.h b/node_modules/node-pty/deps/winpty/src/shared/TimeMeasurement.h deleted file mode 100644 index 716a027..0000000 --- a/node_modules/node-pty/deps/winpty/src/shared/TimeMeasurement.h +++ /dev/null @@ -1,63 +0,0 @@ -// Copyright (c) 2015 Ryan Prichard -// -// 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. - -// Convenience header library for using the high-resolution performance counter -// to measure how long some process takes. - -#ifndef TIME_MEASUREMENT_H -#define TIME_MEASUREMENT_H - -#include -#include -#include - -class TimeMeasurement { -public: - TimeMeasurement() { - static double freq = static_cast(getFrequency()); - m_freq = freq; - m_start = value(); - } - - double elapsed() { - uint64_t elapsedTicks = value() - m_start; - return static_cast(elapsedTicks) / m_freq; - } - -private: - uint64_t getFrequency() { - LARGE_INTEGER freq; - BOOL success = QueryPerformanceFrequency(&freq); - assert(success && "QueryPerformanceFrequency failed"); - return freq.QuadPart; - } - - uint64_t value() { - LARGE_INTEGER ret; - BOOL success = QueryPerformanceCounter(&ret); - assert(success && "QueryPerformanceCounter failed"); - return ret.QuadPart; - } - - uint64_t m_start; - double m_freq; -}; - -#endif // TIME_MEASUREMENT_H diff --git a/node_modules/node-pty/deps/winpty/src/shared/UnixCtrlChars.h b/node_modules/node-pty/deps/winpty/src/shared/UnixCtrlChars.h deleted file mode 100644 index 39dfa62..0000000 --- a/node_modules/node-pty/deps/winpty/src/shared/UnixCtrlChars.h +++ /dev/null @@ -1,45 +0,0 @@ -// Copyright (c) 2015 Ryan Prichard -// -// 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. - -#ifndef UNIX_CTRL_CHARS_H -#define UNIX_CTRL_CHARS_H - -inline char decodeUnixCtrlChar(char ch) { - const char ctrlKeys[] = { - /* 0x00 */ '@', /* 0x01 */ 'A', /* 0x02 */ 'B', /* 0x03 */ 'C', - /* 0x04 */ 'D', /* 0x05 */ 'E', /* 0x06 */ 'F', /* 0x07 */ 'G', - /* 0x08 */ 'H', /* 0x09 */ 'I', /* 0x0A */ 'J', /* 0x0B */ 'K', - /* 0x0C */ 'L', /* 0x0D */ 'M', /* 0x0E */ 'N', /* 0x0F */ 'O', - /* 0x10 */ 'P', /* 0x11 */ 'Q', /* 0x12 */ 'R', /* 0x13 */ 'S', - /* 0x14 */ 'T', /* 0x15 */ 'U', /* 0x16 */ 'V', /* 0x17 */ 'W', - /* 0x18 */ 'X', /* 0x19 */ 'Y', /* 0x1A */ 'Z', /* 0x1B */ '[', - /* 0x1C */ '\\', /* 0x1D */ ']', /* 0x1E */ '^', /* 0x1F */ '_', - }; - unsigned char uch = ch; - if (uch < 32) { - return ctrlKeys[uch]; - } else if (uch == 127) { - return '?'; - } else { - return '\0'; - } -} - -#endif // UNIX_CTRL_CHARS_H diff --git a/node_modules/node-pty/deps/winpty/src/shared/UpdateGenVersion.bat b/node_modules/node-pty/deps/winpty/src/shared/UpdateGenVersion.bat deleted file mode 100644 index ea2a7d6..0000000 --- a/node_modules/node-pty/deps/winpty/src/shared/UpdateGenVersion.bat +++ /dev/null @@ -1,20 +0,0 @@ -@echo off - -rem -- Echo the git commit hash. If git isn't available for some reason, -rem -- output nothing instead. - -mkdir ..\gen 2>nul - -set /p VERSION=<..\..\VERSION.txt -set COMMIT=%1 - -echo // AUTO-GENERATED BY %0 %*>..\gen\GenVersion.h -echo const char GenVersion_Version[] = "%VERSION%";>>..\gen\GenVersion.h -echo const char GenVersion_Commit[] = "%COMMIT%";>>..\gen\GenVersion.h - -rem -- The winpty.gyp file expects the script to output the include directory, -rem -- relative to src. -echo gen - -rem -- Set ERRORLEVEL to 0 using this cryptic syntax. -(call ) diff --git a/node_modules/node-pty/deps/winpty/src/shared/WindowsSecurity.cc b/node_modules/node-pty/deps/winpty/src/shared/WindowsSecurity.cc deleted file mode 100644 index 711a863..0000000 --- a/node_modules/node-pty/deps/winpty/src/shared/WindowsSecurity.cc +++ /dev/null @@ -1,460 +0,0 @@ -// Copyright (c) 2016 Ryan Prichard -// -// 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. - -#include "WindowsSecurity.h" - -#include - -#include "DebugClient.h" -#include "OsModule.h" -#include "OwnedHandle.h" -#include "StringBuilder.h" -#include "WindowsVersion.h" -#include "WinptyAssert.h" -#include "WinptyException.h" - -namespace { - -struct LocalFreer { - void operator()(void *ptr) { - if (ptr != nullptr) { - LocalFree(reinterpret_cast(ptr)); - } - } -}; - -typedef std::unique_ptr PointerLocal; - -template -SecurityItem localItem(typename T::type v) { - typedef typename T::type P; - struct Impl : SecurityItem::Impl { - P m_v; - Impl(P v) : m_v(v) {} - virtual ~Impl() { - LocalFree(reinterpret_cast(m_v)); - } - }; - return SecurityItem(v, std::unique_ptr(new Impl { v })); -} - -Sid allocatedSid(PSID v) { - struct Impl : Sid::Impl { - PSID m_v; - Impl(PSID v) : m_v(v) {} - virtual ~Impl() { - if (m_v != nullptr) { - FreeSid(m_v); - } - } - }; - return Sid(v, std::unique_ptr(new Impl { v })); -} - -} // anonymous namespace - -// Returns a handle to the thread's effective security token. If the thread -// is impersonating another user, its token is returned, and otherwise, the -// process' security token is opened. The handle is opened with TOKEN_QUERY. -static OwnedHandle openSecurityTokenForQuery() { - HANDLE token = nullptr; - // It is unclear to me whether OpenAsSelf matters for winpty, or what the - // most appropriate value is. - if (!OpenThreadToken(GetCurrentThread(), TOKEN_QUERY, - /*OpenAsSelf=*/FALSE, &token)) { - if (GetLastError() != ERROR_NO_TOKEN) { - throwWindowsError(L"OpenThreadToken failed"); - } - if (!OpenProcessToken(GetCurrentProcess(), TOKEN_QUERY, &token)) { - throwWindowsError(L"OpenProcessToken failed"); - } - } - ASSERT(token != nullptr && - "OpenThreadToken/OpenProcessToken token is NULL"); - return OwnedHandle(token); -} - -// Returns the TokenOwner of the thread's effective security token. -Sid getOwnerSid() { - struct Impl : Sid::Impl { - std::unique_ptr buffer; - }; - - OwnedHandle token = openSecurityTokenForQuery(); - DWORD actual = 0; - BOOL success; - success = GetTokenInformation(token.get(), TokenOwner, - nullptr, 0, &actual); - if (success) { - throwWinptyException(L"getOwnerSid: GetTokenInformation: " - L"expected ERROR_INSUFFICIENT_BUFFER"); - } else if (GetLastError() != ERROR_INSUFFICIENT_BUFFER) { - throwWindowsError(L"getOwnerSid: GetTokenInformation: " - L"expected ERROR_INSUFFICIENT_BUFFER"); - } - std::unique_ptr impl(new Impl); - impl->buffer = std::unique_ptr(new char[actual]); - success = GetTokenInformation(token.get(), TokenOwner, - impl->buffer.get(), actual, &actual); - if (!success) { - throwWindowsError(L"getOwnerSid: GetTokenInformation"); - } - TOKEN_OWNER tmp; - ASSERT(actual >= sizeof(tmp)); - std::copy( - impl->buffer.get(), - impl->buffer.get() + sizeof(tmp), - reinterpret_cast(&tmp)); - return Sid(tmp.Owner, std::move(impl)); -} - -Sid wellKnownSid( - const wchar_t *debuggingName, - SID_IDENTIFIER_AUTHORITY authority, - BYTE authorityCount, - DWORD subAuthority0/*=0*/, - DWORD subAuthority1/*=0*/) { - PSID psid = nullptr; - if (!AllocateAndInitializeSid(&authority, authorityCount, - subAuthority0, - subAuthority1, - 0, 0, 0, 0, 0, 0, - &psid)) { - const auto err = GetLastError(); - const auto msg = - std::wstring(L"wellKnownSid: error getting ") + - debuggingName + L" SID"; - throwWindowsError(msg.c_str(), err); - } - return allocatedSid(psid); -} - -Sid builtinAdminsSid() { - // S-1-5-32-544 - SID_IDENTIFIER_AUTHORITY authority = { SECURITY_NT_AUTHORITY }; - return wellKnownSid(L"BUILTIN\\Administrators group", - authority, 2, - SECURITY_BUILTIN_DOMAIN_RID, // 32 - DOMAIN_ALIAS_RID_ADMINS); // 544 -} - -Sid localSystemSid() { - // S-1-5-18 - SID_IDENTIFIER_AUTHORITY authority = { SECURITY_NT_AUTHORITY }; - return wellKnownSid(L"LocalSystem account", - authority, 1, - SECURITY_LOCAL_SYSTEM_RID); // 18 -} - -Sid everyoneSid() { - // S-1-1-0 - SID_IDENTIFIER_AUTHORITY authority = { SECURITY_WORLD_SID_AUTHORITY }; - return wellKnownSid(L"Everyone account", - authority, 1, - SECURITY_WORLD_RID); // 0 -} - -static SecurityDescriptor finishSecurityDescriptor( - size_t daclEntryCount, - EXPLICIT_ACCESSW *daclEntries, - Acl &outAcl) { - { - PACL aclRaw = nullptr; - DWORD aclError = - SetEntriesInAclW(daclEntryCount, - daclEntries, - nullptr, &aclRaw); - if (aclError != ERROR_SUCCESS) { - WStringBuilder sb(64); - sb << L"finishSecurityDescriptor: " - << L"SetEntriesInAcl failed: " << aclError; - throwWinptyException(sb.c_str()); - } - outAcl = localItem(aclRaw); - } - - const PSECURITY_DESCRIPTOR sdRaw = - reinterpret_cast( - LocalAlloc(LPTR, SECURITY_DESCRIPTOR_MIN_LENGTH)); - if (sdRaw == nullptr) { - throwWinptyException(L"finishSecurityDescriptor: LocalAlloc failed"); - } - SecurityDescriptor sd = localItem(sdRaw); - if (!InitializeSecurityDescriptor(sdRaw, SECURITY_DESCRIPTOR_REVISION)) { - throwWindowsError( - L"finishSecurityDescriptor: InitializeSecurityDescriptor"); - } - if (!SetSecurityDescriptorDacl(sdRaw, TRUE, outAcl.get(), FALSE)) { - throwWindowsError( - L"finishSecurityDescriptor: SetSecurityDescriptorDacl"); - } - - return std::move(sd); -} - -// Create a security descriptor that grants full control to the local system -// account, built-in administrators, and the owner. -SecurityDescriptor -createPipeSecurityDescriptorOwnerFullControl() { - - struct Impl : SecurityDescriptor::Impl { - Sid localSystem; - Sid builtinAdmins; - Sid owner; - std::array daclEntries = {}; - Acl dacl; - SecurityDescriptor value; - }; - - std::unique_ptr impl(new Impl); - impl->localSystem = localSystemSid(); - impl->builtinAdmins = builtinAdminsSid(); - impl->owner = getOwnerSid(); - - for (auto &ea : impl->daclEntries) { - ea.grfAccessPermissions = GENERIC_ALL; - ea.grfAccessMode = SET_ACCESS; - ea.grfInheritance = NO_INHERITANCE; - ea.Trustee.TrusteeForm = TRUSTEE_IS_SID; - } - impl->daclEntries[0].Trustee.ptstrName = - reinterpret_cast(impl->localSystem.get()); - impl->daclEntries[1].Trustee.ptstrName = - reinterpret_cast(impl->builtinAdmins.get()); - impl->daclEntries[2].Trustee.ptstrName = - reinterpret_cast(impl->owner.get()); - - impl->value = finishSecurityDescriptor( - impl->daclEntries.size(), - impl->daclEntries.data(), - impl->dacl); - - const auto retValue = impl->value.get(); - return SecurityDescriptor(retValue, std::move(impl)); -} - -SecurityDescriptor -createPipeSecurityDescriptorOwnerFullControlEveryoneWrite() { - - struct Impl : SecurityDescriptor::Impl { - Sid localSystem; - Sid builtinAdmins; - Sid owner; - Sid everyone; - std::array daclEntries = {}; - Acl dacl; - SecurityDescriptor value; - }; - - std::unique_ptr impl(new Impl); - impl->localSystem = localSystemSid(); - impl->builtinAdmins = builtinAdminsSid(); - impl->owner = getOwnerSid(); - impl->everyone = everyoneSid(); - - for (auto &ea : impl->daclEntries) { - ea.grfAccessPermissions = GENERIC_ALL; - ea.grfAccessMode = SET_ACCESS; - ea.grfInheritance = NO_INHERITANCE; - ea.Trustee.TrusteeForm = TRUSTEE_IS_SID; - } - impl->daclEntries[0].Trustee.ptstrName = - reinterpret_cast(impl->localSystem.get()); - impl->daclEntries[1].Trustee.ptstrName = - reinterpret_cast(impl->builtinAdmins.get()); - impl->daclEntries[2].Trustee.ptstrName = - reinterpret_cast(impl->owner.get()); - impl->daclEntries[3].Trustee.ptstrName = - reinterpret_cast(impl->everyone.get()); - // Avoid using FILE_GENERIC_WRITE because it includes FILE_APPEND_DATA, - // which is equal to FILE_CREATE_PIPE_INSTANCE. Instead, include all the - // flags that comprise FILE_GENERIC_WRITE, except for the one. - impl->daclEntries[3].grfAccessPermissions = - FILE_GENERIC_READ | - FILE_WRITE_ATTRIBUTES | FILE_WRITE_DATA | FILE_WRITE_EA | - STANDARD_RIGHTS_WRITE | SYNCHRONIZE; - - impl->value = finishSecurityDescriptor( - impl->daclEntries.size(), - impl->daclEntries.data(), - impl->dacl); - - const auto retValue = impl->value.get(); - return SecurityDescriptor(retValue, std::move(impl)); -} - -SecurityDescriptor getObjectSecurityDescriptor(HANDLE handle) { - PACL dacl = nullptr; - PSECURITY_DESCRIPTOR sd = nullptr; - const DWORD errCode = GetSecurityInfo(handle, SE_KERNEL_OBJECT, - OWNER_SECURITY_INFORMATION | - GROUP_SECURITY_INFORMATION | - DACL_SECURITY_INFORMATION, - nullptr, nullptr, &dacl, nullptr, &sd); - if (errCode != ERROR_SUCCESS) { - throwWindowsError(L"GetSecurityInfo failed"); - } - return localItem(sd); -} - -// The (SID/SD)<->string conversion APIs are useful for testing/debugging, so -// create convenient accessor functions for them. They're too slow for -// ordinary use. The APIs exist in XP and up, but the MinGW headers only -// declare the SID<->string APIs, not the SD APIs. MinGW also gets the -// prototype wrong for ConvertStringSidToSidW (LPWSTR instead of LPCWSTR) and -// requires WINVER to be defined. MSVC and MinGW-w64 get everything right, but -// for consistency, use LoadLibrary/GetProcAddress for all four APIs. - -typedef BOOL WINAPI ConvertStringSidToSidW_t( - LPCWSTR StringSid, - PSID *Sid); - -typedef BOOL WINAPI ConvertSidToStringSidW_t( - PSID Sid, - LPWSTR *StringSid); - -typedef BOOL WINAPI ConvertStringSecurityDescriptorToSecurityDescriptorW_t( - LPCWSTR StringSecurityDescriptor, - DWORD StringSDRevision, - PSECURITY_DESCRIPTOR *SecurityDescriptor, - PULONG SecurityDescriptorSize); - -typedef BOOL WINAPI ConvertSecurityDescriptorToStringSecurityDescriptorW_t( - PSECURITY_DESCRIPTOR SecurityDescriptor, - DWORD RequestedStringSDRevision, - SECURITY_INFORMATION SecurityInformation, - LPWSTR *StringSecurityDescriptor, - PULONG StringSecurityDescriptorLen); - -#define GET_MODULE_PROC(mod, funcName) \ - const auto p##funcName = \ - reinterpret_cast( \ - mod.proc(#funcName)); \ - if (p##funcName == nullptr) { \ - throwWinptyException( \ - L"" L ## #funcName L" API is missing from ADVAPI32.DLL"); \ - } - -const DWORD kSDDL_REVISION_1 = 1; - -std::wstring sidToString(PSID sid) { - OsModule advapi32(L"advapi32.dll"); - GET_MODULE_PROC(advapi32, ConvertSidToStringSidW); - wchar_t *sidString = NULL; - BOOL success = pConvertSidToStringSidW(sid, &sidString); - if (!success) { - throwWindowsError(L"ConvertSidToStringSidW failed"); - } - PointerLocal freer(sidString); - return std::wstring(sidString); -} - -Sid stringToSid(const std::wstring &str) { - // Cast the string from const wchar_t* to LPWSTR because the function is - // incorrectly prototyped in the MinGW sddl.h header. The API does not - // modify the string -- it is correctly prototyped as taking LPCWSTR in - // MinGW-w64, MSVC, and MSDN. - OsModule advapi32(L"advapi32.dll"); - GET_MODULE_PROC(advapi32, ConvertStringSidToSidW); - PSID psid = nullptr; - BOOL success = pConvertStringSidToSidW(const_cast(str.c_str()), - &psid); - if (!success) { - const auto err = GetLastError(); - throwWindowsError( - (std::wstring(L"ConvertStringSidToSidW failed on \"") + - str + L'"').c_str(), - err); - } - return localItem(psid); -} - -SecurityDescriptor stringToSd(const std::wstring &str) { - OsModule advapi32(L"advapi32.dll"); - GET_MODULE_PROC(advapi32, ConvertStringSecurityDescriptorToSecurityDescriptorW); - PSECURITY_DESCRIPTOR desc = nullptr; - if (!pConvertStringSecurityDescriptorToSecurityDescriptorW( - str.c_str(), kSDDL_REVISION_1, &desc, nullptr)) { - const auto err = GetLastError(); - throwWindowsError( - (std::wstring(L"ConvertStringSecurityDescriptorToSecurityDescriptorW failed on \"") + - str + L'"').c_str(), - err); - } - return localItem(desc); -} - -std::wstring sdToString(PSECURITY_DESCRIPTOR sd) { - OsModule advapi32(L"advapi32.dll"); - GET_MODULE_PROC(advapi32, ConvertSecurityDescriptorToStringSecurityDescriptorW); - wchar_t *sdString = nullptr; - if (!pConvertSecurityDescriptorToStringSecurityDescriptorW( - sd, - kSDDL_REVISION_1, - OWNER_SECURITY_INFORMATION | - GROUP_SECURITY_INFORMATION | - DACL_SECURITY_INFORMATION, - &sdString, - nullptr)) { - throwWindowsError( - L"ConvertSecurityDescriptorToStringSecurityDescriptor failed"); - } - PointerLocal freer(sdString); - return std::wstring(sdString); -} - -// Vista added a useful flag to CreateNamedPipe, PIPE_REJECT_REMOTE_CLIENTS, -// that rejects remote connections. Return this flag on Vista, or return 0 -// otherwise. -DWORD rejectRemoteClientsPipeFlag() { - if (isAtLeastWindowsVista()) { - // MinGW lacks this flag; MinGW-w64 has it. - const DWORD kPIPE_REJECT_REMOTE_CLIENTS = 8; - return kPIPE_REJECT_REMOTE_CLIENTS; - } else { - trace("Omitting PIPE_REJECT_REMOTE_CLIENTS on pre-Vista OS"); - return 0; - } -} - -typedef BOOL WINAPI GetNamedPipeClientProcessId_t( - HANDLE Pipe, - PULONG ClientProcessId); - -std::tuple -getNamedPipeClientProcessId(HANDLE serverPipe) { - OsModule kernel32(L"kernel32.dll"); - const auto pGetNamedPipeClientProcessId = - reinterpret_cast( - kernel32.proc("GetNamedPipeClientProcessId")); - if (pGetNamedPipeClientProcessId == nullptr) { - return std::make_tuple( - GetNamedPipeClientProcessId_Result::UnsupportedOs, 0, 0); - } - ULONG pid = 0; - if (!pGetNamedPipeClientProcessId(serverPipe, &pid)) { - return std::make_tuple( - GetNamedPipeClientProcessId_Result::Failure, 0, GetLastError()); - } - return std::make_tuple( - GetNamedPipeClientProcessId_Result::Success, - static_cast(pid), - 0); -} diff --git a/node_modules/node-pty/deps/winpty/src/shared/WindowsSecurity.h b/node_modules/node-pty/deps/winpty/src/shared/WindowsSecurity.h deleted file mode 100644 index 5f9d53a..0000000 --- a/node_modules/node-pty/deps/winpty/src/shared/WindowsSecurity.h +++ /dev/null @@ -1,104 +0,0 @@ -// Copyright (c) 2016 Ryan Prichard -// -// 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. - -#ifndef WINPTY_WINDOWS_SECURITY_H -#define WINPTY_WINDOWS_SECURITY_H - -#include -#include - -#include -#include -#include -#include - -// PSID and PSECURITY_DESCRIPTOR are both pointers to void, but we want -// Sid and SecurityDescriptor to be different types. -struct SidTag { typedef PSID type; }; -struct AclTag { typedef PACL type; }; -struct SecurityDescriptorTag { typedef PSECURITY_DESCRIPTOR type; }; - -template -class SecurityItem { -public: - struct Impl { - virtual ~Impl() {} - }; - -private: - typedef typename T::type P; - P m_v; - std::unique_ptr m_pimpl; - -public: - P get() const { return m_v; } - operator bool() const { return m_v != nullptr; } - - SecurityItem() : m_v(nullptr) {} - SecurityItem(P v, std::unique_ptr &&pimpl) : - m_v(v), m_pimpl(std::move(pimpl)) {} - SecurityItem(SecurityItem &&other) : - m_v(other.m_v), m_pimpl(std::move(other.m_pimpl)) { - other.m_v = nullptr; - } - SecurityItem &operator=(SecurityItem &&other) { - m_v = other.m_v; - other.m_v = nullptr; - m_pimpl = std::move(other.m_pimpl); - return *this; - } -}; - -typedef SecurityItem Sid; -typedef SecurityItem Acl; -typedef SecurityItem SecurityDescriptor; - -Sid getOwnerSid(); -Sid wellKnownSid( - const wchar_t *debuggingName, - SID_IDENTIFIER_AUTHORITY authority, - BYTE authorityCount, - DWORD subAuthority0=0, - DWORD subAuthority1=0); -Sid builtinAdminsSid(); -Sid localSystemSid(); -Sid everyoneSid(); - -SecurityDescriptor createPipeSecurityDescriptorOwnerFullControl(); -SecurityDescriptor createPipeSecurityDescriptorOwnerFullControlEveryoneWrite(); -SecurityDescriptor getObjectSecurityDescriptor(HANDLE handle); - -std::wstring sidToString(PSID sid); -Sid stringToSid(const std::wstring &str); -SecurityDescriptor stringToSd(const std::wstring &str); -std::wstring sdToString(PSECURITY_DESCRIPTOR sd); - -DWORD rejectRemoteClientsPipeFlag(); - -enum class GetNamedPipeClientProcessId_Result { - Success, - Failure, - UnsupportedOs, -}; - -std::tuple -getNamedPipeClientProcessId(HANDLE serverPipe); - -#endif // WINPTY_WINDOWS_SECURITY_H diff --git a/node_modules/node-pty/deps/winpty/src/shared/WindowsVersion.cc b/node_modules/node-pty/deps/winpty/src/shared/WindowsVersion.cc deleted file mode 100644 index d89b00d..0000000 --- a/node_modules/node-pty/deps/winpty/src/shared/WindowsVersion.cc +++ /dev/null @@ -1,252 +0,0 @@ -// Copyright (c) 2016 Ryan Prichard -// -// 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. - -#include "WindowsVersion.h" - -#include -#include - -#include -#include -#include - -#include "DebugClient.h" -#include "OsModule.h" -#include "StringBuilder.h" -#include "StringUtil.h" -#include "WinptyAssert.h" -#include "WinptyException.h" - -namespace { - -typedef std::tuple Version; - -// This function can only return a version up to 6.2 unless the executable is -// manifested for a newer version of Windows. See the MSDN documentation for -// GetVersionEx. -OSVERSIONINFOEX getWindowsVersionInfo() { - // Allow use of deprecated functions (i.e. GetVersionEx). We need to use - // GetVersionEx for the old MinGW toolchain and with MSVC when it targets XP. - // Having two code paths makes code harder to test, and it's not obvious how - // to detect the presence of a new enough SDK. (Including ntverp.h and - // examining VER_PRODUCTBUILD apparently works, but even then, MinGW-w64 and - // MSVC seem to use different version numbers.) -#ifdef _MSC_VER -#pragma warning(push) -#pragma warning(disable:4996) -#endif - OSVERSIONINFOEX info = {}; - info.dwOSVersionInfoSize = sizeof(info); - const auto success = GetVersionEx(reinterpret_cast(&info)); - ASSERT(success && "GetVersionEx failed"); - return info; -#ifdef _MSC_VER -#pragma warning(pop) -#endif -} - -Version getWindowsVersion() { - const auto info = getWindowsVersionInfo(); - return Version(info.dwMajorVersion, info.dwMinorVersion); -} - -struct ModuleNotFound : WinptyException { - virtual const wchar_t *what() const WINPTY_NOEXCEPT override { - return L"ModuleNotFound"; - } -}; - -// Throws WinptyException on error. -std::wstring getSystemDirectory() { - wchar_t systemDirectory[MAX_PATH]; - const UINT size = GetSystemDirectoryW(systemDirectory, MAX_PATH); - if (size == 0) { - throwWindowsError(L"GetSystemDirectory failed"); - } else if (size >= MAX_PATH) { - throwWinptyException( - L"GetSystemDirectory: path is longer than MAX_PATH"); - } - return systemDirectory; -} - -#define GET_VERSION_DLL_API(name) \ - const auto p ## name = \ - reinterpret_cast( \ - versionDll.proc(#name)); \ - if (p ## name == nullptr) { \ - throwWinptyException(L ## #name L" is missing"); \ - } - -// Throws WinptyException on error. -VS_FIXEDFILEINFO getFixedFileInfo(const std::wstring &path) { - // version.dll is not a conventional KnownDll, so if we link to it, there's - // a danger of accidentally loading a malicious DLL. In a more typical - // application, perhaps we'd guard against this security issue by - // controlling which directories this code runs in (e.g. *not* the - // "Downloads" directory), but that's harder for the winpty library. - OsModule versionDll( - (getSystemDirectory() + L"\\version.dll").c_str(), - OsModule::LoadErrorBehavior::Throw); - GET_VERSION_DLL_API(GetFileVersionInfoSizeW); - GET_VERSION_DLL_API(GetFileVersionInfoW); - GET_VERSION_DLL_API(VerQueryValueW); - DWORD size = pGetFileVersionInfoSizeW(path.c_str(), nullptr); - if (!size) { - // I see ERROR_FILE_NOT_FOUND on Win7 and - // ERROR_RESOURCE_DATA_NOT_FOUND on WinXP. - if (GetLastError() == ERROR_FILE_NOT_FOUND || - GetLastError() == ERROR_RESOURCE_DATA_NOT_FOUND) { - throw ModuleNotFound(); - } else { - throwWindowsError( - (L"GetFileVersionInfoSizeW failed on " + path).c_str()); - } - } - std::unique_ptr versionBuffer(new char[size]); - if (!pGetFileVersionInfoW(path.c_str(), 0, size, versionBuffer.get())) { - throwWindowsError((L"GetFileVersionInfoW failed on " + path).c_str()); - } - VS_FIXEDFILEINFO *versionInfo = nullptr; - UINT versionInfoSize = 0; - if (!pVerQueryValueW( - versionBuffer.get(), L"\\", - reinterpret_cast(&versionInfo), &versionInfoSize) || - versionInfo == nullptr || - versionInfoSize != sizeof(VS_FIXEDFILEINFO) || - versionInfo->dwSignature != 0xFEEF04BD) { - throwWinptyException((L"VerQueryValueW failed on " + path).c_str()); - } - return *versionInfo; -} - -uint64_t productVersionFromInfo(const VS_FIXEDFILEINFO &info) { - return (static_cast(info.dwProductVersionMS) << 32) | - (static_cast(info.dwProductVersionLS)); -} - -uint64_t fileVersionFromInfo(const VS_FIXEDFILEINFO &info) { - return (static_cast(info.dwFileVersionMS) << 32) | - (static_cast(info.dwFileVersionLS)); -} - -std::string versionToString(uint64_t version) { - StringBuilder b(32); - b << ((uint16_t)(version >> 48)); - b << '.'; - b << ((uint16_t)(version >> 32)); - b << '.'; - b << ((uint16_t)(version >> 16)); - b << '.'; - b << ((uint16_t)(version >> 0)); - return b.str_moved(); -} - -} // anonymous namespace - -// Returns true for Windows Vista (or Windows Server 2008) or newer. -bool isAtLeastWindowsVista() { - return getWindowsVersion() >= Version(6, 0); -} - -// Returns true for Windows 7 (or Windows Server 2008 R2) or newer. -bool isAtLeastWindows7() { - return getWindowsVersion() >= Version(6, 1); -} - -// Returns true for Windows 8 (or Windows Server 2012) or newer. -bool isAtLeastWindows8() { - return getWindowsVersion() >= Version(6, 2); -} - -#define WINPTY_IA32 1 -#define WINPTY_X64 2 - -#if defined(_M_IX86) || defined(__i386__) -#define WINPTY_ARCH WINPTY_IA32 -#elif defined(_M_X64) || defined(__x86_64__) -#define WINPTY_ARCH WINPTY_X64 -#endif - -typedef BOOL WINAPI IsWow64Process_t(HANDLE hProcess, PBOOL Wow64Process); - -void dumpWindowsVersion() { - if (!isTracingEnabled()) { - return; - } - const auto info = getWindowsVersionInfo(); - StringBuilder b; - b << info.dwMajorVersion << '.' << info.dwMinorVersion - << '.' << info.dwBuildNumber << ' ' - << "SP" << info.wServicePackMajor << '.' << info.wServicePackMinor - << ' '; - switch (info.wProductType) { - case VER_NT_WORKSTATION: b << "Client"; break; - case VER_NT_DOMAIN_CONTROLLER: b << "DomainController"; break; - case VER_NT_SERVER: b << "Server"; break; - default: - b << "product=" << info.wProductType; break; - } - b << ' '; -#if WINPTY_ARCH == WINPTY_IA32 - b << "IA32"; - OsModule kernel32(L"kernel32.dll"); - IsWow64Process_t *pIsWow64Process = - reinterpret_cast( - kernel32.proc("IsWow64Process")); - if (pIsWow64Process != nullptr) { - BOOL result = false; - const BOOL success = pIsWow64Process(GetCurrentProcess(), &result); - if (!success) { - b << " WOW64:error"; - } else if (success && result) { - b << " WOW64"; - } - } else { - b << " WOW64:missingapi"; - } -#elif WINPTY_ARCH == WINPTY_X64 - b << "X64"; -#endif - const auto dllVersion = [](const wchar_t *dllPath) -> std::string { - try { - const auto info = getFixedFileInfo(dllPath); - StringBuilder fb(64); - fb << utf8FromWide(dllPath) << ':'; - fb << "F:" << versionToString(fileVersionFromInfo(info)) << '/' - << "P:" << versionToString(productVersionFromInfo(info)); - return fb.str_moved(); - } catch (const ModuleNotFound&) { - return utf8FromWide(dllPath) + ":none"; - } catch (const WinptyException &e) { - trace("Error getting %s version: %s", - utf8FromWide(dllPath).c_str(), utf8FromWide(e.what()).c_str()); - return utf8FromWide(dllPath) + ":error"; - } - }; - b << ' ' << dllVersion(L"kernel32.dll"); - // ConEmu provides a DLL that hooks many Windows APIs, especially console - // APIs. Its existence and version number could be useful in debugging. -#if WINPTY_ARCH == WINPTY_IA32 - b << ' ' << dllVersion(L"ConEmuHk.dll"); -#elif WINPTY_ARCH == WINPTY_X64 - b << ' ' << dllVersion(L"ConEmuHk64.dll"); -#endif - trace("Windows version: %s", b.c_str()); -} diff --git a/node_modules/node-pty/deps/winpty/src/shared/WindowsVersion.h b/node_modules/node-pty/deps/winpty/src/shared/WindowsVersion.h deleted file mode 100644 index a807984..0000000 --- a/node_modules/node-pty/deps/winpty/src/shared/WindowsVersion.h +++ /dev/null @@ -1,29 +0,0 @@ -// Copyright (c) 2016 Ryan Prichard -// -// 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. - -#ifndef WINPTY_SHARED_WINDOWS_VERSION_H -#define WINPTY_SHARED_WINDOWS_VERSION_H - -bool isAtLeastWindowsVista(); -bool isAtLeastWindows7(); -bool isAtLeastWindows8(); -void dumpWindowsVersion(); - -#endif // WINPTY_SHARED_WINDOWS_VERSION_H diff --git a/node_modules/node-pty/deps/winpty/src/shared/WinptyAssert.cc b/node_modules/node-pty/deps/winpty/src/shared/WinptyAssert.cc deleted file mode 100644 index 1ff0de4..0000000 --- a/node_modules/node-pty/deps/winpty/src/shared/WinptyAssert.cc +++ /dev/null @@ -1,55 +0,0 @@ -// Copyright (c) 2011-2016 Ryan Prichard -// -// 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. - -#include "WinptyAssert.h" - -#include -#include - -#include "DebugClient.h" - -void assertTrace(const char *file, int line, const char *cond) { - trace("Assertion failed: %s, file %s, line %d", - cond, file, line); -} - -#ifdef WINPTY_AGENT_ASSERT - -void agentShutdown() { - HWND hwnd = GetConsoleWindow(); - if (hwnd != NULL) { - PostMessage(hwnd, WM_CLOSE, 0, 0); - Sleep(30000); - trace("Agent shutdown: WM_CLOSE did not end agent process"); - } else { - trace("Agent shutdown: GetConsoleWindow() is NULL"); - } - // abort() prints a message to the console, and if it is frozen, then the - // process would hang, so instead use exit(). (We shouldn't ever get here, - // though, because the WM_CLOSE message should have ended this process.) - exit(1); -} - -void agentAssertFail(const char *file, int line, const char *cond) { - assertTrace(file, line, cond); - agentShutdown(); -} - -#endif diff --git a/node_modules/node-pty/deps/winpty/src/shared/WinptyAssert.h b/node_modules/node-pty/deps/winpty/src/shared/WinptyAssert.h deleted file mode 100644 index b2b8b5e..0000000 --- a/node_modules/node-pty/deps/winpty/src/shared/WinptyAssert.h +++ /dev/null @@ -1,64 +0,0 @@ -// Copyright (c) 2011-2016 Ryan Prichard -// -// 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. - -#ifndef WINPTY_ASSERT_H -#define WINPTY_ASSERT_H - -#ifdef WINPTY_AGENT_ASSERT - -void agentShutdown(); -void agentAssertFail(const char *file, int line, const char *cond); - -// Calling the standard assert() function does not work in the agent because -// the error message would be printed to the console, and the only way the -// user can see the console is via a working agent! Moreover, the console may -// be frozen, so attempting to write to it would block forever. This custom -// assert function instead sends the message to the DebugServer, then attempts -// to close the console, then quietly exits. -#define ASSERT(cond) \ - do { \ - if (!(cond)) { \ - agentAssertFail(__FILE__, __LINE__, #cond); \ - } \ - } while(0) - -#else - -void assertTrace(const char *file, int line, const char *cond); - -// In the other targets, log the assert failure to the debugserver, then fail -// using the ordinary assert mechanism. In case assert is compiled out, fail -// using abort. The amount of code inlined is unfortunate, but asserts aren't -// used much outside the agent. -#include -#include -#define ASSERT_CONDITION(cond) (false && (cond)) -#define ASSERT(cond) \ - do { \ - if (!(cond)) { \ - assertTrace(__FILE__, __LINE__, #cond); \ - assert(ASSERT_CONDITION(#cond)); \ - abort(); \ - } \ - } while(0) - -#endif - -#endif // WINPTY_ASSERT_H diff --git a/node_modules/node-pty/deps/winpty/src/shared/WinptyException.cc b/node_modules/node-pty/deps/winpty/src/shared/WinptyException.cc deleted file mode 100644 index d0d4882..0000000 --- a/node_modules/node-pty/deps/winpty/src/shared/WinptyException.cc +++ /dev/null @@ -1,57 +0,0 @@ -// Copyright (c) 2016 Ryan Prichard -// -// 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. - -#include "WinptyException.h" - -#include -#include - -#include "StringBuilder.h" - -namespace { - -class ExceptionImpl : public WinptyException { -public: - ExceptionImpl(const wchar_t *what) : - m_what(std::make_shared(what)) {} - virtual const wchar_t *what() const WINPTY_NOEXCEPT override { - return m_what->c_str(); - } -private: - // Using a shared_ptr ensures that copying the object raises no exception. - std::shared_ptr m_what; -}; - -} // anonymous namespace - -void throwWinptyException(const wchar_t *what) { - throw ExceptionImpl(what); -} - -void throwWindowsError(const wchar_t *prefix, DWORD errorCode) { - WStringBuilder sb(64); - if (prefix != nullptr) { - sb << prefix << L": "; - } - // It might make sense to use FormatMessage here, but IIRC, its API is hard - // to figure out. - sb << L"Windows error " << errorCode; - throwWinptyException(sb.c_str()); -} diff --git a/node_modules/node-pty/deps/winpty/src/shared/WinptyException.h b/node_modules/node-pty/deps/winpty/src/shared/WinptyException.h deleted file mode 100644 index ec35336..0000000 --- a/node_modules/node-pty/deps/winpty/src/shared/WinptyException.h +++ /dev/null @@ -1,43 +0,0 @@ -// Copyright (c) 2016 Ryan Prichard -// -// 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. - -#ifndef WINPTY_EXCEPTION_H -#define WINPTY_EXCEPTION_H - -#include - -#if defined(__GNUC__) -#define WINPTY_NOEXCEPT noexcept -#elif defined(_MSC_VER) && _MSC_VER >= 1900 -#define WINPTY_NOEXCEPT noexcept -#else -#define WINPTY_NOEXCEPT -#endif - -class WinptyException { -public: - virtual const wchar_t *what() const WINPTY_NOEXCEPT = 0; - virtual ~WinptyException() {} -}; - -void throwWinptyException(const wchar_t *what); -void throwWindowsError(const wchar_t *prefix, DWORD error=GetLastError()); - -#endif // WINPTY_EXCEPTION_H diff --git a/node_modules/node-pty/deps/winpty/src/shared/WinptyVersion.cc b/node_modules/node-pty/deps/winpty/src/shared/WinptyVersion.cc deleted file mode 100644 index 76bb8a5..0000000 --- a/node_modules/node-pty/deps/winpty/src/shared/WinptyVersion.cc +++ /dev/null @@ -1,42 +0,0 @@ -// Copyright (c) 2015 Ryan Prichard -// -// 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. - -#include "WinptyVersion.h" - -#include -#include - -#include "DebugClient.h" - -// This header is auto-generated by either the Makefile (Unix) or -// UpdateGenVersion.bat (gyp). It is placed in a 'gen' directory, which is -// added to the search path. -#include "GenVersion.h" - -void dumpVersionToStdout() { - printf("winpty version %s\n", GenVersion_Version); - printf("commit %s\n", GenVersion_Commit); -} - -void dumpVersionToTrace() { - trace("winpty version %s (commit %s)", - GenVersion_Version, - GenVersion_Commit); -} diff --git a/node_modules/node-pty/deps/winpty/src/shared/WinptyVersion.h b/node_modules/node-pty/deps/winpty/src/shared/WinptyVersion.h deleted file mode 100644 index e6224d7..0000000 --- a/node_modules/node-pty/deps/winpty/src/shared/WinptyVersion.h +++ /dev/null @@ -1,27 +0,0 @@ -// Copyright (c) 2015 Ryan Prichard -// -// 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. - -#ifndef WINPTY_VERSION_H -#define WINPTY_VERSION_H - -void dumpVersionToStdout(); -void dumpVersionToTrace(); - -#endif // WINPTY_VERSION_H diff --git a/node_modules/node-pty/deps/winpty/src/shared/winpty_snprintf.h b/node_modules/node-pty/deps/winpty/src/shared/winpty_snprintf.h deleted file mode 100644 index e716f24..0000000 --- a/node_modules/node-pty/deps/winpty/src/shared/winpty_snprintf.h +++ /dev/null @@ -1,99 +0,0 @@ -// Copyright (c) 2016 Ryan Prichard -// -// 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. - -#ifndef WINPTY_SNPRINTF_H -#define WINPTY_SNPRINTF_H - -#include -#include -#include - -#include "WinptyAssert.h" - -#if defined(__CYGWIN__) || defined(__MSYS__) -#define WINPTY_SNPRINTF_FORMAT(fmtarg, vararg) \ - __attribute__((format(printf, (fmtarg), ((vararg))))) -#elif defined(__GNUC__) -#define WINPTY_SNPRINTF_FORMAT(fmtarg, vararg) \ - __attribute__((format(ms_printf, (fmtarg), ((vararg))))) -#else -#define WINPTY_SNPRINTF_FORMAT(fmtarg, vararg) -#endif - -// Returns a value between 0 and size - 1 (inclusive) on success. Returns -1 -// on failure (including truncation). The output buffer is always -// NUL-terminated. -inline int -winpty_vsnprintf(char *out, size_t size, const char *fmt, va_list ap) { - ASSERT(size > 0); - out[0] = '\0'; -#if defined(_MSC_VER) && _MSC_VER < 1900 - // MSVC 2015 added a C99-conforming vsnprintf. - int count = _vsnprintf_s(out, size, _TRUNCATE, fmt, ap); -#else - // MinGW configurations frequently provide a vsnprintf function that simply - // calls one of the MS _vsnprintf* functions, which are not C99 conformant. - int count = vsnprintf(out, size, fmt, ap); -#endif - if (count < 0 || static_cast(count) >= size) { - // On truncation, some *printf* implementations return the - // non-truncated size, but other implementations returns -1. Return - // -1 for consistency. - count = -1; - // Guarantee NUL termination. - out[size - 1] = '\0'; - } else { - // Guarantee NUL termination. - out[count] = '\0'; - } - return count; -} - -// Wraps winpty_vsnprintf. -inline int winpty_snprintf(char *out, size_t size, const char *fmt, ...) - WINPTY_SNPRINTF_FORMAT(3, 4); -inline int winpty_snprintf(char *out, size_t size, const char *fmt, ...) { - va_list ap; - va_start(ap, fmt); - const int count = winpty_vsnprintf(out, size, fmt, ap); - va_end(ap); - return count; -} - -// Wraps winpty_vsnprintf with automatic size determination. -template -int winpty_vsnprintf(char (&out)[size], const char *fmt, va_list ap) { - return winpty_vsnprintf(out, size, fmt, ap); -} - -// Wraps winpty_vsnprintf with automatic size determination. -template -int winpty_snprintf(char (&out)[size], const char *fmt, ...) - WINPTY_SNPRINTF_FORMAT(2, 3); -template -int winpty_snprintf(char (&out)[size], const char *fmt, ...) { - va_list ap; - va_start(ap, fmt); - const int count = winpty_vsnprintf(out, size, fmt, ap); - va_end(ap); - return count; -} - -#endif // WINPTY_SNPRINTF_H diff --git a/node_modules/node-pty/deps/winpty/src/subdir.mk b/node_modules/node-pty/deps/winpty/src/subdir.mk deleted file mode 100644 index 9ae8031..0000000 --- a/node_modules/node-pty/deps/winpty/src/subdir.mk +++ /dev/null @@ -1,5 +0,0 @@ -include src/agent/subdir.mk -include src/debugserver/subdir.mk -include src/libwinpty/subdir.mk -include src/tests/subdir.mk -include src/unix-adapter/subdir.mk diff --git a/node_modules/node-pty/deps/winpty/src/tests/subdir.mk b/node_modules/node-pty/deps/winpty/src/tests/subdir.mk deleted file mode 100644 index 18799c4..0000000 --- a/node_modules/node-pty/deps/winpty/src/tests/subdir.mk +++ /dev/null @@ -1,28 +0,0 @@ -# Copyright (c) 2015 Ryan Prichard -# -# 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. - -build/%.exe : src/tests/%.cc build/winpty.dll - $(info Building $@) - @$(MINGW_CXX) $(MINGW_CXXFLAGS) $(MINGW_LDFLAGS) -o $@ $^ - -TEST_PROGRAMS = \ - build/trivial_test.exe - --include $(TEST_PROGRAMS:.exe=.d) diff --git a/node_modules/node-pty/deps/winpty/src/tests/trivial_test.cc b/node_modules/node-pty/deps/winpty/src/tests/trivial_test.cc deleted file mode 100644 index 2188a4b..0000000 --- a/node_modules/node-pty/deps/winpty/src/tests/trivial_test.cc +++ /dev/null @@ -1,158 +0,0 @@ -// Copyright (c) 2015 Ryan Prichard -// -// 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. - -#include - -#include -#include -#include -#include -#include -#include - -#include "../include/winpty.h" -#include "../shared/DebugClient.h" - -static std::vector filterContent( - const std::vector &content) { - std::vector result; - auto it = content.begin(); - const auto itEnd = content.end(); - while (it < itEnd) { - if (*it == '\r') { - // Filter out carriage returns. Sometimes the output starts with - // a single CR; other times, it has multiple CRs. - it++; - } else if (*it == '\x1b' && (it + 1) < itEnd && *(it + 1) == '[') { - // Filter out escape sequences. They have no interior letters and - // end with a single letter. - it += 2; - while (it < itEnd && !isalpha(*it)) { - it++; - } - it++; - } else { - // Let everything else through. - result.push_back(*it); - it++; - } - } - return result; -} - -// Read bytes from the non-overlapped file handle until the file is closed or -// until an I/O error occurs. -static std::vector readAll(HANDLE handle) { - unsigned char buf[1024]; - std::vector result; - while (true) { - DWORD amount = 0; - BOOL ret = ReadFile(handle, buf, sizeof(buf), &amount, nullptr); - if (!ret || amount == 0) { - break; - } - result.insert(result.end(), buf, buf + amount); - } - return result; -} - -static void parentTest() { - wchar_t program[1024]; - wchar_t cmdline[1024]; - GetModuleFileNameW(nullptr, program, 1024); - - { - // XXX: We'd like to use swprintf, which is part of C99 and takes a - // size_t maxlen argument. MinGW-w64 has this function, as does MSVC. - // The old MinGW doesn't, though -- instead, it apparently provides an - // swprintf taking no maxlen argument. This *might* be a regression? - // (There is also no swnprintf, but that function is obsolescent with a - // correct swprintf, and it isn't in POSIX or ISO C.) - // - // Visual C++ 6 also provided this non-conformant swprintf, and I'm - // guessing MSVCRT.DLL does too. (My impression is that the old MinGW - // prefers to rely on MSVCRT.DLL for convenience?) - // - // I could compile differently for old MinGW, but what if it fixes its - // function later? Instead, use a workaround. It's starting to make - // sense to drop MinGW support in favor of MinGW-w64. This is too - // annoying. - // - // grepbait: OLD-MINGW / WINPTY_TARGET_MSYS1 - cmdline[0] = L'\0'; - wcscat(cmdline, L"\""); - wcscat(cmdline, program); - wcscat(cmdline, L"\" CHILD"); - } - // swnprintf(cmdline, sizeof(cmdline) / sizeof(cmdline[0]), - // L"\"%ls\" CHILD", program); - - auto agentCfg = winpty_config_new(0, nullptr); - assert(agentCfg != nullptr); - auto pty = winpty_open(agentCfg, nullptr); - assert(pty != nullptr); - winpty_config_free(agentCfg); - - HANDLE conin = CreateFileW( - winpty_conin_name(pty), - GENERIC_WRITE, 0, nullptr, OPEN_EXISTING, 0, nullptr); - HANDLE conout = CreateFileW( - winpty_conout_name(pty), - GENERIC_READ, 0, nullptr, OPEN_EXISTING, 0, nullptr); - assert(conin != INVALID_HANDLE_VALUE); - assert(conout != INVALID_HANDLE_VALUE); - - auto spawnCfg = winpty_spawn_config_new( - WINPTY_SPAWN_FLAG_AUTO_SHUTDOWN, program, cmdline, - nullptr, nullptr, nullptr); - assert(spawnCfg != nullptr); - HANDLE process = nullptr; - BOOL spawnSuccess = winpty_spawn( - pty, spawnCfg, &process, nullptr, nullptr, nullptr); - assert(spawnSuccess && process != nullptr); - - auto content = readAll(conout); - content = filterContent(content); - - std::vector expectedContent = { - 'H', 'I', '\n', 'X', 'Y', '\n' - }; - DWORD exitCode = 0; - assert(GetExitCodeProcess(process, &exitCode) && exitCode == 42); - CloseHandle(process); - CloseHandle(conin); - CloseHandle(conout); - assert(content == expectedContent); - winpty_free(pty); -} - -static void childTest() { - printf("HI\nXY\n"); - exit(42); -} - -int main(int argc, char *argv[]) { - if (argc == 1) { - parentTest(); - } else { - childTest(); - } - return 0; -} diff --git a/node_modules/node-pty/deps/winpty/src/unix-adapter/InputHandler.cc b/node_modules/node-pty/deps/winpty/src/unix-adapter/InputHandler.cc deleted file mode 100644 index 39f1e09..0000000 --- a/node_modules/node-pty/deps/winpty/src/unix-adapter/InputHandler.cc +++ /dev/null @@ -1,114 +0,0 @@ -// Copyright (c) 2011-2015 Ryan Prichard -// -// 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. - -#include "InputHandler.h" - -#include -#include -#include -#include -#include - -#include -#include - -#include "../shared/DebugClient.h" -#include "Util.h" -#include "WakeupFd.h" - -InputHandler::InputHandler( - HANDLE conin, int inputfd, WakeupFd &completionWakeup) : - m_conin(conin), - m_inputfd(inputfd), - m_completionWakeup(completionWakeup), - m_threadHasBeenJoined(false), - m_shouldShutdown(0), - m_threadCompleted(0) -{ - pthread_create(&m_thread, NULL, InputHandler::threadProcS, this); -} - -void InputHandler::shutdown() { - startShutdown(); - if (!m_threadHasBeenJoined) { - int ret = pthread_join(m_thread, NULL); - assert(ret == 0 && "pthread_join failed"); - m_threadHasBeenJoined = true; - } -} - -void InputHandler::threadProc() { - std::vector buffer(4096); - fd_set readfds; - FD_ZERO(&readfds); - while (true) { - // Handle shutdown. - m_wakeup.reset(); - if (m_shouldShutdown) { - trace("InputHandler: shutting down"); - break; - } - - // Block until data arrives. - { - const int max_fd = std::max(m_inputfd, m_wakeup.fd()); - FD_SET(m_inputfd, &readfds); - FD_SET(m_wakeup.fd(), &readfds); - selectWrapper("InputHandler", max_fd + 1, &readfds); - if (!FD_ISSET(m_inputfd, &readfds)) { - continue; - } - } - - const int numRead = read(m_inputfd, &buffer[0], buffer.size()); - if (numRead == -1 && errno == EINTR) { - // Apparently, this read is interrupted on Cygwin 1.7 by a SIGWINCH - // signal even though I set the SA_RESTART flag on the handler. - continue; - } - - // tty is closed, or the read failed for some unexpected reason. - if (numRead <= 0) { - trace("InputHandler: tty read failed: numRead=%d", numRead); - break; - } - - DWORD written = 0; - BOOL ret = WriteFile(m_conin, - &buffer[0], numRead, - &written, NULL); - if (!ret || written != static_cast(numRead)) { - if (!ret && GetLastError() == ERROR_BROKEN_PIPE) { - trace("InputHandler: pipe closed: written=%u", - static_cast(written)); - } else { - trace("InputHandler: write failed: " - "ret=%d lastError=0x%x numRead=%d written=%u", - ret, - static_cast(GetLastError()), - numRead, - static_cast(written)); - } - break; - } - } - m_threadCompleted = 1; - m_completionWakeup.set(); -} diff --git a/node_modules/node-pty/deps/winpty/src/unix-adapter/InputHandler.h b/node_modules/node-pty/deps/winpty/src/unix-adapter/InputHandler.h deleted file mode 100644 index 9c3f540..0000000 --- a/node_modules/node-pty/deps/winpty/src/unix-adapter/InputHandler.h +++ /dev/null @@ -1,56 +0,0 @@ -// Copyright (c) 2011-2015 Ryan Prichard -// -// 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. - -#ifndef UNIX_ADAPTER_INPUT_HANDLER_H -#define UNIX_ADAPTER_INPUT_HANDLER_H - -#include -#include -#include - -#include "WakeupFd.h" - -// Connect a Cygwin blocking fd to winpty CONIN. -class InputHandler { -public: - InputHandler(HANDLE conin, int inputfd, WakeupFd &completionWakeup); - ~InputHandler() { shutdown(); } - bool isComplete() { return m_threadCompleted; } - void startShutdown() { m_shouldShutdown = 1; m_wakeup.set(); } - void shutdown(); - -private: - static void *threadProcS(void *pvthis) { - reinterpret_cast(pvthis)->threadProc(); - return NULL; - } - void threadProc(); - - HANDLE m_conin; - int m_inputfd; - pthread_t m_thread; - WakeupFd &m_completionWakeup; - WakeupFd m_wakeup; - bool m_threadHasBeenJoined; - volatile sig_atomic_t m_shouldShutdown; - volatile sig_atomic_t m_threadCompleted; -}; - -#endif // UNIX_ADAPTER_INPUT_HANDLER_H diff --git a/node_modules/node-pty/deps/winpty/src/unix-adapter/OutputHandler.cc b/node_modules/node-pty/deps/winpty/src/unix-adapter/OutputHandler.cc deleted file mode 100644 index 573b8ad..0000000 --- a/node_modules/node-pty/deps/winpty/src/unix-adapter/OutputHandler.cc +++ /dev/null @@ -1,80 +0,0 @@ -// Copyright (c) 2011-2015 Ryan Prichard -// -// 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. - -#include "OutputHandler.h" - -#include -#include -#include -#include - -#include -#include - -#include "../shared/DebugClient.h" -#include "Util.h" -#include "WakeupFd.h" - -OutputHandler::OutputHandler( - HANDLE conout, int outputfd, WakeupFd &completionWakeup) : - m_conout(conout), - m_outputfd(outputfd), - m_completionWakeup(completionWakeup), - m_threadHasBeenJoined(false), - m_threadCompleted(0) -{ - pthread_create(&m_thread, NULL, OutputHandler::threadProcS, this); -} - -void OutputHandler::shutdown() { - if (!m_threadHasBeenJoined) { - int ret = pthread_join(m_thread, NULL); - assert(ret == 0 && "pthread_join failed"); - m_threadHasBeenJoined = true; - } -} - -void OutputHandler::threadProc() { - std::vector buffer(4096); - while (true) { - DWORD numRead = 0; - BOOL ret = ReadFile(m_conout, - &buffer[0], buffer.size(), - &numRead, NULL); - if (!ret || numRead == 0) { - if (!ret && GetLastError() == ERROR_BROKEN_PIPE) { - trace("OutputHandler: pipe closed: numRead=%u", - static_cast(numRead)); - } else { - trace("OutputHandler: read failed: " - "ret=%d lastError=0x%x numRead=%u", - ret, - static_cast(GetLastError()), - static_cast(numRead)); - } - break; - } - if (!writeAll(m_outputfd, &buffer[0], numRead)) { - break; - } - } - m_threadCompleted = 1; - m_completionWakeup.set(); -} diff --git a/node_modules/node-pty/deps/winpty/src/unix-adapter/OutputHandler.h b/node_modules/node-pty/deps/winpty/src/unix-adapter/OutputHandler.h deleted file mode 100644 index 48241c5..0000000 --- a/node_modules/node-pty/deps/winpty/src/unix-adapter/OutputHandler.h +++ /dev/null @@ -1,53 +0,0 @@ -// Copyright (c) 2011-2015 Ryan Prichard -// -// 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. - -#ifndef UNIX_ADAPTER_OUTPUT_HANDLER_H -#define UNIX_ADAPTER_OUTPUT_HANDLER_H - -#include -#include -#include - -#include "WakeupFd.h" - -// Connect winpty CONOUT/CONERR to a Cygwin blocking fd. -class OutputHandler { -public: - OutputHandler(HANDLE conout, int outputfd, WakeupFd &completionWakeup); - ~OutputHandler() { shutdown(); } - bool isComplete() { return m_threadCompleted; } - void shutdown(); - -private: - static void *threadProcS(void *pvthis) { - reinterpret_cast(pvthis)->threadProc(); - return NULL; - } - void threadProc(); - - HANDLE m_conout; - int m_outputfd; - pthread_t m_thread; - WakeupFd &m_completionWakeup; - bool m_threadHasBeenJoined; - volatile sig_atomic_t m_threadCompleted; -}; - -#endif // UNIX_ADAPTER_OUTPUT_HANDLER_H diff --git a/node_modules/node-pty/deps/winpty/src/unix-adapter/Util.cc b/node_modules/node-pty/deps/winpty/src/unix-adapter/Util.cc deleted file mode 100644 index e13f84a..0000000 --- a/node_modules/node-pty/deps/winpty/src/unix-adapter/Util.cc +++ /dev/null @@ -1,86 +0,0 @@ -// Copyright (c) 2015 Ryan Prichard -// -// 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. - -#include "Util.h" - -#include -#include -#include -#include -#include - -#include "../shared/DebugClient.h" - -// Write the entire buffer, restarting it as necessary. -bool writeAll(int fd, const void *buffer, size_t size) { - size_t written = 0; - while (written < size) { - int ret = write(fd, - reinterpret_cast(buffer) + written, - size - written); - if (ret == -1 && errno == EINTR) { - continue; - } - if (ret <= 0) { - trace("write failed: " - "fd=%d errno=%d size=%u written=%d ret=%d", - fd, - errno, - static_cast(size), - static_cast(written), - ret); - return false; - } - assert(static_cast(ret) <= size - written); - written += ret; - } - assert(written == size); - return true; -} - -bool writeStr(int fd, const char *str) { - return writeAll(fd, str, strlen(str)); -} - -void selectWrapper(const char *diagName, int nfds, fd_set *readfds) { - int ret = select(nfds, readfds, NULL, NULL, NULL); - if (ret < 0) { - if (errno == EINTR) { - FD_ZERO(readfds); - return; - } -#ifdef WINPTY_TARGET_MSYS1 - // The select system call sometimes fails with EAGAIN instead of EINTR. - // This apparantly only happens with the old Cygwin fork "MSYS" used in - // the mingw.org project. select is not supposed to fail with EAGAIN, - // and EAGAIN does not make much sense as an error code. (The whole - // point of select is to block.) - if (errno == EAGAIN) { - trace("%s select returned EAGAIN: interpreting like EINTR", - diagName); - FD_ZERO(readfds); - return; - } -#endif - fprintf(stderr, "Internal error: %s select failed: " - "error %d", diagName, errno); - abort(); - } -} diff --git a/node_modules/node-pty/deps/winpty/src/unix-adapter/Util.h b/node_modules/node-pty/deps/winpty/src/unix-adapter/Util.h deleted file mode 100644 index cadb4c8..0000000 --- a/node_modules/node-pty/deps/winpty/src/unix-adapter/Util.h +++ /dev/null @@ -1,31 +0,0 @@ -// Copyright (c) 2015 Ryan Prichard -// -// 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. - -#ifndef UNIX_ADAPTER_UTIL_H -#define UNIX_ADAPTER_UTIL_H - -#include -#include - -bool writeAll(int fd, const void *buffer, size_t size); -bool writeStr(int fd, const char *str); -void selectWrapper(const char *diagName, int nfds, fd_set *readfds); - -#endif // UNIX_ADAPTER_UTIL_H diff --git a/node_modules/node-pty/deps/winpty/src/unix-adapter/WakeupFd.cc b/node_modules/node-pty/deps/winpty/src/unix-adapter/WakeupFd.cc deleted file mode 100644 index 6b47379..0000000 --- a/node_modules/node-pty/deps/winpty/src/unix-adapter/WakeupFd.cc +++ /dev/null @@ -1,70 +0,0 @@ -// Copyright (c) 2011-2015 Ryan Prichard -// -// 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. - -#include "WakeupFd.h" - -#include -#include -#include -#include -#include - -static void setFdNonBlock(int fd) { - int status = fcntl(fd, F_GETFL); - fcntl(fd, F_SETFL, status | O_NONBLOCK); -} - -WakeupFd::WakeupFd() { - int pipeFd[2]; - if (pipe(pipeFd) != 0) { - perror("Could not create internal wakeup pipe"); - abort(); - } - m_pipeReadFd = pipeFd[0]; - m_pipeWriteFd = pipeFd[1]; - setFdNonBlock(m_pipeReadFd); - setFdNonBlock(m_pipeWriteFd); -} - -WakeupFd::~WakeupFd() { - close(m_pipeReadFd); - close(m_pipeWriteFd); -} - -void WakeupFd::set() { - char dummy = 0; - int ret; - do { - ret = write(m_pipeWriteFd, &dummy, 1); - } while (ret < 0 && errno == EINTR); -} - -void WakeupFd::reset() { - char tmpBuf[256]; - while (true) { - int amount = read(m_pipeReadFd, tmpBuf, sizeof(tmpBuf)); - if (amount < 0 && errno == EAGAIN) { - break; - } else if (amount <= 0) { - perror("error reading from internal wakeup pipe"); - abort(); - } - } -} diff --git a/node_modules/node-pty/deps/winpty/src/unix-adapter/WakeupFd.h b/node_modules/node-pty/deps/winpty/src/unix-adapter/WakeupFd.h deleted file mode 100644 index dd8d362..0000000 --- a/node_modules/node-pty/deps/winpty/src/unix-adapter/WakeupFd.h +++ /dev/null @@ -1,42 +0,0 @@ -// Copyright (c) 2015 Ryan Prichard -// -// 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. - -#ifndef UNIX_ADAPTER_WAKEUP_FD_H -#define UNIX_ADAPTER_WAKEUP_FD_H - -class WakeupFd { -public: - WakeupFd(); - ~WakeupFd(); - int fd() { return m_pipeReadFd; } - void set(); - void reset(); - -private: - // Do not allow copying the WakeupFd object. - WakeupFd(const WakeupFd &other); - WakeupFd &operator=(const WakeupFd &other); - -private: - int m_pipeReadFd; - int m_pipeWriteFd; -}; - -#endif // UNIX_ADAPTER_WAKEUP_FD_H diff --git a/node_modules/node-pty/deps/winpty/src/unix-adapter/main.cc b/node_modules/node-pty/deps/winpty/src/unix-adapter/main.cc deleted file mode 100644 index 992cb70..0000000 --- a/node_modules/node-pty/deps/winpty/src/unix-adapter/main.cc +++ /dev/null @@ -1,729 +0,0 @@ -// Copyright (c) 2011-2015 Ryan Prichard -// -// 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. - -// MSYS's sys/cygwin.h header only declares cygwin_internal if WINVER is -// defined, which is defined in windows.h. Therefore, include windows.h early. -#include - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include -#include -#include -#include - -#include -#include "../shared/DebugClient.h" -#include "../shared/UnixCtrlChars.h" -#include "../shared/WinptyVersion.h" -#include "InputHandler.h" -#include "OutputHandler.h" -#include "Util.h" -#include "WakeupFd.h" - -#define CSI "\x1b[" - -static WakeupFd *g_mainWakeup = NULL; - -static WakeupFd &mainWakeup() -{ - if (g_mainWakeup == NULL) { - static const char msg[] = "Internal error: g_mainWakeup is NULL\r\n"; - write(STDERR_FILENO, msg, sizeof(msg) - 1); - abort(); - } - return *g_mainWakeup; -} - -struct SavedTermiosMode { - int count; - bool valid[3]; - termios mode[3]; -}; - -// Put the input terminal into non-canonical mode. -static SavedTermiosMode setRawTerminalMode( - bool allowNonTtys, bool setStdout, bool setStderr) -{ - SavedTermiosMode ret; - const char *const kNames[3] = { "stdin", "stdout", "stderr" }; - - ret.valid[0] = true; - ret.valid[1] = setStdout; - ret.valid[2] = setStderr; - - for (int i = 0; i < 3; ++i) { - if (!ret.valid[i]) { - continue; - } - if (!isatty(i)) { - ret.valid[i] = false; - if (!allowNonTtys) { - fprintf(stderr, "%s is not a tty\n", kNames[i]); - exit(1); - } - } else { - ret.valid[i] = true; - if (tcgetattr(i, &ret.mode[i]) < 0) { - perror("tcgetattr failed"); - exit(1); - } - } - } - - if (ret.valid[STDIN_FILENO]) { - termios buf; - if (tcgetattr(STDIN_FILENO, &buf) < 0) { - perror("tcgetattr failed"); - exit(1); - } - buf.c_lflag &= ~(ECHO | ICANON | IEXTEN | ISIG); - buf.c_iflag &= ~(BRKINT | ICRNL | INPCK | ISTRIP | IXON); - buf.c_cflag &= ~(CSIZE | PARENB); - buf.c_cflag |= CS8; - buf.c_cc[VMIN] = 1; // blocking read - buf.c_cc[VTIME] = 0; - if (tcsetattr(STDIN_FILENO, TCSAFLUSH, &buf) < 0) { - fprintf(stderr, "tcsetattr failed\n"); - exit(1); - } - } - - for (int i = STDOUT_FILENO; i <= STDERR_FILENO; ++i) { - if (!ret.valid[i]) { - continue; - } - termios buf; - if (tcgetattr(i, &buf) < 0) { - perror("tcgetattr failed"); - exit(1); - } - buf.c_cflag &= ~(CSIZE | PARENB); - buf.c_cflag |= CS8; - buf.c_oflag &= ~OPOST; - if (tcsetattr(i, TCSAFLUSH, &buf) < 0) { - fprintf(stderr, "tcsetattr failed\n"); - exit(1); - } - } - - return ret; -} - -static void restoreTerminalMode(const SavedTermiosMode &original) -{ - for (int i = 0; i < 3; ++i) { - if (!original.valid[i]) { - continue; - } - if (tcsetattr(i, TCSAFLUSH, &original.mode[i]) < 0) { - perror("error restoring terminal mode"); - exit(1); - } - } -} - -static void debugShowKey(bool allowNonTtys) -{ - printf("\nPress any keys -- Ctrl-D exits\n\n"); - const SavedTermiosMode saved = - setRawTerminalMode(allowNonTtys, false, false); - char buf[128]; - while (true) { - const ssize_t len = read(STDIN_FILENO, buf, sizeof(buf)); - if (len <= 0) { - break; - } - for (int i = 0; i < len; ++i) { - char ctrl = decodeUnixCtrlChar(buf[i]); - if (ctrl == '\0') { - putchar(buf[i]); - } else { - putchar('^'); - putchar(ctrl); - } - } - for (int i = 0; i < len; ++i) { - unsigned char uch = buf[i]; - printf("\t%3d %04o 0x%02x\n", uch, uch, uch); - fflush(stdout); - } - if (buf[0] == 4) { - // Ctrl-D - break; - } - } - restoreTerminalMode(saved); -} - -static void terminalResized(int signo) -{ - mainWakeup().set(); -} - -static void registerResizeSignalHandler() -{ - struct sigaction resizeSigAct; - memset(&resizeSigAct, 0, sizeof(resizeSigAct)); - resizeSigAct.sa_handler = terminalResized; - resizeSigAct.sa_flags = SA_RESTART; - sigaction(SIGWINCH, &resizeSigAct, NULL); -} - -// Convert the path to a Win32 path if it is a POSIX path, and convert slashes -// to backslashes. -static std::string convertPosixPathToWin(const std::string &path) -{ - char *tmp; -#if defined(CYGWIN_VERSION_CYGWIN_CONV) && \ - CYGWIN_VERSION_API_MINOR >= CYGWIN_VERSION_CYGWIN_CONV - // MSYS2 and versions of Cygwin released after 2009 or so use this API. - // The original MSYS still lacks this API. - ssize_t newSize = cygwin_conv_path(CCP_POSIX_TO_WIN_A | CCP_ABSOLUTE, - path.c_str(), NULL, 0); - assert(newSize >= 0); - tmp = new char[newSize + 1]; - ssize_t success = cygwin_conv_path(CCP_POSIX_TO_WIN_A | CCP_ABSOLUTE, - path.c_str(), tmp, newSize + 1); - assert(success == 0); -#else - // In the current Cygwin header file, this API is documented as deprecated - // because it's restricted to paths of MAX_PATH length. In the CVS version - // of MSYS, the newer API doesn't exist, and this older API is implemented - // using msys_p2w, which seems like it would handle paths larger than - // MAX_PATH, but there's no way to query how large the new path is. - // Hopefully, this is large enough. - tmp = new char[MAX_PATH + path.size()]; - cygwin_conv_to_win32_path(path.c_str(), tmp); -#endif - for (int i = 0; tmp[i] != '\0'; ++i) { - if (tmp[i] == '/') - tmp[i] = '\\'; - } - std::string ret(tmp); - delete [] tmp; - return ret; -} - -static std::string resolvePath(const std::string &path) -{ - char ret[PATH_MAX]; - ret[0] = '\0'; - if (realpath(path.c_str(), ret) != ret) { - return std::string(); - } - return ret; -} - -template -static bool endsWith(const std::string &path, const char (&suf)[N]) -{ - const size_t suffixLen = N - 1; - char actualSuf[N]; - if (path.size() < suffixLen) { - return false; - } - strcpy(actualSuf, &path.c_str()[path.size() - suffixLen]); - for (size_t i = 0; i < suffixLen; ++i) { - actualSuf[i] = tolower(actualSuf[i]); - } - return !strcmp(actualSuf, suf); -} - -static std::string findProgram( - const char *winptyProgName, - const std::string &prog) -{ - std::string candidate; - if (prog.find('/') == std::string::npos && - prog.find('\\') == std::string::npos) { - // XXX: It would be nice to use a lambda here (once/if old MSYS support - // is dropped). - // Search the PATH. - const char *const pathVar = getenv("PATH"); - const std::string pathList(pathVar ? pathVar : ""); - size_t elpos = 0; - while (true) { - const size_t elend = pathList.find(':', elpos); - candidate = pathList.substr(elpos, elend - elpos); - if (!candidate.empty() && *(candidate.end() - 1) != '/') { - candidate += '/'; - } - candidate += prog; - candidate = resolvePath(candidate); - if (!candidate.empty()) { - int perm = X_OK; - if (endsWith(candidate, ".bat") || endsWith(candidate, ".cmd")) { -#ifdef __MSYS__ - // In MSYS/MSYS2, batch files don't have the execute bit - // set, so just check that they're readable. - perm = R_OK; -#endif - } else if (endsWith(candidate, ".com") || endsWith(candidate, ".exe")) { - // Do nothing. - } else { - // Make the exe extension explicit so that we don't try to - // run shell scripts with CreateProcess/winpty_spawn. - candidate += ".exe"; - } - if (!access(candidate.c_str(), perm)) { - break; - } - } - if (elend == std::string::npos) { - fprintf(stderr, "%s: error: cannot start '%s': Not found in PATH\n", - winptyProgName, prog.c_str()); - exit(1); - } else { - elpos = elend + 1; - } - } - } else { - candidate = resolvePath(prog); - if (candidate.empty()) { - std::string errstr(strerror(errno)); - fprintf(stderr, "%s: error: cannot start '%s': %s\n", - winptyProgName, prog.c_str(), errstr.c_str()); - exit(1); - } - } - return convertPosixPathToWin(candidate); -} - -// Convert argc/argv into a Win32 command-line following the escaping convention -// documented on MSDN. (e.g. see CommandLineToArgvW documentation) -static std::string argvToCommandLine(const std::vector &argv) -{ - std::string result; - for (size_t argIndex = 0; argIndex < argv.size(); ++argIndex) { - if (argIndex > 0) - result.push_back(' '); - const char *arg = argv[argIndex].c_str(); - const bool quote = - strchr(arg, ' ') != NULL || - strchr(arg, '\t') != NULL || - *arg == '\0'; - if (quote) - result.push_back('\"'); - int bsCount = 0; - for (const char *p = arg; *p != '\0'; ++p) { - if (*p == '\\') { - bsCount++; - } else if (*p == '\"') { - result.append(bsCount * 2 + 1, '\\'); - result.push_back('\"'); - bsCount = 0; - } else { - result.append(bsCount, '\\'); - bsCount = 0; - result.push_back(*p); - } - } - if (quote) { - result.append(bsCount * 2, '\\'); - result.push_back('\"'); - } else { - result.append(bsCount, '\\'); - } - } - return result; -} - -static wchar_t *heapMbsToWcs(const char *text) -{ - // Calling mbstowcs with a NULL first argument seems to be broken on MSYS. - // Instead of returning the size of the converted string, it returns 0. - // Using strlen(text) * 2 is probably big enough. - size_t maxLen = strlen(text) * 2 + 1; - wchar_t *ret = new wchar_t[maxLen]; - size_t len = mbstowcs(ret, text, maxLen); - assert(len != (size_t)-1 && len < maxLen); - return ret; -} - -static char *heapWcsToMbs(const wchar_t *text) -{ - // Calling wcstombs with a NULL first argument seems to be broken on MSYS. - // Instead of returning the size of the converted string, it returns 0. - // Using wcslen(text) * 3 is big enough for UTF-8 and probably other - // encodings. For UTF-8, codepoints that fit in a single wchar - // (U+0000 to U+FFFF) are encoded using 1-3 bytes. The remaining code - // points needs two wchar's and are encoded using 4 bytes. - size_t maxLen = wcslen(text) * 3 + 1; - char *ret = new char[maxLen]; - size_t len = wcstombs(ret, text, maxLen); - if (len == (size_t)-1 || len >= maxLen) { - delete [] ret; - return NULL; - } else { - return ret; - } -} - -static std::string wcsToMbs(const wchar_t *text) -{ - std::string ret; - const char *ptr = heapWcsToMbs(text); - if (ptr != NULL) { - ret = ptr; - delete [] ptr; - } - return ret; -} - -void setupWin32Environment() -{ - std::map varsToCopy; - const char *vars[] = { - "WINPTY_DEBUG", - "WINPTY_SHOW_CONSOLE", - NULL - }; - for (int i = 0; vars[i] != NULL; ++i) { - const char *cstr = getenv(vars[i]); - if (cstr != NULL && cstr[0] != '\0') { - varsToCopy[vars[i]] = cstr; - } - } - -#if defined(__MSYS__) && CYGWIN_VERSION_API_MINOR >= 48 || \ - !defined(__MSYS__) && CYGWIN_VERSION_API_MINOR >= 153 - // Use CW_SYNC_WINENV to copy the Unix environment to the Win32 - // environment. The command performs special translation on some variables - // (such as PATH and TMP). It also copies the debugging environment - // variables. - // - // Note that the API minor versions have diverged in Cygwin and MSYS. - // CW_SYNC_WINENV was added to Cygwin in version 153. (Cygwin's - // include/cygwin/version.h says that CW_SETUP_WINENV was added in 153. - // The flag was renamed 8 days after it was added, but the API docs weren't - // updated.) The flag was added to MSYS in version 48. - // - // Also, in my limited testing, this call seems to be necessary with Cygwin - // but unnecessary with MSYS. Perhaps MSYS is automatically syncing the - // Unix environment with the Win32 environment before starting console.exe? - // It shouldn't hurt to call it for MSYS. - cygwin_internal(CW_SYNC_WINENV); -#endif - - // Copy debugging environment variables from the Cygwin environment - // to the Win32 environment so the agent will inherit it. - for (std::map::iterator it = varsToCopy.begin(); - it != varsToCopy.end(); - ++it) { - wchar_t *nameW = heapMbsToWcs(it->first.c_str()); - wchar_t *valueW = heapMbsToWcs(it->second.c_str()); - SetEnvironmentVariableW(nameW, valueW); - delete [] nameW; - delete [] valueW; - } - - // Clear the TERM variable. The child process's immediate console/terminal - // environment is a Windows console, not the terminal that winpty is - // communicating with. Leaving the TERM variable set can break programs in - // various ways. (e.g. arrows keys broken in Cygwin less, IronPython's - // help(...) function doesn't start, misc programs decide they should - // output color escape codes on pre-Win10). See - // https://github.com/rprichard/winpty/issues/43. - SetEnvironmentVariableW(L"TERM", NULL); -} - -static void usage(const char *program, int exitCode) -{ - printf("Usage: %s [options] [--] program [args]\n", program); - printf("\n"); - printf("Options:\n"); - printf(" -h, --help Show this help message\n"); - printf(" --mouse Enable terminal mouse input\n"); - printf(" --showkey Dump STDIN escape sequences\n"); - printf(" --version Show the winpty version number\n"); - exit(exitCode); -} - -struct Arguments { - std::vector childArgv; - bool mouseInput; - bool testAllowNonTtys; - bool testConerr; - bool testPlainOutput; - bool testColorEscapes; -}; - -static void parseArguments(int argc, char *argv[], Arguments &out) -{ - out.mouseInput = false; - out.testAllowNonTtys = false; - out.testConerr = false; - out.testPlainOutput = false; - out.testColorEscapes = false; - bool doShowKeys = false; - const char *const program = argc >= 1 ? argv[0] : ""; - int argi = 1; - while (argi < argc) { - std::string arg(argv[argi++]); - if (arg.size() >= 1 && arg[0] == '-') { - if (arg == "-h" || arg == "--help") { - usage(program, 0); - } else if (arg == "--mouse") { - out.mouseInput = true; - } else if (arg == "--showkey") { - doShowKeys = true; - } else if (arg == "--version") { - dumpVersionToStdout(); - exit(0); - } else if (arg == "-Xallow-non-tty") { - out.testAllowNonTtys = true; - } else if (arg == "-Xconerr") { - out.testConerr = true; - } else if (arg == "-Xplain") { - out.testPlainOutput = true; - } else if (arg == "-Xcolor") { - out.testColorEscapes = true; - } else if (arg == "--") { - break; - } else { - fprintf(stderr, "Error: unrecognized option: '%s'\n", - arg.c_str()); - exit(1); - } - } else { - out.childArgv.push_back(arg); - break; - } - } - for (; argi < argc; ++argi) { - out.childArgv.push_back(argv[argi]); - } - if (doShowKeys) { - debugShowKey(out.testAllowNonTtys); - exit(0); - } - if (out.childArgv.size() == 0) { - usage(program, 1); - } -} - -static std::string errorMessageToString(DWORD err) -{ - // Use FormatMessageW rather than FormatMessageA, because we want to use - // wcstombs to convert to the Cygwin locale, which might not match the - // codepage FormatMessageA would use. We need to convert using wcstombs, - // rather than print using %ls, because %ls doesn't work in the original - // MSYS. - wchar_t *wideMsgPtr = NULL; - const DWORD formatRet = FormatMessageW( - FORMAT_MESSAGE_FROM_SYSTEM | - FORMAT_MESSAGE_ALLOCATE_BUFFER | - FORMAT_MESSAGE_IGNORE_INSERTS, - NULL, - err, - MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), - reinterpret_cast(&wideMsgPtr), - 0, - NULL); - if (formatRet == 0 || wideMsgPtr == NULL) { - return std::string(); - } - std::string msg = wcsToMbs(wideMsgPtr); - LocalFree(wideMsgPtr); - const size_t pos = msg.find_last_not_of(" \r\n\t"); - if (pos == std::string::npos) { - msg.clear(); - } else { - msg.erase(pos + 1); - } - return msg; -} - -static std::string formatErrorMessage(DWORD err) -{ - char buf[64]; - sprintf(buf, "error %#x", static_cast(err)); - std::string ret = errorMessageToString(err); - if (ret.empty()) { - ret += buf; - } else { - ret += " ("; - ret += buf; - ret += ")"; - } - return ret; -} - -int main(int argc, char *argv[]) -{ - setlocale(LC_ALL, ""); - - g_mainWakeup = new WakeupFd(); - - Arguments args; - parseArguments(argc, argv, args); - - setupWin32Environment(); - - winsize sz = { 0 }; - sz.ws_col = 80; - sz.ws_row = 25; - ioctl(STDIN_FILENO, TIOCGWINSZ, &sz); - - DWORD agentFlags = WINPTY_FLAG_ALLOW_CURPROC_DESKTOP_CREATION; - if (args.testConerr) { agentFlags |= WINPTY_FLAG_CONERR; } - if (args.testPlainOutput) { agentFlags |= WINPTY_FLAG_PLAIN_OUTPUT; } - if (args.testColorEscapes) { agentFlags |= WINPTY_FLAG_COLOR_ESCAPES; } - winpty_config_t *agentCfg = winpty_config_new(agentFlags, NULL); - assert(agentCfg != NULL); - winpty_config_set_initial_size(agentCfg, sz.ws_col, sz.ws_row); - if (args.mouseInput) { - winpty_config_set_mouse_mode(agentCfg, WINPTY_MOUSE_MODE_FORCE); - } - - winpty_error_ptr_t openErr = NULL; - winpty_t *wp = winpty_open(agentCfg, &openErr); - if (wp == NULL) { - fprintf(stderr, "Error creating winpty: %s\n", - wcsToMbs(winpty_error_msg(openErr)).c_str()); - exit(1); - } - winpty_config_free(agentCfg); - winpty_error_free(openErr); - - HANDLE conin = CreateFileW(winpty_conin_name(wp), GENERIC_WRITE, 0, NULL, - OPEN_EXISTING, 0, NULL); - HANDLE conout = CreateFileW(winpty_conout_name(wp), GENERIC_READ, 0, NULL, - OPEN_EXISTING, 0, NULL); - assert(conin != INVALID_HANDLE_VALUE); - assert(conout != INVALID_HANDLE_VALUE); - HANDLE conerr = NULL; - if (args.testConerr) { - conerr = CreateFileW(winpty_conerr_name(wp), GENERIC_READ, 0, NULL, - OPEN_EXISTING, 0, NULL); - assert(conerr != INVALID_HANDLE_VALUE); - } - - HANDLE childHandle = NULL; - - { - // Start the child process under the console. - args.childArgv[0] = findProgram(argv[0], args.childArgv[0]); - std::string cmdLine = argvToCommandLine(args.childArgv); - wchar_t *cmdLineW = heapMbsToWcs(cmdLine.c_str()); - - winpty_spawn_config_t *spawnCfg = winpty_spawn_config_new( - WINPTY_SPAWN_FLAG_AUTO_SHUTDOWN, - NULL, cmdLineW, NULL, NULL, NULL); - assert(spawnCfg != NULL); - - winpty_error_ptr_t spawnErr = NULL; - DWORD lastError = 0; - BOOL spawnRet = winpty_spawn(wp, spawnCfg, &childHandle, NULL, - &lastError, &spawnErr); - winpty_spawn_config_free(spawnCfg); - - if (!spawnRet) { - winpty_result_t spawnCode = winpty_error_code(spawnErr); - if (spawnCode == WINPTY_ERROR_SPAWN_CREATE_PROCESS_FAILED) { - fprintf(stderr, "%s: error: cannot start '%s': %s\n", - argv[0], - cmdLine.c_str(), - formatErrorMessage(lastError).c_str()); - } else { - fprintf(stderr, "%s: error: cannot start '%s': internal error: %s\n", - argv[0], - cmdLine.c_str(), - wcsToMbs(winpty_error_msg(spawnErr)).c_str()); - } - exit(1); - } - winpty_error_free(spawnErr); - delete [] cmdLineW; - } - - registerResizeSignalHandler(); - SavedTermiosMode mode = - setRawTerminalMode(args.testAllowNonTtys, true, args.testConerr); - - InputHandler inputHandler(conin, STDIN_FILENO, mainWakeup()); - OutputHandler outputHandler(conout, STDOUT_FILENO, mainWakeup()); - OutputHandler *errorHandler = NULL; - if (args.testConerr) { - errorHandler = new OutputHandler(conerr, STDERR_FILENO, mainWakeup()); - } - - while (true) { - fd_set readfds; - FD_ZERO(&readfds); - FD_SET(mainWakeup().fd(), &readfds); - selectWrapper("main thread", mainWakeup().fd() + 1, &readfds); - mainWakeup().reset(); - - // Check for terminal resize. - { - winsize sz2; - ioctl(STDIN_FILENO, TIOCGWINSZ, &sz2); - if (memcmp(&sz, &sz2, sizeof(sz)) != 0) { - sz = sz2; - winpty_set_size(wp, sz.ws_col, sz.ws_row, NULL); - } - } - - // Check for an I/O handler shutting down (possibly indicating that the - // child process has exited). - if (inputHandler.isComplete() || outputHandler.isComplete() || - (errorHandler != NULL && errorHandler->isComplete())) { - break; - } - } - - // Kill the agent connection. This will kill the agent, closing the CONIN - // and CONOUT pipes on the agent pipe, prompting our I/O handler to shut - // down. - winpty_free(wp); - - inputHandler.shutdown(); - outputHandler.shutdown(); - CloseHandle(conin); - CloseHandle(conout); - - if (errorHandler != NULL) { - errorHandler->shutdown(); - delete errorHandler; - CloseHandle(conerr); - } - - restoreTerminalMode(mode); - - DWORD exitCode = 0; - if (!GetExitCodeProcess(childHandle, &exitCode)) { - exitCode = 1; - } - CloseHandle(childHandle); - return exitCode; -} diff --git a/node_modules/node-pty/deps/winpty/src/unix-adapter/subdir.mk b/node_modules/node-pty/deps/winpty/src/unix-adapter/subdir.mk deleted file mode 100644 index 200193a..0000000 --- a/node_modules/node-pty/deps/winpty/src/unix-adapter/subdir.mk +++ /dev/null @@ -1,41 +0,0 @@ -# Copyright (c) 2011-2015 Ryan Prichard -# -# 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. - -ALL_TARGETS += build/$(UNIX_ADAPTER_EXE) - -$(eval $(call def_unix_target,unix-adapter,)) - -UNIX_ADAPTER_OBJECTS = \ - build/unix-adapter/unix-adapter/InputHandler.o \ - build/unix-adapter/unix-adapter/OutputHandler.o \ - build/unix-adapter/unix-adapter/Util.o \ - build/unix-adapter/unix-adapter/WakeupFd.o \ - build/unix-adapter/unix-adapter/main.o \ - build/unix-adapter/shared/DebugClient.o \ - build/unix-adapter/shared/WinptyAssert.o \ - build/unix-adapter/shared/WinptyVersion.o - -build/unix-adapter/shared/WinptyVersion.o : build/gen/GenVersion.h - -build/$(UNIX_ADAPTER_EXE) : $(UNIX_ADAPTER_OBJECTS) build/winpty.dll - $(info Linking $@) - @$(UNIX_CXX) $(UNIX_LDFLAGS) -o $@ $^ - --include $(UNIX_ADAPTER_OBJECTS:.o=.d) diff --git a/node_modules/node-pty/deps/winpty/src/winpty.gyp b/node_modules/node-pty/deps/winpty/src/winpty.gyp deleted file mode 100644 index 7ee68d5..0000000 --- a/node_modules/node-pty/deps/winpty/src/winpty.gyp +++ /dev/null @@ -1,206 +0,0 @@ -{ - # The MSVC generator is the default. Select the compiler version by - # passing -G msvs_version= to gyp. is a string like 2013e. - # See gyp\pylib\gyp\MSVSVersion.py for sample version strings. You - # can also pass configurations.gypi to gyp for 32-bit and 64-bit builds. - # See that file for details. - # - # Pass --format=make to gyp to generate a Makefile instead. The Makefile - # can be configured by passing variables to make, e.g.: - # make -j4 CXX=i686-w64-mingw32-g++ LDFLAGS="-static -static-libgcc -static-libstdc++" - - 'variables': { - 'WINPTY_COMMIT_HASH%': ' { - // // Flow control doesn't work on Windows - // if (process.platform === 'win32') { - // return; - // } - // this.timeout(10000); - // const pty = new terminalConstructor(SHELL, [], {handleFlowControl: true, flowControlPause: 'PAUSE', flowControlResume: 'RESUME'}); - // let read: string = ''; - // pty.on('data', data => read += data); - // pty.on('pause', () => read += 'paused'); - // pty.on('resume', () => read += 'resumed'); - // pty.write('1'); - // pty.write('PAUSE'); - // pty.write('2'); - // pty.write('RESUME'); - // pty.write('3'); - // await pollUntil(() => { - // return stripEscapeSequences(read).endsWith('1pausedresumed23'); - // }, 100, 10); - // }); - }); -}); -function stripEscapeSequences(data) { - return data.replace(/\u001b\[0K/, ''); -} -//# sourceMappingURL=terminal.test.js.map \ No newline at end of file diff --git a/node_modules/node-pty/lib/terminal.test.js.map b/node_modules/node-pty/lib/terminal.test.js.map deleted file mode 100644 index 8f25cd6..0000000 --- a/node_modules/node-pty/lib/terminal.test.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"terminal.test.js","sourceRoot":"","sources":["../src/terminal.test.ts"],"names":[],"mappings":";AAAA;;;GAGG;;AAEH,+BAAiC;AACjC,qDAAoD;AACpD,+CAA8C;AAG9C,IAAM,mBAAmB,GAAG,CAAC,OAAO,CAAC,QAAQ,KAAK,OAAO,CAAC,CAAC,CAAC,CAAC,iCAAe,CAAC,CAAC,CAAC,2BAAY,CAAC;AAC5F,IAAM,KAAK,GAAG,CAAC,OAAO,CAAC,QAAQ,KAAK,OAAO,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,WAAW,CAAC;AAEvE,IAAI,YAA4C,CAAC;AACjD,IAAI,OAAO,CAAC,QAAQ,KAAK,OAAO,EAAE;IAChC,YAAY,GAAG,OAAO,CAAC,mBAAmB,CAAC,CAAC;CAC7C;KAAM;IACL,YAAY,GAAG,OAAO,CAAC,gBAAgB,CAAC,CAAC;CAC1C;AAGD,QAAQ,CAAC,UAAU,EAAE;IACnB,QAAQ,CAAC,aAAa,EAAE;QACtB,EAAE,CAAC,6BAA6B,EAAE;YAChC,MAAM,CAAC,MAAM,CACX,cAAM,OAAA,IAAU,YAAa,CAAC,GAAG,EAAE,GAAG,EAAE,EAAE,MAAM,EAAE,EAAE,EAAE,CAAC,EAAjD,CAAiD,EACvD,sCAAsC,CACvC,CAAC;QACJ,CAAC,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;IAEH,QAAQ,CAAC,wBAAwB,EAAE;QACjC,EAAE,CAAC,0CAA0C,EAAE;YAC7C,IAAM,GAAG,GAAG,IAAI,mBAAmB,CAAC,KAAK,EAAE,EAAE,EAAE,EAAC,iBAAiB,EAAE,IAAI,EAAE,gBAAgB,EAAE,KAAK,EAAE,iBAAiB,EAAE,KAAK,EAAC,CAAC,CAAC;YAC7H,MAAM,CAAC,KAAK,CAAC,GAAG,CAAC,iBAAiB,EAAE,IAAI,CAAC,CAAC;YAC1C,MAAM,CAAC,KAAK,CAAE,GAAW,CAAC,iBAAiB,EAAE,KAAK,CAAC,CAAC;YACpD,MAAM,CAAC,KAAK,CAAE,GAAW,CAAC,kBAAkB,EAAE,KAAK,CAAC,CAAC;QACvD,CAAC,CAAC,CAAC;QACH,oFAAoF;QACpF,+EAA+E;QAC/E,4CAA4C;QAC5C,wCAAwC;QACxC,cAAc;QACd,MAAM;QAEN,yBAAyB;QACzB,uIAAuI;QACvI,2BAA2B;QAC3B,0CAA0C;QAC1C,6CAA6C;QAC7C,+CAA+C;QAC/C,oBAAoB;QACpB,wBAAwB;QACxB,oBAAoB;QACpB,yBAAyB;QACzB,oBAAoB;QACpB,4BAA4B;QAC5B,sEAAsE;QACtE,iBAAiB;QACjB,MAAM;IACR,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC;AAEH,SAAS,oBAAoB,CAAC,IAAY;IACxC,OAAO,IAAI,CAAC,OAAO,CAAC,YAAY,EAAE,EAAE,CAAC,CAAC;AACxC,CAAC"} \ No newline at end of file diff --git a/node_modules/node-pty/lib/testUtils.test.js b/node_modules/node-pty/lib/testUtils.test.js deleted file mode 100644 index b861d36..0000000 --- a/node_modules/node-pty/lib/testUtils.test.js +++ /dev/null @@ -1,27 +0,0 @@ -"use strict"; -/** - * Copyright (c) 2019, Microsoft Corporation (MIT License). - */ -Object.defineProperty(exports, "__esModule", { value: true }); -function pollUntil(cb, timeout, interval) { - return new Promise(function (resolve, reject) { - var intervalId = setInterval(function () { - if (cb()) { - clearInterval(intervalId); - clearTimeout(timeoutId); - resolve(); - } - }, interval); - var timeoutId = setTimeout(function () { - clearInterval(intervalId); - if (cb()) { - resolve(); - } - else { - reject(); - } - }, timeout); - }); -} -exports.pollUntil = pollUntil; -//# sourceMappingURL=testUtils.test.js.map \ No newline at end of file diff --git a/node_modules/node-pty/lib/testUtils.test.js.map b/node_modules/node-pty/lib/testUtils.test.js.map deleted file mode 100644 index 73b16dc..0000000 --- a/node_modules/node-pty/lib/testUtils.test.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"testUtils.test.js","sourceRoot":"","sources":["../src/testUtils.test.ts"],"names":[],"mappings":";AAAA;;GAEG;;AAEH,SAAgB,SAAS,CAAC,EAAiB,EAAE,OAAe,EAAE,QAAgB;IAC5E,OAAO,IAAI,OAAO,CAAO,UAAC,OAAO,EAAE,MAAM;QACvC,IAAM,UAAU,GAAG,WAAW,CAAC;YAC7B,IAAI,EAAE,EAAE,EAAE;gBACR,aAAa,CAAC,UAAU,CAAC,CAAC;gBAC1B,YAAY,CAAC,SAAS,CAAC,CAAC;gBACxB,OAAO,EAAE,CAAC;aACX;QACH,CAAC,EAAE,QAAQ,CAAC,CAAC;QACb,IAAM,SAAS,GAAG,UAAU,CAAC;YAC3B,aAAa,CAAC,UAAU,CAAC,CAAC;YAC1B,IAAI,EAAE,EAAE,EAAE;gBACR,OAAO,EAAE,CAAC;aACX;iBAAM;gBACL,MAAM,EAAE,CAAC;aACV;QACH,CAAC,EAAE,OAAO,CAAC,CAAC;IACd,CAAC,CAAC,CAAC;AACL,CAAC;AAlBD,8BAkBC"} \ No newline at end of file diff --git a/node_modules/node-pty/lib/types.js b/node_modules/node-pty/lib/types.js deleted file mode 100644 index 3768e95..0000000 --- a/node_modules/node-pty/lib/types.js +++ /dev/null @@ -1,7 +0,0 @@ -"use strict"; -/** - * Copyright (c) 2017, Daniel Imms (MIT License). - * Copyright (c) 2018, Microsoft Corporation (MIT License). - */ -Object.defineProperty(exports, "__esModule", { value: true }); -//# sourceMappingURL=types.js.map \ No newline at end of file diff --git a/node_modules/node-pty/lib/types.js.map b/node_modules/node-pty/lib/types.js.map deleted file mode 100644 index 5ab8a95..0000000 --- a/node_modules/node-pty/lib/types.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":";AAAA;;;GAGG"} \ No newline at end of file diff --git a/node_modules/node-pty/lib/unixTerminal.js b/node_modules/node-pty/lib/unixTerminal.js deleted file mode 100644 index 004364d..0000000 --- a/node_modules/node-pty/lib/unixTerminal.js +++ /dev/null @@ -1,276 +0,0 @@ -"use strict"; -var __extends = (this && this.__extends) || (function () { - var extendStatics = function (d, b) { - extendStatics = Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; - return extendStatics(d, b); - }; - return function (d, b) { - extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); - }; -})(); -Object.defineProperty(exports, "__esModule", { value: true }); -/** - * Copyright (c) 2012-2015, Christopher Jeffrey (MIT License) - * Copyright (c) 2016, Daniel Imms (MIT License). - * Copyright (c) 2018, Microsoft Corporation (MIT License). - */ -var net = require("net"); -var terminal_1 = require("./terminal"); -var utils_1 = require("./utils"); -var pty; -try { - pty = require('../build/Release/pty.node'); -} -catch (outerError) { - try { - pty = require('../build/Debug/pty.node'); - } - catch (innerError) { - console.error('innerError', innerError); - // Re-throw the exception from the Release require if the Debug require fails as well - throw outerError; - } -} -var DEFAULT_FILE = 'sh'; -var DEFAULT_NAME = 'xterm'; -var DESTROY_SOCKET_TIMEOUT_MS = 200; -var UnixTerminal = /** @class */ (function (_super) { - __extends(UnixTerminal, _super); - function UnixTerminal(file, args, opt) { - var _this = _super.call(this, opt) || this; - if (typeof args === 'string') { - throw new Error('args as a string is not supported on unix.'); - } - // Initialize arguments - args = args || []; - file = file || DEFAULT_FILE; - opt = opt || {}; - opt.env = opt.env || process.env; - _this._cols = opt.cols || terminal_1.DEFAULT_COLS; - _this._rows = opt.rows || terminal_1.DEFAULT_ROWS; - var uid = opt.uid || -1; - var gid = opt.gid || -1; - var env = utils_1.assign({}, opt.env); - if (opt.env === process.env) { - _this._sanitizeEnv(env); - } - var cwd = opt.cwd || process.cwd(); - var name = opt.name || env.TERM || DEFAULT_NAME; - env.TERM = name; - var parsedEnv = _this._parseEnv(env); - var encoding = (opt.encoding === undefined ? 'utf8' : opt.encoding); - var onexit = function (code, signal) { - // XXX Sometimes a data event is emitted after exit. Wait til socket is - // destroyed. - if (!_this._emittedClose) { - if (_this._boundClose) { - return; - } - _this._boundClose = true; - // From macOS High Sierra 10.13.2 sometimes the socket never gets - // closed. A timeout is applied here to avoid the terminal never being - // destroyed when this occurs. - var timeout_1 = setTimeout(function () { - timeout_1 = null; - // Destroying the socket now will cause the close event to fire - _this._socket.destroy(); - }, DESTROY_SOCKET_TIMEOUT_MS); - _this.once('close', function () { - if (timeout_1 !== null) { - clearTimeout(timeout_1); - } - _this.emit('exit', code, signal); - }); - return; - } - _this.emit('exit', code, signal); - }; - // fork - var term = pty.fork(file, args, parsedEnv, cwd, _this._cols, _this._rows, uid, gid, (encoding === 'utf8'), onexit); - _this._socket = new PipeSocket(term.fd); - if (encoding !== null) { - _this._socket.setEncoding(encoding); - } - // setup - _this._socket.on('error', function (err) { - // NOTE: fs.ReadStream gets EAGAIN twice at first: - if (err.code) { - if (~err.code.indexOf('EAGAIN')) { - return; - } - } - // close - _this._close(); - // EIO on exit from fs.ReadStream: - if (!_this._emittedClose) { - _this._emittedClose = true; - _this.emit('close'); - } - // EIO, happens when someone closes our child process: the only process in - // the terminal. - // node < 0.6.14: errno 5 - // node >= 0.6.14: read EIO - if (err.code) { - if (~err.code.indexOf('errno 5') || ~err.code.indexOf('EIO')) { - return; - } - } - // throw anything else - if (_this.listeners('error').length < 2) { - throw err; - } - }); - _this._pid = term.pid; - _this._fd = term.fd; - _this._pty = term.pty; - _this._file = file; - _this._name = name; - _this._readable = true; - _this._writable = true; - _this._socket.on('close', function () { - if (_this._emittedClose) { - return; - } - _this._emittedClose = true; - _this._close(); - _this.emit('close'); - }); - _this._forwardEvents(); - return _this; - } - Object.defineProperty(UnixTerminal.prototype, "master", { - get: function () { return this._master; }, - enumerable: true, - configurable: true - }); - Object.defineProperty(UnixTerminal.prototype, "slave", { - get: function () { return this._slave; }, - enumerable: true, - configurable: true - }); - UnixTerminal.prototype._write = function (data) { - this._socket.write(data); - }; - /** - * openpty - */ - UnixTerminal.open = function (opt) { - var self = Object.create(UnixTerminal.prototype); - opt = opt || {}; - if (arguments.length > 1) { - opt = { - cols: arguments[1], - rows: arguments[2] - }; - } - var cols = opt.cols || terminal_1.DEFAULT_COLS; - var rows = opt.rows || terminal_1.DEFAULT_ROWS; - var encoding = (opt.encoding === undefined ? 'utf8' : opt.encoding); - // open - var term = pty.open(cols, rows); - self._master = new PipeSocket(term.master); - if (encoding !== null) { - self._master.setEncoding(encoding); - } - self._master.resume(); - self._slave = new PipeSocket(term.slave); - if (encoding !== null) { - self._slave.setEncoding(encoding); - } - self._slave.resume(); - self._socket = self._master; - self._pid = null; - self._fd = term.master; - self._pty = term.pty; - self._file = process.argv[0] || 'node'; - self._name = process.env.TERM || ''; - self._readable = true; - self._writable = true; - self._socket.on('error', function (err) { - self._close(); - if (self.listeners('error').length < 2) { - throw err; - } - }); - self._socket.on('close', function () { - self._close(); - }); - return self; - }; - UnixTerminal.prototype.destroy = function () { - var _this = this; - this._close(); - // Need to close the read stream so node stops reading a dead file - // descriptor. Then we can safely SIGHUP the shell. - this._socket.once('close', function () { - _this.kill('SIGHUP'); - }); - this._socket.destroy(); - }; - UnixTerminal.prototype.kill = function (signal) { - try { - process.kill(this.pid, signal || 'SIGHUP'); - } - catch (e) { /* swallow */ } - }; - Object.defineProperty(UnixTerminal.prototype, "process", { - /** - * Gets the name of the process. - */ - get: function () { - return pty.process(this._fd, this._pty) || this._file; - }, - enumerable: true, - configurable: true - }); - /** - * TTY - */ - UnixTerminal.prototype.resize = function (cols, rows) { - if (cols <= 0 || rows <= 0 || isNaN(cols) || isNaN(rows) || cols === Infinity || rows === Infinity) { - throw new Error('resizing must be done using positive cols and rows'); - } - pty.resize(this._fd, cols, rows); - this._cols = cols; - this._rows = rows; - }; - UnixTerminal.prototype._sanitizeEnv = function (env) { - // Make sure we didn't start our server from inside tmux. - delete env['TMUX']; - delete env['TMUX_PANE']; - // Make sure we didn't start our server from inside screen. - // http://web.mit.edu/gnu/doc/html/screen_20.html - delete env['STY']; - delete env['WINDOW']; - // Delete some variables that might confuse our terminal. - delete env['WINDOWID']; - delete env['TERMCAP']; - delete env['COLUMNS']; - delete env['LINES']; - }; - return UnixTerminal; -}(terminal_1.Terminal)); -exports.UnixTerminal = UnixTerminal; -/** - * Wraps net.Socket to force the handle type "PIPE" by temporarily overwriting - * tty_wrap.guessHandleType. - * See: https://github.com/chjj/pty.js/issues/103 - */ -var PipeSocket = /** @class */ (function (_super) { - __extends(PipeSocket, _super); - function PipeSocket(fd) { - var _this = this; - var _a = process.binding('pipe_wrap'), Pipe = _a.Pipe, constants = _a.constants; // tslint:disable-line - // @types/node has fd as string? https://github.com/DefinitelyTyped/DefinitelyTyped/pull/18275 - var handle = new Pipe(constants.SOCKET); - handle.open(fd); - _this = _super.call(this, { handle: handle }) || this; - return _this; - } - return PipeSocket; -}(net.Socket)); -//# sourceMappingURL=unixTerminal.js.map \ No newline at end of file diff --git a/node_modules/node-pty/lib/unixTerminal.js.map b/node_modules/node-pty/lib/unixTerminal.js.map deleted file mode 100644 index 3275877..0000000 --- a/node_modules/node-pty/lib/unixTerminal.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"unixTerminal.js","sourceRoot":"","sources":["../src/unixTerminal.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA;;;;GAIG;AACH,yBAA2B;AAC3B,uCAAkE;AAGlE,iCAAiC;AAEjC,IAAI,GAAgB,CAAC;AACrB,IAAI;IACF,GAAG,GAAG,OAAO,CAAC,2BAA2B,CAAC,CAAC;CAC5C;AAAC,OAAO,UAAU,EAAE;IACnB,IAAI;QACF,GAAG,GAAG,OAAO,CAAC,yBAAyB,CAAC,CAAC;KAC1C;IAAC,OAAO,UAAU,EAAE;QACnB,OAAO,CAAC,KAAK,CAAC,YAAY,EAAE,UAAU,CAAC,CAAC;QACxC,qFAAqF;QACrF,MAAM,UAAU,CAAC;KAClB;CACF;AAED,IAAM,YAAY,GAAG,IAAI,CAAC;AAC1B,IAAM,YAAY,GAAG,OAAO,CAAC;AAC7B,IAAM,yBAAyB,GAAG,GAAG,CAAC;AAEtC;IAAkC,gCAAQ;IAkBxC,sBAAY,IAAa,EAAE,IAAwB,EAAE,GAAqB;QAA1E,YACE,kBAAM,GAAG,CAAC,SAqHX;QAnHC,IAAI,OAAO,IAAI,KAAK,QAAQ,EAAE;YAC5B,MAAM,IAAI,KAAK,CAAC,4CAA4C,CAAC,CAAC;SAC/D;QAED,uBAAuB;QACvB,IAAI,GAAG,IAAI,IAAI,EAAE,CAAC;QAClB,IAAI,GAAG,IAAI,IAAI,YAAY,CAAC;QAC5B,GAAG,GAAG,GAAG,IAAI,EAAE,CAAC;QAChB,GAAG,CAAC,GAAG,GAAG,GAAG,CAAC,GAAG,IAAI,OAAO,CAAC,GAAG,CAAC;QAEjC,KAAI,CAAC,KAAK,GAAG,GAAG,CAAC,IAAI,IAAI,uBAAY,CAAC;QACtC,KAAI,CAAC,KAAK,GAAG,GAAG,CAAC,IAAI,IAAI,uBAAY,CAAC;QACtC,IAAM,GAAG,GAAG,GAAG,CAAC,GAAG,IAAI,CAAC,CAAC,CAAC;QAC1B,IAAM,GAAG,GAAG,GAAG,CAAC,GAAG,IAAI,CAAC,CAAC,CAAC;QAC1B,IAAM,GAAG,GAAG,cAAM,CAAC,EAAE,EAAE,GAAG,CAAC,GAAG,CAAC,CAAC;QAEhC,IAAI,GAAG,CAAC,GAAG,KAAK,OAAO,CAAC,GAAG,EAAE;YAC3B,KAAI,CAAC,YAAY,CAAC,GAAG,CAAC,CAAC;SACxB;QAED,IAAM,GAAG,GAAG,GAAG,CAAC,GAAG,IAAI,OAAO,CAAC,GAAG,EAAE,CAAC;QACrC,IAAM,IAAI,GAAG,GAAG,CAAC,IAAI,IAAI,GAAG,CAAC,IAAI,IAAI,YAAY,CAAC;QAClD,GAAG,CAAC,IAAI,GAAG,IAAI,CAAC;QAChB,IAAM,SAAS,GAAG,KAAI,CAAC,SAAS,CAAC,GAAG,CAAC,CAAC;QAEtC,IAAM,QAAQ,GAAG,CAAC,GAAG,CAAC,QAAQ,KAAK,SAAS,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAC;QAEtE,IAAM,MAAM,GAAG,UAAC,IAAY,EAAE,MAAc;YAC1C,uEAAuE;YACvE,aAAa;YACb,IAAI,CAAC,KAAI,CAAC,aAAa,EAAE;gBACvB,IAAI,KAAI,CAAC,WAAW,EAAE;oBACpB,OAAO;iBACR;gBACD,KAAI,CAAC,WAAW,GAAG,IAAI,CAAC;gBACxB,iEAAiE;gBACjE,sEAAsE;gBACtE,8BAA8B;gBAC9B,IAAI,SAAO,GAAG,UAAU,CAAC;oBACvB,SAAO,GAAG,IAAI,CAAC;oBACf,+DAA+D;oBAC/D,KAAI,CAAC,OAAO,CAAC,OAAO,EAAE,CAAC;gBACzB,CAAC,EAAE,yBAAyB,CAAC,CAAC;gBAC9B,KAAI,CAAC,IAAI,CAAC,OAAO,EAAE;oBACjB,IAAI,SAAO,KAAK,IAAI,EAAE;wBACpB,YAAY,CAAC,SAAO,CAAC,CAAC;qBACvB;oBACD,KAAI,CAAC,IAAI,CAAC,MAAM,EAAE,IAAI,EAAE,MAAM,CAAC,CAAC;gBAClC,CAAC,CAAC,CAAC;gBACH,OAAO;aACR;YACD,KAAI,CAAC,IAAI,CAAC,MAAM,EAAE,IAAI,EAAE,MAAM,CAAC,CAAC;QAClC,CAAC,CAAC;QAEF,OAAO;QACP,IAAM,IAAI,GAAG,GAAG,CAAC,IAAI,CAAC,IAAI,EAAE,IAAI,EAAE,SAAS,EAAE,GAAG,EAAE,KAAI,CAAC,KAAK,EAAE,KAAI,CAAC,KAAK,EAAE,GAAG,EAAE,GAAG,EAAE,CAAC,QAAQ,KAAK,MAAM,CAAC,EAAE,MAAM,CAAC,CAAC;QAEnH,KAAI,CAAC,OAAO,GAAG,IAAI,UAAU,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;QACvC,IAAI,QAAQ,KAAK,IAAI,EAAE;YACrB,KAAI,CAAC,OAAO,CAAC,WAAW,CAAC,QAAQ,CAAC,CAAC;SACpC;QAED,QAAQ;QACR,KAAI,CAAC,OAAO,CAAC,EAAE,CAAC,OAAO,EAAE,UAAC,GAAQ;YAChC,kDAAkD;YAClD,IAAI,GAAG,CAAC,IAAI,EAAE;gBACZ,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,OAAO,CAAC,QAAQ,CAAC,EAAE;oBAC/B,OAAO;iBACR;aACF;YAED,QAAQ;YACR,KAAI,CAAC,MAAM,EAAE,CAAC;YACd,kCAAkC;YAClC,IAAI,CAAC,KAAI,CAAC,aAAa,EAAE;gBACvB,KAAI,CAAC,aAAa,GAAG,IAAI,CAAC;gBAC1B,KAAI,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;aACpB;YAED,0EAA0E;YAC1E,gBAAgB;YAChB,yBAAyB;YACzB,2BAA2B;YAC3B,IAAI,GAAG,CAAC,IAAI,EAAE;gBACZ,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,OAAO,CAAC,SAAS,CAAC,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,OAAO,CAAC,KAAK,CAAC,EAAE;oBAC5D,OAAO;iBACR;aACF;YAED,sBAAsB;YACtB,IAAI,KAAI,CAAC,SAAS,CAAC,OAAO,CAAC,CAAC,MAAM,GAAG,CAAC,EAAE;gBACtC,MAAM,GAAG,CAAC;aACX;QACH,CAAC,CAAC,CAAC;QAEH,KAAI,CAAC,IAAI,GAAG,IAAI,CAAC,GAAG,CAAC;QACrB,KAAI,CAAC,GAAG,GAAG,IAAI,CAAC,EAAE,CAAC;QACnB,KAAI,CAAC,IAAI,GAAG,IAAI,CAAC,GAAG,CAAC;QAErB,KAAI,CAAC,KAAK,GAAG,IAAI,CAAC;QAClB,KAAI,CAAC,KAAK,GAAG,IAAI,CAAC;QAElB,KAAI,CAAC,SAAS,GAAG,IAAI,CAAC;QACtB,KAAI,CAAC,SAAS,GAAG,IAAI,CAAC;QAEtB,KAAI,CAAC,OAAO,CAAC,EAAE,CAAC,OAAO,EAAE;YACvB,IAAI,KAAI,CAAC,aAAa,EAAE;gBACtB,OAAO;aACR;YACD,KAAI,CAAC,aAAa,GAAG,IAAI,CAAC;YAC1B,KAAI,CAAC,MAAM,EAAE,CAAC;YACd,KAAI,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;QACrB,CAAC,CAAC,CAAC;QAEH,KAAI,CAAC,cAAc,EAAE,CAAC;;IACxB,CAAC;IAzHD,sBAAW,gCAAM;aAAjB,cAAkC,OAAO,IAAI,CAAC,OAAO,CAAC,CAAC,CAAC;;;OAAA;IACxD,sBAAW,+BAAK;aAAhB,cAAiC,OAAO,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC;;;OAAA;IA0H5C,6BAAM,GAAhB,UAAiB,IAAY;QAC3B,IAAI,CAAC,OAAO,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;IAC3B,CAAC;IAED;;OAEG;IAEW,iBAAI,GAAlB,UAAmB,GAAoB;QACrC,IAAM,IAAI,GAAiB,MAAM,CAAC,MAAM,CAAC,YAAY,CAAC,SAAS,CAAC,CAAC;QACjE,GAAG,GAAG,GAAG,IAAI,EAAE,CAAC;QAEhB,IAAI,SAAS,CAAC,MAAM,GAAG,CAAC,EAAE;YACxB,GAAG,GAAG;gBACJ,IAAI,EAAE,SAAS,CAAC,CAAC,CAAC;gBAClB,IAAI,EAAE,SAAS,CAAC,CAAC,CAAC;aACnB,CAAC;SACH;QAED,IAAM,IAAI,GAAG,GAAG,CAAC,IAAI,IAAI,uBAAY,CAAC;QACtC,IAAM,IAAI,GAAG,GAAG,CAAC,IAAI,IAAI,uBAAY,CAAC;QACtC,IAAM,QAAQ,GAAG,CAAC,GAAG,CAAC,QAAQ,KAAK,SAAS,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAC;QAEtE,OAAO;QACP,IAAM,IAAI,GAAqB,GAAG,CAAC,IAAI,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC;QAEpD,IAAI,CAAC,OAAO,GAAG,IAAI,UAAU,CAAS,IAAI,CAAC,MAAM,CAAC,CAAC;QACnD,IAAI,QAAQ,KAAK,IAAI,EAAE;YACnB,IAAI,CAAC,OAAO,CAAC,WAAW,CAAC,QAAQ,CAAC,CAAC;SACtC;QACD,IAAI,CAAC,OAAO,CAAC,MAAM,EAAE,CAAC;QAEtB,IAAI,CAAC,MAAM,GAAG,IAAI,UAAU,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;QACzC,IAAI,QAAQ,KAAK,IAAI,EAAE;YACnB,IAAI,CAAC,MAAM,CAAC,WAAW,CAAC,QAAQ,CAAC,CAAC;SACrC;QACD,IAAI,CAAC,MAAM,CAAC,MAAM,EAAE,CAAC;QAErB,IAAI,CAAC,OAAO,GAAG,IAAI,CAAC,OAAO,CAAC;QAC5B,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;QACjB,IAAI,CAAC,GAAG,GAAG,IAAI,CAAC,MAAM,CAAC;QACvB,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC,GAAG,CAAC;QAErB,IAAI,CAAC,KAAK,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,IAAI,MAAM,CAAC;QACvC,IAAI,CAAC,KAAK,GAAG,OAAO,CAAC,GAAG,CAAC,IAAI,IAAI,EAAE,CAAC;QAEpC,IAAI,CAAC,SAAS,GAAG,IAAI,CAAC;QACtB,IAAI,CAAC,SAAS,GAAG,IAAI,CAAC;QAEtB,IAAI,CAAC,OAAO,CAAC,EAAE,CAAC,OAAO,EAAE,UAAA,GAAG;YAC1B,IAAI,CAAC,MAAM,EAAE,CAAC;YACd,IAAI,IAAI,CAAC,SAAS,CAAC,OAAO,CAAC,CAAC,MAAM,GAAG,CAAC,EAAE;gBACtC,MAAM,GAAG,CAAC;aACX;QACH,CAAC,CAAC,CAAC;QAEH,IAAI,CAAC,OAAO,CAAC,EAAE,CAAC,OAAO,EAAE;YACvB,IAAI,CAAC,MAAM,EAAE,CAAC;QAChB,CAAC,CAAC,CAAC;QAEH,OAAO,IAAI,CAAC;IACd,CAAC;IAEM,8BAAO,GAAd;QAAA,iBAUC;QATC,IAAI,CAAC,MAAM,EAAE,CAAC;QAEd,kEAAkE;QAClE,mDAAmD;QACnD,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,OAAO,EAAE;YACzB,KAAI,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;QACtB,CAAC,CAAC,CAAC;QAEH,IAAI,CAAC,OAAO,CAAC,OAAO,EAAE,CAAC;IACzB,CAAC;IAEM,2BAAI,GAAX,UAAY,MAAe;QACzB,IAAI;YACF,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG,EAAE,MAAM,IAAI,QAAQ,CAAC,CAAC;SAC5C;QAAC,OAAO,CAAC,EAAE,EAAE,aAAa,EAAE;IAC/B,CAAC;IAKD,sBAAW,iCAAO;QAHlB;;WAEG;aACH;YACE,OAAO,GAAG,CAAC,OAAO,CAAC,IAAI,CAAC,GAAG,EAAE,IAAI,CAAC,IAAI,CAAC,IAAI,IAAI,CAAC,KAAK,CAAC;QACxD,CAAC;;;OAAA;IAED;;OAEG;IAEI,6BAAM,GAAb,UAAc,IAAY,EAAE,IAAY;QACtC,IAAI,IAAI,IAAI,CAAC,IAAI,IAAI,IAAI,CAAC,IAAI,KAAK,CAAC,IAAI,CAAC,IAAI,KAAK,CAAC,IAAI,CAAC,IAAI,IAAI,KAAK,QAAQ,IAAI,IAAI,KAAK,QAAQ,EAAE;YAClG,MAAM,IAAI,KAAK,CAAC,oDAAoD,CAAC,CAAC;SACvE;QACD,GAAG,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,EAAE,IAAI,EAAE,IAAI,CAAC,CAAC;QACjC,IAAI,CAAC,KAAK,GAAG,IAAI,CAAC;QAClB,IAAI,CAAC,KAAK,GAAG,IAAI,CAAC;IACpB,CAAC;IAEO,mCAAY,GAApB,UAAqB,GAAgB;QACjC,yDAAyD;QACzD,OAAO,GAAG,CAAC,MAAM,CAAC,CAAC;QACnB,OAAO,GAAG,CAAC,WAAW,CAAC,CAAC;QAExB,2DAA2D;QAC3D,iDAAiD;QACjD,OAAO,GAAG,CAAC,KAAK,CAAC,CAAC;QAClB,OAAO,GAAG,CAAC,QAAQ,CAAC,CAAC;QAErB,yDAAyD;QACzD,OAAO,GAAG,CAAC,UAAU,CAAC,CAAC;QACvB,OAAO,GAAG,CAAC,SAAS,CAAC,CAAC;QACtB,OAAO,GAAG,CAAC,SAAS,CAAC,CAAC;QACtB,OAAO,GAAG,CAAC,OAAO,CAAC,CAAC;IACxB,CAAC;IACH,mBAAC;AAAD,CAAC,AA/PD,CAAkC,mBAAQ,GA+PzC;AA/PY,oCAAY;AAiQzB;;;;GAIG;AACH;IAAyB,8BAAU;IACjC,oBAAY,EAAU;QAAtB,iBAMC;QALO,IAAA,iCAAyD,EAAvD,cAAI,EAAE,wBAAiD,CAAC,CAAC,sBAAsB;QACvF,8FAA8F;QAC9F,IAAM,MAAM,GAAG,IAAI,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC,CAAC;QAC1C,MAAM,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;QAChB,QAAA,kBAAW,EAAE,MAAM,QAAA,EAAE,CAAC,SAAC;;IACzB,CAAC;IACH,iBAAC;AAAD,CAAC,AARD,CAAyB,GAAG,CAAC,MAAM,GAQlC"} \ No newline at end of file diff --git a/node_modules/node-pty/lib/unixTerminal.test.js b/node_modules/node-pty/lib/unixTerminal.test.js deleted file mode 100644 index 62799e3..0000000 --- a/node_modules/node-pty/lib/unixTerminal.test.js +++ /dev/null @@ -1,100 +0,0 @@ -"use strict"; -/** - * Copyright (c) 2017, Daniel Imms (MIT License). - * Copyright (c) 2018, Microsoft Corporation (MIT License). - */ -Object.defineProperty(exports, "__esModule", { value: true }); -var unixTerminal_1 = require("./unixTerminal"); -var assert = require("assert"); -var path = require("path"); -var testUtils_test_1 = require("./testUtils.test"); -var FIXTURES_PATH = path.normalize(path.join(__dirname, '..', 'fixtures', 'utf8-character.txt')); -if (process.platform !== 'win32') { - describe('UnixTerminal', function () { - describe('Constructor', function () { - it('should set a valid pts name', function () { - var term = new unixTerminal_1.UnixTerminal('/bin/bash', [], {}); - var regExp; - if (process.platform === 'linux') { - // https://linux.die.net/man/4/pts - regExp = /^\/dev\/pts\/\d+$/; - } - if (process.platform === 'darwin') { - // https://developer.apple.com/legacy/library/documentation/Darwin/Reference/ManPages/man4/pty.4.html - regExp = /^\/dev\/tty[p-sP-S][a-z0-9]+$/; - } - if (regExp) { - assert.ok(regExp.test(term._pty), '"' + term._pty + '" should match ' + regExp.toString()); - } - }); - }); - describe('PtyForkEncodingOption', function () { - it('should default to utf8', function (done) { - var term = new unixTerminal_1.UnixTerminal('/bin/bash', ['-c', "cat \"" + FIXTURES_PATH + "\""]); - term.on('data', function (data) { - assert.equal(typeof data, 'string'); - assert.equal(data, '\u00E6'); - done(); - }); - }); - it('should return a Buffer when encoding is null', function (done) { - var term = new unixTerminal_1.UnixTerminal('/bin/bash', ['-c', "cat \"" + FIXTURES_PATH + "\""], { - encoding: null - }); - term.on('data', function (data) { - assert.equal(typeof data, 'object'); - assert.ok(data instanceof Buffer); - assert.equal(0xC3, data[0]); - assert.equal(0xA6, data[1]); - done(); - }); - }); - it('should support other encodings', function (done) { - var text = 'test æ!'; - var term = new unixTerminal_1.UnixTerminal(null, ['-c', 'echo "' + text + '"'], { - encoding: 'base64' - }); - var buffer = ''; - term.on('data', function (data) { - assert.equal(typeof data, 'string'); - buffer += data; - }); - term.on('exit', function () { - assert.equal(Buffer.alloc(8, buffer, 'base64').toString().replace('\r', '').replace('\n', ''), text); - done(); - }); - }); - }); - describe('open', function () { - var term; - afterEach(function () { - if (term) { - term.slave.destroy(); - term.master.destroy(); - } - }); - it('should open a pty with access to a master and slave socket', function (done) { - var doneCalled = false; - term = unixTerminal_1.UnixTerminal.open({}); - var slavebuf = ''; - term.slave.on('data', function (data) { - slavebuf += data; - }); - var masterbuf = ''; - term.master.on('data', function (data) { - masterbuf += data; - }); - testUtils_test_1.pollUntil(function () { - if (masterbuf === 'slave\r\nmaster\r\n' && slavebuf === 'master\n') { - done(); - return true; - } - return false; - }, 200, 10); - term.slave.write('slave\n'); - term.master.write('master\n'); - }); - }); - }); -} -//# sourceMappingURL=unixTerminal.test.js.map \ No newline at end of file diff --git a/node_modules/node-pty/lib/unixTerminal.test.js.map b/node_modules/node-pty/lib/unixTerminal.test.js.map deleted file mode 100644 index 8a360ac..0000000 --- a/node_modules/node-pty/lib/unixTerminal.test.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"unixTerminal.test.js","sourceRoot":"","sources":["../src/unixTerminal.test.ts"],"names":[],"mappings":";AAAA;;;GAGG;;AAEH,+CAA8C;AAC9C,+BAAiC;AACjC,2BAA6B;AAC7B,mDAA6C;AAE7C,IAAM,aAAa,GAAG,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,IAAI,CAAC,SAAS,EAAE,IAAI,EAAE,UAAU,EAAE,oBAAoB,CAAC,CAAC,CAAC;AAEnG,IAAI,OAAO,CAAC,QAAQ,KAAK,OAAO,EAAE;IAChC,QAAQ,CAAC,cAAc,EAAE;QACvB,QAAQ,CAAC,aAAa,EAAE;YACtB,EAAE,CAAC,6BAA6B,EAAE;gBAChC,IAAM,IAAI,GAAG,IAAI,2BAAY,CAAC,WAAW,EAAE,EAAE,EAAE,EAAE,CAAC,CAAC;gBACnD,IAAI,MAAM,CAAC;gBACX,IAAI,OAAO,CAAC,QAAQ,KAAK,OAAO,EAAE;oBAChC,kCAAkC;oBAClC,MAAM,GAAG,mBAAmB,CAAC;iBAC9B;gBACD,IAAI,OAAO,CAAC,QAAQ,KAAK,QAAQ,EAAE;oBACjC,qGAAqG;oBACrG,MAAM,GAAG,+BAA+B,CAAC;iBAC1C;gBACD,IAAI,MAAM,EAAE;oBACV,MAAM,CAAC,EAAE,CAAC,MAAM,CAAC,IAAI,CAAO,IAAK,CAAC,IAAI,CAAC,EAAE,GAAG,GAAS,IAAK,CAAC,IAAI,GAAG,iBAAiB,GAAG,MAAM,CAAC,QAAQ,EAAE,CAAC,CAAC;iBAC1G;YACH,CAAC,CAAC,CAAC;QACL,CAAC,CAAC,CAAC;QAEH,QAAQ,CAAC,uBAAuB,EAAE;YAChC,EAAE,CAAC,wBAAwB,EAAE,UAAC,IAAI;gBAChC,IAAM,IAAI,GAAG,IAAI,2BAAY,CAAC,WAAW,EAAE,CAAE,IAAI,EAAE,WAAQ,aAAa,OAAG,CAAE,CAAC,CAAC;gBAC/E,IAAI,CAAC,EAAE,CAAC,MAAM,EAAE,UAAC,IAAI;oBACnB,MAAM,CAAC,KAAK,CAAC,OAAO,IAAI,EAAE,QAAQ,CAAC,CAAC;oBACpC,MAAM,CAAC,KAAK,CAAC,IAAI,EAAE,QAAQ,CAAC,CAAC;oBAC7B,IAAI,EAAE,CAAC;gBACT,CAAC,CAAC,CAAC;YACL,CAAC,CAAC,CAAC;YACH,EAAE,CAAC,8CAA8C,EAAE,UAAC,IAAI;gBACtD,IAAM,IAAI,GAAG,IAAI,2BAAY,CAAC,WAAW,EAAE,CAAE,IAAI,EAAE,WAAQ,aAAa,OAAG,CAAE,EAAE;oBAC7E,QAAQ,EAAE,IAAI;iBACf,CAAC,CAAC;gBACH,IAAI,CAAC,EAAE,CAAC,MAAM,EAAE,UAAC,IAAI;oBACnB,MAAM,CAAC,KAAK,CAAC,OAAO,IAAI,EAAE,QAAQ,CAAC,CAAC;oBACpC,MAAM,CAAC,EAAE,CAAC,IAAI,YAAY,MAAM,CAAC,CAAC;oBAClC,MAAM,CAAC,KAAK,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC;oBAC5B,MAAM,CAAC,KAAK,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC;oBAC5B,IAAI,EAAE,CAAC;gBACT,CAAC,CAAC,CAAC;YACL,CAAC,CAAC,CAAC;YACH,EAAE,CAAC,gCAAgC,EAAE,UAAC,IAAI;gBACxC,IAAM,IAAI,GAAG,SAAS,CAAC;gBACvB,IAAM,IAAI,GAAG,IAAI,2BAAY,CAAC,IAAI,EAAE,CAAC,IAAI,EAAE,QAAQ,GAAG,IAAI,GAAG,GAAG,CAAC,EAAE;oBACjE,QAAQ,EAAE,QAAQ;iBACnB,CAAC,CAAC;gBACH,IAAI,MAAM,GAAG,EAAE,CAAC;gBAChB,IAAI,CAAC,EAAE,CAAC,MAAM,EAAE,UAAC,IAAI;oBACnB,MAAM,CAAC,KAAK,CAAC,OAAO,IAAI,EAAE,QAAQ,CAAC,CAAC;oBACpC,MAAM,IAAI,IAAI,CAAC;gBACjB,CAAC,CAAC,CAAC;gBACH,IAAI,CAAC,EAAE,CAAC,MAAM,EAAE;oBACd,MAAM,CAAC,KAAK,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,EAAE,MAAM,EAAE,QAAQ,CAAC,CAAC,QAAQ,EAAE,CAAC,OAAO,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC,OAAO,CAAC,IAAI,EAAE,EAAE,CAAC,EAAE,IAAI,CAAC,CAAC;oBACrG,IAAI,EAAE,CAAC;gBACT,CAAC,CAAC,CAAC;YACL,CAAC,CAAC,CAAC;QACL,CAAC,CAAC,CAAC;QAEH,QAAQ,CAAC,MAAM,EAAE;YACf,IAAI,IAAkB,CAAC;YAEvB,SAAS,CAAC;gBACR,IAAI,IAAI,EAAE;oBACR,IAAI,CAAC,KAAK,CAAC,OAAO,EAAE,CAAC;oBACrB,IAAI,CAAC,MAAM,CAAC,OAAO,EAAE,CAAC;iBACvB;YACH,CAAC,CAAC,CAAC;YAEH,EAAE,CAAC,4DAA4D,EAAE,UAAC,IAAI;gBACpE,IAAI,UAAU,GAAG,KAAK,CAAC;gBACvB,IAAI,GAAG,2BAAY,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;gBAE7B,IAAI,QAAQ,GAAG,EAAE,CAAC;gBAClB,IAAI,CAAC,KAAK,CAAC,EAAE,CAAC,MAAM,EAAE,UAAC,IAAI;oBACzB,QAAQ,IAAI,IAAI,CAAC;gBACnB,CAAC,CAAC,CAAC;gBAEH,IAAI,SAAS,GAAG,EAAE,CAAC;gBACnB,IAAI,CAAC,MAAM,CAAC,EAAE,CAAC,MAAM,EAAE,UAAC,IAAI;oBAC1B,SAAS,IAAI,IAAI,CAAC;gBACpB,CAAC,CAAC,CAAC;gBAEH,0BAAS,CAAC;oBACR,IAAI,SAAS,KAAK,qBAAqB,IAAI,QAAQ,KAAK,UAAU,EAAE;wBAClE,IAAI,EAAE,CAAC;wBACP,OAAO,IAAI,CAAC;qBACb;oBACD,OAAO,KAAK,CAAC;gBACf,CAAC,EAAE,GAAG,EAAE,EAAE,CAAC,CAAC;gBAEZ,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,SAAS,CAAC,CAAC;gBAC5B,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,UAAU,CAAC,CAAC;YAChC,CAAC,CAAC,CAAC;QACL,CAAC,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;CACJ"} \ No newline at end of file diff --git a/node_modules/node-pty/lib/utils.js b/node_modules/node-pty/lib/utils.js deleted file mode 100644 index 89639c4..0000000 --- a/node_modules/node-pty/lib/utils.js +++ /dev/null @@ -1,16 +0,0 @@ -"use strict"; -/** - * Copyright (c) 2017, Daniel Imms (MIT License). - * Copyright (c) 2018, Microsoft Corporation (MIT License). - */ -Object.defineProperty(exports, "__esModule", { value: true }); -function assign(target) { - var sources = []; - for (var _i = 1; _i < arguments.length; _i++) { - sources[_i - 1] = arguments[_i]; - } - sources.forEach(function (source) { return Object.keys(source).forEach(function (key) { return target[key] = source[key]; }); }); - return target; -} -exports.assign = assign; -//# sourceMappingURL=utils.js.map \ No newline at end of file diff --git a/node_modules/node-pty/lib/utils.js.map b/node_modules/node-pty/lib/utils.js.map deleted file mode 100644 index bd56943..0000000 --- a/node_modules/node-pty/lib/utils.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"utils.js","sourceRoot":"","sources":["../src/utils.ts"],"names":[],"mappings":";AAAA;;;GAGG;;AAEH,SAAgB,MAAM,CAAC,MAAW;IAAE,iBAAiB;SAAjB,UAAiB,EAAjB,qBAAiB,EAAjB,IAAiB;QAAjB,gCAAiB;;IACnD,OAAO,CAAC,OAAO,CAAC,UAAA,MAAM,IAAI,OAAA,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,OAAO,CAAC,UAAA,GAAG,IAAI,OAAA,MAAM,CAAC,GAAG,CAAC,GAAG,MAAM,CAAC,GAAG,CAAC,EAAzB,CAAyB,CAAC,EAA7D,CAA6D,CAAC,CAAC;IACzF,OAAO,MAAM,CAAC;AAChB,CAAC;AAHD,wBAGC"} \ No newline at end of file diff --git a/node_modules/node-pty/lib/windowsPtyAgent.js b/node_modules/node-pty/lib/windowsPtyAgent.js deleted file mode 100644 index 4ef3fd6..0000000 --- a/node_modules/node-pty/lib/windowsPtyAgent.js +++ /dev/null @@ -1,310 +0,0 @@ -"use strict"; -/** - * Copyright (c) 2012-2015, Christopher Jeffrey, Peter Sunde (MIT License) - * Copyright (c) 2016, Daniel Imms (MIT License). - * Copyright (c) 2018, Microsoft Corporation (MIT License). - */ -Object.defineProperty(exports, "__esModule", { value: true }); -var os = require("os"); -var path = require("path"); -var net_1 = require("net"); -var child_process_1 = require("child_process"); -var conptyNative; -var winptyNative; -/** - * The amount of time to wait for additional data after the conpty shell process has exited before - * shutting down the socket. The timer will be reset if a new data event comes in after the timer - * has started. - */ -var FLUSH_DATA_INTERVAL = 20; -/** - * This agent sits between the WindowsTerminal class and provides a common interface for both conpty - * and winpty. - */ -var WindowsPtyAgent = /** @class */ (function () { - function WindowsPtyAgent(file, args, env, cwd, cols, rows, debug, _useConpty, conptyInheritCursor) { - var _this = this; - if (conptyInheritCursor === void 0) { conptyInheritCursor = false; } - this._useConpty = _useConpty; - if (this._useConpty === undefined || this._useConpty === true) { - this._useConpty = this._getWindowsBuildNumber() >= 18309; - } - if (this._useConpty) { - if (!conptyNative) { - try { - conptyNative = require('../build/Release/conpty.node'); - } - catch (outerError) { - try { - conptyNative = require('../build/Debug/conpty.node'); - } - catch (innerError) { - console.error('innerError', innerError); - // Re-throw the exception from the Release require if the Debug require fails as well - throw outerError; - } - } - } - } - else { - if (!winptyNative) { - try { - winptyNative = require('../build/Release/pty.node'); - } - catch (outerError) { - try { - winptyNative = require('../build/Debug/pty.node'); - } - catch (innerError) { - console.error('innerError', innerError); - // Re-throw the exception from the Release require if the Debug require fails as well - throw outerError; - } - } - } - } - this._ptyNative = this._useConpty ? conptyNative : winptyNative; - // Sanitize input variable. - cwd = path.resolve(cwd); - // Compose command line - var commandLine = argsToCommandLine(file, args); - // Open pty session. - var term; - if (this._useConpty) { - term = this._ptyNative.startProcess(file, cols, rows, debug, this._generatePipeName(), conptyInheritCursor); - } - else { - term = this._ptyNative.startProcess(file, commandLine, env, cwd, cols, rows, debug); - this._pid = term.pid; - this._innerPid = term.innerPid; - this._innerPidHandle = term.innerPidHandle; - } - // Not available on windows. - this._fd = term.fd; - // Generated incremental number that has no real purpose besides using it - // as a terminal id. - this._pty = term.pty; - // Create terminal pipe IPC channel and forward to a local unix socket. - this._outSocket = new net_1.Socket(); - this._outSocket.setEncoding('utf8'); - this._outSocket.connect(term.conout, function () { - // TODO: Emit event on agent instead of socket? - // Emit ready event. - _this._outSocket.emit('ready_datapipe'); - }); - this._inSocket = new net_1.Socket(); - this._inSocket.setEncoding('utf8'); - this._inSocket.connect(term.conin); - // TODO: Wait for ready event? - if (this._useConpty) { - var connect = this._ptyNative.connect(this._pty, commandLine, cwd, env, function (c) { return _this._$onProcessExit(c); }); - this._innerPid = connect.pid; - } - } - Object.defineProperty(WindowsPtyAgent.prototype, "inSocket", { - get: function () { return this._inSocket; }, - enumerable: true, - configurable: true - }); - Object.defineProperty(WindowsPtyAgent.prototype, "outSocket", { - get: function () { return this._outSocket; }, - enumerable: true, - configurable: true - }); - Object.defineProperty(WindowsPtyAgent.prototype, "fd", { - get: function () { return this._fd; }, - enumerable: true, - configurable: true - }); - Object.defineProperty(WindowsPtyAgent.prototype, "innerPid", { - get: function () { return this._innerPid; }, - enumerable: true, - configurable: true - }); - Object.defineProperty(WindowsPtyAgent.prototype, "pty", { - get: function () { return this._pty; }, - enumerable: true, - configurable: true - }); - WindowsPtyAgent.prototype.resize = function (cols, rows) { - if (this._useConpty) { - if (this._exitCode !== undefined) { - throw new Error('Cannot resize a pty that has already exited'); - } - this._ptyNative.resize(this._pty, cols, rows); - return; - } - this._ptyNative.resize(this._pid, cols, rows); - }; - WindowsPtyAgent.prototype.kill = function () { - var _this = this; - this._inSocket.readable = false; - this._inSocket.writable = false; - this._outSocket.readable = false; - this._outSocket.writable = false; - // Tell the agent to kill the pty, this releases handles to the process - if (this._useConpty) { - this._getConsoleProcessList().then(function (consoleProcessList) { - consoleProcessList.forEach(function (pid) { - try { - process.kill(pid); - } - catch (e) { - // Ignore if process cannot be found (kill ESRCH error) - } - }); - _this._ptyNative.kill(_this._pty); - }); - } - else { - this._ptyNative.kill(this._pid, this._innerPidHandle); - // Since pty.kill closes the handle it will kill most processes by itself - // and process IDs can be reused as soon as all handles to them are - // dropped, we want to immediately kill the entire console process list. - // If we do not force kill all processes here, node servers in particular - // seem to become detached and remain running (see - // Microsoft/vscode#26807). - var processList = this._ptyNative.getProcessList(this._pid); - processList.forEach(function (pid) { - try { - process.kill(pid); - } - catch (e) { - // Ignore if process cannot be found (kill ESRCH error) - } - }); - } - }; - WindowsPtyAgent.prototype._getConsoleProcessList = function () { - var _this = this; - return new Promise(function (resolve) { - var agent = child_process_1.fork(path.join(__dirname, 'conpty_console_list_agent'), [_this._innerPid.toString()]); - agent.on('message', function (message) { - clearTimeout(timeout); - resolve(message.consoleProcessList); - }); - var timeout = setTimeout(function () { - // Something went wrong, just send back the shell PID - agent.kill(); - resolve([_this._innerPid]); - }, 5000); - }); - }; - Object.defineProperty(WindowsPtyAgent.prototype, "exitCode", { - get: function () { - if (this._useConpty) { - return this._exitCode; - } - return this._ptyNative.getExitCode(this._innerPidHandle); - }, - enumerable: true, - configurable: true - }); - WindowsPtyAgent.prototype._getWindowsBuildNumber = function () { - var osVersion = (/(\d+)\.(\d+)\.(\d+)/g).exec(os.release()); - var buildNumber = 0; - if (osVersion && osVersion.length === 4) { - buildNumber = parseInt(osVersion[3]); - } - return buildNumber; - }; - WindowsPtyAgent.prototype._generatePipeName = function () { - return "conpty-" + Math.random() * 10000000; - }; - /** - * Triggered from the native side when a contpy process exits. - */ - WindowsPtyAgent.prototype._$onProcessExit = function (exitCode) { - var _this = this; - this._exitCode = exitCode; - this._flushDataAndCleanUp(); - this._outSocket.on('data', function () { return _this._flushDataAndCleanUp(); }); - }; - WindowsPtyAgent.prototype._flushDataAndCleanUp = function () { - var _this = this; - if (this._closeTimeout) { - clearTimeout(this._closeTimeout); - } - this._closeTimeout = setTimeout(function () { return _this._cleanUpProcess(); }, FLUSH_DATA_INTERVAL); - }; - WindowsPtyAgent.prototype._cleanUpProcess = function () { - this._inSocket.readable = false; - this._inSocket.writable = false; - this._outSocket.readable = false; - this._outSocket.writable = false; - this._outSocket.destroy(); - }; - return WindowsPtyAgent; -}()); -exports.WindowsPtyAgent = WindowsPtyAgent; -// Convert argc/argv into a Win32 command-line following the escaping convention -// documented on MSDN (e.g. see CommandLineToArgvW documentation). Copied from -// winpty project. -function argsToCommandLine(file, args) { - if (isCommandLine(args)) { - if (args.length === 0) { - return file; - } - return argsToCommandLine(file, []) + " " + args; - } - var argv = [file]; - Array.prototype.push.apply(argv, args); - var result = ''; - for (var argIndex = 0; argIndex < argv.length; argIndex++) { - if (argIndex > 0) { - result += ' '; - } - var arg = argv[argIndex]; - // if it is empty or it contains whitespace and is not already quoted - var hasLopsidedEnclosingQuote = xOr((arg[0] !== '"'), (arg[arg.length - 1] !== '"')); - var hasNoEnclosingQuotes = ((arg[0] !== '"') && (arg[arg.length - 1] !== '"')); - var quote = arg === '' || - (arg.indexOf(' ') !== -1 || - arg.indexOf('\t') !== -1) && - ((arg.length > 1) && - (hasLopsidedEnclosingQuote || hasNoEnclosingQuotes)); - if (quote) { - result += '\"'; - } - var bsCount = 0; - for (var i = 0; i < arg.length; i++) { - var p = arg[i]; - if (p === '\\') { - bsCount++; - } - else if (p === '"') { - result += repeatText('\\', bsCount * 2 + 1); - result += '"'; - bsCount = 0; - } - else { - result += repeatText('\\', bsCount); - bsCount = 0; - result += p; - } - } - if (quote) { - result += repeatText('\\', bsCount * 2); - result += '\"'; - } - else { - result += repeatText('\\', bsCount); - } - } - return result; -} -exports.argsToCommandLine = argsToCommandLine; -function isCommandLine(args) { - return typeof args === 'string'; -} -function repeatText(text, count) { - var result = ''; - for (var i = 0; i < count; i++) { - result += text; - } - return result; -} -function xOr(arg1, arg2) { - return ((arg1 && !arg2) || (!arg1 && arg2)); -} -//# sourceMappingURL=windowsPtyAgent.js.map \ No newline at end of file diff --git a/node_modules/node-pty/lib/windowsPtyAgent.js.map b/node_modules/node-pty/lib/windowsPtyAgent.js.map deleted file mode 100644 index b8d1b05..0000000 --- a/node_modules/node-pty/lib/windowsPtyAgent.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"windowsPtyAgent.js","sourceRoot":"","sources":["../src/windowsPtyAgent.ts"],"names":[],"mappings":";AAAA;;;;GAIG;;AAEH,uBAAyB;AACzB,2BAA6B;AAC7B,2BAA6B;AAE7B,+CAAqC;AAErC,IAAI,YAA2B,CAAC;AAChC,IAAI,YAA2B,CAAC;AAEhC;;;;GAIG;AACH,IAAM,mBAAmB,GAAG,EAAE,CAAC;AAE/B;;;GAGG;AACH;IAmBE,yBACE,IAAY,EACZ,IAAuB,EACvB,GAAa,EACb,GAAW,EACX,IAAY,EACZ,IAAY,EACZ,KAAc,EACN,UAA+B,EACvC,mBAAoC;QATtC,iBAyFC;QAhFC,oCAAA,EAAA,2BAAoC;QAD5B,eAAU,GAAV,UAAU,CAAqB;QAGvC,IAAI,IAAI,CAAC,UAAU,KAAK,SAAS,IAAI,IAAI,CAAC,UAAU,KAAK,IAAI,EAAE;YAC7D,IAAI,CAAC,UAAU,GAAG,IAAI,CAAC,sBAAsB,EAAE,IAAI,KAAK,CAAC;SAC1D;QACD,IAAI,IAAI,CAAC,UAAU,EAAE;YACnB,IAAI,CAAC,YAAY,EAAE;gBACjB,IAAI;oBACF,YAAY,GAAG,OAAO,CAAC,8BAA8B,CAAC,CAAC;iBACxD;gBAAC,OAAO,UAAU,EAAE;oBACnB,IAAI;wBACF,YAAY,GAAG,OAAO,CAAC,4BAA4B,CAAC,CAAC;qBACtD;oBAAC,OAAO,UAAU,EAAE;wBACnB,OAAO,CAAC,KAAK,CAAC,YAAY,EAAE,UAAU,CAAC,CAAC;wBACxC,qFAAqF;wBACrF,MAAM,UAAU,CAAC;qBAClB;iBACF;aACF;SACF;aAAM;YACL,IAAI,CAAC,YAAY,EAAE;gBACjB,IAAI;oBACF,YAAY,GAAG,OAAO,CAAC,2BAA2B,CAAC,CAAC;iBACrD;gBAAC,OAAO,UAAU,EAAE;oBACnB,IAAI;wBACF,YAAY,GAAG,OAAO,CAAC,yBAAyB,CAAC,CAAC;qBACnD;oBAAC,OAAO,UAAU,EAAE;wBACnB,OAAO,CAAC,KAAK,CAAC,YAAY,EAAE,UAAU,CAAC,CAAC;wBACxC,qFAAqF;wBACrF,MAAM,UAAU,CAAC;qBAClB;iBACF;aACF;SACF;QACD,IAAI,CAAC,UAAU,GAAG,IAAI,CAAC,UAAU,CAAC,CAAC,CAAC,YAAY,CAAC,CAAC,CAAC,YAAY,CAAC;QAEhE,2BAA2B;QAC3B,GAAG,GAAG,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC;QAExB,uBAAuB;QACvB,IAAM,WAAW,GAAG,iBAAiB,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC;QAElD,oBAAoB;QACpB,IAAI,IAAqC,CAAC;QAC1C,IAAI,IAAI,CAAC,UAAU,EAAE;YACnB,IAAI,GAAI,IAAI,CAAC,UAA4B,CAAC,YAAY,CAAC,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,KAAK,EAAE,IAAI,CAAC,iBAAiB,EAAE,EAAE,mBAAmB,CAAC,CAAC;SAChI;aAAM;YACL,IAAI,GAAI,IAAI,CAAC,UAA4B,CAAC,YAAY,CAAC,IAAI,EAAE,WAAW,EAAE,GAAG,EAAE,GAAG,EAAE,IAAI,EAAE,IAAI,EAAE,KAAK,CAAC,CAAC;YACvG,IAAI,CAAC,IAAI,GAAI,IAAuB,CAAC,GAAG,CAAC;YACzC,IAAI,CAAC,SAAS,GAAI,IAAuB,CAAC,QAAQ,CAAC;YACnD,IAAI,CAAC,eAAe,GAAI,IAAuB,CAAC,cAAc,CAAC;SAChE;QAED,4BAA4B;QAC5B,IAAI,CAAC,GAAG,GAAG,IAAI,CAAC,EAAE,CAAC;QAEnB,0EAA0E;QAC1E,oBAAoB;QACpB,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC,GAAG,CAAC;QAErB,uEAAuE;QACvE,IAAI,CAAC,UAAU,GAAG,IAAI,YAAM,EAAE,CAAC;QAC/B,IAAI,CAAC,UAAU,CAAC,WAAW,CAAC,MAAM,CAAC,CAAC;QACpC,IAAI,CAAC,UAAU,CAAC,OAAO,CAAC,IAAI,CAAC,MAAM,EAAE;YACnC,+CAA+C;YAE/C,oBAAoB;YACpB,KAAI,CAAC,UAAU,CAAC,IAAI,CAAC,gBAAgB,CAAC,CAAC;QACzC,CAAC,CAAC,CAAC;QAEH,IAAI,CAAC,SAAS,GAAG,IAAI,YAAM,EAAE,CAAC;QAC9B,IAAI,CAAC,SAAS,CAAC,WAAW,CAAC,MAAM,CAAC,CAAC;QACnC,IAAI,CAAC,SAAS,CAAC,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;QACnC,8BAA8B;QAE9B,IAAI,IAAI,CAAC,UAAU,EAAE;YACnB,IAAM,OAAO,GAAI,IAAI,CAAC,UAA4B,CAAC,OAAO,CAAC,IAAI,CAAC,IAAI,EAAE,WAAW,EAAE,GAAG,EAAE,GAAG,EAAE,UAAA,CAAC,IAAI,OAAA,KAAI,CAAC,eAAe,CAAC,CAAC,CAAC,EAAvB,CAAuB,CAC9H,CAAC;YACI,IAAI,CAAC,SAAS,GAAG,OAAO,CAAC,GAAG,CAAC;SAC9B;IACH,CAAC;IA/FD,sBAAW,qCAAQ;aAAnB,cAAgC,OAAO,IAAI,CAAC,SAAS,CAAC,CAAC,CAAC;;;OAAA;IACxD,sBAAW,sCAAS;aAApB,cAAiC,OAAO,IAAI,CAAC,UAAU,CAAC,CAAC,CAAC;;;OAAA;IAC1D,sBAAW,+BAAE;aAAb,cAAuB,OAAO,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC;;;OAAA;IACzC,sBAAW,qCAAQ;aAAnB,cAAgC,OAAO,IAAI,CAAC,SAAS,CAAC,CAAC,CAAC;;;OAAA;IACxD,sBAAW,gCAAG;aAAd,cAA2B,OAAO,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC;;;OAAA;IA6FvC,gCAAM,GAAb,UAAc,IAAY,EAAE,IAAY;QACtC,IAAI,IAAI,CAAC,UAAU,EAAE;YACnB,IAAI,IAAI,CAAC,SAAS,KAAK,SAAS,EAAE;gBAChC,MAAM,IAAI,KAAK,CAAC,6CAA6C,CAAC,CAAC;aAChE;YACD,IAAI,CAAC,UAAU,CAAC,MAAM,CAAC,IAAI,CAAC,IAAI,EAAE,IAAI,EAAE,IAAI,CAAC,CAAC;YAC9C,OAAO;SACR;QACD,IAAI,CAAC,UAAU,CAAC,MAAM,CAAC,IAAI,CAAC,IAAI,EAAE,IAAI,EAAE,IAAI,CAAC,CAAC;IAChD,CAAC;IAEM,8BAAI,GAAX;QAAA,iBAkCC;QAjCC,IAAI,CAAC,SAAS,CAAC,QAAQ,GAAG,KAAK,CAAC;QAChC,IAAI,CAAC,SAAS,CAAC,QAAQ,GAAG,KAAK,CAAC;QAChC,IAAI,CAAC,UAAU,CAAC,QAAQ,GAAG,KAAK,CAAC;QACjC,IAAI,CAAC,UAAU,CAAC,QAAQ,GAAG,KAAK,CAAC;QACjC,uEAAuE;QACvE,IAAI,IAAI,CAAC,UAAU,EAAE;YACnB,IAAI,CAAC,sBAAsB,EAAE,CAAC,IAAI,CAAC,UAAA,kBAAkB;gBACnD,kBAAkB,CAAC,OAAO,CAAC,UAAC,GAAW;oBACrC,IAAI;wBACF,OAAO,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;qBACnB;oBAAC,OAAO,CAAC,EAAE;wBACV,uDAAuD;qBACxD;gBACH,CAAC,CAAC,CAAC;gBACF,KAAI,CAAC,UAA4B,CAAC,IAAI,CAAC,KAAI,CAAC,IAAI,CAAC,CAAC;YACrD,CAAC,CAAC,CAAC;SACJ;aAAM;YACJ,IAAI,CAAC,UAA4B,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,EAAE,IAAI,CAAC,eAAe,CAAC,CAAC;YACzE,yEAAyE;YACzE,mEAAmE;YACnE,wEAAwE;YACxE,yEAAyE;YACzE,kDAAkD;YAClD,2BAA2B;YAC3B,IAAM,WAAW,GAAc,IAAI,CAAC,UAA4B,CAAC,cAAc,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;YAC3F,WAAW,CAAC,OAAO,CAAC,UAAA,GAAG;gBACrB,IAAI;oBACF,OAAO,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;iBACnB;gBAAC,OAAO,CAAC,EAAE;oBACV,uDAAuD;iBACxD;YACH,CAAC,CAAC,CAAC;SACJ;IACH,CAAC;IAEO,gDAAsB,GAA9B;QAAA,iBAaC;QAZC,OAAO,IAAI,OAAO,CAAW,UAAA,OAAO;YAClC,IAAM,KAAK,GAAG,oBAAI,CAAC,IAAI,CAAC,IAAI,CAAC,SAAS,EAAE,2BAA2B,CAAC,EAAE,CAAE,KAAI,CAAC,SAAS,CAAC,QAAQ,EAAE,CAAE,CAAC,CAAC;YACrG,KAAK,CAAC,EAAE,CAAC,SAAS,EAAE,UAAA,OAAO;gBACzB,YAAY,CAAC,OAAO,CAAC,CAAC;gBACtB,OAAO,CAAC,OAAO,CAAC,kBAAkB,CAAC,CAAC;YACtC,CAAC,CAAC,CAAC;YACH,IAAM,OAAO,GAAG,UAAU,CAAC;gBACzB,qDAAqD;gBACrD,KAAK,CAAC,IAAI,EAAE,CAAC;gBACb,OAAO,CAAC,CAAE,KAAI,CAAC,SAAS,CAAE,CAAC,CAAC;YAC9B,CAAC,EAAE,IAAI,CAAC,CAAC;QACX,CAAC,CAAC,CAAC;IACL,CAAC;IAED,sBAAW,qCAAQ;aAAnB;YACE,IAAI,IAAI,CAAC,UAAU,EAAE;gBACnB,OAAO,IAAI,CAAC,SAAS,CAAC;aACvB;YACD,OAAQ,IAAI,CAAC,UAA4B,CAAC,WAAW,CAAC,IAAI,CAAC,eAAe,CAAC,CAAC;QAC9E,CAAC;;;OAAA;IAEO,gDAAsB,GAA9B;QACE,IAAM,SAAS,GAAG,CAAC,sBAAsB,CAAC,CAAC,IAAI,CAAC,EAAE,CAAC,OAAO,EAAE,CAAC,CAAC;QAC9D,IAAI,WAAW,GAAW,CAAC,CAAC;QAC5B,IAAI,SAAS,IAAI,SAAS,CAAC,MAAM,KAAK,CAAC,EAAE;YACvC,WAAW,GAAG,QAAQ,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,CAAC;SACtC;QACD,OAAO,WAAW,CAAC;IACrB,CAAC;IAEO,2CAAiB,GAAzB;QACE,OAAO,YAAU,IAAI,CAAC,MAAM,EAAE,GAAG,QAAU,CAAC;IAC9C,CAAC;IAED;;OAEG;IACK,yCAAe,GAAvB,UAAwB,QAAgB;QAAxC,iBAIC;QAHC,IAAI,CAAC,SAAS,GAAG,QAAQ,CAAC;QAC1B,IAAI,CAAC,oBAAoB,EAAE,CAAC;QAC5B,IAAI,CAAC,UAAU,CAAC,EAAE,CAAC,MAAM,EAAE,cAAM,OAAA,KAAI,CAAC,oBAAoB,EAAE,EAA3B,CAA2B,CAAC,CAAC;IAChE,CAAC;IAEO,8CAAoB,GAA5B;QAAA,iBAKC;QAJC,IAAI,IAAI,CAAC,aAAa,EAAE;YACtB,YAAY,CAAC,IAAI,CAAC,aAAa,CAAC,CAAC;SAClC;QACD,IAAI,CAAC,aAAa,GAAG,UAAU,CAAC,cAAM,OAAA,KAAI,CAAC,eAAe,EAAE,EAAtB,CAAsB,EAAE,mBAAmB,CAAC,CAAC;IACrF,CAAC;IAEO,yCAAe,GAAvB;QACE,IAAI,CAAC,SAAS,CAAC,QAAQ,GAAG,KAAK,CAAC;QAChC,IAAI,CAAC,SAAS,CAAC,QAAQ,GAAG,KAAK,CAAC;QAChC,IAAI,CAAC,UAAU,CAAC,QAAQ,GAAG,KAAK,CAAC;QACjC,IAAI,CAAC,UAAU,CAAC,QAAQ,GAAG,KAAK,CAAC;QACjC,IAAI,CAAC,UAAU,CAAC,OAAO,EAAE,CAAC;IAC5B,CAAC;IACH,sBAAC;AAAD,CAAC,AAvND,IAuNC;AAvNY,0CAAe;AAyN5B,gFAAgF;AAChF,8EAA8E;AAC9E,kBAAkB;AAClB,SAAgB,iBAAiB,CAAC,IAAY,EAAE,IAAuB;IACrE,IAAI,aAAa,CAAC,IAAI,CAAC,EAAE;QACvB,IAAI,IAAI,CAAC,MAAM,KAAK,CAAC,EAAE;YACrB,OAAO,IAAI,CAAC;SACb;QACD,OAAU,iBAAiB,CAAC,IAAI,EAAE,EAAE,CAAC,SAAI,IAAM,CAAC;KACjD;IACD,IAAM,IAAI,GAAG,CAAC,IAAI,CAAC,CAAC;IACpB,KAAK,CAAC,SAAS,CAAC,IAAI,CAAC,KAAK,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC;IACvC,IAAI,MAAM,GAAG,EAAE,CAAC;IAChB,KAAK,IAAI,QAAQ,GAAG,CAAC,EAAE,QAAQ,GAAG,IAAI,CAAC,MAAM,EAAE,QAAQ,EAAE,EAAE;QACzD,IAAI,QAAQ,GAAG,CAAC,EAAE;YAChB,MAAM,IAAI,GAAG,CAAC;SACf;QACD,IAAM,GAAG,GAAG,IAAI,CAAC,QAAQ,CAAC,CAAC;QAC3B,qEAAqE;QACrE,IAAM,yBAAyB,GAAG,GAAG,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,KAAK,GAAG,CAAC,EAAE,CAAC,GAAG,CAAC,GAAG,CAAC,MAAM,GAAG,CAAC,CAAC,KAAK,GAAG,CAAC,CAAC,CAAC;QACvF,IAAM,oBAAoB,GAAG,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,KAAK,GAAG,CAAC,IAAI,CAAC,GAAG,CAAC,GAAG,CAAC,MAAM,GAAG,CAAC,CAAC,KAAK,GAAG,CAAC,CAAC,CAAC;QACjF,IAAM,KAAK,GACT,GAAG,KAAK,EAAE;YACV,CAAC,GAAG,CAAC,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC;gBACxB,GAAG,CAAC,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC;gBACzB,CAAC,CAAC,GAAG,CAAC,MAAM,GAAG,CAAC,CAAC;oBACjB,CAAC,yBAAyB,IAAI,oBAAoB,CAAC,CAAC,CAAC;QACvD,IAAI,KAAK,EAAE;YACT,MAAM,IAAI,IAAI,CAAC;SAChB;QACD,IAAI,OAAO,GAAG,CAAC,CAAC;QAChB,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,GAAG,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE;YACnC,IAAM,CAAC,GAAG,GAAG,CAAC,CAAC,CAAC,CAAC;YACjB,IAAI,CAAC,KAAK,IAAI,EAAE;gBACd,OAAO,EAAE,CAAC;aACX;iBAAM,IAAI,CAAC,KAAK,GAAG,EAAE;gBACpB,MAAM,IAAI,UAAU,CAAC,IAAI,EAAE,OAAO,GAAG,CAAC,GAAG,CAAC,CAAC,CAAC;gBAC5C,MAAM,IAAI,GAAG,CAAC;gBACd,OAAO,GAAG,CAAC,CAAC;aACb;iBAAM;gBACL,MAAM,IAAI,UAAU,CAAC,IAAI,EAAE,OAAO,CAAC,CAAC;gBACpC,OAAO,GAAG,CAAC,CAAC;gBACZ,MAAM,IAAI,CAAC,CAAC;aACb;SACF;QACD,IAAI,KAAK,EAAE;YACT,MAAM,IAAI,UAAU,CAAC,IAAI,EAAE,OAAO,GAAG,CAAC,CAAC,CAAC;YACxC,MAAM,IAAI,IAAI,CAAC;SAChB;aAAM;YACL,MAAM,IAAI,UAAU,CAAC,IAAI,EAAE,OAAO,CAAC,CAAC;SACrC;KACF;IACD,OAAO,MAAM,CAAC;AAChB,CAAC;AAlDD,8CAkDC;AAED,SAAS,aAAa,CAAC,IAAuB;IAC5C,OAAO,OAAO,IAAI,KAAK,QAAQ,CAAC;AAClC,CAAC;AAED,SAAS,UAAU,CAAC,IAAY,EAAE,KAAa;IAC7C,IAAI,MAAM,GAAG,EAAE,CAAC;IAChB,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,KAAK,EAAE,CAAC,EAAE,EAAE;QAC9B,MAAM,IAAI,IAAI,CAAC;KAChB;IACD,OAAO,MAAM,CAAC;AAChB,CAAC;AAED,SAAS,GAAG,CAAC,IAAa,EAAE,IAAa;IACvC,OAAO,CAAC,CAAC,IAAI,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,IAAI,IAAI,IAAI,CAAC,CAAC,CAAC;AAC9C,CAAC"} \ No newline at end of file diff --git a/node_modules/node-pty/lib/windowsPtyAgent.test.js b/node_modules/node-pty/lib/windowsPtyAgent.test.js deleted file mode 100644 index 15bbf5b..0000000 --- a/node_modules/node-pty/lib/windowsPtyAgent.test.js +++ /dev/null @@ -1,90 +0,0 @@ -"use strict"; -/** - * Copyright (c) 2017, Daniel Imms (MIT License). - * Copyright (c) 2018, Microsoft Corporation (MIT License). - */ -Object.defineProperty(exports, "__esModule", { value: true }); -var assert = require("assert"); -var windowsPtyAgent_1 = require("./windowsPtyAgent"); -function check(file, args, expected) { - assert.equal(windowsPtyAgent_1.argsToCommandLine(file, args), expected); -} -if (process.platform === 'win32') { - describe('argsToCommandLine', function () { - describe('Plain strings', function () { - it('doesn\'t quote plain string', function () { - check('asdf', [], 'asdf'); - }); - it('doesn\'t escape backslashes', function () { - check('\\asdf\\qwer\\', [], '\\asdf\\qwer\\'); - }); - it('doesn\'t escape multiple backslashes', function () { - check('asdf\\\\qwer', [], 'asdf\\\\qwer'); - }); - it('adds backslashes before quotes', function () { - check('"asdf"qwer"', [], '\\"asdf\\"qwer\\"'); - }); - it('escapes backslashes before quotes', function () { - check('asdf\\"qwer', [], 'asdf\\\\\\"qwer'); - }); - }); - describe('Quoted strings', function () { - it('quotes string with spaces', function () { - check('asdf qwer', [], '"asdf qwer"'); - }); - it('quotes empty string', function () { - check('', [], '""'); - }); - it('quotes string with tabs', function () { - check('asdf\tqwer', [], '"asdf\tqwer"'); - }); - it('escapes only the last backslash', function () { - check('\\asdf \\qwer\\', [], '"\\asdf \\qwer\\\\"'); - }); - it('doesn\'t escape multiple backslashes', function () { - check('asdf \\\\qwer', [], '"asdf \\\\qwer"'); - }); - it('escapes backslashes before quotes', function () { - check('asdf \\"qwer', [], '"asdf \\\\\\"qwer"'); - }); - it('escapes multiple backslashes at the end', function () { - check('asdf qwer\\\\', [], '"asdf qwer\\\\\\\\"'); - }); - }); - describe('Multiple arguments', function () { - it('joins arguments with spaces', function () { - check('asdf', ['qwer zxcv', '', '"'], 'asdf "qwer zxcv" "" \\"'); - }); - it('array argument all in quotes', function () { - check('asdf', ['"surounded by quotes"'], 'asdf \\"surounded by quotes\\"'); - }); - it('array argument quotes in the middle', function () { - check('asdf', ['quotes "in the" middle'], 'asdf "quotes \\"in the\\" middle"'); - }); - it('array argument quotes near start', function () { - check('asdf', ['"quotes" near start'], 'asdf "\\"quotes\\" near start"'); - }); - it('array argument quotes near end', function () { - check('asdf', ['quotes "near end"'], 'asdf "quotes \\"near end\\""'); - }); - }); - describe('Args as CommandLine', function () { - it('should handle empty string', function () { - check('file', '', 'file'); - }); - it('should not change args', function () { - check('file', 'foo bar baz', 'file foo bar baz'); - check('file', 'foo \\ba"r \baz', 'file foo \\ba"r \baz'); - }); - }); - describe('Real-world cases', function () { - it('quotes within quotes', function () { - check('cmd.exe', ['/c', 'powershell -noexit -command \'Set-location \"C:\\user\"\''], 'cmd.exe /c "powershell -noexit -command \'Set-location \\\"C:\\user\\"\'"'); - }); - it('space within quotes', function () { - check('cmd.exe', ['/k', '"C:\\Users\\alros\\Desktop\\test script.bat"'], 'cmd.exe /k \\"C:\\Users\\alros\\Desktop\\test script.bat\\"'); - }); - }); - }); -} -//# sourceMappingURL=windowsPtyAgent.test.js.map \ No newline at end of file diff --git a/node_modules/node-pty/lib/windowsPtyAgent.test.js.map b/node_modules/node-pty/lib/windowsPtyAgent.test.js.map deleted file mode 100644 index f92251a..0000000 --- a/node_modules/node-pty/lib/windowsPtyAgent.test.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"windowsPtyAgent.test.js","sourceRoot":"","sources":["../src/windowsPtyAgent.test.ts"],"names":[],"mappings":";AAAA;;;GAGG;;AAEH,+BAAiC;AACjC,qDAAsD;AAEtD,SAAS,KAAK,CAAC,IAAY,EAAE,IAAuB,EAAE,QAAgB;IACpE,MAAM,CAAC,KAAK,CAAC,mCAAiB,CAAC,IAAI,EAAE,IAAI,CAAC,EAAE,QAAQ,CAAC,CAAC;AACxD,CAAC;AAED,IAAI,OAAO,CAAC,QAAQ,KAAK,OAAO,EAAE;IAChC,QAAQ,CAAC,mBAAmB,EAAE;QAC5B,QAAQ,CAAC,eAAe,EAAE;YACxB,EAAE,CAAC,6BAA6B,EAAE;gBAChC,KAAK,CAAC,MAAM,EAAE,EAAE,EAAE,MAAM,CAAC,CAAC;YAC5B,CAAC,CAAC,CAAC;YACH,EAAE,CAAC,6BAA6B,EAAE;gBAChC,KAAK,CAAC,gBAAgB,EAAE,EAAE,EAAE,gBAAgB,CAAC,CAAC;YAChD,CAAC,CAAC,CAAC;YACH,EAAE,CAAC,sCAAsC,EAAE;gBACzC,KAAK,CAAC,cAAc,EAAE,EAAE,EAAE,cAAc,CAAC,CAAC;YAC5C,CAAC,CAAC,CAAC;YACH,EAAE,CAAC,gCAAgC,EAAE;gBACnC,KAAK,CAAC,aAAa,EAAE,EAAE,EAAE,mBAAmB,CAAC,CAAC;YAChD,CAAC,CAAC,CAAC;YACH,EAAE,CAAC,mCAAmC,EAAE;gBACtC,KAAK,CAAC,aAAa,EAAE,EAAE,EAAE,iBAAiB,CAAC,CAAC;YAC9C,CAAC,CAAC,CAAC;QACL,CAAC,CAAC,CAAC;QAEH,QAAQ,CAAC,gBAAgB,EAAE;YACzB,EAAE,CAAC,2BAA2B,EAAE;gBAC9B,KAAK,CAAC,WAAW,EAAE,EAAE,EAAE,aAAa,CAAC,CAAC;YACxC,CAAC,CAAC,CAAC;YACH,EAAE,CAAC,qBAAqB,EAAE;gBACxB,KAAK,CAAC,EAAE,EAAE,EAAE,EAAE,IAAI,CAAC,CAAC;YACtB,CAAC,CAAC,CAAC;YACH,EAAE,CAAC,yBAAyB,EAAE;gBAC5B,KAAK,CAAC,YAAY,EAAE,EAAE,EAAE,cAAc,CAAC,CAAC;YAC1C,CAAC,CAAC,CAAC;YACH,EAAE,CAAC,iCAAiC,EAAE;gBACpC,KAAK,CAAC,iBAAiB,EAAE,EAAE,EAAE,qBAAqB,CAAC,CAAC;YACtD,CAAC,CAAC,CAAC;YACH,EAAE,CAAC,sCAAsC,EAAE;gBACzC,KAAK,CAAC,eAAe,EAAE,EAAE,EAAE,iBAAiB,CAAC,CAAC;YAChD,CAAC,CAAC,CAAC;YACH,EAAE,CAAC,mCAAmC,EAAE;gBACtC,KAAK,CAAC,cAAc,EAAE,EAAE,EAAE,oBAAoB,CAAC,CAAC;YAClD,CAAC,CAAC,CAAC;YACH,EAAE,CAAC,yCAAyC,EAAE;gBAC5C,KAAK,CAAC,eAAe,EAAE,EAAE,EAAE,qBAAqB,CAAC,CAAC;YACpD,CAAC,CAAC,CAAC;QACL,CAAC,CAAC,CAAC;QAEH,QAAQ,CAAC,oBAAoB,EAAE;YAC7B,EAAE,CAAC,6BAA6B,EAAE;gBAChC,KAAK,CAAC,MAAM,EAAE,CAAC,WAAW,EAAE,EAAE,EAAE,GAAG,CAAC,EAAE,yBAAyB,CAAC,CAAC;YACnE,CAAC,CAAC,CAAC;YACH,EAAE,CAAC,8BAA8B,EAAE;gBACjC,KAAK,CAAC,MAAM,EAAE,CAAC,uBAAuB,CAAC,EAAE,gCAAgC,CAAC,CAAC;YAC7E,CAAC,CAAC,CAAC;YACH,EAAE,CAAC,qCAAqC,EAAE;gBACxC,KAAK,CAAC,MAAM,EAAE,CAAC,wBAAwB,CAAC,EAAE,mCAAmC,CAAC,CAAC;YACjF,CAAC,CAAC,CAAC;YACH,EAAE,CAAC,kCAAkC,EAAE;gBACrC,KAAK,CAAC,MAAM,EAAE,CAAC,qBAAqB,CAAC,EAAE,gCAAgC,CAAC,CAAC;YAC3E,CAAC,CAAC,CAAC;YACH,EAAE,CAAC,gCAAgC,EAAE;gBACnC,KAAK,CAAC,MAAM,EAAE,CAAC,mBAAmB,CAAC,EAAE,8BAA8B,CAAC,CAAC;YACvE,CAAC,CAAC,CAAC;QACL,CAAC,CAAC,CAAC;QAEH,QAAQ,CAAC,qBAAqB,EAAE;YAC9B,EAAE,CAAC,4BAA4B,EAAE;gBAC/B,KAAK,CAAC,MAAM,EAAE,EAAE,EAAE,MAAM,CAAC,CAAC;YAC5B,CAAC,CAAC,CAAC;YACH,EAAE,CAAC,wBAAwB,EAAE;gBAC3B,KAAK,CAAC,MAAM,EAAE,aAAa,EAAE,kBAAkB,CAAC,CAAC;gBACjD,KAAK,CAAC,MAAM,EAAE,iBAAiB,EAAE,sBAAsB,CAAC,CAAC;YAC3D,CAAC,CAAC,CAAC;QACL,CAAC,CAAC,CAAC;QAEH,QAAQ,CAAC,kBAAkB,EAAE;YAC3B,EAAE,CAAC,sBAAsB,EAAE;gBACzB,KAAK,CAAC,SAAS,EAAE,CAAC,IAAI,EAAE,2DAA2D,CAAC,EAAE,2EAA2E,CAAC,CAAC;YACrK,CAAC,CAAC,CAAC;YACH,EAAE,CAAC,qBAAqB,EAAE;gBACxB,KAAK,CAAC,SAAS,EAAE,CAAC,IAAI,EAAE,8CAA8C,CAAC,EAAE,6DAA6D,CAAC,CAAC;YAC1I,CAAC,CAAC,CAAC;QACL,CAAC,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;CACJ"} \ No newline at end of file diff --git a/node_modules/node-pty/lib/windowsTerminal.js b/node_modules/node-pty/lib/windowsTerminal.js deleted file mode 100644 index 0f14f3d..0000000 --- a/node_modules/node-pty/lib/windowsTerminal.js +++ /dev/null @@ -1,181 +0,0 @@ -"use strict"; -/** - * Copyright (c) 2012-2015, Christopher Jeffrey, Peter Sunde (MIT License) - * Copyright (c) 2016, Daniel Imms (MIT License). - * Copyright (c) 2018, Microsoft Corporation (MIT License). - */ -var __extends = (this && this.__extends) || (function () { - var extendStatics = function (d, b) { - extendStatics = Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; - return extendStatics(d, b); - }; - return function (d, b) { - extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); - }; -})(); -Object.defineProperty(exports, "__esModule", { value: true }); -var terminal_1 = require("./terminal"); -var windowsPtyAgent_1 = require("./windowsPtyAgent"); -var utils_1 = require("./utils"); -var DEFAULT_FILE = 'cmd.exe'; -var DEFAULT_NAME = 'Windows Shell'; -var WindowsTerminal = /** @class */ (function (_super) { - __extends(WindowsTerminal, _super); - function WindowsTerminal(file, args, opt) { - var _this = _super.call(this, opt) || this; - // Initialize arguments - args = args || []; - file = file || DEFAULT_FILE; - opt = opt || {}; - opt.env = opt.env || process.env; - if (opt.encoding) { - console.warn('Setting encoding on Windows is not supported'); - } - var env = utils_1.assign({}, opt.env); - _this._cols = opt.cols || terminal_1.DEFAULT_COLS; - _this._rows = opt.rows || terminal_1.DEFAULT_ROWS; - var cwd = opt.cwd || process.cwd(); - var name = opt.name || env.TERM || DEFAULT_NAME; - var parsedEnv = _this._parseEnv(env); - // If the terminal is ready - _this._isReady = false; - // Functions that need to run after `ready` event is emitted. - _this._deferreds = []; - // Create new termal. - _this._agent = new windowsPtyAgent_1.WindowsPtyAgent(file, args, parsedEnv, cwd, _this._cols, _this._rows, false, opt.useConpty, opt.conptyInheritCursor); - _this._socket = _this._agent.outSocket; - // Not available until `ready` event emitted. - _this._pid = _this._agent.innerPid; - _this._fd = _this._agent.fd; - _this._pty = _this._agent.pty; - // The forked windows terminal is not available until `ready` event is - // emitted. - _this._socket.on('ready_datapipe', function () { - // These events needs to be forwarded. - ['connect', 'data', 'end', 'timeout', 'drain'].forEach(function (event) { - _this._socket.on(event, function () { - // Wait until the first data event is fired then we can run deferreds. - if (!_this._isReady && event === 'data') { - // Terminal is now ready and we can avoid having to defer method - // calls. - _this._isReady = true; - // Execute all deferred methods - _this._deferreds.forEach(function (fn) { - // NB! In order to ensure that `this` has all its references - // updated any variable that need to be available in `this` before - // the deferred is run has to be declared above this forEach - // statement. - fn.run(); - }); - // Reset - _this._deferreds = []; - } - }); - }); - // Shutdown if `error` event is emitted. - _this._socket.on('error', function (err) { - // Close terminal session. - _this._close(); - // EIO, happens when someone closes our child process: the only process - // in the terminal. - // node < 0.6.14: errno 5 - // node >= 0.6.14: read EIO - if (err.code) { - if (~err.code.indexOf('errno 5') || ~err.code.indexOf('EIO')) - return; - } - // Throw anything else. - if (_this.listeners('error').length < 2) { - throw err; - } - }); - // Cleanup after the socket is closed. - _this._socket.on('close', function () { - _this.emit('exit', _this._agent.exitCode); - _this._close(); - }); - }); - _this._file = file; - _this._name = name; - _this._readable = true; - _this._writable = true; - _this._forwardEvents(); - return _this; - } - WindowsTerminal.prototype._write = function (data) { - this._defer(this._doWrite, data); - }; - WindowsTerminal.prototype._doWrite = function (data) { - this._agent.inSocket.write(data); - }; - /** - * openpty - */ - WindowsTerminal.open = function (options) { - throw new Error('open() not supported on windows, use Fork() instead.'); - }; - /** - * TTY - */ - WindowsTerminal.prototype.resize = function (cols, rows) { - var _this = this; - if (cols <= 0 || rows <= 0 || isNaN(cols) || isNaN(rows) || cols === Infinity || rows === Infinity) { - throw new Error('resizing must be done using positive cols and rows'); - } - this._defer(function () { - _this._agent.resize(cols, rows); - _this._cols = cols; - _this._rows = rows; - }); - }; - WindowsTerminal.prototype.destroy = function () { - var _this = this; - this._defer(function () { - _this.kill(); - }); - }; - WindowsTerminal.prototype.kill = function (signal) { - var _this = this; - this._defer(function () { - if (signal) { - throw new Error('Signals not supported on windows.'); - } - _this._close(); - _this._agent.kill(); - }); - }; - WindowsTerminal.prototype._defer = function (deferredFn, arg) { - var _this = this; - // If the terminal is ready, execute. - if (this._isReady) { - deferredFn.call(this, arg); - return; - } - // Queue until terminal is ready. - this._deferreds.push({ - run: function () { return deferredFn.call(_this, arg); } - }); - }; - Object.defineProperty(WindowsTerminal.prototype, "process", { - get: function () { return this._name; }, - enumerable: true, - configurable: true - }); - Object.defineProperty(WindowsTerminal.prototype, "master", { - get: function () { throw new Error('master is not supported on Windows'); }, - enumerable: true, - configurable: true - }); - Object.defineProperty(WindowsTerminal.prototype, "slave", { - get: function () { throw new Error('slave is not supported on Windows'); }, - enumerable: true, - configurable: true - }); - return WindowsTerminal; -}(terminal_1.Terminal)); -exports.WindowsTerminal = WindowsTerminal; -//# sourceMappingURL=windowsTerminal.js.map \ No newline at end of file diff --git a/node_modules/node-pty/lib/windowsTerminal.js.map b/node_modules/node-pty/lib/windowsTerminal.js.map deleted file mode 100644 index 30b49af..0000000 --- a/node_modules/node-pty/lib/windowsTerminal.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"windowsTerminal.js","sourceRoot":"","sources":["../src/windowsTerminal.ts"],"names":[],"mappings":";AAAA;;;;GAIG;;;;;;;;;;;;;;;AAGH,uCAAkE;AAClE,qDAAoD;AAGpD,iCAAiC;AAEjC,IAAM,YAAY,GAAG,SAAS,CAAC;AAC/B,IAAM,YAAY,GAAG,eAAe,CAAC;AAErC;IAAqC,mCAAQ;IAK3C,yBAAY,IAAa,EAAE,IAAwB,EAAE,GAA4B;QAAjF,YACE,kBAAM,GAAG,CAAC,SAmGX;QAjGC,uBAAuB;QACvB,IAAI,GAAG,IAAI,IAAI,EAAE,CAAC;QAClB,IAAI,GAAG,IAAI,IAAI,YAAY,CAAC;QAC5B,GAAG,GAAG,GAAG,IAAI,EAAE,CAAC;QAChB,GAAG,CAAC,GAAG,GAAG,GAAG,CAAC,GAAG,IAAI,OAAO,CAAC,GAAG,CAAC;QAEjC,IAAI,GAAG,CAAC,QAAQ,EAAE;YAChB,OAAO,CAAC,IAAI,CAAC,8CAA8C,CAAC,CAAC;SAC9D;QAED,IAAM,GAAG,GAAG,cAAM,CAAC,EAAE,EAAE,GAAG,CAAC,GAAG,CAAC,CAAC;QAChC,KAAI,CAAC,KAAK,GAAG,GAAG,CAAC,IAAI,IAAI,uBAAY,CAAC;QACtC,KAAI,CAAC,KAAK,GAAG,GAAG,CAAC,IAAI,IAAI,uBAAY,CAAC;QACtC,IAAM,GAAG,GAAG,GAAG,CAAC,GAAG,IAAI,OAAO,CAAC,GAAG,EAAE,CAAC;QACrC,IAAM,IAAI,GAAG,GAAG,CAAC,IAAI,IAAI,GAAG,CAAC,IAAI,IAAI,YAAY,CAAC;QAClD,IAAM,SAAS,GAAG,KAAI,CAAC,SAAS,CAAC,GAAG,CAAC,CAAC;QAEtC,2BAA2B;QAC3B,KAAI,CAAC,QAAQ,GAAG,KAAK,CAAC;QAEtB,6DAA6D;QAC7D,KAAI,CAAC,UAAU,GAAG,EAAE,CAAC;QAErB,qBAAqB;QACrB,KAAI,CAAC,MAAM,GAAG,IAAI,iCAAe,CAAC,IAAI,EAAE,IAAI,EAAE,SAAS,EAAE,GAAG,EAAE,KAAI,CAAC,KAAK,EAAE,KAAI,CAAC,KAAK,EAAE,KAAK,EAAE,GAAG,CAAC,SAAS,EAAE,GAAG,CAAC,mBAAmB,CAAC,CAAC;QACrI,KAAI,CAAC,OAAO,GAAG,KAAI,CAAC,MAAM,CAAC,SAAS,CAAC;QAErC,6CAA6C;QAC7C,KAAI,CAAC,IAAI,GAAG,KAAI,CAAC,MAAM,CAAC,QAAQ,CAAC;QACjC,KAAI,CAAC,GAAG,GAAG,KAAI,CAAC,MAAM,CAAC,EAAE,CAAC;QAC1B,KAAI,CAAC,IAAI,GAAG,KAAI,CAAC,MAAM,CAAC,GAAG,CAAC;QAE5B,sEAAsE;QACtE,WAAW;QACX,KAAI,CAAC,OAAO,CAAC,EAAE,CAAC,gBAAgB,EAAE;YAEhC,sCAAsC;YACtC,CAAC,SAAS,EAAE,MAAM,EAAE,KAAK,EAAE,SAAS,EAAE,OAAO,CAAC,CAAC,OAAO,CAAC,UAAA,KAAK;gBAC1D,KAAI,CAAC,OAAO,CAAC,EAAE,CAAC,KAAK,EAAE;oBAErB,sEAAsE;oBACtE,IAAI,CAAC,KAAI,CAAC,QAAQ,IAAI,KAAK,KAAK,MAAM,EAAE;wBAEtC,gEAAgE;wBAChE,SAAS;wBACT,KAAI,CAAC,QAAQ,GAAG,IAAI,CAAC;wBAErB,+BAA+B;wBAC/B,KAAI,CAAC,UAAU,CAAC,OAAO,CAAC,UAAA,EAAE;4BACxB,4DAA4D;4BAC5D,kEAAkE;4BAClE,4DAA4D;4BAC5D,aAAa;4BACb,EAAE,CAAC,GAAG,EAAE,CAAC;wBACX,CAAC,CAAC,CAAC;wBAEH,QAAQ;wBACR,KAAI,CAAC,UAAU,GAAG,EAAE,CAAC;qBAEtB;gBACH,CAAC,CAAC,CAAC;YACL,CAAC,CAAC,CAAC;YAEH,wCAAwC;YACxC,KAAI,CAAC,OAAO,CAAC,EAAE,CAAC,OAAO,EAAE,UAAA,GAAG;gBAC1B,0BAA0B;gBAC1B,KAAI,CAAC,MAAM,EAAE,CAAC;gBAEd,uEAAuE;gBACvE,mBAAmB;gBACnB,yBAAyB;gBACzB,2BAA2B;gBAC3B,IAAU,GAAI,CAAC,IAAI,EAAE;oBACnB,IAAI,CAAO,GAAI,CAAC,IAAI,CAAC,OAAO,CAAC,SAAS,CAAC,IAAI,CAAO,GAAI,CAAC,IAAI,CAAC,OAAO,CAAC,KAAK,CAAC;wBAAE,OAAO;iBACpF;gBAED,uBAAuB;gBACvB,IAAI,KAAI,CAAC,SAAS,CAAC,OAAO,CAAC,CAAC,MAAM,GAAG,CAAC,EAAE;oBACtC,MAAM,GAAG,CAAC;iBACX;YACH,CAAC,CAAC,CAAC;YAEH,sCAAsC;YACtC,KAAI,CAAC,OAAO,CAAC,EAAE,CAAC,OAAO,EAAE;gBACvB,KAAI,CAAC,IAAI,CAAC,MAAM,EAAE,KAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC;gBACxC,KAAI,CAAC,MAAM,EAAE,CAAC;YAChB,CAAC,CAAC,CAAC;QAEL,CAAC,CAAC,CAAC;QAEH,KAAI,CAAC,KAAK,GAAG,IAAI,CAAC;QAClB,KAAI,CAAC,KAAK,GAAG,IAAI,CAAC;QAElB,KAAI,CAAC,SAAS,GAAG,IAAI,CAAC;QACtB,KAAI,CAAC,SAAS,GAAG,IAAI,CAAC;QAEtB,KAAI,CAAC,cAAc,EAAE,CAAC;;IACxB,CAAC;IAES,gCAAM,GAAhB,UAAiB,IAAY;QAC3B,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,QAAQ,EAAE,IAAI,CAAC,CAAC;IACnC,CAAC;IAEO,kCAAQ,GAAhB,UAAiB,IAAY;QAC3B,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;IACnC,CAAC;IAED;;OAEG;IAEW,oBAAI,GAAlB,UAAmB,OAAyB;QAC1C,MAAM,IAAI,KAAK,CAAC,sDAAsD,CAAC,CAAC;IAC1E,CAAC;IAED;;OAEG;IAEI,gCAAM,GAAb,UAAc,IAAY,EAAE,IAAY;QAAxC,iBASC;QARC,IAAI,IAAI,IAAI,CAAC,IAAI,IAAI,IAAI,CAAC,IAAI,KAAK,CAAC,IAAI,CAAC,IAAI,KAAK,CAAC,IAAI,CAAC,IAAI,IAAI,KAAK,QAAQ,IAAI,IAAI,KAAK,QAAQ,EAAE;YAClG,MAAM,IAAI,KAAK,CAAC,oDAAoD,CAAC,CAAC;SACvE;QACD,IAAI,CAAC,MAAM,CAAC;YACV,KAAI,CAAC,MAAM,CAAC,MAAM,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC;YAC/B,KAAI,CAAC,KAAK,GAAG,IAAI,CAAC;YAClB,KAAI,CAAC,KAAK,GAAG,IAAI,CAAC;QACpB,CAAC,CAAC,CAAC;IACL,CAAC;IAEM,iCAAO,GAAd;QAAA,iBAIC;QAHC,IAAI,CAAC,MAAM,CAAC;YACV,KAAI,CAAC,IAAI,EAAE,CAAC;QACd,CAAC,CAAC,CAAC;IACL,CAAC;IAEM,8BAAI,GAAX,UAAY,MAAe;QAA3B,iBAQC;QAPC,IAAI,CAAC,MAAM,CAAC;YACV,IAAI,MAAM,EAAE;gBACV,MAAM,IAAI,KAAK,CAAC,mCAAmC,CAAC,CAAC;aACtD;YACD,KAAI,CAAC,MAAM,EAAE,CAAC;YACd,KAAI,CAAC,MAAM,CAAC,IAAI,EAAE,CAAC;QACrB,CAAC,CAAC,CAAC;IACL,CAAC;IAEO,gCAAM,GAAd,UAA8B,UAA6B,EAAE,GAAO;QAApE,iBAWC;QAVC,qCAAqC;QACrC,IAAI,IAAI,CAAC,QAAQ,EAAE;YACjB,UAAU,CAAC,IAAI,CAAC,IAAI,EAAE,GAAG,CAAC,CAAC;YAC3B,OAAO;SACR;QAED,iCAAiC;QACjC,IAAI,CAAC,UAAU,CAAC,IAAI,CAAC;YACnB,GAAG,EAAE,cAAM,OAAA,UAAU,CAAC,IAAI,CAAC,KAAI,EAAE,GAAG,CAAC,EAA1B,CAA0B;SACtC,CAAC,CAAC;IACL,CAAC;IAED,sBAAW,oCAAO;aAAlB,cAA+B,OAAO,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC;;;OAAA;IACnD,sBAAW,mCAAM;aAAjB,cAA8B,MAAM,IAAI,KAAK,CAAC,oCAAoC,CAAC,CAAC,CAAC,CAAC;;;OAAA;IACtF,sBAAW,kCAAK;aAAhB,cAA6B,MAAM,IAAI,KAAK,CAAC,mCAAmC,CAAC,CAAC,CAAC,CAAC;;;OAAA;IACtF,sBAAC;AAAD,CAAC,AA1KD,CAAqC,mBAAQ,GA0K5C;AA1KY,0CAAe"} \ No newline at end of file diff --git a/node_modules/node-pty/lib/windowsTerminal.test.js b/node_modules/node-pty/lib/windowsTerminal.test.js deleted file mode 100644 index 1a638e4..0000000 --- a/node_modules/node-pty/lib/windowsTerminal.test.js +++ /dev/null @@ -1,195 +0,0 @@ -"use strict"; -/** - * Copyright (c) 2017, Daniel Imms (MIT License). - * Copyright (c) 2018, Microsoft Corporation (MIT License). - */ -Object.defineProperty(exports, "__esModule", { value: true }); -var fs = require("fs"); -var assert = require("assert"); -var windowsTerminal_1 = require("./windowsTerminal"); -var path = require("path"); -var psList = require("ps-list"); -function pollForProcessState(desiredState, intervalMs, timeoutMs) { - if (intervalMs === void 0) { intervalMs = 100; } - if (timeoutMs === void 0) { timeoutMs = 2000; } - return new Promise(function (resolve) { - var tries = 0; - var interval = setInterval(function () { - psList({ all: true }).then(function (ps) { - var success = true; - var pids = Object.keys(desiredState).map(function (k) { return parseInt(k, 10); }); - pids.forEach(function (pid) { - if (desiredState[pid]) { - if (!ps.some(function (p) { return p.pid === pid; })) { - success = false; - } - } - else { - if (ps.some(function (p) { return p.pid === pid; })) { - success = false; - } - } - }); - if (success) { - clearInterval(interval); - resolve(); - return; - } - tries++; - if (tries * intervalMs >= timeoutMs) { - clearInterval(interval); - var processListing = pids.map(function (k) { return k + ": " + desiredState[k]; }).join('\n'); - assert.fail("Bad process state, expected:\n" + processListing); - resolve(); - } - }); - }, intervalMs); - }); -} -function pollForProcessTreeSize(pid, size, intervalMs, timeoutMs) { - if (intervalMs === void 0) { intervalMs = 100; } - if (timeoutMs === void 0) { timeoutMs = 2000; } - return new Promise(function (resolve) { - var tries = 0; - var interval = setInterval(function () { - psList({ all: true }).then(function (ps) { - var openList = []; - openList.push(ps.filter(function (p) { return p.pid === pid; }).map(function (p) { - return { name: p.name, pid: p.pid }; - })[0]); - var list = []; - var _loop_1 = function () { - var current = openList.shift(); - ps.filter(function (p) { return p.ppid === current.pid; }).map(function (p) { - return { name: p.name, pid: p.pid }; - }).forEach(function (p) { return openList.push(p); }); - list.push(current); - }; - while (openList.length) { - _loop_1(); - } - var success = list.length === size; - if (success) { - clearInterval(interval); - resolve(list); - return; - } - tries++; - if (tries * intervalMs >= timeoutMs) { - clearInterval(interval); - assert.fail("Bad process state, expected: " + size + ", actual: " + list.length); - resolve(); - } - }); - }, intervalMs); - }); -} -if (process.platform === 'win32') { - describe('WindowsTerminal', function () { - describe('kill', function () { - it('should not crash parent process', function (done) { - var term = new windowsTerminal_1.WindowsTerminal('cmd.exe', [], {}); - term.kill(); - // Add done call to deferred function queue to ensure the kill call has completed - term._defer(done); - }); - it('should kill the process tree', function (done) { - this.timeout(5000); - var term = new windowsTerminal_1.WindowsTerminal('cmd.exe', [], {}); - // Start sub-processes - term.write('powershell.exe\r'); - term.write('notepad.exe\r'); - term.write('node.exe\r'); - pollForProcessTreeSize(term.pid, 4, 500, 5000).then(function (list) { - assert.equal(list[0].name, 'cmd.exe'); - assert.equal(list[1].name, 'powershell.exe'); - assert.equal(list[2].name, 'notepad.exe'); - assert.equal(list[3].name, 'node.exe'); - term.kill(); - var desiredState = {}; - desiredState[list[0].pid] = false; - desiredState[list[1].pid] = false; - desiredState[list[2].pid] = true; - desiredState[list[3].pid] = false; - pollForProcessState(desiredState).then(function () { - // Kill notepad before done - process.kill(list[2].pid); - done(); - }); - }); - }); - }); - describe('resize', function () { - it('should throw a non-native exception when resizing an invalid value', function () { - var term = new windowsTerminal_1.WindowsTerminal('cmd.exe', [], {}); - assert.throws(function () { return term.resize(-1, -1); }); - assert.throws(function () { return term.resize(0, 0); }); - assert.doesNotThrow(function () { return term.resize(1, 1); }); - }); - it('should throw an non-native exception when resizing a killed terminal', function (done) { - var term = new windowsTerminal_1.WindowsTerminal('cmd.exe', [], {}); - term._defer(function () { - term.on('exit', function () { - assert.throws(function () { return term.resize(1, 1); }); - done(); - }); - term.destroy(); - }); - }); - }); - describe('Args as CommandLine', function () { - it('should not fail running a file containing a space in the path', function (done) { - var spaceFolder = path.resolve(__dirname, '..', 'fixtures', 'space folder'); - if (!fs.existsSync(spaceFolder)) { - fs.mkdirSync(spaceFolder); - } - var cmdCopiedPath = path.resolve(spaceFolder, 'cmd.exe'); - var data = fs.readFileSync(process.env.windir + "\\System32\\cmd.exe"); - fs.writeFileSync(cmdCopiedPath, data); - if (!fs.existsSync(cmdCopiedPath)) { - // Skip test if git bash isn't installed - return; - } - var term = new windowsTerminal_1.WindowsTerminal(cmdCopiedPath, '/c echo "hello world"', {}); - var result = ''; - term.on('data', function (data) { - result += data; - }); - term.on('exit', function () { - assert.ok(result.indexOf('hello world') >= 1); - done(); - }); - }); - }); - describe('env', function () { - it('should set environment variables of the shell', function (done) { - var term = new windowsTerminal_1.WindowsTerminal('cmd.exe', '/C echo %FOO%', { env: { FOO: 'BAR' } }); - var result = ''; - term.on('data', function (data) { - result += data; - }); - term.on('exit', function () { - assert.ok(result.indexOf('BAR') >= 0); - done(); - }); - }); - }); - describe('On close', function () { - it('should return process zero exit codes', function (done) { - var term = new windowsTerminal_1.WindowsTerminal('cmd.exe', '/C exit'); - term.on('exit', function (code) { - assert.equal(code, 0); - done(); - }); - }); - it('should return process non-zero exit codes', function (done) { - var term = new windowsTerminal_1.WindowsTerminal('cmd.exe', '/C exit 2'); - term.on('exit', function (code) { - assert.equal(code, 2); - done(); - }); - }); - }); - }); -} -//# sourceMappingURL=windowsTerminal.test.js.map \ No newline at end of file diff --git a/node_modules/node-pty/lib/windowsTerminal.test.js.map b/node_modules/node-pty/lib/windowsTerminal.test.js.map deleted file mode 100644 index 6eaac58..0000000 --- a/node_modules/node-pty/lib/windowsTerminal.test.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"windowsTerminal.test.js","sourceRoot":"","sources":["../src/windowsTerminal.test.ts"],"names":[],"mappings":";AAAA;;;GAGG;;AAEH,uBAAyB;AACzB,+BAAiC;AACjC,qDAAoD;AACpD,2BAA6B;AAC7B,gCAAkC;AAYlC,SAAS,mBAAmB,CAAC,YAA2B,EAAE,UAAwB,EAAE,SAAwB;IAAlD,2BAAA,EAAA,gBAAwB;IAAE,0BAAA,EAAA,gBAAwB;IAC1G,OAAO,IAAI,OAAO,CAAO,UAAA,OAAO;QAC9B,IAAI,KAAK,GAAG,CAAC,CAAC;QACd,IAAM,QAAQ,GAAG,WAAW,CAAC;YAC3B,MAAM,CAAC,EAAE,GAAG,EAAE,IAAI,EAAE,CAAC,CAAC,IAAI,CAAC,UAAA,EAAE;gBAC3B,IAAI,OAAO,GAAG,IAAI,CAAC;gBACnB,IAAM,IAAI,GAAG,MAAM,CAAC,IAAI,CAAC,YAAY,CAAC,CAAC,GAAG,CAAC,UAAA,CAAC,IAAI,OAAA,QAAQ,CAAC,CAAC,EAAE,EAAE,CAAC,EAAf,CAAe,CAAC,CAAC;gBACjE,IAAI,CAAC,OAAO,CAAC,UAAA,GAAG;oBACd,IAAI,YAAY,CAAC,GAAG,CAAC,EAAE;wBACrB,IAAI,CAAC,EAAE,CAAC,IAAI,CAAC,UAAA,CAAC,IAAI,OAAA,CAAC,CAAC,GAAG,KAAK,GAAG,EAAb,CAAa,CAAC,EAAE;4BAChC,OAAO,GAAG,KAAK,CAAC;yBACjB;qBACF;yBAAM;wBACL,IAAI,EAAE,CAAC,IAAI,CAAC,UAAA,CAAC,IAAI,OAAA,CAAC,CAAC,GAAG,KAAK,GAAG,EAAb,CAAa,CAAC,EAAE;4BAC/B,OAAO,GAAG,KAAK,CAAC;yBACjB;qBACF;gBACH,CAAC,CAAC,CAAC;gBACH,IAAI,OAAO,EAAE;oBACX,aAAa,CAAC,QAAQ,CAAC,CAAC;oBACxB,OAAO,EAAE,CAAC;oBACV,OAAO;iBACR;gBACD,KAAK,EAAE,CAAC;gBACR,IAAI,KAAK,GAAG,UAAU,IAAI,SAAS,EAAE;oBACnC,aAAa,CAAC,QAAQ,CAAC,CAAC;oBACxB,IAAM,cAAc,GAAG,IAAI,CAAC,GAAG,CAAC,UAAA,CAAC,IAAI,OAAG,CAAC,UAAK,YAAY,CAAC,CAAC,CAAG,EAA1B,CAA0B,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;oBAC5E,MAAM,CAAC,IAAI,CAAC,mCAAiC,cAAgB,CAAC,CAAC;oBAC/D,OAAO,EAAE,CAAC;iBACX;YACH,CAAC,CAAC,CAAC;QACL,CAAC,EAAE,UAAU,CAAC,CAAC;IACjB,CAAC,CAAC,CAAC;AACL,CAAC;AAED,SAAS,sBAAsB,CAAC,GAAW,EAAE,IAAY,EAAE,UAAwB,EAAE,SAAwB;IAAlD,2BAAA,EAAA,gBAAwB;IAAE,0BAAA,EAAA,gBAAwB;IAC3G,OAAO,IAAI,OAAO,CAA8B,UAAA,OAAO;QACrD,IAAI,KAAK,GAAG,CAAC,CAAC;QACd,IAAM,QAAQ,GAAG,WAAW,CAAC;YAC3B,MAAM,CAAC,EAAE,GAAG,EAAE,IAAI,EAAE,CAAC,CAAC,IAAI,CAAC,UAAA,EAAE;gBAC3B,IAAM,QAAQ,GAAgC,EAAE,CAAC;gBACjD,QAAQ,CAAC,IAAI,CAAC,EAAE,CAAC,MAAM,CAAC,UAAA,CAAC,IAAI,OAAA,CAAC,CAAC,GAAG,KAAK,GAAG,EAAb,CAAa,CAAC,CAAC,GAAG,CAAC,UAAA,CAAC;oBAC/C,OAAO,EAAE,IAAI,EAAE,CAAC,CAAC,IAAI,EAAE,GAAG,EAAE,CAAC,CAAC,GAAG,EAAE,CAAC;gBACtC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;gBACP,IAAM,IAAI,GAAgC,EAAE,CAAC;;oBAE3C,IAAM,OAAO,GAAG,QAAQ,CAAC,KAAK,EAAE,CAAC;oBACjC,EAAE,CAAC,MAAM,CAAC,UAAA,CAAC,IAAI,OAAA,CAAC,CAAC,IAAI,KAAK,OAAO,CAAC,GAAG,EAAtB,CAAsB,CAAC,CAAC,GAAG,CAAC,UAAA,CAAC;wBAC1C,OAAO,EAAE,IAAI,EAAE,CAAC,CAAC,IAAI,EAAE,GAAG,EAAE,CAAC,CAAC,GAAG,EAAE,CAAC;oBACtC,CAAC,CAAC,CAAC,OAAO,CAAC,UAAA,CAAC,IAAI,OAAA,QAAQ,CAAC,IAAI,CAAC,CAAC,CAAC,EAAhB,CAAgB,CAAC,CAAC;oBAClC,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;;gBALrB,OAAO,QAAQ,CAAC,MAAM;;iBAMrB;gBACD,IAAM,OAAO,GAAG,IAAI,CAAC,MAAM,KAAK,IAAI,CAAC;gBACrC,IAAI,OAAO,EAAE;oBACX,aAAa,CAAC,QAAQ,CAAC,CAAC;oBACxB,OAAO,CAAC,IAAI,CAAC,CAAC;oBACd,OAAO;iBACR;gBACD,KAAK,EAAE,CAAC;gBACR,IAAI,KAAK,GAAG,UAAU,IAAI,SAAS,EAAE;oBACnC,aAAa,CAAC,QAAQ,CAAC,CAAC;oBACxB,MAAM,CAAC,IAAI,CAAC,kCAAgC,IAAI,kBAAa,IAAI,CAAC,MAAQ,CAAC,CAAC;oBAC5E,OAAO,EAAE,CAAC;iBACX;YACH,CAAC,CAAC,CAAC;QACL,CAAC,EAAE,UAAU,CAAC,CAAC;IACjB,CAAC,CAAC,CAAC;AACL,CAAC;AAED,IAAI,OAAO,CAAC,QAAQ,KAAK,OAAO,EAAE;IAChC,QAAQ,CAAC,iBAAiB,EAAE;QAC1B,QAAQ,CAAC,MAAM,EAAE;YACf,EAAE,CAAC,iCAAiC,EAAE,UAAC,IAAI;gBACzC,IAAM,IAAI,GAAG,IAAI,iCAAe,CAAC,SAAS,EAAE,EAAE,EAAE,EAAE,CAAC,CAAC;gBACpD,IAAI,CAAC,IAAI,EAAE,CAAC;gBACZ,iFAAiF;gBAC3E,IAAK,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;YAC3B,CAAC,CAAC,CAAC;YACH,EAAE,CAAC,8BAA8B,EAAE,UAAU,IAAgB;gBAC3D,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;gBACnB,IAAM,IAAI,GAAG,IAAI,iCAAe,CAAC,SAAS,EAAE,EAAE,EAAE,EAAE,CAAC,CAAC;gBACpD,sBAAsB;gBACtB,IAAI,CAAC,KAAK,CAAC,kBAAkB,CAAC,CAAC;gBAC/B,IAAI,CAAC,KAAK,CAAC,eAAe,CAAC,CAAC;gBAC5B,IAAI,CAAC,KAAK,CAAC,YAAY,CAAC,CAAC;gBACzB,sBAAsB,CAAC,IAAI,CAAC,GAAG,EAAE,CAAC,EAAE,GAAG,EAAE,IAAI,CAAC,CAAC,IAAI,CAAC,UAAA,IAAI;oBACtD,MAAM,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,IAAI,EAAE,SAAS,CAAC,CAAC;oBACtC,MAAM,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,IAAI,EAAE,gBAAgB,CAAC,CAAC;oBAC7C,MAAM,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,IAAI,EAAE,aAAa,CAAC,CAAC;oBAC1C,MAAM,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,IAAI,EAAE,UAAU,CAAC,CAAC;oBACvC,IAAI,CAAC,IAAI,EAAE,CAAC;oBACZ,IAAM,YAAY,GAAkB,EAAE,CAAC;oBACvC,YAAY,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,GAAG,KAAK,CAAC;oBAClC,YAAY,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,GAAG,KAAK,CAAC;oBAClC,YAAY,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,GAAG,IAAI,CAAC;oBACjC,YAAY,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,GAAG,KAAK,CAAC;oBAClC,mBAAmB,CAAC,YAAY,CAAC,CAAC,IAAI,CAAC;wBACrC,2BAA2B;wBAC3B,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC;wBAC1B,IAAI,EAAE,CAAC;oBACT,CAAC,CAAC,CAAC;gBACL,CAAC,CAAC,CAAC;YACL,CAAC,CAAC,CAAC;QACL,CAAC,CAAC,CAAC;QAEH,QAAQ,CAAC,QAAQ,EAAE;YACjB,EAAE,CAAC,oEAAoE,EAAE;gBACvE,IAAM,IAAI,GAAG,IAAI,iCAAe,CAAC,SAAS,EAAE,EAAE,EAAE,EAAE,CAAC,CAAC;gBACpD,MAAM,CAAC,MAAM,CAAC,cAAM,OAAA,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,EAAnB,CAAmB,CAAC,CAAC;gBACzC,MAAM,CAAC,MAAM,CAAC,cAAM,OAAA,IAAI,CAAC,MAAM,CAAC,CAAC,EAAE,CAAC,CAAC,EAAjB,CAAiB,CAAC,CAAC;gBACvC,MAAM,CAAC,YAAY,CAAC,cAAM,OAAA,IAAI,CAAC,MAAM,CAAC,CAAC,EAAE,CAAC,CAAC,EAAjB,CAAiB,CAAC,CAAC;YAC/C,CAAC,CAAC,CAAC;YACH,EAAE,CAAC,sEAAsE,EAAE,UAAC,IAAI;gBAC9E,IAAM,IAAI,GAAG,IAAI,iCAAe,CAAC,SAAS,EAAE,EAAE,EAAE,EAAE,CAAC,CAAC;gBAC9C,IAAK,CAAC,MAAM,CAAC;oBACjB,IAAI,CAAC,EAAE,CAAC,MAAM,EAAE;wBACd,MAAM,CAAC,MAAM,CAAC,cAAM,OAAA,IAAI,CAAC,MAAM,CAAC,CAAC,EAAE,CAAC,CAAC,EAAjB,CAAiB,CAAC,CAAC;wBACvC,IAAI,EAAE,CAAC;oBACT,CAAC,CAAC,CAAC;oBACH,IAAI,CAAC,OAAO,EAAE,CAAC;gBACjB,CAAC,CAAC,CAAC;YACL,CAAC,CAAC,CAAC;QACL,CAAC,CAAC,CAAC;QAEH,QAAQ,CAAC,qBAAqB,EAAE;YAC9B,EAAE,CAAC,+DAA+D,EAAE,UAAC,IAAI;gBACvE,IAAM,WAAW,GAAG,IAAI,CAAC,OAAO,CAAC,SAAS,EAAE,IAAI,EAAE,UAAU,EAAE,cAAc,CAAC,CAAC;gBAC9E,IAAI,CAAC,EAAE,CAAC,UAAU,CAAC,WAAW,CAAC,EAAE;oBAC/B,EAAE,CAAC,SAAS,CAAC,WAAW,CAAC,CAAC;iBAC3B;gBAED,IAAM,aAAa,GAAG,IAAI,CAAC,OAAO,CAAC,WAAW,EAAE,SAAS,CAAC,CAAC;gBAC3D,IAAM,IAAI,GAAG,EAAE,CAAC,YAAY,CAAI,OAAO,CAAC,GAAG,CAAC,MAAM,wBAAqB,CAAC,CAAC;gBACzE,EAAE,CAAC,aAAa,CAAC,aAAa,EAAE,IAAI,CAAC,CAAC;gBAEtC,IAAI,CAAC,EAAE,CAAC,UAAU,CAAC,aAAa,CAAC,EAAE;oBACjC,wCAAwC;oBACxC,OAAO;iBACR;gBACD,IAAM,IAAI,GAAG,IAAI,iCAAe,CAAC,aAAa,EAAE,uBAAuB,EAAE,EAAE,CAAC,CAAC;gBAC7E,IAAI,MAAM,GAAG,EAAE,CAAC;gBAChB,IAAI,CAAC,EAAE,CAAC,MAAM,EAAE,UAAC,IAAI;oBACnB,MAAM,IAAI,IAAI,CAAC;gBACjB,CAAC,CAAC,CAAC;gBACH,IAAI,CAAC,EAAE,CAAC,MAAM,EAAE;oBACd,MAAM,CAAC,EAAE,CAAC,MAAM,CAAC,OAAO,CAAC,aAAa,CAAC,IAAI,CAAC,CAAC,CAAC;oBAC9C,IAAI,EAAE,CAAC;gBACT,CAAC,CAAC,CAAC;YACL,CAAC,CAAC,CAAC;QACL,CAAC,CAAC,CAAC;QAEH,QAAQ,CAAC,KAAK,EAAE;YACd,EAAE,CAAC,+CAA+C,EAAE,UAAC,IAAI;gBACvD,IAAM,IAAI,GAAG,IAAI,iCAAe,CAAC,SAAS,EAAE,eAAe,EAAE,EAAE,GAAG,EAAE,EAAE,GAAG,EAAE,KAAK,EAAE,EAAC,CAAC,CAAC;gBACrF,IAAI,MAAM,GAAG,EAAE,CAAC;gBAChB,IAAI,CAAC,EAAE,CAAC,MAAM,EAAE,UAAC,IAAI;oBACnB,MAAM,IAAI,IAAI,CAAC;gBACjB,CAAC,CAAC,CAAC;gBACH,IAAI,CAAC,EAAE,CAAC,MAAM,EAAE;oBACd,MAAM,CAAC,EAAE,CAAC,MAAM,CAAC,OAAO,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC;oBACtC,IAAI,EAAE,CAAC;gBACT,CAAC,CAAC,CAAC;YACL,CAAC,CAAC,CAAC;QACL,CAAC,CAAC,CAAC;QAEH,QAAQ,CAAC,UAAU,EAAE;YACnB,EAAE,CAAC,uCAAuC,EAAE,UAAC,IAAI;gBAC/C,IAAM,IAAI,GAAG,IAAI,iCAAe,CAAC,SAAS,EAAE,SAAS,CAAC,CAAC;gBACvD,IAAI,CAAC,EAAE,CAAC,MAAM,EAAE,UAAC,IAAI;oBACnB,MAAM,CAAC,KAAK,CAAC,IAAI,EAAE,CAAC,CAAC,CAAC;oBACtB,IAAI,EAAE,CAAC;gBACT,CAAC,CAAC,CAAC;YACL,CAAC,CAAC,CAAC;YAEH,EAAE,CAAC,2CAA2C,EAAE,UAAC,IAAI;gBACnD,IAAM,IAAI,GAAG,IAAI,iCAAe,CAAC,SAAS,EAAE,WAAW,CAAC,CAAC;gBACzD,IAAI,CAAC,EAAE,CAAC,MAAM,EAAE,UAAC,IAAI;oBACnB,MAAM,CAAC,KAAK,CAAC,IAAI,EAAE,CAAC,CAAC,CAAC;oBACtB,IAAI,EAAE,CAAC;gBACT,CAAC,CAAC,CAAC;YACL,CAAC,CAAC,CAAC;QACL,CAAC,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;CACJ"} \ No newline at end of file diff --git a/node_modules/node-pty/node_modules/nan/CHANGELOG.md b/node_modules/node-pty/node_modules/nan/CHANGELOG.md deleted file mode 100644 index 7cdfbe7..0000000 --- a/node_modules/node-pty/node_modules/nan/CHANGELOG.md +++ /dev/null @@ -1,529 +0,0 @@ -# NAN ChangeLog - -**Version 2.14.0: current Node 12.2.0, Node 0.12: 0.12.18, Node 0.10: 0.10.48, iojs: 3.3.1** - -### 2.14.0 May 16 2019 - - - Feature: Add missing methods to Nan::Maybe (#852) 4e962489fb84a184035b9fa74f245f650249aca6 - -### 2.13.2 Mar 24 2019 - - - Bugfix: remove usage of deprecated `IsNearDeath` (#842) fbaf42252af279c3d867c6b193571f9711c39847 - -### 2.13.1 Mar 14 2019 - - - Bugfix: check V8 version directly instead of inferring from NMV (#840) 12f9df9f393285de8fb4a8cd01478dc4fe3b089d - -### 2.13.0 Mar 13 2019 - - - Feature: add support for node master (#831) 113c0282072e7ff4f9dfc98b432fd894b798c2c - -### 2.12.1 Dec 18 2018 - - - Bugfix: Fix build breakage with Node.js 10.0.0-10.9.0. (#833) 625e90e8fef8d39ffa7247250a76a100b2487474 - -### 2.12.0 Dec 16 2018 - - - Bugfix: Add scope.Escape() to Call() (#817) 2e5ed4fc3a8ac80a6ef1f2a55099ab3ac8800dc6 - - Bugfix: Fix Node.js v10.12.0 deprecation warnings. 509859cc23b1770376b56550a027840a2ce0f73d - - Feature: Allow SetWeak() for non-object persistent handles. (#824) e6ef6a48e7e671fe3e4b7dddaa8912a3f8262ecd - -### 2.11.1 Sep 29 2018 - - - Fix: adapt to V8 7.0 24a22c3b25eeeec2016c6ec239bdd6169e985447 - -### 2.11.0 Aug 25 2018 - - - Removal: remove `FunctionCallbackInfo::Callee` for nodejs `>= 10` 1a56c0a6efd4fac944cb46c30912a8e023bda7d4 - - Bugfix: Fix `AsyncProgressWorkerBase::WorkProgress` sends invalid data b0c764d1dab11e9f8b37ffb81e2560a4498aad5e - - Feature: Introduce `GetCurrentEventLoop` b4911b0bb1f6d47d860e10ec014d941c51efac5e - - Feature: Add `NAN_MODULE_WORKER_ENABLED` macro as a replacement for `NAN_MODULE` b058fb047d18a58250e66ae831444441c1f2ac7a - -### 2.10.0 Mar 16 2018 - - - Deprecation: Deprecate `MakeCallback` 5e92b19a59e194241d6a658bd6ff7bfbda372950 - - Feature: add `Nan::Call` overload 4482e1242fe124d166fc1a5b2be3c1cc849fe452 - - Feature: add more `Nan::Call` overloads 8584e63e6d04c7d2eb8c4a664e4ef57d70bf672b - - Feature: Fix deprecation warnings for Node 10 1caf258243b0602ed56922bde74f1c91b0cbcb6a - -### 2.9.2 Feb 22 2018 - - - Bugfix: Bandaid for async hooks 212bd2f849be14ef1b02fc85010b053daa24252b - -### 2.9.1 Feb 22 2018 - - - Bugfix: Avoid deprecation warnings in deprecated `Nan::Callback::operator()` 372b14d91289df4604b0f81780709708c45a9aa4 - - Bugfix: Avoid deprecation warnings in `Nan::JSON` 3bc294bce0b7d0a3ee4559926303e5ed4866fda2 - -### 2.9.0 Feb 22 2018 - - - Deprecation: Deprecate legacy `Callback::Call` 6dd5fa690af61ca3523004b433304c581b3ea309 - - Feature: introduce `AsyncResource` class 90c0a179c0d8cb5fd26f1a7d2b1d6231eb402d48o - - Feature: Add context aware `Nan::Callback::Call` functions 7169e09fb088418b6e388222e88b4c13f07ebaee - - Feature: Make `AsyncWorker` context aware 066ba21a6fb9e2b5230c9ed3a6fc51f1211736a4 - - Feature: add `Callback` overload to `Nan::Call` 5328daf66e202658c1dc0d916c3aaba99b3cc606 - - Bugfix: fix warning: suggest parentheses around `&&` within `||` b2bb63d68b8ae623a526b542764e1ac82319cb2c - - Bugfix: Fix compilation on io.js 3 d06114dba0a522fb436f0c5f47b994210968cd7b - -### 2.8.0 Nov 15 2017 - - - Deprecation: Deprecate `Nan::ForceSet` in favor of `Nan::DefineOwnProperty()` 95cbb976d6fbbba88ba0f86dd188223a8591b4e7 - - Feature: Add `Nan::AsyncProgressQueueWorker` a976636ecc2ef617d1b061ce4a6edf39923691cb - - Feature: Add `Nan::DefineOwnProperty()` 95cbb976d6fbbba88ba0f86dd188223a8591b4e7 - - Bugfix: Fix compiling on io.js 1 & 2 82705a64503ce60c62e98df5bd02972bba090900 - - Bugfix: Use DefineOwnProperty instead of ForceSet 95cbb976d6fbbba88ba0f86dd188223a8591b4e7 - -### 2.7.0 Aug 30 2017 - - - Feature: Add `Nan::To()` overload. b93280670c9f6da42ed4cf6cbf085ffdd87bd65b - - Bugfix: Fix ternary in `Nan::MaybeLocal::FromMaybe()`. 79a26f7d362e756a9524e672a82c3d603b542867 - -### 2.6.2 Apr 12 2017 - - - Bugfix: Fix v8::JSON::Parse() deprecation warning. 87f6a3c65815fa062296a994cc863e2fa124867d - -### 2.6.1 Apr 6 2017 - - - Bugfix: nan_json.h: fix build breakage in Node 6 ac8d47dc3c10bfbf3f15a6b951633120c0ee6d51 - -### 2.6.0 Apr 6 2017 - - - Feature: nan: add support for JSON::Parse & Stringify b533226c629cce70e1932a873bb6f849044a56c5 - -### 2.5.1 Jan 23 2017 - - - Bugfix: Fix disappearing handle for private value 6a80995694f162ef63dbc9948fbefd45d4485aa0 - - Bugfix: Add missing scopes a93b8bae6bc7d32a170db6e89228b7f60ee57112 - - Bugfix: Use string::data instead of string::front in NewOneByteString d5f920371e67e1f3b268295daee6e83af86b6e50 - -### 2.5.0 Dec 21 2016 - - - Feature: Support Private accessors a86255cb357e8ad8ccbf1f6a4a901c921e39a178 - - Bugfix: Abort in delete operators that shouldn't be called 0fe38215ff8581703967dfd26c12793feb960018 - -### 2.4.0 Jul 10 2016 - - - Feature: Rewrite Callback to add Callback::Reset c4cf44d61f8275cd5f7b0c911d7a806d4004f649 - - Feature: AsyncProgressWorker: add template types for .send 1242c9a11a7ed481c8f08ec06316385cacc513d0 - - Bugfix: Add constness to old Persistent comparison operators bd43cb9982c7639605d60fd073efe8cae165d9b2 - -### 2.3.5 May 31 2016 - - - Bugfix: Replace NAN_INLINE with 'inline' keyword. 71819d8725f822990f439479c9aba3b240804909 - -### 2.3.4 May 31 2016 - - - Bugfix: Remove V8 deprecation warnings 0592fb0a47f3a1c7763087ebea8e1138829f24f9 - - Bugfix: Fix new versions not to use WeakCallbackInfo::IsFirstPass 615c19d9e03d4be2049c10db0151edbc3b229246 - - Bugfix: Make ObjectWrap::handle() const d19af99595587fe7a26bd850af6595c2a7145afc - - Bugfix: Fix compilation errors related to 0592fb0a47f3a1c7763087ebea8e1138829f24f9 e9191c525b94f652718325e28610a1adcf90fed8 - -### 2.3.3 May 4 2016 - - - Bugfix: Refactor SetMethod() to deal with v8::Templates (#566) b9083cf6d5de6ebe6bcb49c7502fbb7c0d9ddda8 - -### 2.3.2 Apr 27 2016 - - - Bugfix: Fix compilation on outdated versions due to Handle removal f8b7c875d04d425a41dfd4f3f8345bc3a11e6c52 - -### 2.3.1 Apr 27 2016 - - - Bugfix: Don't use deprecated v8::Template::Set() in SetMethod a90951e9ea70fa1b3836af4b925322919159100e - -### 2.3.0 Apr 27 2016 - - - Feature: added Signal() for invoking async callbacks without sending data from AsyncProgressWorker d8adba45f20e077d00561b20199133620c990b38 - - Bugfix: Don't use deprecated v8::Template::Set() 00dacf0a4b86027415867fa7f1059acc499dcece - -### 2.2.1 Mar 29 2016 - - - Bugfix: Use NewFromUnsigned in ReturnValue::Set(uint32_t i) for pre_12 3a18f9bdce29826e0e4c217854bc476918241a58 - - Performance: Remove unneeeded nullptr checks b715ef44887931c94f0d1605b3b1a4156eebece9 - -### 2.2.0 Jan 9 2016 - - - Feature: Add Function::Call wrapper 4c157474dacf284d125c324177b45aa5dabc08c6 - - Feature: Rename GC*logueCallback to GCCallback for > 4.0 3603435109f981606d300eb88004ca101283acec - - Bugfix: Fix Global::Pass for old versions 367e82a60fbaa52716232cc89db1cc3f685d77d9 - - Bugfix: Remove weird MaybeLocal wrapping of what already is a MaybeLocal 23b4590db10c2ba66aee2338aebe9751c4cb190b - -### 2.1.0 Oct 8 2015 - - - Deprecation: Deprecate NanErrnoException in favor of ErrnoException 0af1ca4cf8b3f0f65ed31bc63a663ab3319da55c - - Feature: added helper class for accessing contents of typedarrays 17b51294c801e534479d5463697a73462d0ca555 - - Feature: [Maybe types] Add MakeMaybe(...) 48d7b53d9702b0c7a060e69ea10fea8fb48d814d - - Feature: new: allow utf16 string with length 66ac6e65c8ab9394ef588adfc59131b3b9d8347b - - Feature: Introduce SetCallHandler and SetCallAsFunctionHandler 7764a9a115d60ba10dc24d86feb0fbc9b4f75537 - - Bugfix: Enable creating Locals from Globals under Node 0.10. 9bf9b8b190821af889790fdc18ace57257e4f9ff - - Bugfix: Fix issue #462 where PropertyCallbackInfo data is not stored safely. 55f50adedd543098526c7b9f4fffd607d3f9861f - -### 2.0.9 Sep 8 2015 - - - Bugfix: EscapableHandleScope in Nan::NewBuffer for Node 0.8 and 0.10 b1654d7 - -### 2.0.8 Aug 28 2015 - - - Work around duplicate linking bug in clang 11902da - -### 2.0.7 Aug 26 2015 - - - Build: Repackage - -### 2.0.6 Aug 26 2015 - - - Bugfix: Properly handle null callback in FunctionTemplate factory 6e99cb1 - - Bugfix: Remove unused static std::map instances 525bddc - - Bugfix: Make better use of maybe versions of APIs bfba85b - - Bugfix: Fix shadowing issues with handle in ObjectWrap 0a9072d - -### 2.0.5 Aug 10 2015 - - - Bugfix: Reimplement weak callback in ObjectWrap 98d38c1 - - Bugfix: Make sure callback classes are not assignable, copyable or movable 81f9b1d - -### 2.0.4 Aug 6 2015 - - - Build: Repackage - -### 2.0.3 Aug 6 2015 - - - Bugfix: Don't use clang++ / g++ syntax extension. 231450e - -### 2.0.2 Aug 6 2015 - - - Build: Repackage - -### 2.0.1 Aug 6 2015 - - - Bugfix: Add workaround for missing REPLACE_INVALID_UTF8 60d6687 - - Bugfix: Reimplement ObjectWrap from scratch to prevent memory leaks 6484601 - - Bugfix: Fix Persistent leak in FunctionCallbackInfo and PropertyCallbackInfo 641ef5f - - Bugfix: Add missing overload for Nan::NewInstance that takes argc/argv 29450ed - -### 2.0.0 Jul 31 2015 - - - Change: Renamed identifiers with leading underscores b5932b4 - - Change: Replaced NanObjectWrapHandle with class NanObjectWrap 464f1e1 - - Change: Replace NanScope and NanEscpableScope macros with classes 47751c4 - - Change: Rename NanNewBufferHandle to NanNewBuffer 6745f99 - - Change: Rename NanBufferUse to NanNewBuffer 3e8b0a5 - - Change: Rename NanNewBuffer to NanCopyBuffer d6af78d - - Change: Remove Nan prefix from all names 72d1f67 - - Change: Update Buffer API for new upstream changes d5d3291 - - Change: Rename Scope and EscapableScope to HandleScope and EscapableHandleScope 21a7a6a - - Change: Get rid of Handles e6c0daf - - Feature: Support io.js 3 with V8 4.4 - - Feature: Introduce NanPersistent 7fed696 - - Feature: Introduce NanGlobal 4408da1 - - Feature: Added NanTryCatch 10f1ca4 - - Feature: Update for V8 v4.3 4b6404a - - Feature: Introduce NanNewOneByteString c543d32 - - Feature: Introduce namespace Nan 67ed1b1 - - Removal: Remove NanLocker and NanUnlocker dd6e401 - - Removal: Remove string converters, except NanUtf8String, which now follows the node implementation b5d00a9 - - Removal: Remove NanReturn* macros d90a25c - - Removal: Remove HasInstance e8f84fe - - -### 1.9.0 Jul 31 2015 - - - Feature: Added `NanFatalException` 81d4a2c - - Feature: Added more error types 4265f06 - - Feature: Added dereference and function call operators to NanCallback c4b2ed0 - - Feature: Added indexed GetFromPersistent and SaveToPersistent edd510c - - Feature: Added more overloads of SaveToPersistent and GetFromPersistent 8b1cef6 - - Feature: Added NanErrnoException dd87d9e - - Correctness: Prevent assign, copy, and move for classes that do not support it 1f55c59, 4b808cb, c96d9b2, fba4a29, 3357130 - - Deprecation: Deprecate `NanGetPointerSafe` and `NanSetPointerSafe` 81d4a2c - - Deprecation: Deprecate `NanBooleanOptionValue` and `NanUInt32OptionValue` 0ad254b - -### 1.8.4 Apr 26 2015 - - - Build: Repackage - -### 1.8.3 Apr 26 2015 - - - Bugfix: Include missing header 1af8648 - -### 1.8.2 Apr 23 2015 - - - Build: Repackage - -### 1.8.1 Apr 23 2015 - - - Bugfix: NanObjectWrapHandle should take a pointer 155f1d3 - -### 1.8.0 Apr 23 2015 - - - Feature: Allow primitives with NanReturnValue 2e4475e - - Feature: Added comparison operators to NanCallback 55b075e - - Feature: Backport thread local storage 15bb7fa - - Removal: Remove support for signatures with arguments 8a2069d - - Correcteness: Replaced NanObjectWrapHandle macro with function 0bc6d59 - -### 1.7.0 Feb 28 2015 - - - Feature: Made NanCallback::Call accept optional target 8d54da7 - - Feature: Support atom-shell 0.21 0b7f1bb - -### 1.6.2 Feb 6 2015 - - - Bugfix: NanEncode: fix argument type for node::Encode on io.js 2be8639 - -### 1.6.1 Jan 23 2015 - - - Build: version bump - -### 1.5.3 Jan 23 2015 - - - Build: repackage - -### 1.6.0 Jan 23 2015 - - - Deprecated `NanNewContextHandle` in favor of `NanNew` 49259af - - Support utility functions moved in newer v8 versions (Node 0.11.15, io.js 1.0) a0aa179 - - Added `NanEncode`, `NanDecodeBytes` and `NanDecodeWrite` 75e6fb9 - -### 1.5.2 Jan 23 2015 - - - Bugfix: Fix non-inline definition build error with clang++ 21d96a1, 60fadd4 - - Bugfix: Readded missing String constructors 18d828f - - Bugfix: Add overload handling NanNew(..) 5ef813b - - Bugfix: Fix uv_work_cb versioning 997e4ae - - Bugfix: Add function factory and test 4eca89c - - Bugfix: Add object template factory and test cdcb951 - - Correctness: Lifted an io.js related typedef c9490be - - Correctness: Make explicit downcasts of String lengths 00074e6 - - Windows: Limit the scope of disabled warning C4530 83d7deb - -### 1.5.1 Jan 15 2015 - - - Build: version bump - -### 1.4.3 Jan 15 2015 - - - Build: version bump - -### 1.4.2 Jan 15 2015 - - - Feature: Support io.js 0dbc5e8 - -### 1.5.0 Jan 14 2015 - - - Feature: Support io.js b003843 - - Correctness: Improved NanNew internals 9cd4f6a - - Feature: Implement progress to NanAsyncWorker 8d6a160 - -### 1.4.1 Nov 8 2014 - - - Bugfix: Handle DEBUG definition correctly - - Bugfix: Accept int as Boolean - -### 1.4.0 Nov 1 2014 - - - Feature: Added NAN_GC_CALLBACK 6a5c245 - - Performance: Removed unnecessary local handle creation 18a7243, 41fe2f8 - - Correctness: Added constness to references in NanHasInstance 02c61cd - - Warnings: Fixed spurious warnings from -Wundef and -Wshadow, 541b122, 99d8cb6 - - Windoze: Shut Visual Studio up when compiling 8d558c1 - - License: Switch to plain MIT from custom hacked MIT license 11de983 - - Build: Added test target to Makefile e232e46 - - Performance: Removed superfluous scope in NanAsyncWorker f4b7821 - - Sugar/Feature: Added NanReturnThis() and NanReturnHolder() shorthands 237a5ff, d697208 - - Feature: Added suitable overload of NanNew for v8::Integer::NewFromUnsigned b27b450 - -### 1.3.0 Aug 2 2014 - - - Added NanNew(std::string) - - Added NanNew(std::string&) - - Added NanAsciiString helper class - - Added NanUtf8String helper class - - Added NanUcs2String helper class - - Deprecated NanRawString() - - Deprecated NanCString() - - Added NanGetIsolateData(v8::Isolate *isolate) - - Added NanMakeCallback(v8::Handle target, v8::Handle func, int argc, v8::Handle* argv) - - Added NanMakeCallback(v8::Handle target, v8::Handle symbol, int argc, v8::Handle* argv) - - Added NanMakeCallback(v8::Handle target, const char* method, int argc, v8::Handle* argv) - - Added NanSetTemplate(v8::Handle templ, v8::Handle name , v8::Handle value, v8::PropertyAttribute attributes) - - Added NanSetPrototypeTemplate(v8::Local templ, v8::Handle name, v8::Handle value, v8::PropertyAttribute attributes) - - Added NanSetInstanceTemplate(v8::Local templ, const char *name, v8::Handle value) - - Added NanSetInstanceTemplate(v8::Local templ, v8::Handle name, v8::Handle value, v8::PropertyAttribute attributes) - -### 1.2.0 Jun 5 2014 - - - Add NanSetPrototypeTemplate - - Changed NAN_WEAK_CALLBACK internals, switched _NanWeakCallbackData to class, - introduced _NanWeakCallbackDispatcher - - Removed -Wno-unused-local-typedefs from test builds - - Made test builds Windows compatible ('Sleep()') - -### 1.1.2 May 28 2014 - - - Release to fix more stuff-ups in 1.1.1 - -### 1.1.1 May 28 2014 - - - Release to fix version mismatch in nan.h and lack of changelog entry for 1.1.0 - -### 1.1.0 May 25 2014 - - - Remove nan_isolate, use v8::Isolate::GetCurrent() internally instead - - Additional explicit overloads for NanNew(): (char*,int), (uint8_t*[,int]), - (uint16_t*[,int), double, int, unsigned int, bool, v8::String::ExternalStringResource*, - v8::String::ExternalAsciiStringResource* - - Deprecate NanSymbol() - - Added SetErrorMessage() and ErrorMessage() to NanAsyncWorker - -### 1.0.0 May 4 2014 - - - Heavy API changes for V8 3.25 / Node 0.11.13 - - Use cpplint.py - - Removed NanInitPersistent - - Removed NanPersistentToLocal - - Removed NanFromV8String - - Removed NanMakeWeak - - Removed NanNewLocal - - Removed NAN_WEAK_CALLBACK_OBJECT - - Removed NAN_WEAK_CALLBACK_DATA - - Introduce NanNew, replaces NanNewLocal, NanPersistentToLocal, adds many overloaded typed versions - - Introduce NanUndefined, NanNull, NanTrue and NanFalse - - Introduce NanEscapableScope and NanEscapeScope - - Introduce NanMakeWeakPersistent (requires a special callback to work on both old and new node) - - Introduce NanMakeCallback for node::MakeCallback - - Introduce NanSetTemplate - - Introduce NanGetCurrentContext - - Introduce NanCompileScript and NanRunScript - - Introduce NanAdjustExternalMemory - - Introduce NanAddGCEpilogueCallback, NanAddGCPrologueCallback, NanRemoveGCEpilogueCallback, NanRemoveGCPrologueCallback - - Introduce NanGetHeapStatistics - - Rename NanAsyncWorker#SavePersistent() to SaveToPersistent() - -### 0.8.0 Jan 9 2014 - - - NanDispose -> NanDisposePersistent, deprecate NanDispose - - Extract _NAN_*_RETURN_TYPE, pull up NAN_*() - -### 0.7.1 Jan 9 2014 - - - Fixes to work against debug builds of Node - - Safer NanPersistentToLocal (avoid reinterpret_cast) - - Speed up common NanRawString case by only extracting flattened string when necessary - -### 0.7.0 Dec 17 2013 - - - New no-arg form of NanCallback() constructor. - - NanCallback#Call takes Handle rather than Local - - Removed deprecated NanCallback#Run method, use NanCallback#Call instead - - Split off _NAN_*_ARGS_TYPE from _NAN_*_ARGS - - Restore (unofficial) Node 0.6 compatibility at NanCallback#Call() - - Introduce NanRawString() for char* (or appropriate void*) from v8::String - (replacement for NanFromV8String) - - Introduce NanCString() for null-terminated char* from v8::String - -### 0.6.0 Nov 21 2013 - - - Introduce NanNewLocal(v8::Handle value) for use in place of - v8::Local::New(...) since v8 started requiring isolate in Node 0.11.9 - -### 0.5.2 Nov 16 2013 - - - Convert SavePersistent and GetFromPersistent in NanAsyncWorker from protected and public - -### 0.5.1 Nov 12 2013 - - - Use node::MakeCallback() instead of direct v8::Function::Call() - -### 0.5.0 Nov 11 2013 - - - Added @TooTallNate as collaborator - - New, much simpler, "include_dirs" for binding.gyp - - Added full range of NAN_INDEX_* macros to match NAN_PROPERTY_* macros - -### 0.4.4 Nov 2 2013 - - - Isolate argument from v8::Persistent::MakeWeak removed for 0.11.8+ - -### 0.4.3 Nov 2 2013 - - - Include node_object_wrap.h, removed from node.h for Node 0.11.8. - -### 0.4.2 Nov 2 2013 - - - Handle deprecation of v8::Persistent::Dispose(v8::Isolate* isolate)) for - Node 0.11.8 release. - -### 0.4.1 Sep 16 2013 - - - Added explicit `#include ` as it was removed from node.h for v0.11.8 - -### 0.4.0 Sep 2 2013 - - - Added NAN_INLINE and NAN_DEPRECATED and made use of them - - Added NanError, NanTypeError and NanRangeError - - Cleaned up code - -### 0.3.2 Aug 30 2013 - - - Fix missing scope declaration in GetFromPersistent() and SaveToPersistent - in NanAsyncWorker - -### 0.3.1 Aug 20 2013 - - - fix "not all control paths return a value" compile warning on some platforms - -### 0.3.0 Aug 19 2013 - - - Made NAN work with NPM - - Lots of fixes to NanFromV8String, pulling in features from new Node core - - Changed node::encoding to Nan::Encoding in NanFromV8String to unify the API - - Added optional error number argument for NanThrowError() - - Added NanInitPersistent() - - Added NanReturnNull() and NanReturnEmptyString() - - Added NanLocker and NanUnlocker - - Added missing scopes - - Made sure to clear disposed Persistent handles - - Changed NanAsyncWorker to allocate error messages on the heap - - Changed NanThrowError(Local) to NanThrowError(Handle) - - Fixed leak in NanAsyncWorker when errmsg is used - -### 0.2.2 Aug 5 2013 - - - Fixed usage of undefined variable with node::BASE64 in NanFromV8String() - -### 0.2.1 Aug 5 2013 - - - Fixed 0.8 breakage, node::BUFFER encoding type not available in 0.8 for - NanFromV8String() - -### 0.2.0 Aug 5 2013 - - - Added NAN_PROPERTY_GETTER, NAN_PROPERTY_SETTER, NAN_PROPERTY_ENUMERATOR, - NAN_PROPERTY_DELETER, NAN_PROPERTY_QUERY - - Extracted _NAN_METHOD_ARGS, _NAN_GETTER_ARGS, _NAN_SETTER_ARGS, - _NAN_PROPERTY_GETTER_ARGS, _NAN_PROPERTY_SETTER_ARGS, - _NAN_PROPERTY_ENUMERATOR_ARGS, _NAN_PROPERTY_DELETER_ARGS, - _NAN_PROPERTY_QUERY_ARGS - - Added NanGetInternalFieldPointer, NanSetInternalFieldPointer - - Added NAN_WEAK_CALLBACK, NAN_WEAK_CALLBACK_OBJECT, - NAN_WEAK_CALLBACK_DATA, NanMakeWeak - - Renamed THROW_ERROR to _NAN_THROW_ERROR - - Added NanNewBufferHandle(char*, size_t, node::smalloc::FreeCallback, void*) - - Added NanBufferUse(char*, uint32_t) - - Added NanNewContextHandle(v8::ExtensionConfiguration*, - v8::Handle, v8::Handle) - - Fixed broken NanCallback#GetFunction() - - Added optional encoding and size arguments to NanFromV8String() - - Added NanGetPointerSafe() and NanSetPointerSafe() - - Added initial test suite (to be expanded) - - Allow NanUInt32OptionValue to convert any Number object - -### 0.1.0 Jul 21 2013 - - - Added `NAN_GETTER`, `NAN_SETTER` - - Added `NanThrowError` with single Local argument - - Added `NanNewBufferHandle` with single uint32_t argument - - Added `NanHasInstance(Persistent&, Handle)` - - Added `Local NanCallback#GetFunction()` - - Added `NanCallback#Call(int, Local[])` - - Deprecated `NanCallback#Run(int, Local[])` in favour of Call diff --git a/node_modules/node-pty/node_modules/nan/LICENSE.md b/node_modules/node-pty/node_modules/nan/LICENSE.md deleted file mode 100644 index dddd13d..0000000 --- a/node_modules/node-pty/node_modules/nan/LICENSE.md +++ /dev/null @@ -1,13 +0,0 @@ -The MIT License (MIT) -===================== - -Copyright (c) 2018 NAN contributors ------------------------------------ - -*NAN contributors listed at * - -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. diff --git a/node_modules/node-pty/node_modules/nan/README.md b/node_modules/node-pty/node_modules/nan/README.md deleted file mode 100644 index 3389ef5..0000000 --- a/node_modules/node-pty/node_modules/nan/README.md +++ /dev/null @@ -1,456 +0,0 @@ -Native Abstractions for Node.js -=============================== - -**A header file filled with macro and utility goodness for making add-on development for Node.js easier across versions 0.8, 0.10, 0.12, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11 and 12.** - -***Current version: 2.14.0*** - -*(See [CHANGELOG.md](https://github.com/nodejs/nan/blob/master/CHANGELOG.md) for complete ChangeLog)* - -[![NPM](https://nodei.co/npm/nan.png?downloads=true&downloadRank=true)](https://nodei.co/npm/nan/) [![NPM](https://nodei.co/npm-dl/nan.png?months=6&height=3)](https://nodei.co/npm/nan/) - -[![Build Status](https://api.travis-ci.org/nodejs/nan.svg?branch=master)](https://travis-ci.org/nodejs/nan) -[![Build status](https://ci.appveyor.com/api/projects/status/kh73pbm9dsju7fgh)](https://ci.appveyor.com/project/RodVagg/nan) - -Thanks to the crazy changes in V8 (and some in Node core), keeping native addons compiling happily across versions, particularly 0.10 to 0.12 to 4.0, is a minor nightmare. The goal of this project is to store all logic necessary to develop native Node.js addons without having to inspect `NODE_MODULE_VERSION` and get yourself into a macro-tangle. - -This project also contains some helper utilities that make addon development a bit more pleasant. - - * **[News & Updates](#news)** - * **[Usage](#usage)** - * **[Example](#example)** - * **[API](#api)** - * **[Tests](#tests)** - * **[Known issues](#issues)** - * **[Governance & Contributing](#governance)** - - - -## News & Updates - - - -## Usage - -Simply add **NAN** as a dependency in the *package.json* of your Node addon: - -``` bash -$ npm install --save nan -``` - -Pull in the path to **NAN** in your *binding.gyp* so that you can use `#include ` in your *.cpp* files: - -``` python -"include_dirs" : [ - "` when compiling your addon. - - - -## Example - -Just getting started with Nan? Take a look at the **[Node Add-on Examples](https://github.com/nodejs/node-addon-examples)**. - -Refer to a [quick-start **Nan** Boilerplate](https://github.com/fcanas/node-native-boilerplate) for a ready-to-go project that utilizes basic Nan functionality. - -For a simpler example, see the **[async pi estimation example](https://github.com/nodejs/nan/tree/master/examples/async_pi_estimate)** in the examples directory for full code and an explanation of what this Monte Carlo Pi estimation example does. Below are just some parts of the full example that illustrate the use of **NAN**. - -Yet another example is **[nan-example-eol](https://github.com/CodeCharmLtd/nan-example-eol)**. It shows newline detection implemented as a native addon. - -Also take a look at our comprehensive **[C++ test suite](https://github.com/nodejs/nan/tree/master/test/cpp)** which has a plethora of code snippets for your pasting pleasure. - - - -## API - -Additional to the NAN documentation below, please consult: - -* [The V8 Getting Started * Guide](https://github.com/v8/v8/wiki/Getting%20Started%20with%20Embedding) -* [The V8 Embedders * Guide](https://github.com/v8/v8/wiki/Embedder%27s%20Guide) -* [V8 API Documentation](https://v8docs.nodesource.com/) -* [Node Add-on Documentation](https://nodejs.org/api/addons.html) - - - -### JavaScript-accessible methods - -A _template_ is a blueprint for JavaScript functions and objects in a context. You can use a template to wrap C++ functions and data structures within JavaScript objects so that they can be manipulated from JavaScript. See the V8 Embedders Guide section on [Templates](https://github.com/v8/v8/wiki/Embedder%27s-Guide#templates) for further information. - -In order to expose functionality to JavaScript via a template, you must provide it to V8 in a form that it understands. Across the versions of V8 supported by NAN, JavaScript-accessible method signatures vary widely, NAN fully abstracts method declaration and provides you with an interface that is similar to the most recent V8 API but is backward-compatible with older versions that still use the now-deceased `v8::Argument` type. - -* **Method argument types** - - Nan::FunctionCallbackInfo - - Nan::PropertyCallbackInfo - - Nan::ReturnValue -* **Method declarations** - - Method declaration - - Getter declaration - - Setter declaration - - Property getter declaration - - Property setter declaration - - Property enumerator declaration - - Property deleter declaration - - Property query declaration - - Index getter declaration - - Index setter declaration - - Index enumerator declaration - - Index deleter declaration - - Index query declaration -* Method and template helpers - - Nan::SetMethod() - - Nan::SetPrototypeMethod() - - Nan::SetAccessor() - - Nan::SetNamedPropertyHandler() - - Nan::SetIndexedPropertyHandler() - - Nan::SetTemplate() - - Nan::SetPrototypeTemplate() - - Nan::SetInstanceTemplate() - - Nan::SetCallHandler() - - Nan::SetCallAsFunctionHandler() - -### Scopes - -A _local handle_ is a pointer to an object. All V8 objects are accessed using handles, they are necessary because of the way the V8 garbage collector works. - -A handle scope can be thought of as a container for any number of handles. When you've finished with your handles, instead of deleting each one individually you can simply delete their scope. - -The creation of `HandleScope` objects is different across the supported versions of V8. Therefore, NAN provides its own implementations that can be used safely across these. - - - Nan::HandleScope - - Nan::EscapableHandleScope - -Also see the V8 Embedders Guide section on [Handles and Garbage Collection](https://github.com/v8/v8/wiki/Embedder%27s%20Guide#handles-and-garbage-collection). - -### Persistent references - -An object reference that is independent of any `HandleScope` is a _persistent_ reference. Where a `Local` handle only lives as long as the `HandleScope` in which it was allocated, a `Persistent` handle remains valid until it is explicitly disposed. - -Due to the evolution of the V8 API, it is necessary for NAN to provide a wrapper implementation of the `Persistent` classes to supply compatibility across the V8 versions supported. - - - Nan::PersistentBase & v8::PersistentBase - - Nan::NonCopyablePersistentTraits & v8::NonCopyablePersistentTraits - - Nan::CopyablePersistentTraits & v8::CopyablePersistentTraits - - Nan::Persistent - - Nan::Global - - Nan::WeakCallbackInfo - - Nan::WeakCallbackType - -Also see the V8 Embedders Guide section on [Handles and Garbage Collection](https://developers.google.com/v8/embed#handles). - -### New - -NAN provides a `Nan::New()` helper for the creation of new JavaScript objects in a way that's compatible across the supported versions of V8. - - - Nan::New() - - Nan::Undefined() - - Nan::Null() - - Nan::True() - - Nan::False() - - Nan::EmptyString() - - -### Converters - -NAN contains functions that convert `v8::Value`s to other `v8::Value` types and native types. Since type conversion is not guaranteed to succeed, they return `Nan::Maybe` types. These converters can be used in place of `value->ToX()` and `value->XValue()` (where `X` is one of the types, e.g. `Boolean`) in a way that provides a consistent interface across V8 versions. Newer versions of V8 use the new `v8::Maybe` and `v8::MaybeLocal` types for these conversions, older versions don't have this functionality so it is provided by NAN. - - - Nan::To() - -### Maybe Types - -The `Nan::MaybeLocal` and `Nan::Maybe` types are monads that encapsulate `v8::Local` handles that _may be empty_. - -* **Maybe Types** - - Nan::MaybeLocal - - Nan::Maybe - - Nan::Nothing - - Nan::Just -* **Maybe Helpers** - - Nan::Call() - - Nan::ToDetailString() - - Nan::ToArrayIndex() - - Nan::Equals() - - Nan::NewInstance() - - Nan::GetFunction() - - Nan::Set() - - Nan::DefineOwnProperty() - - Nan::ForceSet() - - Nan::Get() - - Nan::GetPropertyAttributes() - - Nan::Has() - - Nan::Delete() - - Nan::GetPropertyNames() - - Nan::GetOwnPropertyNames() - - Nan::SetPrototype() - - Nan::ObjectProtoToString() - - Nan::HasOwnProperty() - - Nan::HasRealNamedProperty() - - Nan::HasRealIndexedProperty() - - Nan::HasRealNamedCallbackProperty() - - Nan::GetRealNamedPropertyInPrototypeChain() - - Nan::GetRealNamedProperty() - - Nan::CallAsFunction() - - Nan::CallAsConstructor() - - Nan::GetSourceLine() - - Nan::GetLineNumber() - - Nan::GetStartColumn() - - Nan::GetEndColumn() - - Nan::CloneElementAt() - - Nan::HasPrivate() - - Nan::GetPrivate() - - Nan::SetPrivate() - - Nan::DeletePrivate() - - Nan::MakeMaybe() - -### Script - -NAN provides a `v8::Script` helpers as the API has changed over the supported versions of V8. - - - Nan::CompileScript() - - Nan::RunScript() - - -### JSON - -The _JSON_ object provides the c++ versions of the methods offered by the `JSON` object in javascript. V8 exposes these methods via the `v8::JSON` object. - - - Nan::JSON.Parse - - Nan::JSON.Stringify - -Refer to the V8 JSON object in the [V8 documentation](https://v8docs.nodesource.com/node-8.11/da/d6f/classv8_1_1_j_s_o_n.html) for more information about these methods and their arguments. - -### Errors - -NAN includes helpers for creating, throwing and catching Errors as much of this functionality varies across the supported versions of V8 and must be abstracted. - -Note that an Error object is simply a specialized form of `v8::Value`. - -Also consult the V8 Embedders Guide section on [Exceptions](https://developers.google.com/v8/embed#exceptions) for more information. - - - Nan::Error() - - Nan::RangeError() - - Nan::ReferenceError() - - Nan::SyntaxError() - - Nan::TypeError() - - Nan::ThrowError() - - Nan::ThrowRangeError() - - Nan::ThrowReferenceError() - - Nan::ThrowSyntaxError() - - Nan::ThrowTypeError() - - Nan::FatalException() - - Nan::ErrnoException() - - Nan::TryCatch - - -### Buffers - -NAN's `node::Buffer` helpers exist as the API has changed across supported Node versions. Use these methods to ensure compatibility. - - - Nan::NewBuffer() - - Nan::CopyBuffer() - - Nan::FreeCallback() - -### Nan::Callback - -`Nan::Callback` makes it easier to use `v8::Function` handles as callbacks. A class that wraps a `v8::Function` handle, protecting it from garbage collection and making it particularly useful for storage and use across asynchronous execution. - - - Nan::Callback - -### Asynchronous work helpers - -`Nan::AsyncWorker`, `Nan::AsyncProgressWorker` and `Nan::AsyncProgressQueueWorker` are helper classes that make working with asynchronous code easier. - - - Nan::AsyncWorker - - Nan::AsyncProgressWorkerBase & Nan::AsyncProgressWorker - - Nan::AsyncProgressQueueWorker - - Nan::AsyncQueueWorker - -### Strings & Bytes - -Miscellaneous string & byte encoding and decoding functionality provided for compatibility across supported versions of V8 and Node. Implemented by NAN to ensure that all encoding types are supported, even for older versions of Node where they are missing. - - - Nan::Encoding - - Nan::Encode() - - Nan::DecodeBytes() - - Nan::DecodeWrite() - - -### Object Wrappers - -The `ObjectWrap` class can be used to make wrapped C++ objects and a factory of wrapped objects. - - - Nan::ObjectWrap - - -### V8 internals - -The hooks to access V8 internals—including GC and statistics—are different across the supported versions of V8, therefore NAN provides its own hooks that call the appropriate V8 methods. - - - NAN_GC_CALLBACK() - - Nan::AddGCEpilogueCallback() - - Nan::RemoveGCEpilogueCallback() - - Nan::AddGCPrologueCallback() - - Nan::RemoveGCPrologueCallback() - - Nan::GetHeapStatistics() - - Nan::SetCounterFunction() - - Nan::SetCreateHistogramFunction() - - Nan::SetAddHistogramSampleFunction() - - Nan::IdleNotification() - - Nan::LowMemoryNotification() - - Nan::ContextDisposedNotification() - - Nan::GetInternalFieldPointer() - - Nan::SetInternalFieldPointer() - - Nan::AdjustExternalMemory() - - -### Miscellaneous V8 Helpers - - - Nan::Utf8String - - Nan::GetCurrentContext() - - Nan::SetIsolateData() - - Nan::GetIsolateData() - - Nan::TypedArrayContents - - -### Miscellaneous Node Helpers - - - Nan::AsyncResource - - Nan::MakeCallback() - - NAN_MODULE_INIT() - - Nan::Export() - - - - - - -### Tests - -To run the NAN tests do: - -``` sh -npm install -npm run-script rebuild-tests -npm test -``` - -Or just: - -``` sh -npm install -make test -``` - - - -## Known issues - -### Compiling against Node.js 0.12 on OSX - -With new enough compilers available on OSX, the versions of V8 headers corresponding to Node.js 0.12 -do not compile anymore. The error looks something like: - -``` -❯ CXX(target) Release/obj.target/accessors/cpp/accessors.o -In file included from ../cpp/accessors.cpp:9: -In file included from ../../nan.h:51: -In file included from /Users/ofrobots/.node-gyp/0.12.18/include/node/node.h:61: -/Users/ofrobots/.node-gyp/0.12.18/include/node/v8.h:5800:54: error: 'CreateHandle' is a protected member of 'v8::HandleScope' - return Handle(reinterpret_cast(HandleScope::CreateHandle( - ~~~~~~~~~~~~~^~~~~~~~~~~~ -``` - -This can be worked around by patching your local versions of v8.h corresponding to Node 0.12 to make -`v8::Handle` a friend of `v8::HandleScope`. Since neither Node.js not V8 support this release line anymore -this patch cannot be released by either project in an official release. - -For this reason, we do not test against Node.js 0.12 on OSX in this project's CI. If you need to support -that configuration, you will need to either get an older compiler, or apply a source patch to the version -of V8 headers as a workaround. - - - -## Governance & Contributing - -NAN is governed by the [Node.js Addon API Working Group](https://github.com/nodejs/CTC/blob/master/WORKING_GROUPS.md#addon-api) - -### Addon API Working Group (WG) - -The NAN project is jointly governed by a Working Group which is responsible for high-level guidance of the project. - -Members of the WG are also known as Collaborators, there is no distinction between the two, unlike other Node.js projects. - -The WG has final authority over this project including: - -* Technical direction -* Project governance and process (including this policy) -* Contribution policy -* GitHub repository hosting -* Maintaining the list of additional Collaborators - -For the current list of WG members, see the project [README.md](./README.md#collaborators). - -Individuals making significant and valuable contributions are made members of the WG and given commit-access to the project. These individuals are identified by the WG and their addition to the WG is discussed via GitHub and requires unanimous consensus amongst those WG members participating in the discussion with a quorum of 50% of WG members required for acceptance of the vote. - -_Note:_ If you make a significant contribution and are not considered for commit-access log an issue or contact a WG member directly. - -For the current list of WG members / Collaborators, see the project [README.md](./README.md#collaborators). - -### Consensus Seeking Process - -The WG follows a [Consensus Seeking](https://en.wikipedia.org/wiki/Consensus-seeking_decision-making) decision making model. - -Modifications of the contents of the NAN repository are made on a collaborative basis. Anybody with a GitHub account may propose a modification via pull request and it will be considered by the WG. All pull requests must be reviewed and accepted by a WG member with sufficient expertise who is able to take full responsibility for the change. In the case of pull requests proposed by an existing WG member, an additional WG member is required for sign-off. Consensus should be sought if additional WG members participate and there is disagreement around a particular modification. - -If a change proposal cannot reach a consensus, a WG member can call for a vote amongst the members of the WG. Simple majority wins. - - - -## Developer's Certificate of Origin 1.1 - -By making a contribution to this project, I certify that: - -* (a) The contribution was created in whole or in part by me and I - have the right to submit it under the open source license - indicated in the file; or - -* (b) The contribution is based upon previous work that, to the best - of my knowledge, is covered under an appropriate open source - license and I have the right under that license to submit that - work with modifications, whether created in whole or in part - by me, under the same open source license (unless I am - permitted to submit under a different license), as indicated - in the file; or - -* (c) The contribution was provided directly to me by some other - person who certified (a), (b) or (c) and I have not modified - it. - -* (d) I understand and agree that this project and the contribution - are public and that a record of the contribution (including all - personal information I submit with it, including my sign-off) is - maintained indefinitely and may be redistributed consistent with - this project or the open source license(s) involved. - - - -### WG Members / Collaborators - - - - - - - - - - -
Rod VaggGitHub/rvaggTwitter/@rvagg
Benjamin ByholmGitHub/kkoopa-
Trevor NorrisGitHub/trevnorrisTwitter/@trevnorris
Nathan RajlichGitHub/TooTallNateTwitter/@TooTallNate
Brett LawsonGitHub/brett19Twitter/@brett19x
Ben NoordhuisGitHub/bnoordhuisTwitter/@bnoordhuis
David SiegelGitHub/agnatTwitter/@agnat
Michael Ira KrufkyGitHub/mkrufkyTwitter/@mkrufky
- -## Licence & copyright - -Copyright (c) 2018 NAN WG Members / Collaborators (listed above). - -Native Abstractions for Node.js is licensed under an MIT license. All rights not explicitly granted in the MIT license are reserved. See the included LICENSE file for more details. diff --git a/node_modules/node-pty/node_modules/nan/doc/asyncworker.md b/node_modules/node-pty/node_modules/nan/doc/asyncworker.md deleted file mode 100644 index 04231f8..0000000 --- a/node_modules/node-pty/node_modules/nan/doc/asyncworker.md +++ /dev/null @@ -1,146 +0,0 @@ -## Asynchronous work helpers - -`Nan::AsyncWorker`, `Nan::AsyncProgressWorker` and `Nan::AsyncProgressQueueWorker` are helper classes that make working with asynchronous code easier. - - - Nan::AsyncWorker - - Nan::AsyncProgressWorkerBase & Nan::AsyncProgressWorker - - Nan::AsyncProgressQueueWorker - - Nan::AsyncQueueWorker - - -### Nan::AsyncWorker - -`Nan::AsyncWorker` is an _abstract_ class that you can subclass to have much of the annoying asynchronous queuing and handling taken care of for you. It can even store arbitrary V8 objects for you and have them persist while the asynchronous work is in progress. - -This class internally handles the details of creating an [`AsyncResource`][AsyncResource], and running the callback in the -correct async context. To be able to identify the async resources created by this class in async-hooks, provide a -`resource_name` to the constructor. It is recommended that the module name be used as a prefix to the `resource_name` to avoid -collisions in the names. For more details see [`AsyncResource`][AsyncResource] documentation. The `resource_name` needs to stay valid for the lifetime of the worker instance. - -Definition: - -```c++ -class AsyncWorker { - public: - explicit AsyncWorker(Callback *callback_, const char* resource_name = "nan:AsyncWorker"); - - virtual ~AsyncWorker(); - - virtual void WorkComplete(); - - void SaveToPersistent(const char *key, const v8::Local &value); - - void SaveToPersistent(const v8::Local &key, - const v8::Local &value); - - void SaveToPersistent(uint32_t index, - const v8::Local &value); - - v8::Local GetFromPersistent(const char *key) const; - - v8::Local GetFromPersistent(const v8::Local &key) const; - - v8::Local GetFromPersistent(uint32_t index) const; - - virtual void Execute() = 0; - - uv_work_t request; - - virtual void Destroy(); - - protected: - Persistent persistentHandle; - - Callback *callback; - - virtual void HandleOKCallback(); - - virtual void HandleErrorCallback(); - - void SetErrorMessage(const char *msg); - - const char* ErrorMessage(); -}; -``` - - -### Nan::AsyncProgressWorkerBase & Nan::AsyncProgressWorker - -`Nan::AsyncProgressWorkerBase` is an _abstract_ class template that extends `Nan::AsyncWorker` and adds additional progress reporting callbacks that can be used during the asynchronous work execution to provide progress data back to JavaScript. - -Previously the definition of `Nan::AsyncProgressWorker` only allowed sending `const char` data. Now extending `Nan::AsyncProgressWorker` will yield an instance of the implicit `Nan::AsyncProgressWorkerBase` template with type `` for compatibility. - -`Nan::AsyncProgressWorkerBase` & `Nan::AsyncProgressWorker` is intended for best-effort delivery of nonessential progress messages, e.g. a progress bar. The last event sent before the main thread is woken will be delivered. - -Definition: - -```c++ -template -class AsyncProgressWorkerBase : public AsyncWorker { - public: - explicit AsyncProgressWorkerBase(Callback *callback_, const char* resource_name = ...); - - virtual ~AsyncProgressWorkerBase(); - - void WorkProgress(); - - class ExecutionProgress { - public: - void Signal() const; - void Send(const T* data, size_t count) const; - }; - - virtual void Execute(const ExecutionProgress& progress) = 0; - - virtual void HandleProgressCallback(const T *data, size_t count) = 0; - - virtual void Destroy(); -}; - -typedef AsyncProgressWorkerBase AsyncProgressWorker; -``` - - -### Nan::AsyncProgressQueueWorker - -`Nan::AsyncProgressQueueWorker` is an _abstract_ class template that extends `Nan::AsyncWorker` and adds additional progress reporting callbacks that can be used during the asynchronous work execution to provide progress data back to JavaScript. - -`Nan::AsyncProgressQueueWorker` behaves exactly the same as `Nan::AsyncProgressWorker`, except all events are queued and delivered to the main thread. - -Definition: - -```c++ -template -class AsyncProgressQueueWorker : public AsyncWorker { - public: - explicit AsyncProgressQueueWorker(Callback *callback_, const char* resource_name = "nan:AsyncProgressQueueWorker"); - - virtual ~AsyncProgressQueueWorker(); - - void WorkProgress(); - - class ExecutionProgress { - public: - void Send(const T* data, size_t count) const; - }; - - virtual void Execute(const ExecutionProgress& progress) = 0; - - virtual void HandleProgressCallback(const T *data, size_t count) = 0; - - virtual void Destroy(); -}; -``` - - -### Nan::AsyncQueueWorker - -`Nan::AsyncQueueWorker` will run a `Nan::AsyncWorker` asynchronously via libuv. Both the `execute` and `after_work` steps are taken care of for you. Most of the logic for this is embedded in `Nan::AsyncWorker`. - -Definition: - -```c++ -void AsyncQueueWorker(AsyncWorker *); -``` - -[AsyncResource]: node_misc.md#api_nan_asyncresource diff --git a/node_modules/node-pty/node_modules/nan/doc/buffers.md b/node_modules/node-pty/node_modules/nan/doc/buffers.md deleted file mode 100644 index 8d8d25c..0000000 --- a/node_modules/node-pty/node_modules/nan/doc/buffers.md +++ /dev/null @@ -1,54 +0,0 @@ -## Buffers - -NAN's `node::Buffer` helpers exist as the API has changed across supported Node versions. Use these methods to ensure compatibility. - - - Nan::NewBuffer() - - Nan::CopyBuffer() - - Nan::FreeCallback() - - -### Nan::NewBuffer() - -Allocate a new `node::Buffer` object with the specified size and optional data. Calls `node::Buffer::New()`. - -Note that when creating a `Buffer` using `Nan::NewBuffer()` and an existing `char*`, it is assumed that the ownership of the pointer is being transferred to the new `Buffer` for management. -When a `node::Buffer` instance is garbage collected and a `FreeCallback` has not been specified, `data` will be disposed of via a call to `free()`. -You _must not_ free the memory space manually once you have created a `Buffer` in this way. - -Signature: - -```c++ -Nan::MaybeLocal Nan::NewBuffer(uint32_t size) -Nan::MaybeLocal Nan::NewBuffer(char* data, uint32_t size) -Nan::MaybeLocal Nan::NewBuffer(char *data, - size_t length, - Nan::FreeCallback callback, - void *hint) -``` - - - -### Nan::CopyBuffer() - -Similar to [`Nan::NewBuffer()`](#api_nan_new_buffer) except that an implicit memcpy will occur within Node. Calls `node::Buffer::Copy()`. - -Management of the `char*` is left to the user, you should manually free the memory space if necessary as the new `Buffer` will have its own copy. - -Signature: - -```c++ -Nan::MaybeLocal Nan::CopyBuffer(const char *data, uint32_t size) -``` - - - -### Nan::FreeCallback() - -A free callback that can be provided to [`Nan::NewBuffer()`](#api_nan_new_buffer). -The supplied callback will be invoked when the `Buffer` undergoes garbage collection. - -Signature: - -```c++ -typedef void (*FreeCallback)(char *data, void *hint); -``` diff --git a/node_modules/node-pty/node_modules/nan/doc/callback.md b/node_modules/node-pty/node_modules/nan/doc/callback.md deleted file mode 100644 index f7af0bf..0000000 --- a/node_modules/node-pty/node_modules/nan/doc/callback.md +++ /dev/null @@ -1,76 +0,0 @@ -## Nan::Callback - -`Nan::Callback` makes it easier to use `v8::Function` handles as callbacks. A class that wraps a `v8::Function` handle, protecting it from garbage collection and making it particularly useful for storage and use across asynchronous execution. - - - Nan::Callback - - -### Nan::Callback - -```c++ -class Callback { - public: - Callback(); - - explicit Callback(const v8::Local &fn); - - ~Callback(); - - bool operator==(const Callback &other) const; - - bool operator!=(const Callback &other) const; - - v8::Local operator*() const; - - MaybeLocal operator()(AsyncResource* async_resource, - v8::Local target, - int argc = 0, - v8::Local argv[] = 0) const; - - MaybeLocal operator()(AsyncResource* async_resource, - int argc = 0, - v8::Local argv[] = 0) const; - - void SetFunction(const v8::Local &fn); - - v8::Local GetFunction() const; - - bool IsEmpty() const; - - void Reset(const v8::Local &fn); - - void Reset(); - - MaybeLocal Call(v8::Local target, - int argc, - v8::Local argv[], - AsyncResource* async_resource) const; - MaybeLocal Call(int argc, - v8::Local argv[], - AsyncResource* async_resource) const; - - // Deprecated versions. Use the versions that accept an async_resource instead - // as they run the callback in the correct async context as specified by the - // resource. If you want to call a synchronous JS function (i.e. on a - // non-empty JS stack), you can use Nan::Call instead. - v8::Local operator()(v8::Local target, - int argc = 0, - v8::Local argv[] = 0) const; - - v8::Local operator()(int argc = 0, - v8::Local argv[] = 0) const; - v8::Local Call(v8::Local target, - int argc, - v8::Local argv[]) const; - - v8::Local Call(int argc, v8::Local argv[]) const; -}; -``` - -Example usage: - -```c++ -v8::Local function; -Nan::Callback callback(function); -callback.Call(0, 0); -``` diff --git a/node_modules/node-pty/node_modules/nan/doc/converters.md b/node_modules/node-pty/node_modules/nan/doc/converters.md deleted file mode 100644 index d20861b..0000000 --- a/node_modules/node-pty/node_modules/nan/doc/converters.md +++ /dev/null @@ -1,41 +0,0 @@ -## Converters - -NAN contains functions that convert `v8::Value`s to other `v8::Value` types and native types. Since type conversion is not guaranteed to succeed, they return `Nan::Maybe` types. These converters can be used in place of `value->ToX()` and `value->XValue()` (where `X` is one of the types, e.g. `Boolean`) in a way that provides a consistent interface across V8 versions. Newer versions of V8 use the new `v8::Maybe` and `v8::MaybeLocal` types for these conversions, older versions don't have this functionality so it is provided by NAN. - - - Nan::To() - - -### Nan::To() - -Converts a `v8::Local` to a different subtype of `v8::Value` or to a native data type. Returns a `Nan::MaybeLocal<>` or a `Nan::Maybe<>` accordingly. - -See [maybe_types.md](./maybe_types.md) for more information on `Nan::Maybe` types. - -Signatures: - -```c++ -// V8 types -Nan::MaybeLocal Nan::To(v8::Local val); -Nan::MaybeLocal Nan::To(v8::Local val); -Nan::MaybeLocal Nan::To(v8::Local val); -Nan::MaybeLocal Nan::To(v8::Local val); -Nan::MaybeLocal Nan::To(v8::Local val); -Nan::MaybeLocal Nan::To(v8::Local val); -Nan::MaybeLocal Nan::To(v8::Local val); - -// Native types -Nan::Maybe Nan::To(v8::Local val); -Nan::Maybe Nan::To(v8::Local val); -Nan::Maybe Nan::To(v8::Local val); -Nan::Maybe Nan::To(v8::Local val); -Nan::Maybe Nan::To(v8::Local val); -``` - -### Example - -```c++ -v8::Local val; -Nan::MaybeLocal str = Nan::To(val); -Nan::Maybe d = Nan::To(val); -``` - diff --git a/node_modules/node-pty/node_modules/nan/doc/errors.md b/node_modules/node-pty/node_modules/nan/doc/errors.md deleted file mode 100644 index 8127a54..0000000 --- a/node_modules/node-pty/node_modules/nan/doc/errors.md +++ /dev/null @@ -1,226 +0,0 @@ -## Errors - -NAN includes helpers for creating, throwing and catching Errors as much of this functionality varies across the supported versions of V8 and must be abstracted. - -Note that an Error object is simply a specialized form of `v8::Value`. - -Also consult the V8 Embedders Guide section on [Exceptions](https://developers.google.com/v8/embed#exceptions) for more information. - - - Nan::Error() - - Nan::RangeError() - - Nan::ReferenceError() - - Nan::SyntaxError() - - Nan::TypeError() - - Nan::ThrowError() - - Nan::ThrowRangeError() - - Nan::ThrowReferenceError() - - Nan::ThrowSyntaxError() - - Nan::ThrowTypeError() - - Nan::FatalException() - - Nan::ErrnoException() - - Nan::TryCatch - - - -### Nan::Error() - -Create a new Error object using the [v8::Exception](https://v8docs.nodesource.com/node-8.11/da/d6a/classv8_1_1_exception.html) class in a way that is compatible across the supported versions of V8. - -Note that an Error object is simply a specialized form of `v8::Value`. - -Signature: - -```c++ -v8::Local Nan::Error(const char *msg); -v8::Local Nan::Error(v8::Local msg); -``` - - - -### Nan::RangeError() - -Create a new RangeError object using the [v8::Exception](https://v8docs.nodesource.com/node-8.11/da/d6a/classv8_1_1_exception.html) class in a way that is compatible across the supported versions of V8. - -Note that an RangeError object is simply a specialized form of `v8::Value`. - -Signature: - -```c++ -v8::Local Nan::RangeError(const char *msg); -v8::Local Nan::RangeError(v8::Local msg); -``` - - - -### Nan::ReferenceError() - -Create a new ReferenceError object using the [v8::Exception](https://v8docs.nodesource.com/node-8.11/da/d6a/classv8_1_1_exception.html) class in a way that is compatible across the supported versions of V8. - -Note that an ReferenceError object is simply a specialized form of `v8::Value`. - -Signature: - -```c++ -v8::Local Nan::ReferenceError(const char *msg); -v8::Local Nan::ReferenceError(v8::Local msg); -``` - - - -### Nan::SyntaxError() - -Create a new SyntaxError object using the [v8::Exception](https://v8docs.nodesource.com/node-8.11/da/d6a/classv8_1_1_exception.html) class in a way that is compatible across the supported versions of V8. - -Note that an SyntaxError object is simply a specialized form of `v8::Value`. - -Signature: - -```c++ -v8::Local Nan::SyntaxError(const char *msg); -v8::Local Nan::SyntaxError(v8::Local msg); -``` - - - -### Nan::TypeError() - -Create a new TypeError object using the [v8::Exception](https://v8docs.nodesource.com/node-8.11/da/d6a/classv8_1_1_exception.html) class in a way that is compatible across the supported versions of V8. - -Note that an TypeError object is simply a specialized form of `v8::Value`. - -Signature: - -```c++ -v8::Local Nan::TypeError(const char *msg); -v8::Local Nan::TypeError(v8::Local msg); -``` - - - -### Nan::ThrowError() - -Throw an Error object (a specialized `v8::Value` as above) in the current context. If a `msg` is provided, a new Error object will be created. - -Signature: - -```c++ -void Nan::ThrowError(const char *msg); -void Nan::ThrowError(v8::Local msg); -void Nan::ThrowError(v8::Local error); -``` - - - -### Nan::ThrowRangeError() - -Throw an RangeError object (a specialized `v8::Value` as above) in the current context. If a `msg` is provided, a new RangeError object will be created. - -Signature: - -```c++ -void Nan::ThrowRangeError(const char *msg); -void Nan::ThrowRangeError(v8::Local msg); -void Nan::ThrowRangeError(v8::Local error); -``` - - - -### Nan::ThrowReferenceError() - -Throw an ReferenceError object (a specialized `v8::Value` as above) in the current context. If a `msg` is provided, a new ReferenceError object will be created. - -Signature: - -```c++ -void Nan::ThrowReferenceError(const char *msg); -void Nan::ThrowReferenceError(v8::Local msg); -void Nan::ThrowReferenceError(v8::Local error); -``` - - - -### Nan::ThrowSyntaxError() - -Throw an SyntaxError object (a specialized `v8::Value` as above) in the current context. If a `msg` is provided, a new SyntaxError object will be created. - -Signature: - -```c++ -void Nan::ThrowSyntaxError(const char *msg); -void Nan::ThrowSyntaxError(v8::Local msg); -void Nan::ThrowSyntaxError(v8::Local error); -``` - - - -### Nan::ThrowTypeError() - -Throw an TypeError object (a specialized `v8::Value` as above) in the current context. If a `msg` is provided, a new TypeError object will be created. - -Signature: - -```c++ -void Nan::ThrowTypeError(const char *msg); -void Nan::ThrowTypeError(v8::Local msg); -void Nan::ThrowTypeError(v8::Local error); -``` - - -### Nan::FatalException() - -Replaces `node::FatalException()` which has a different API across supported versions of Node. For use with [`Nan::TryCatch`](#api_nan_try_catch). - -Signature: - -```c++ -void Nan::FatalException(const Nan::TryCatch& try_catch); -``` - - -### Nan::ErrnoException() - -Replaces `node::ErrnoException()` which has a different API across supported versions of Node. - -Signature: - -```c++ -v8::Local Nan::ErrnoException(int errorno, - const char* syscall = NULL, - const char* message = NULL, - const char* path = NULL); -``` - - - -### Nan::TryCatch - -A simple wrapper around [`v8::TryCatch`](https://v8docs.nodesource.com/node-8.11/d4/dc6/classv8_1_1_try_catch.html) compatible with all supported versions of V8. Can be used as a direct replacement in most cases. See also [`Nan::FatalException()`](#api_nan_fatal_exception) for an internal use compatible with `node::FatalException`. - -Signature: - -```c++ -class Nan::TryCatch { - public: - Nan::TryCatch(); - - bool HasCaught() const; - - bool CanContinue() const; - - v8::Local ReThrow(); - - v8::Local Exception() const; - - // Nan::MaybeLocal for older versions of V8 - v8::MaybeLocal StackTrace() const; - - v8::Local Message() const; - - void Reset(); - - void SetVerbose(bool value); - - void SetCaptureMessage(bool value); -}; -``` - diff --git a/node_modules/node-pty/node_modules/nan/doc/json.md b/node_modules/node-pty/node_modules/nan/doc/json.md deleted file mode 100644 index 4fa78db..0000000 --- a/node_modules/node-pty/node_modules/nan/doc/json.md +++ /dev/null @@ -1,62 +0,0 @@ -## JSON - -The _JSON_ object provides the c++ versions of the methods offered by the `JSON` object in javascript. V8 exposes these methods via the `v8::JSON` object. - - - Nan::JSON.Parse - - Nan::JSON.Stringify - -Refer to the V8 JSON object in the [V8 documentation](https://v8docs.nodesource.com/node-8.11/da/d6f/classv8_1_1_j_s_o_n.html) for more information about these methods and their arguments. - - - -### Nan::JSON.Parse - -A simple wrapper around [`v8::JSON::Parse`](https://v8docs.nodesource.com/node-8.11/da/d6f/classv8_1_1_j_s_o_n.html#a936310d2540fb630ed37d3ee3ffe4504). - -Definition: - -```c++ -Nan::MaybeLocal Nan::JSON::Parse(v8::Local json_string); -``` - -Use `JSON.Parse(json_string)` to parse a string into a `v8::Value`. - -Example: - -```c++ -v8::Local json_string = Nan::New("{ \"JSON\": \"object\" }").ToLocalChecked(); - -Nan::JSON NanJSON; -Nan::MaybeLocal result = NanJSON.Parse(json_string); -if (!result.IsEmpty()) { - v8::Local val = result.ToLocalChecked(); -} -``` - - - -### Nan::JSON.Stringify - -A simple wrapper around [`v8::JSON::Stringify`](https://v8docs.nodesource.com/node-8.11/da/d6f/classv8_1_1_j_s_o_n.html#a44b255c3531489ce43f6110209138860). - -Definition: - -```c++ -Nan::MaybeLocal Nan::JSON::Stringify(v8::Local json_object, v8::Local gap = v8::Local()); -``` - -Use `JSON.Stringify(value)` to stringify a `v8::Object`. - -Example: - -```c++ -// using `v8::Local val` from the `JSON::Parse` example -v8::Local obj = Nan::To(val).ToLocalChecked(); - -Nan::JSON NanJSON; -Nan::MaybeLocal result = NanJSON.Stringify(obj); -if (!result.IsEmpty()) { - v8::Local stringified = result.ToLocalChecked(); -} -``` - diff --git a/node_modules/node-pty/node_modules/nan/doc/maybe_types.md b/node_modules/node-pty/node_modules/nan/doc/maybe_types.md deleted file mode 100644 index 1a9fabf..0000000 --- a/node_modules/node-pty/node_modules/nan/doc/maybe_types.md +++ /dev/null @@ -1,583 +0,0 @@ -## Maybe Types - -The `Nan::MaybeLocal` and `Nan::Maybe` types are monads that encapsulate `v8::Local` handles that _may be empty_. - -* **Maybe Types** - - Nan::MaybeLocal - - Nan::Maybe - - Nan::Nothing - - Nan::Just -* **Maybe Helpers** - - Nan::Call() - - Nan::ToDetailString() - - Nan::ToArrayIndex() - - Nan::Equals() - - Nan::NewInstance() - - Nan::GetFunction() - - Nan::Set() - - Nan::DefineOwnProperty() - - Nan::ForceSet() - - Nan::Get() - - Nan::GetPropertyAttributes() - - Nan::Has() - - Nan::Delete() - - Nan::GetPropertyNames() - - Nan::GetOwnPropertyNames() - - Nan::SetPrototype() - - Nan::ObjectProtoToString() - - Nan::HasOwnProperty() - - Nan::HasRealNamedProperty() - - Nan::HasRealIndexedProperty() - - Nan::HasRealNamedCallbackProperty() - - Nan::GetRealNamedPropertyInPrototypeChain() - - Nan::GetRealNamedProperty() - - Nan::CallAsFunction() - - Nan::CallAsConstructor() - - Nan::GetSourceLine() - - Nan::GetLineNumber() - - Nan::GetStartColumn() - - Nan::GetEndColumn() - - Nan::CloneElementAt() - - Nan::HasPrivate() - - Nan::GetPrivate() - - Nan::SetPrivate() - - Nan::DeletePrivate() - - Nan::MakeMaybe() - - -### Nan::MaybeLocal - -A `Nan::MaybeLocal` is a wrapper around [`v8::Local`](https://v8docs.nodesource.com/node-8.11/de/deb/classv8_1_1_local.html) that enforces a check that determines whether the `v8::Local` is empty before it can be used. - -If an API method returns a `Nan::MaybeLocal`, the API method can potentially fail either because an exception is thrown, or because an exception is pending, e.g. because a previous API call threw an exception that hasn't been caught yet, or because a `v8::TerminateExecution` exception was thrown. In that case, an empty `Nan::MaybeLocal` is returned. - -Definition: - -```c++ -template class Nan::MaybeLocal { - public: - MaybeLocal(); - - template MaybeLocal(v8::Local that); - - bool IsEmpty() const; - - template bool ToLocal(v8::Local *out); - - // Will crash if the MaybeLocal<> is empty. - v8::Local ToLocalChecked(); - - template v8::Local FromMaybe(v8::Local default_value) const; -}; -``` - -See the documentation for [`v8::MaybeLocal`](https://v8docs.nodesource.com/node-8.11/d8/d7d/classv8_1_1_maybe_local.html) for further details. - - -### Nan::Maybe - -A simple `Nan::Maybe` type, representing an object which may or may not have a value, see https://hackage.haskell.org/package/base/docs/Data-Maybe.html. - -If an API method returns a `Nan::Maybe<>`, the API method can potentially fail either because an exception is thrown, or because an exception is pending, e.g. because a previous API call threw an exception that hasn't been caught yet, or because a `v8::TerminateExecution` exception was thrown. In that case, a "Nothing" value is returned. - -Definition: - -```c++ -template class Nan::Maybe { - public: - bool IsNothing() const; - bool IsJust() const; - - // Will crash if the Maybe<> is nothing. - T FromJust(); - - T FromMaybe(const T& default_value); - - bool operator==(const Maybe &other); - - bool operator!=(const Maybe &other); -}; -``` - -See the documentation for [`v8::Maybe`](https://v8docs.nodesource.com/node-8.11/d9/d4b/classv8_1_1_maybe.html) for further details. - - -### Nan::Nothing - -Construct an empty `Nan::Maybe` type representing _nothing_. - -```c++ -template Nan::Maybe Nan::Nothing(); -``` - - -### Nan::Just - -Construct a `Nan::Maybe` type representing _just_ a value. - -```c++ -template Nan::Maybe Nan::Just(const T &t); -``` - - -### Nan::Call() - -A helper method for calling a synchronous [`v8::Function#Call()`](https://v8docs.nodesource.com/node-8.11/d5/d54/classv8_1_1_function.html#a9c3d0e4e13ddd7721fce238aa5b94a11) in a way compatible across supported versions of V8. - -For asynchronous callbacks, use Nan::Callback::Call along with an AsyncResource. - -Signature: - -```c++ -Nan::MaybeLocal Nan::Call(v8::Local fun, v8::Local recv, int argc, v8::Local argv[]); -Nan::MaybeLocal Nan::Call(const Nan::Callback& callback, v8::Local recv, - int argc, v8::Local argv[]); -Nan::MaybeLocal Nan::Call(const Nan::Callback& callback, int argc, v8::Local argv[]); -``` - - - -### Nan::ToDetailString() - -A helper method for calling [`v8::Value#ToDetailString()`](https://v8docs.nodesource.com/node-8.11/dc/d0a/classv8_1_1_value.html#a2f9770296dc2c8d274bc8cc0dca243e5) in a way compatible across supported versions of V8. - -Signature: - -```c++ -Nan::MaybeLocal Nan::ToDetailString(v8::Local val); -``` - - - -### Nan::ToArrayIndex() - -A helper method for calling [`v8::Value#ToArrayIndex()`](https://v8docs.nodesource.com/node-8.11/dc/d0a/classv8_1_1_value.html#acc5bbef3c805ec458470c0fcd6f13493) in a way compatible across supported versions of V8. - -Signature: - -```c++ -Nan::MaybeLocal Nan::ToArrayIndex(v8::Local val); -``` - - - -### Nan::Equals() - -A helper method for calling [`v8::Value#Equals()`](https://v8docs.nodesource.com/node-8.11/dc/d0a/classv8_1_1_value.html#a08fba1d776a59bbf6864b25f9152c64b) in a way compatible across supported versions of V8. - -Signature: - -```c++ -Nan::Maybe Nan::Equals(v8::Local a, v8::Local(b)); -``` - - - -### Nan::NewInstance() - -A helper method for calling [`v8::Function#NewInstance()`](https://v8docs.nodesource.com/node-8.11/d5/d54/classv8_1_1_function.html#ae477558b10c14b76ed00e8dbab44ce5b) and [`v8::ObjectTemplate#NewInstance()`](https://v8docs.nodesource.com/node-8.11/db/d5f/classv8_1_1_object_template.html#ad605a7543cfbc5dab54cdb0883d14ae4) in a way compatible across supported versions of V8. - -Signature: - -```c++ -Nan::MaybeLocal Nan::NewInstance(v8::Local h); -Nan::MaybeLocal Nan::NewInstance(v8::Local h, int argc, v8::Local argv[]); -Nan::MaybeLocal Nan::NewInstance(v8::Local h); -``` - - - -### Nan::GetFunction() - -A helper method for calling [`v8::FunctionTemplate#GetFunction()`](https://v8docs.nodesource.com/node-8.11/d8/d83/classv8_1_1_function_template.html#a56d904662a86eca78da37d9bb0ed3705) in a way compatible across supported versions of V8. - -Signature: - -```c++ -Nan::MaybeLocal Nan::GetFunction(v8::Local t); -``` - - - -### Nan::Set() - -A helper method for calling [`v8::Object#Set()`](https://v8docs.nodesource.com/node-8.11/db/d85/classv8_1_1_object.html#a67604ea3734f170c66026064ea808f20) in a way compatible across supported versions of V8. - -Signature: - -```c++ -Nan::Maybe Nan::Set(v8::Local obj, - v8::Local key, - v8::Local value) -Nan::Maybe Nan::Set(v8::Local obj, - uint32_t index, - v8::Local value); -``` - - - -### Nan::DefineOwnProperty() - -A helper method for calling [`v8::Object#DefineOwnProperty()`](https://v8docs.nodesource.com/node-8.11/db/d85/classv8_1_1_object.html#a6f76b2ed605cb8f9185b92de0033a820) in a way compatible across supported versions of V8. - -Signature: - -```c++ -Nan::Maybe Nan::DefineOwnProperty(v8::Local obj, - v8::Local key, - v8::Local value, - v8::PropertyAttribute attribs = v8::None); -``` - - - -### Nan::ForceSet() - -Deprecated, use Nan::DefineOwnProperty(). - -A helper method for calling [`v8::Object#ForceSet()`](https://v8docs.nodesource.com/node-0.12/db/d85/classv8_1_1_object.html#acfbdfd7427b516ebdb5c47c4df5ed96c) in a way compatible across supported versions of V8. - -Signature: - -```c++ -NAN_DEPRECATED Nan::Maybe Nan::ForceSet(v8::Local obj, - v8::Local key, - v8::Local value, - v8::PropertyAttribute attribs = v8::None); -``` - - - -### Nan::Get() - -A helper method for calling [`v8::Object#Get()`](https://v8docs.nodesource.com/node-8.11/db/d85/classv8_1_1_object.html#a2565f03e736694f6b1e1cf22a0b4eac2) in a way compatible across supported versions of V8. - -Signature: - -```c++ -Nan::MaybeLocal Nan::Get(v8::Local obj, - v8::Local key); -Nan::MaybeLocal Nan::Get(v8::Local obj, uint32_t index); -``` - - - -### Nan::GetPropertyAttributes() - -A helper method for calling [`v8::Object#GetPropertyAttributes()`](https://v8docs.nodesource.com/node-8.11/db/d85/classv8_1_1_object.html#a9b898894da3d1db2714fd9325a54fe57) in a way compatible across supported versions of V8. - -Signature: - -```c++ -Nan::Maybe Nan::GetPropertyAttributes( - v8::Local obj, - v8::Local key); -``` - - - -### Nan::Has() - -A helper method for calling [`v8::Object#Has()`](https://v8docs.nodesource.com/node-8.11/db/d85/classv8_1_1_object.html#ab3c3d89ea7c2f9afd08965bd7299a41d) in a way compatible across supported versions of V8. - -Signature: - -```c++ -Nan::Maybe Nan::Has(v8::Local obj, v8::Local key); -Nan::Maybe Nan::Has(v8::Local obj, uint32_t index); -``` - - - -### Nan::Delete() - -A helper method for calling [`v8::Object#Delete()`](https://v8docs.nodesource.com/node-8.11/db/d85/classv8_1_1_object.html#a48e4a19b2cedff867eecc73ddb7d377f) in a way compatible across supported versions of V8. - -Signature: - -```c++ -Nan::Maybe Nan::Delete(v8::Local obj, - v8::Local key); -Nan::Maybe Nan::Delete(v8::Local obj, uint32_t index); -``` - - - -### Nan::GetPropertyNames() - -A helper method for calling [`v8::Object#GetPropertyNames()`](https://v8docs.nodesource.com/node-8.11/db/d85/classv8_1_1_object.html#aced885270cfd2c956367b5eedc7fbfe8) in a way compatible across supported versions of V8. - -Signature: - -```c++ -Nan::MaybeLocal Nan::GetPropertyNames(v8::Local obj); -``` - - - -### Nan::GetOwnPropertyNames() - -A helper method for calling [`v8::Object#GetOwnPropertyNames()`](https://v8docs.nodesource.com/node-8.11/db/d85/classv8_1_1_object.html#a79a6e4d66049b9aa648ed4dfdb23e6eb) in a way compatible across supported versions of V8. - -Signature: - -```c++ -Nan::MaybeLocal Nan::GetOwnPropertyNames(v8::Local obj); -``` - - - -### Nan::SetPrototype() - -A helper method for calling [`v8::Object#SetPrototype()`](https://v8docs.nodesource.com/node-8.11/db/d85/classv8_1_1_object.html#a442706b22fceda6e6d1f632122a9a9f4) in a way compatible across supported versions of V8. - -Signature: - -```c++ -Nan::Maybe Nan::SetPrototype(v8::Local obj, - v8::Local prototype); -``` - - - -### Nan::ObjectProtoToString() - -A helper method for calling [`v8::Object#ObjectProtoToString()`](https://v8docs.nodesource.com/node-8.11/db/d85/classv8_1_1_object.html#ab7a92b4dcf822bef72f6c0ac6fea1f0b) in a way compatible across supported versions of V8. - -Signature: - -```c++ -Nan::MaybeLocal Nan::ObjectProtoToString(v8::Local obj); -``` - - - -### Nan::HasOwnProperty() - -A helper method for calling [`v8::Object#HasOwnProperty()`](https://v8docs.nodesource.com/node-8.11/db/d85/classv8_1_1_object.html#ab7b7245442ca6de1e1c145ea3fd653ff) in a way compatible across supported versions of V8. - -Signature: - -```c++ -Nan::Maybe Nan::HasOwnProperty(v8::Local obj, - v8::Local key); -``` - - - -### Nan::HasRealNamedProperty() - -A helper method for calling [`v8::Object#HasRealNamedProperty()`](https://v8docs.nodesource.com/node-8.11/db/d85/classv8_1_1_object.html#ad8b80a59c9eb3c1e6c3cd6c84571f767) in a way compatible across supported versions of V8. - -Signature: - -```c++ -Nan::Maybe Nan::HasRealNamedProperty(v8::Local obj, - v8::Local key); -``` - - - -### Nan::HasRealIndexedProperty() - -A helper method for calling [`v8::Object#HasRealIndexedProperty()`](https://v8docs.nodesource.com/node-8.11/db/d85/classv8_1_1_object.html#af94fc1135a5e74a2193fb72c3a1b9855) in a way compatible across supported versions of V8. - -Signature: - -```c++ -Nan::Maybe Nan::HasRealIndexedProperty(v8::Local obj, - uint32_t index); -``` - - - -### Nan::HasRealNamedCallbackProperty() - -A helper method for calling [`v8::Object#HasRealNamedCallbackProperty()`](https://v8docs.nodesource.com/node-8.11/db/d85/classv8_1_1_object.html#af743b7ea132b89f84d34d164d0668811) in a way compatible across supported versions of V8. - -Signature: - -```c++ -Nan::Maybe Nan::HasRealNamedCallbackProperty( - v8::Local obj, - v8::Local key); -``` - - - -### Nan::GetRealNamedPropertyInPrototypeChain() - -A helper method for calling [`v8::Object#GetRealNamedPropertyInPrototypeChain()`](https://v8docs.nodesource.com/node-8.11/db/d85/classv8_1_1_object.html#a8700b1862e6b4783716964ba4d5e6172) in a way compatible across supported versions of V8. - -Signature: - -```c++ -Nan::MaybeLocal Nan::GetRealNamedPropertyInPrototypeChain( - v8::Local obj, - v8::Local key); -``` - - - -### Nan::GetRealNamedProperty() - -A helper method for calling [`v8::Object#GetRealNamedProperty()`](https://v8docs.nodesource.com/node-8.11/db/d85/classv8_1_1_object.html#a84471a824576a5994fdd0ffcbf99ccc0) in a way compatible across supported versions of V8. - -Signature: - -```c++ -Nan::MaybeLocal Nan::GetRealNamedProperty(v8::Local obj, - v8::Local key); -``` - - - -### Nan::CallAsFunction() - -A helper method for calling [`v8::Object#CallAsFunction()`](https://v8docs.nodesource.com/node-8.11/db/d85/classv8_1_1_object.html#ad3ffc36f3dfc3592ce2a96bc047ee2cd) in a way compatible across supported versions of V8. - -Signature: - -```c++ -Nan::MaybeLocal Nan::CallAsFunction(v8::Local obj, - v8::Local recv, - int argc, - v8::Local argv[]); -``` - - - -### Nan::CallAsConstructor() - -A helper method for calling [`v8::Object#CallAsConstructor()`](https://v8docs.nodesource.com/node-8.11/db/d85/classv8_1_1_object.html#a50d571de50d0b0dfb28795619d07a01b) in a way compatible across supported versions of V8. - -Signature: - -```c++ -Nan::MaybeLocal Nan::CallAsConstructor(v8::Local obj, - int argc, - v8::Local argv[]); -``` - - - -### Nan::GetSourceLine() - -A helper method for calling [`v8::Message#GetSourceLine()`](https://v8docs.nodesource.com/node-8.11/d9/d28/classv8_1_1_message.html#a849f7a6c41549d83d8159825efccd23a) in a way compatible across supported versions of V8. - -Signature: - -```c++ -Nan::MaybeLocal Nan::GetSourceLine(v8::Local msg); -``` - - - -### Nan::GetLineNumber() - -A helper method for calling [`v8::Message#GetLineNumber()`](https://v8docs.nodesource.com/node-8.11/d9/d28/classv8_1_1_message.html#adbe46c10a88a6565f2732a2d2adf99b9) in a way compatible across supported versions of V8. - -Signature: - -```c++ -Nan::Maybe Nan::GetLineNumber(v8::Local msg); -``` - - - -### Nan::GetStartColumn() - -A helper method for calling [`v8::Message#GetStartColumn()`](https://v8docs.nodesource.com/node-8.11/d9/d28/classv8_1_1_message.html#a60ede616ba3822d712e44c7a74487ba6) in a way compatible across supported versions of V8. - -Signature: - -```c++ -Nan::Maybe Nan::GetStartColumn(v8::Local msg); -``` - - - -### Nan::GetEndColumn() - -A helper method for calling [`v8::Message#GetEndColumn()`](https://v8docs.nodesource.com/node-8.11/d9/d28/classv8_1_1_message.html#aaa004cf19e529da980bc19fcb76d93be) in a way compatible across supported versions of V8. - -Signature: - -```c++ -Nan::Maybe Nan::GetEndColumn(v8::Local msg); -``` - - - -### Nan::CloneElementAt() - -A helper method for calling [`v8::Array#CloneElementAt()`](https://v8docs.nodesource.com/node-4.8/d3/d32/classv8_1_1_array.html#a1d3a878d4c1c7cae974dd50a1639245e) in a way compatible across supported versions of V8. - -Signature: - -```c++ -Nan::MaybeLocal Nan::CloneElementAt(v8::Local array, uint32_t index); -``` - - -### Nan::HasPrivate() - -A helper method for calling [`v8::Object#HasPrivate()`](https://v8docs.nodesource.com/node-8.11/db/d85/classv8_1_1_object.html#af68a0b98066cfdeb8f943e98a40ba08d) in a way compatible across supported versions of V8. - -Signature: - -```c++ -Nan::Maybe Nan::HasPrivate(v8::Local object, v8::Local key); -``` - - -### Nan::GetPrivate() - -A helper method for calling [`v8::Object#GetPrivate()`](https://v8docs.nodesource.com/node-8.11/db/d85/classv8_1_1_object.html#a169f2da506acbec34deadd9149a1925a) in a way compatible across supported versions of V8. - -Signature: - -```c++ -Nan::MaybeLocal Nan::GetPrivate(v8::Local object, v8::Local key); -``` - - -### Nan::SetPrivate() - -A helper method for calling [`v8::Object#SetPrivate()`](https://v8docs.nodesource.com/node-8.11/db/d85/classv8_1_1_object.html#ace1769b0f3b86bfe9fda1010916360ee) in a way compatible across supported versions of V8. - -Signature: - -```c++ -Nan::Maybe Nan::SetPrivate(v8::Local object, v8::Local key, v8::Local value); -``` - - -### Nan::DeletePrivate() - -A helper method for calling [`v8::Object#DeletePrivate()`](https://v8docs.nodesource.com/node-8.11/db/d85/classv8_1_1_object.html#a138bb32a304f3982be02ad499693b8fd) in a way compatible across supported versions of V8. - -Signature: - -```c++ -Nan::Maybe Nan::DeletePrivate(v8::Local object, v8::Local key); -``` - - -### Nan::MakeMaybe() - -Wraps a `v8::Local<>` in a `Nan::MaybeLocal<>`. When called with a `Nan::MaybeLocal<>` it just returns its argument. This is useful in generic template code that builds on NAN. - -Synopsis: - -```c++ - MaybeLocal someNumber = MakeMaybe(New(3.141592654)); - MaybeLocal someString = MakeMaybe(New("probably")); -``` - -Signature: - -```c++ -template class MaybeMaybe> -Nan::MaybeLocal Nan::MakeMaybe(MaybeMaybe v); -``` diff --git a/node_modules/node-pty/node_modules/nan/doc/methods.md b/node_modules/node-pty/node_modules/nan/doc/methods.md deleted file mode 100644 index b2b26c3..0000000 --- a/node_modules/node-pty/node_modules/nan/doc/methods.md +++ /dev/null @@ -1,661 +0,0 @@ -## JavaScript-accessible methods - -A _template_ is a blueprint for JavaScript functions and objects in a context. You can use a template to wrap C++ functions and data structures within JavaScript objects so that they can be manipulated from JavaScript. See the V8 Embedders Guide section on [Templates](https://github.com/v8/v8/wiki/Embedder%27s-Guide#templates) for further information. - -In order to expose functionality to JavaScript via a template, you must provide it to V8 in a form that it understands. Across the versions of V8 supported by NAN, JavaScript-accessible method signatures vary widely, NAN fully abstracts method declaration and provides you with an interface that is similar to the most recent V8 API but is backward-compatible with older versions that still use the now-deceased `v8::Argument` type. - -* **Method argument types** - - Nan::FunctionCallbackInfo - - Nan::PropertyCallbackInfo - - Nan::ReturnValue -* **Method declarations** - - Method declaration - - Getter declaration - - Setter declaration - - Property getter declaration - - Property setter declaration - - Property enumerator declaration - - Property deleter declaration - - Property query declaration - - Index getter declaration - - Index setter declaration - - Index enumerator declaration - - Index deleter declaration - - Index query declaration -* Method and template helpers - - Nan::SetMethod() - - Nan::SetPrototypeMethod() - - Nan::SetAccessor() - - Nan::SetNamedPropertyHandler() - - Nan::SetIndexedPropertyHandler() - - Nan::SetTemplate() - - Nan::SetPrototypeTemplate() - - Nan::SetInstanceTemplate() - - Nan::SetCallHandler() - - Nan::SetCallAsFunctionHandler() - - -### Nan::FunctionCallbackInfo - -`Nan::FunctionCallbackInfo` should be used in place of [`v8::FunctionCallbackInfo`](https://v8docs.nodesource.com/node-8.11/dd/d0d/classv8_1_1_function_callback_info.html), even with older versions of Node where `v8::FunctionCallbackInfo` does not exist. - -Definition: - -```c++ -template class FunctionCallbackInfo { - public: - ReturnValue GetReturnValue() const; - v8::Local Callee(); // NOTE: Not available in NodeJS >= 10.0.0 - v8::Local Data(); - v8::Local Holder(); - bool IsConstructCall(); - int Length() const; - v8::Local operator[](int i) const; - v8::Local This() const; - v8::Isolate *GetIsolate() const; -}; -``` - -See the [`v8::FunctionCallbackInfo`](https://v8docs.nodesource.com/node-8.11/dd/d0d/classv8_1_1_function_callback_info.html) documentation for usage details on these. See [`Nan::ReturnValue`](#api_nan_return_value) for further information on how to set a return value from methods. - -**Note:** `FunctionCallbackInfo::Callee` is removed in Node.js after `10.0.0` because it is was deprecated in V8. Consider using `info.Data()` to pass any information you need. - - -### Nan::PropertyCallbackInfo - -`Nan::PropertyCallbackInfo` should be used in place of [`v8::PropertyCallbackInfo`](https://v8docs.nodesource.com/node-8.11/d7/dc5/classv8_1_1_property_callback_info.html), even with older versions of Node where `v8::PropertyCallbackInfo` does not exist. - -Definition: - -```c++ -template class PropertyCallbackInfo : public PropertyCallbackInfoBase { - public: - ReturnValue GetReturnValue() const; - v8::Isolate* GetIsolate() const; - v8::Local Data() const; - v8::Local This() const; - v8::Local Holder() const; -}; -``` - -See the [`v8::PropertyCallbackInfo`](https://v8docs.nodesource.com/node-8.11/d7/dc5/classv8_1_1_property_callback_info.html) documentation for usage details on these. See [`Nan::ReturnValue`](#api_nan_return_value) for further information on how to set a return value from property accessor methods. - - -### Nan::ReturnValue - -`Nan::ReturnValue` is used in place of [`v8::ReturnValue`](https://v8docs.nodesource.com/node-8.11/da/da7/classv8_1_1_return_value.html) on both [`Nan::FunctionCallbackInfo`](#api_nan_function_callback_info) and [`Nan::PropertyCallbackInfo`](#api_nan_property_callback_info) as the return type of `GetReturnValue()`. - -Example usage: - -```c++ -void EmptyArray(const Nan::FunctionCallbackInfo& info) { - info.GetReturnValue().Set(Nan::New()); -} -``` - -Definition: - -```c++ -template class ReturnValue { - public: - // Handle setters - template void Set(const v8::Local &handle); - template void Set(const Nan::Global &handle); - - // Fast primitive setters - void Set(bool value); - void Set(double i); - void Set(int32_t i); - void Set(uint32_t i); - - // Fast JS primitive setters - void SetNull(); - void SetUndefined(); - void SetEmptyString(); - - // Convenience getter for isolate - v8::Isolate *GetIsolate() const; -}; -``` - -See the documentation on [`v8::ReturnValue`](https://v8docs.nodesource.com/node-8.11/da/da7/classv8_1_1_return_value.html) for further information on this. - - -### Method declaration - -JavaScript-accessible methods should be declared with the following signature to form a `Nan::FunctionCallback`: - -```c++ -typedef void(*FunctionCallback)(const FunctionCallbackInfo&); -``` - -Example: - -```c++ -void MethodName(const Nan::FunctionCallbackInfo& info) { - ... -} -``` - -You do not need to declare a new `HandleScope` within a method as one is implicitly created for you. - -**Example usage** - -```c++ -// .h: -class Foo : public Nan::ObjectWrap { - ... - - static void Bar(const Nan::FunctionCallbackInfo& info); - static void Baz(const Nan::FunctionCallbackInfo& info); -} - - -// .cc: -void Foo::Bar(const Nan::FunctionCallbackInfo& info) { - ... -} - -void Foo::Baz(const Nan::FunctionCallbackInfo& info) { - ... -} -``` - -A helper macro `NAN_METHOD(methodname)` exists, compatible with NAN v1 method declarations. - -**Example usage with `NAN_METHOD(methodname)`** - -```c++ -// .h: -class Foo : public Nan::ObjectWrap { - ... - - static NAN_METHOD(Bar); - static NAN_METHOD(Baz); -} - - -// .cc: -NAN_METHOD(Foo::Bar) { - ... -} - -NAN_METHOD(Foo::Baz) { - ... -} -``` - -Use [`Nan::SetPrototypeMethod`](#api_nan_set_prototype_method) to attach a method to a JavaScript function prototype or [`Nan::SetMethod`](#api_nan_set_method) to attach a method directly on a JavaScript object. - - -### Getter declaration - -JavaScript-accessible getters should be declared with the following signature to form a `Nan::GetterCallback`: - -```c++ -typedef void(*GetterCallback)(v8::Local, - const PropertyCallbackInfo&); -``` - -Example: - -```c++ -void GetterName(v8::Local property, - const Nan::PropertyCallbackInfo& info) { - ... -} -``` - -You do not need to declare a new `HandleScope` within a getter as one is implicitly created for you. - -A helper macro `NAN_GETTER(methodname)` exists, compatible with NAN v1 method declarations. - -Also see the V8 Embedders Guide documentation on [Accessors](https://developers.google.com/v8/embed#accesssors). - - -### Setter declaration - -JavaScript-accessible setters should be declared with the following signature to form a Nan::SetterCallback: - -```c++ -typedef void(*SetterCallback)(v8::Local, - v8::Local, - const PropertyCallbackInfo&); -``` - -Example: - -```c++ -void SetterName(v8::Local property, - v8::Local value, - const Nan::PropertyCallbackInfo& info) { - ... -} -``` - -You do not need to declare a new `HandleScope` within a setter as one is implicitly created for you. - -A helper macro `NAN_SETTER(methodname)` exists, compatible with NAN v1 method declarations. - -Also see the V8 Embedders Guide documentation on [Accessors](https://developers.google.com/v8/embed#accesssors). - - -### Property getter declaration - -JavaScript-accessible property getters should be declared with the following signature to form a Nan::PropertyGetterCallback: - -```c++ -typedef void(*PropertyGetterCallback)(v8::Local, - const PropertyCallbackInfo&); -``` - -Example: - -```c++ -void PropertyGetterName(v8::Local property, - const Nan::PropertyCallbackInfo& info) { - ... -} -``` - -You do not need to declare a new `HandleScope` within a property getter as one is implicitly created for you. - -A helper macro `NAN_PROPERTY_GETTER(methodname)` exists, compatible with NAN v1 method declarations. - -Also see the V8 Embedders Guide documentation on named property [Interceptors](https://developers.google.com/v8/embed#interceptors). - - -### Property setter declaration - -JavaScript-accessible property setters should be declared with the following signature to form a Nan::PropertySetterCallback: - -```c++ -typedef void(*PropertySetterCallback)(v8::Local, - v8::Local, - const PropertyCallbackInfo&); -``` - -Example: - -```c++ -void PropertySetterName(v8::Local property, - v8::Local value, - const Nan::PropertyCallbackInfo& info); -``` - -You do not need to declare a new `HandleScope` within a property setter as one is implicitly created for you. - -A helper macro `NAN_PROPERTY_SETTER(methodname)` exists, compatible with NAN v1 method declarations. - -Also see the V8 Embedders Guide documentation on named property [Interceptors](https://developers.google.com/v8/embed#interceptors). - - -### Property enumerator declaration - -JavaScript-accessible property enumerators should be declared with the following signature to form a Nan::PropertyEnumeratorCallback: - -```c++ -typedef void(*PropertyEnumeratorCallback)(const PropertyCallbackInfo&); -``` - -Example: - -```c++ -void PropertyEnumeratorName(const Nan::PropertyCallbackInfo& info); -``` - -You do not need to declare a new `HandleScope` within a property enumerator as one is implicitly created for you. - -A helper macro `NAN_PROPERTY_ENUMERATOR(methodname)` exists, compatible with NAN v1 method declarations. - -Also see the V8 Embedders Guide documentation on named property [Interceptors](https://developers.google.com/v8/embed#interceptors). - - -### Property deleter declaration - -JavaScript-accessible property deleters should be declared with the following signature to form a Nan::PropertyDeleterCallback: - -```c++ -typedef void(*PropertyDeleterCallback)(v8::Local, - const PropertyCallbackInfo&); -``` - -Example: - -```c++ -void PropertyDeleterName(v8::Local property, - const Nan::PropertyCallbackInfo& info); -``` - -You do not need to declare a new `HandleScope` within a property deleter as one is implicitly created for you. - -A helper macro `NAN_PROPERTY_DELETER(methodname)` exists, compatible with NAN v1 method declarations. - -Also see the V8 Embedders Guide documentation on named property [Interceptors](https://developers.google.com/v8/embed#interceptors). - - -### Property query declaration - -JavaScript-accessible property query methods should be declared with the following signature to form a Nan::PropertyQueryCallback: - -```c++ -typedef void(*PropertyQueryCallback)(v8::Local, - const PropertyCallbackInfo&); -``` - -Example: - -```c++ -void PropertyQueryName(v8::Local property, - const Nan::PropertyCallbackInfo& info); -``` - -You do not need to declare a new `HandleScope` within a property query method as one is implicitly created for you. - -A helper macro `NAN_PROPERTY_QUERY(methodname)` exists, compatible with NAN v1 method declarations. - -Also see the V8 Embedders Guide documentation on named property [Interceptors](https://developers.google.com/v8/embed#interceptors). - - -### Index getter declaration - -JavaScript-accessible index getter methods should be declared with the following signature to form a Nan::IndexGetterCallback: - -```c++ -typedef void(*IndexGetterCallback)(uint32_t, - const PropertyCallbackInfo&); -``` - -Example: - -```c++ -void IndexGetterName(uint32_t index, const PropertyCallbackInfo& info); -``` - -You do not need to declare a new `HandleScope` within a index getter as one is implicitly created for you. - -A helper macro `NAN_INDEX_GETTER(methodname)` exists, compatible with NAN v1 method declarations. - -Also see the V8 Embedders Guide documentation on indexed property [Interceptors](https://developers.google.com/v8/embed#interceptors). - - -### Index setter declaration - -JavaScript-accessible index setter methods should be declared with the following signature to form a Nan::IndexSetterCallback: - -```c++ -typedef void(*IndexSetterCallback)(uint32_t, - v8::Local, - const PropertyCallbackInfo&); -``` - -Example: - -```c++ -void IndexSetterName(uint32_t index, - v8::Local value, - const PropertyCallbackInfo& info); -``` - -You do not need to declare a new `HandleScope` within a index setter as one is implicitly created for you. - -A helper macro `NAN_INDEX_SETTER(methodname)` exists, compatible with NAN v1 method declarations. - -Also see the V8 Embedders Guide documentation on indexed property [Interceptors](https://developers.google.com/v8/embed#interceptors). - - -### Index enumerator declaration - -JavaScript-accessible index enumerator methods should be declared with the following signature to form a Nan::IndexEnumeratorCallback: - -```c++ -typedef void(*IndexEnumeratorCallback)(const PropertyCallbackInfo&); -``` - -Example: - -```c++ -void IndexEnumeratorName(const PropertyCallbackInfo& info); -``` - -You do not need to declare a new `HandleScope` within a index enumerator as one is implicitly created for you. - -A helper macro `NAN_INDEX_ENUMERATOR(methodname)` exists, compatible with NAN v1 method declarations. - -Also see the V8 Embedders Guide documentation on indexed property [Interceptors](https://developers.google.com/v8/embed#interceptors). - - -### Index deleter declaration - -JavaScript-accessible index deleter methods should be declared with the following signature to form a Nan::IndexDeleterCallback: - -```c++ -typedef void(*IndexDeleterCallback)(uint32_t, - const PropertyCallbackInfo&); -``` - -Example: - -```c++ -void IndexDeleterName(uint32_t index, const PropertyCallbackInfo& info); -``` - -You do not need to declare a new `HandleScope` within a index deleter as one is implicitly created for you. - -A helper macro `NAN_INDEX_DELETER(methodname)` exists, compatible with NAN v1 method declarations. - -Also see the V8 Embedders Guide documentation on indexed property [Interceptors](https://developers.google.com/v8/embed#interceptors). - - -### Index query declaration - -JavaScript-accessible index query methods should be declared with the following signature to form a Nan::IndexQueryCallback: - -```c++ -typedef void(*IndexQueryCallback)(uint32_t, - const PropertyCallbackInfo&); -``` - -Example: - -```c++ -void IndexQueryName(uint32_t index, const PropertyCallbackInfo& info); -``` - -You do not need to declare a new `HandleScope` within a index query method as one is implicitly created for you. - -A helper macro `NAN_INDEX_QUERY(methodname)` exists, compatible with NAN v1 method declarations. - -Also see the V8 Embedders Guide documentation on indexed property [Interceptors](https://developers.google.com/v8/embed#interceptors). - - -### Nan::SetMethod() - -Sets a method with a given name directly on a JavaScript object where the method has the `Nan::FunctionCallback` signature (see Method declaration). - -Signature: - -```c++ -void Nan::SetMethod(v8::Local recv, - const char *name, - Nan::FunctionCallback callback) -void Nan::SetMethod(v8::Local templ, - const char *name, - Nan::FunctionCallback callback) -``` - - -### Nan::SetPrototypeMethod() - -Sets a method with a given name on a `FunctionTemplate`'s prototype where the method has the `Nan::FunctionCallback` signature (see Method declaration). - -Signature: - -```c++ -void Nan::SetPrototypeMethod(v8::Local recv, - const char* name, - Nan::FunctionCallback callback) -``` - - -### Nan::SetAccessor() - -Sets getters and setters for a property with a given name on an `ObjectTemplate` or a plain `Object`. Accepts getters with the `Nan::GetterCallback` signature (see Getter declaration) and setters with the `Nan::SetterCallback` signature (see Setter declaration). - -Signature: - -```c++ -void SetAccessor(v8::Local tpl, - v8::Local name, - Nan::GetterCallback getter, - Nan::SetterCallback setter = 0, - v8::Local data = v8::Local(), - v8::AccessControl settings = v8::DEFAULT, - v8::PropertyAttribute attribute = v8::None, - imp::Sig signature = imp::Sig()); -bool SetAccessor(v8::Local obj, - v8::Local name, - Nan::GetterCallback getter, - Nan::SetterCallback setter = 0, - v8::Local data = v8::Local(), - v8::AccessControl settings = v8::DEFAULT, - v8::PropertyAttribute attribute = v8::None) -``` - -See the V8 [`ObjectTemplate#SetAccessor()`](https://v8docs.nodesource.com/node-8.11/db/d5f/classv8_1_1_object_template.html#aca0ed196f8a9adb1f68b1aadb6c9cd77) and [`Object#SetAccessor()`](https://v8docs.nodesource.com/node-8.11/db/d85/classv8_1_1_object.html#ae91b3b56b357f285288c89fbddc46d1b) for further information about how to use `Nan::SetAccessor()`. - - -### Nan::SetNamedPropertyHandler() - -Sets named property getters, setters, query, deleter and enumerator methods on an `ObjectTemplate`. Accepts: - -* Property getters with the `Nan::PropertyGetterCallback` signature (see Property getter declaration) -* Property setters with the `Nan::PropertySetterCallback` signature (see Property setter declaration) -* Property query methods with the `Nan::PropertyQueryCallback` signature (see Property query declaration) -* Property deleters with the `Nan::PropertyDeleterCallback` signature (see Property deleter declaration) -* Property enumerators with the `Nan::PropertyEnumeratorCallback` signature (see Property enumerator declaration) - -Signature: - -```c++ -void SetNamedPropertyHandler(v8::Local tpl, - Nan::PropertyGetterCallback getter, - Nan::PropertySetterCallback setter = 0, - Nan::PropertyQueryCallback query = 0, - Nan::PropertyDeleterCallback deleter = 0, - Nan::PropertyEnumeratorCallback enumerator = 0, - v8::Local data = v8::Local()) -``` - -See the V8 [`ObjectTemplate#SetNamedPropertyHandler()`](https://v8docs.nodesource.com/node-8.11/db/d5f/classv8_1_1_object_template.html#a33b3ebd7de641f6cc6414b7de01fc1c7) for further information about how to use `Nan::SetNamedPropertyHandler()`. - - -### Nan::SetIndexedPropertyHandler() - -Sets indexed property getters, setters, query, deleter and enumerator methods on an `ObjectTemplate`. Accepts: - -* Indexed property getters with the `Nan::IndexGetterCallback` signature (see Index getter declaration) -* Indexed property setters with the `Nan::IndexSetterCallback` signature (see Index setter declaration) -* Indexed property query methods with the `Nan::IndexQueryCallback` signature (see Index query declaration) -* Indexed property deleters with the `Nan::IndexDeleterCallback` signature (see Index deleter declaration) -* Indexed property enumerators with the `Nan::IndexEnumeratorCallback` signature (see Index enumerator declaration) - -Signature: - -```c++ -void SetIndexedPropertyHandler(v8::Local tpl, - Nan::IndexGetterCallback getter, - Nan::IndexSetterCallback setter = 0, - Nan::IndexQueryCallback query = 0, - Nan::IndexDeleterCallback deleter = 0, - Nan::IndexEnumeratorCallback enumerator = 0, - v8::Local data = v8::Local()) -``` - -See the V8 [`ObjectTemplate#SetIndexedPropertyHandler()`](https://v8docs.nodesource.com/node-8.11/db/d5f/classv8_1_1_object_template.html#ac89f06d634add0e890452033f7d17ff1) for further information about how to use `Nan::SetIndexedPropertyHandler()`. - - -### Nan::SetTemplate() - -Adds properties on an `Object`'s or `Function`'s template. - -Signature: - -```c++ -void Nan::SetTemplate(v8::Local templ, - const char *name, - v8::Local value); -void Nan::SetTemplate(v8::Local templ, - v8::Local name, - v8::Local value, - v8::PropertyAttribute attributes) -``` - -Calls the `Template`'s [`Set()`](https://v8docs.nodesource.com/node-8.11/db/df7/classv8_1_1_template.html#ae3fbaff137557aa6a0233bc7e52214ac). - - -### Nan::SetPrototypeTemplate() - -Adds properties on an `Object`'s or `Function`'s prototype template. - -Signature: - -```c++ -void Nan::SetPrototypeTemplate(v8::Local templ, - const char *name, - v8::Local value); -void Nan::SetPrototypeTemplate(v8::Local templ, - v8::Local name, - v8::Local value, - v8::PropertyAttribute attributes) -``` - -Calls the `FunctionTemplate`'s _PrototypeTemplate's_ [`Set()`](https://v8docs.nodesource.com/node-8.11/db/df7/classv8_1_1_template.html#a2db6a56597bf23c59659c0659e564ddf). - - -### Nan::SetInstanceTemplate() - -Use to add instance properties on `FunctionTemplate`'s. - -Signature: - -```c++ -void Nan::SetInstanceTemplate(v8::Local templ, - const char *name, - v8::Local value); -void Nan::SetInstanceTemplate(v8::Local templ, - v8::Local name, - v8::Local value, - v8::PropertyAttribute attributes) -``` - -Calls the `FunctionTemplate`'s _InstanceTemplate's_ [`Set()`](https://v8docs.nodesource.com/node-8.11/db/df7/classv8_1_1_template.html#a2db6a56597bf23c59659c0659e564ddf). - - -### Nan::SetCallHandler() - -Set the call-handler callback for a `v8::FunctionTemplate`. -This callback is called whenever the function created from this FunctionTemplate is called. - -Signature: - -```c++ -void Nan::SetCallHandler(v8::Local templ, Nan::FunctionCallback callback, v8::Local data = v8::Local()) -``` - -Calls the `FunctionTemplate`'s [`SetCallHandler()`](https://v8docs.nodesource.com/node-8.11/d8/d83/classv8_1_1_function_template.html#ab7574b298db3c27fbc2ed465c08ea2f8). - - -### Nan::SetCallAsFunctionHandler() - -Sets the callback to be used when calling instances created from the `v8::ObjectTemplate` as a function. -If no callback is set, instances behave like normal JavaScript objects that cannot be called as a function. - -Signature: - -```c++ -void Nan::SetCallAsFunctionHandler(v8::Local templ, Nan::FunctionCallback callback, v8::Local data = v8::Local()) -``` - -Calls the `ObjectTemplate`'s [`SetCallAsFunctionHandler()`](https://v8docs.nodesource.com/node-8.11/db/d5f/classv8_1_1_object_template.html#a5e9612fc80bf6db8f2da199b9b0bd04e). - diff --git a/node_modules/node-pty/node_modules/nan/doc/new.md b/node_modules/node-pty/node_modules/nan/doc/new.md deleted file mode 100644 index 359df43..0000000 --- a/node_modules/node-pty/node_modules/nan/doc/new.md +++ /dev/null @@ -1,147 +0,0 @@ -## New - -NAN provides a `Nan::New()` helper for the creation of new JavaScript objects in a way that's compatible across the supported versions of V8. - - - Nan::New() - - Nan::Undefined() - - Nan::Null() - - Nan::True() - - Nan::False() - - Nan::EmptyString() - - - -### Nan::New() - -`Nan::New()` should be used to instantiate new JavaScript objects. - -Refer to the specific V8 type in the [V8 documentation](https://v8docs.nodesource.com/node-8.11/d1/d83/classv8_1_1_data.html) for information on the types of arguments required for instantiation. - -Signatures: - -Return types are mostly omitted from the signatures for simplicity. In most cases the type will be contained within a `v8::Local`. The following types will be contained within a `Nan::MaybeLocal`: `v8::String`, `v8::Date`, `v8::RegExp`, `v8::Script`, `v8::UnboundScript`. - -Empty objects: - -```c++ -Nan::New(); -``` - -Generic single and multiple-argument: - -```c++ -Nan::New(A0 arg0); -Nan::New(A0 arg0, A1 arg1); -Nan::New(A0 arg0, A1 arg1, A2 arg2); -Nan::New(A0 arg0, A1 arg1, A2 arg2, A3 arg3); -``` - -For creating `v8::FunctionTemplate` and `v8::Function` objects: - -_The definition of `Nan::FunctionCallback` can be found in the [Method declaration](./methods.md#api_nan_method) documentation._ - -```c++ -Nan::New(Nan::FunctionCallback callback, - v8::Local data = v8::Local()); -Nan::New(Nan::FunctionCallback callback, - v8::Local data = v8::Local(), - A2 a2 = A2()); -``` - -Native number types: - -```c++ -v8::Local Nan::New(bool value); -v8::Local Nan::New(int32_t value); -v8::Local Nan::New(uint32_t value); -v8::Local Nan::New(double value); -``` - -String types: - -```c++ -Nan::MaybeLocal Nan::New(std::string const& value); -Nan::MaybeLocal Nan::New(const char * value, int length); -Nan::MaybeLocal Nan::New(const char * value); -Nan::MaybeLocal Nan::New(const uint16_t * value); -Nan::MaybeLocal Nan::New(const uint16_t * value, int length); -``` - -Specialized types: - -```c++ -v8::Local Nan::New(v8::String::ExternalStringResource * value); -v8::Local Nan::New(Nan::ExternalOneByteStringResource * value); -v8::Local Nan::New(v8::Local pattern, v8::RegExp::Flags flags); -``` - -Note that `Nan::ExternalOneByteStringResource` maps to [`v8::String::ExternalOneByteStringResource`](https://v8docs.nodesource.com/node-8.11/d9/db3/classv8_1_1_string_1_1_external_one_byte_string_resource.html), and `v8::String::ExternalAsciiStringResource` in older versions of V8. - - - -### Nan::Undefined() - -A helper method to reference the `v8::Undefined` object in a way that is compatible across all supported versions of V8. - -Signature: - -```c++ -v8::Local Nan::Undefined() -``` - - -### Nan::Null() - -A helper method to reference the `v8::Null` object in a way that is compatible across all supported versions of V8. - -Signature: - -```c++ -v8::Local Nan::Null() -``` - - -### Nan::True() - -A helper method to reference the `v8::Boolean` object representing the `true` value in a way that is compatible across all supported versions of V8. - -Signature: - -```c++ -v8::Local Nan::True() -``` - - -### Nan::False() - -A helper method to reference the `v8::Boolean` object representing the `false` value in a way that is compatible across all supported versions of V8. - -Signature: - -```c++ -v8::Local Nan::False() -``` - - -### Nan::EmptyString() - -Call [`v8::String::Empty`](https://v8docs.nodesource.com/node-8.11/d2/db3/classv8_1_1_string.html#a7c1bc8886115d7ee46f1d571dd6ebc6d) to reference the empty string in a way that is compatible across all supported versions of V8. - -Signature: - -```c++ -v8::Local Nan::EmptyString() -``` - - - -### Nan::NewOneByteString() - -An implementation of [`v8::String::NewFromOneByte()`](https://v8docs.nodesource.com/node-8.11/d2/db3/classv8_1_1_string.html#a5264d50b96d2c896ce525a734dc10f09) provided for consistent availability and API across supported versions of V8. Allocates a new string from Latin-1 data. - -Signature: - -```c++ -Nan::MaybeLocal Nan::NewOneByteString(const uint8_t * value, - int length = -1) -``` diff --git a/node_modules/node-pty/node_modules/nan/doc/node_misc.md b/node_modules/node-pty/node_modules/nan/doc/node_misc.md deleted file mode 100644 index 17578e3..0000000 --- a/node_modules/node-pty/node_modules/nan/doc/node_misc.md +++ /dev/null @@ -1,123 +0,0 @@ -## Miscellaneous Node Helpers - - - Nan::AsyncResource - - Nan::MakeCallback() - - NAN_MODULE_INIT() - - Nan::Export() - - -### Nan::AsyncResource - -This class is analogous to the `AsyncResource` JavaScript class exposed by Node's [async_hooks][] API. - -When calling back into JavaScript asynchronously, special care must be taken to ensure that the runtime can properly track -async hops. `Nan::AsyncResource` is a class that provides an RAII wrapper around `node::EmitAsyncInit`, `node::EmitAsyncDestroy`, -and `node::MakeCallback`. Using this mechanism to call back into JavaScript, as opposed to `Nan::MakeCallback` or -`v8::Function::Call` ensures that the callback is executed in the correct async context. This ensures that async mechanisms -such as domains and [async_hooks][] function correctly. - -Definition: - -```c++ -class AsyncResource { - public: - AsyncResource(v8::Local name, - v8::Local resource = New()); - AsyncResource(const char* name, - v8::Local resource = New()); - ~AsyncResource(); - - v8::MaybeLocal runInAsyncScope(v8::Local target, - v8::Local func, - int argc, - v8::Local* argv); - v8::MaybeLocal runInAsyncScope(v8::Local target, - v8::Local symbol, - int argc, - v8::Local* argv); - v8::MaybeLocal runInAsyncScope(v8::Local target, - const char* method, - int argc, - v8::Local* argv); -}; -``` - -* `name`: Identifier for the kind of resource that is being provided for diagnostics information exposed by the [async_hooks][] - API. This will be passed to the possible `init` hook as the `type`. To avoid name collisions with other modules we recommend - that the name include the name of the owning module as a prefix. For example `mysql` module could use something like - `mysql:batch-db-query-resource`. -* `resource`: An optional object associated with the async work that will be passed to the possible [async_hooks][] - `init` hook. If this parameter is omitted, or an empty handle is provided, this object will be created automatically. -* When calling JS on behalf of this resource, one can use `runInAsyncScope`. This will ensure that the callback runs in the - correct async execution context. -* `AsyncDestroy` is automatically called when an AsyncResource object is destroyed. - -For more details, see the Node [async_hooks][] documentation. You might also want to take a look at the documentation for the -[N-API counterpart][napi]. For example usage, see the `asyncresource.cpp` example in the `test/cpp` directory. - - -### Nan::MakeCallback() - -Deprecated wrappers around the legacy `node::MakeCallback()` APIs. Node.js 10+ -has deprecated these legacy APIs as they do not provide a mechanism to preserve -async context. - -We recommend that you use the `AsyncResource` class and `AsyncResource::runInAsyncScope` instead of using `Nan::MakeCallback` or -`v8::Function#Call()` directly. `AsyncResource` properly takes care of running the callback in the correct async execution -context – something that is essential for functionality like domains, async_hooks and async debugging. - -Signatures: - -```c++ -NAN_DEPRECATED -v8::Local Nan::MakeCallback(v8::Local target, - v8::Local func, - int argc, - v8::Local* argv); -NAN_DEPRECATED -v8::Local Nan::MakeCallback(v8::Local target, - v8::Local symbol, - int argc, - v8::Local* argv); -NAN_DEPRECATED -v8::Local Nan::MakeCallback(v8::Local target, - const char* method, - int argc, - v8::Local* argv); -``` - - - -### NAN_MODULE_INIT() - -Used to define the entry point function to a Node add-on. Creates a function with a given `name` that receives a `target` object representing the equivalent of the JavaScript `exports` object. - -See example below. - - -### Nan::Export() - -A simple helper to register a `v8::FunctionTemplate` from a JavaScript-accessible method (see [Methods](./methods.md)) as a property on an object. Can be used in a way similar to assigning properties to `module.exports` in JavaScript. - -Signature: - -```c++ -void Export(v8::Local target, const char *name, Nan::FunctionCallback f) -``` - -Also available as the shortcut `NAN_EXPORT` macro. - -Example: - -```c++ -NAN_METHOD(Foo) { - ... -} - -NAN_MODULE_INIT(Init) { - NAN_EXPORT(target, Foo); -} -``` - -[async_hooks]: https://nodejs.org/dist/latest-v9.x/docs/api/async_hooks.html -[napi]: https://nodejs.org/dist/latest-v9.x/docs/api/n-api.html#n_api_custom_asynchronous_operations diff --git a/node_modules/node-pty/node_modules/nan/doc/object_wrappers.md b/node_modules/node-pty/node_modules/nan/doc/object_wrappers.md deleted file mode 100644 index 08dd6b5..0000000 --- a/node_modules/node-pty/node_modules/nan/doc/object_wrappers.md +++ /dev/null @@ -1,263 +0,0 @@ -## Object Wrappers - -The `ObjectWrap` class can be used to make wrapped C++ objects and a factory of wrapped objects. - - - Nan::ObjectWrap - - - -### Nan::ObjectWrap() - -A reimplementation of `node::ObjectWrap` that adds some API not present in older versions of Node. Should be preferred over `node::ObjectWrap` in all cases for consistency. - -Definition: - -```c++ -class ObjectWrap { - public: - ObjectWrap(); - - virtual ~ObjectWrap(); - - template - static inline T* Unwrap(v8::Local handle); - - inline v8::Local handle(); - - inline Nan::Persistent& persistent(); - - protected: - inline void Wrap(v8::Local handle); - - inline void MakeWeak(); - - /* Ref() marks the object as being attached to an event loop. - * Refed objects will not be garbage collected, even if - * all references are lost. - */ - virtual void Ref(); - - /* Unref() marks an object as detached from the event loop. This is its - * default state. When an object with a "weak" reference changes from - * attached to detached state it will be freed. Be careful not to access - * the object after making this call as it might be gone! - * (A "weak reference" means an object that only has a - * persistant handle.) - * - * DO NOT CALL THIS FROM DESTRUCTOR - */ - virtual void Unref(); - - int refs_; // ro -}; -``` - -See the Node documentation on [Wrapping C++ Objects](https://nodejs.org/api/addons.html#addons_wrapping_c_objects) for more details. - -### This vs. Holder - -When calling `Unwrap`, it is important that the argument is indeed some JavaScript object which got wrapped by a `Wrap` call for this class or any derived class. -The `Signature` installed by [`Nan::SetPrototypeMethod()`](methods.md#api_nan_set_prototype_method) does ensure that `info.Holder()` is just such an instance. -In Node 0.12 and later, `info.This()` will also be of such a type, since otherwise the invocation will get rejected. -However, in Node 0.10 and before it was possible to invoke a method on a JavaScript object which just had the extension type in its prototype chain. -In such a situation, calling `Unwrap` on `info.This()` will likely lead to a failed assertion causing a crash, but could lead to even more serious corruption. - -On the other hand, calling `Unwrap` in an [accessor](methods.md#api_nan_set_accessor) should not use `Holder()` if the accessor is defined on the prototype. -So either define your accessors on the instance template, -or use `This()` after verifying that it is indeed a valid object. - -### Examples - -#### Basic - -```c++ -class MyObject : public Nan::ObjectWrap { - public: - static NAN_MODULE_INIT(Init) { - v8::Local tpl = Nan::New(New); - tpl->SetClassName(Nan::New("MyObject").ToLocalChecked()); - tpl->InstanceTemplate()->SetInternalFieldCount(1); - - Nan::SetPrototypeMethod(tpl, "getHandle", GetHandle); - Nan::SetPrototypeMethod(tpl, "getValue", GetValue); - - constructor().Reset(Nan::GetFunction(tpl).ToLocalChecked()); - Nan::Set(target, Nan::New("MyObject").ToLocalChecked(), - Nan::GetFunction(tpl).ToLocalChecked()); - } - - private: - explicit MyObject(double value = 0) : value_(value) {} - ~MyObject() {} - - static NAN_METHOD(New) { - if (info.IsConstructCall()) { - double value = info[0]->IsUndefined() ? 0 : Nan::To(info[0]).FromJust(); - MyObject *obj = new MyObject(value); - obj->Wrap(info.This()); - info.GetReturnValue().Set(info.This()); - } else { - const int argc = 1; - v8::Local argv[argc] = {info[0]}; - v8::Local cons = Nan::New(constructor()); - info.GetReturnValue().Set(Nan::NewInstance(cons, argc, argv).ToLocalChecked()); - } - } - - static NAN_METHOD(GetHandle) { - MyObject* obj = Nan::ObjectWrap::Unwrap(info.Holder()); - info.GetReturnValue().Set(obj->handle()); - } - - static NAN_METHOD(GetValue) { - MyObject* obj = Nan::ObjectWrap::Unwrap(info.Holder()); - info.GetReturnValue().Set(obj->value_); - } - - static inline Nan::Persistent & constructor() { - static Nan::Persistent my_constructor; - return my_constructor; - } - - double value_; -}; - -NODE_MODULE(objectwrapper, MyObject::Init) -``` - -To use in Javascript: - -```Javascript -var objectwrapper = require('bindings')('objectwrapper'); - -var obj = new objectwrapper.MyObject(5); -console.log('Should be 5: ' + obj.getValue()); -``` - -#### Factory of wrapped objects - -```c++ -class MyFactoryObject : public Nan::ObjectWrap { - public: - static NAN_MODULE_INIT(Init) { - v8::Local tpl = Nan::New(New); - tpl->InstanceTemplate()->SetInternalFieldCount(1); - - Nan::SetPrototypeMethod(tpl, "getValue", GetValue); - - constructor().Reset(Nan::GetFunction(tpl).ToLocalChecked()); - } - - static NAN_METHOD(NewInstance) { - v8::Local cons = Nan::New(constructor()); - double value = info[0]->IsNumber() ? Nan::To(info[0]).FromJust() : 0; - const int argc = 1; - v8::Local argv[1] = {Nan::New(value)}; - info.GetReturnValue().Set(Nan::NewInstance(cons, argc, argv).ToLocalChecked()); - } - - // Needed for the next example: - inline double value() const { - return value_; - } - - private: - explicit MyFactoryObject(double value = 0) : value_(value) {} - ~MyFactoryObject() {} - - static NAN_METHOD(New) { - if (info.IsConstructCall()) { - double value = info[0]->IsNumber() ? Nan::To(info[0]).FromJust() : 0; - MyFactoryObject * obj = new MyFactoryObject(value); - obj->Wrap(info.This()); - info.GetReturnValue().Set(info.This()); - } else { - const int argc = 1; - v8::Local argv[argc] = {info[0]}; - v8::Local cons = Nan::New(constructor()); - info.GetReturnValue().Set(Nan::NewInstance(cons, argc, argv).ToLocalChecked()); - } - } - - static NAN_METHOD(GetValue) { - MyFactoryObject* obj = ObjectWrap::Unwrap(info.Holder()); - info.GetReturnValue().Set(obj->value_); - } - - static inline Nan::Persistent & constructor() { - static Nan::Persistent my_constructor; - return my_constructor; - } - - double value_; -}; - -NAN_MODULE_INIT(Init) { - MyFactoryObject::Init(target); - Nan::Set(target, - Nan::New("newFactoryObjectInstance").ToLocalChecked(), - Nan::GetFunction( - Nan::New(MyFactoryObject::NewInstance)).ToLocalChecked() - ); -} - -NODE_MODULE(wrappedobjectfactory, Init) -``` - -To use in Javascript: - -```Javascript -var wrappedobjectfactory = require('bindings')('wrappedobjectfactory'); - -var obj = wrappedobjectfactory.newFactoryObjectInstance(10); -console.log('Should be 10: ' + obj.getValue()); -``` - -#### Passing wrapped objects around - -Use the `MyFactoryObject` class above along with the following: - -```c++ -static NAN_METHOD(Sum) { - Nan::MaybeLocal maybe1 = Nan::To(info[0]); - Nan::MaybeLocal maybe2 = Nan::To(info[1]); - - // Quick check: - if (maybe1.IsEmpty() || maybe2.IsEmpty()) { - // return value is undefined by default - return; - } - - MyFactoryObject* obj1 = - Nan::ObjectWrap::Unwrap(maybe1.ToLocalChecked()); - MyFactoryObject* obj2 = - Nan::ObjectWrap::Unwrap(maybe2.ToLocalChecked()); - - info.GetReturnValue().Set(Nan::New(obj1->value() + obj2->value())); -} - -NAN_MODULE_INIT(Init) { - MyFactoryObject::Init(target); - Nan::Set(target, - Nan::New("newFactoryObjectInstance").ToLocalChecked(), - Nan::GetFunction( - Nan::New(MyFactoryObject::NewInstance)).ToLocalChecked() - ); - Nan::Set(target, - Nan::New("sum").ToLocalChecked(), - Nan::GetFunction(Nan::New(Sum)).ToLocalChecked() - ); -} - -NODE_MODULE(myaddon, Init) -``` - -To use in Javascript: - -```Javascript -var myaddon = require('bindings')('myaddon'); - -var obj1 = myaddon.newFactoryObjectInstance(5); -var obj2 = myaddon.newFactoryObjectInstance(10); -console.log('sum of object values: ' + myaddon.sum(obj1, obj2)); -``` diff --git a/node_modules/node-pty/node_modules/nan/doc/persistent.md b/node_modules/node-pty/node_modules/nan/doc/persistent.md deleted file mode 100644 index bec9c3f..0000000 --- a/node_modules/node-pty/node_modules/nan/doc/persistent.md +++ /dev/null @@ -1,296 +0,0 @@ -## Persistent references - -An object reference that is independent of any `HandleScope` is a _persistent_ reference. Where a `Local` handle only lives as long as the `HandleScope` in which it was allocated, a `Persistent` handle remains valid until it is explicitly disposed. - -Due to the evolution of the V8 API, it is necessary for NAN to provide a wrapper implementation of the `Persistent` classes to supply compatibility across the V8 versions supported. - - - Nan::PersistentBase & v8::PersistentBase - - Nan::NonCopyablePersistentTraits & v8::NonCopyablePersistentTraits - - Nan::CopyablePersistentTraits & v8::CopyablePersistentTraits - - Nan::Persistent - - Nan::Global - - Nan::WeakCallbackInfo - - Nan::WeakCallbackType - -Also see the V8 Embedders Guide section on [Handles and Garbage Collection](https://developers.google.com/v8/embed#handles). - - -### Nan::PersistentBase & v8::PersistentBase - -A persistent handle contains a reference to a storage cell in V8 which holds an object value and which is updated by the garbage collector whenever the object is moved. A new storage cell can be created using the constructor or `Nan::PersistentBase::Reset()`. Existing handles can be disposed using an argument-less `Nan::PersistentBase::Reset()`. - -Definition: - -_(note: this is implemented as `Nan::PersistentBase` for older versions of V8 and the native `v8::PersistentBase` is used for newer versions of V8)_ - -```c++ -template class PersistentBase { - public: - /** - * If non-empty, destroy the underlying storage cell - */ - void Reset(); - - /** - * If non-empty, destroy the underlying storage cell and create a new one with - * the contents of another if it is also non-empty - */ - template void Reset(const v8::Local &other); - - /** - * If non-empty, destroy the underlying storage cell and create a new one with - * the contents of another if it is also non-empty - */ - template void Reset(const PersistentBase &other); - - /** Returns true if the handle is empty. */ - bool IsEmpty() const; - - /** - * If non-empty, destroy the underlying storage cell - * IsEmpty() will return true after this call. - */ - void Empty(); - - template bool operator==(const PersistentBase &that); - - template bool operator==(const v8::Local &that); - - template bool operator!=(const PersistentBase &that); - - template bool operator!=(const v8::Local &that); - - /** - * Install a finalization callback on this object. - * NOTE: There is no guarantee as to *when* or even *if* the callback is - * invoked. The invocation is performed solely on a best effort basis. - * As always, GC-based finalization should *not* be relied upon for any - * critical form of resource management! At the moment you can either - * specify a parameter for the callback or the location of two internal - * fields in the dying object. - */ - template - void SetWeak(P *parameter, - typename WeakCallbackInfo

::Callback callback, - WeakCallbackType type); - - void ClearWeak(); - - /** - * Marks the reference to this object independent. Garbage collector is free - * to ignore any object groups containing this object. Weak callback for an - * independent handle should not assume that it will be preceded by a global - * GC prologue callback or followed by a global GC epilogue callback. - */ - void MarkIndependent() const; - - bool IsIndependent() const; - - /** Checks if the handle holds the only reference to an object. */ - bool IsNearDeath() const; - - /** Returns true if the handle's reference is weak. */ - bool IsWeak() const -}; -``` - -See the V8 documentation for [`PersistentBase`](https://v8docs.nodesource.com/node-8.11/d4/dca/classv8_1_1_persistent_base.html) for further information. - -**Tip:** To get a `v8::Local` reference to the original object back from a `PersistentBase` or `Persistent` object: - -```c++ -v8::Local object = Nan::New(persistent); -``` - - -### Nan::NonCopyablePersistentTraits & v8::NonCopyablePersistentTraits - -Default traits for `Nan::Persistent`. This class does not allow use of the a copy constructor or assignment operator. At present `kResetInDestructor` is not set, but that will change in a future version. - -Definition: - -_(note: this is implemented as `Nan::NonCopyablePersistentTraits` for older versions of V8 and the native `v8::NonCopyablePersistentTraits` is used for newer versions of V8)_ - -```c++ -template class NonCopyablePersistentTraits { - public: - typedef Persistent > NonCopyablePersistent; - - static const bool kResetInDestructor = false; - - template - static void Copy(const Persistent &source, - NonCopyablePersistent *dest); - - template static void Uncompilable(); -}; -``` - -See the V8 documentation for [`NonCopyablePersistentTraits`](https://v8docs.nodesource.com/node-8.11/de/d73/classv8_1_1_non_copyable_persistent_traits.html) for further information. - - -### Nan::CopyablePersistentTraits & v8::CopyablePersistentTraits - -A helper class of traits to allow copying and assignment of `Persistent`. This will clone the contents of storage cell, but not any of the flags, etc.. - -Definition: - -_(note: this is implemented as `Nan::CopyablePersistentTraits` for older versions of V8 and the native `v8::NonCopyablePersistentTraits` is used for newer versions of V8)_ - -```c++ -template -class CopyablePersistentTraits { - public: - typedef Persistent > CopyablePersistent; - - static const bool kResetInDestructor = true; - - template - static void Copy(const Persistent &source, - CopyablePersistent *dest); -}; -``` - -See the V8 documentation for [`CopyablePersistentTraits`](https://v8docs.nodesource.com/node-8.11/da/d5c/structv8_1_1_copyable_persistent_traits.html) for further information. - - -### Nan::Persistent - -A type of `PersistentBase` which allows copy and assignment. Copy, assignment and destructor behavior is controlled by the traits class `M`. - -Definition: - -```c++ -template > -class Persistent; - -template class Persistent : public PersistentBase { - public: - /** - * A Persistent with no storage cell. - */ - Persistent(); - - /** - * Construct a Persistent from a v8::Local. When the v8::Local is non-empty, a - * new storage cell is created pointing to the same object, and no flags are - * set. - */ - template Persistent(v8::Local that); - - /** - * Construct a Persistent from a Persistent. When the Persistent is non-empty, - * a new storage cell is created pointing to the same object, and no flags are - * set. - */ - Persistent(const Persistent &that); - - /** - * The copy constructors and assignment operator create a Persistent exactly - * as the Persistent constructor, but the Copy function from the traits class - * is called, allowing the setting of flags based on the copied Persistent. - */ - Persistent &operator=(const Persistent &that); - - template - Persistent &operator=(const Persistent &that); - - /** - * The destructor will dispose the Persistent based on the kResetInDestructor - * flags in the traits class. Since not calling dispose can result in a - * memory leak, it is recommended to always set this flag. - */ - ~Persistent(); -}; -``` - -See the V8 documentation for [`Persistent`](https://v8docs.nodesource.com/node-8.11/d2/d78/classv8_1_1_persistent.html) for further information. - - -### Nan::Global - -A type of `PersistentBase` which has move semantics. - -```c++ -template class Global : public PersistentBase { - public: - /** - * A Global with no storage cell. - */ - Global(); - - /** - * Construct a Global from a v8::Local. When the v8::Local is non-empty, a new - * storage cell is created pointing to the same object, and no flags are set. - */ - template Global(v8::Local that); - /** - * Construct a Global from a PersistentBase. When the Persistent is non-empty, - * a new storage cell is created pointing to the same object, and no flags are - * set. - */ - template Global(const PersistentBase &that); - - /** - * Pass allows returning globals from functions, etc. - */ - Global Pass(); -}; -``` - -See the V8 documentation for [`Global`](https://v8docs.nodesource.com/node-8.11/d5/d40/classv8_1_1_global.html) for further information. - - -### Nan::WeakCallbackInfo - -`Nan::WeakCallbackInfo` is used as an argument when setting a persistent reference as weak. You may need to free any external resources attached to the object. It is a mirror of `v8:WeakCallbackInfo` as found in newer versions of V8. - -Definition: - -```c++ -template class WeakCallbackInfo { - public: - typedef void (*Callback)(const WeakCallbackInfo& data); - - v8::Isolate *GetIsolate() const; - - /** - * Get the parameter that was associated with the weak handle. - */ - T *GetParameter() const; - - /** - * Get pointer from internal field, index can be 0 or 1. - */ - void *GetInternalField(int index) const; -}; -``` - -Example usage: - -```c++ -void weakCallback(const WeakCallbackInfo &data) { - int *parameter = data.GetParameter(); - delete parameter; -} - -Persistent obj; -int *data = new int(0); -obj.SetWeak(data, callback, WeakCallbackType::kParameter); -``` - -See the V8 documentation for [`WeakCallbackInfo`](https://v8docs.nodesource.com/node-8.11/d8/d06/classv8_1_1_weak_callback_info.html) for further information. - - -### Nan::WeakCallbackType - -Represents the type of a weak callback. -A weak callback of type `kParameter` makes the supplied parameter to `Nan::PersistentBase::SetWeak` available through `WeakCallbackInfo::GetParameter`. -A weak callback of type `kInternalFields` uses up to two internal fields at indices 0 and 1 on the `Nan::PersistentBase` being made weak. -Note that only `v8::Object`s and derivatives can have internal fields. - -Definition: - -```c++ -enum class WeakCallbackType { kParameter, kInternalFields }; -``` diff --git a/node_modules/node-pty/node_modules/nan/doc/scopes.md b/node_modules/node-pty/node_modules/nan/doc/scopes.md deleted file mode 100644 index 27ab863..0000000 --- a/node_modules/node-pty/node_modules/nan/doc/scopes.md +++ /dev/null @@ -1,73 +0,0 @@ -## Scopes - -A _local handle_ is a pointer to an object. All V8 objects are accessed using handles, they are necessary because of the way the V8 garbage collector works. - -A handle scope can be thought of as a container for any number of handles. When you've finished with your handles, instead of deleting each one individually you can simply delete their scope. - -The creation of `HandleScope` objects is different across the supported versions of V8. Therefore, NAN provides its own implementations that can be used safely across these. - - - Nan::HandleScope - - Nan::EscapableHandleScope - -Also see the V8 Embedders Guide section on [Handles and Garbage Collection](https://github.com/v8/v8/wiki/Embedder%27s%20Guide#handles-and-garbage-collection). - - -### Nan::HandleScope - -A simple wrapper around [`v8::HandleScope`](https://v8docs.nodesource.com/node-8.11/d3/d95/classv8_1_1_handle_scope.html). - -Definition: - -```c++ -class Nan::HandleScope { - public: - Nan::HandleScope(); - static int NumberOfHandles(); -}; -``` - -Allocate a new `Nan::HandleScope` whenever you are creating new V8 JavaScript objects. Note that an implicit `HandleScope` is created for you on JavaScript-accessible methods so you do not need to insert one yourself. - -Example: - -```c++ -// new object is created, it needs a new scope: -void Pointless() { - Nan::HandleScope scope; - v8::Local obj = Nan::New(); -} - -// JavaScript-accessible method already has a HandleScope -NAN_METHOD(Pointless2) { - v8::Local obj = Nan::New(); -} -``` - - -### Nan::EscapableHandleScope - -Similar to [`Nan::HandleScope`](#api_nan_handle_scope) but should be used in cases where a function needs to return a V8 JavaScript type that has been created within it. - -Definition: - -```c++ -class Nan::EscapableHandleScope { - public: - Nan::EscapableHandleScope(); - static int NumberOfHandles(); - template v8::Local Escape(v8::Local value); -} -``` - -Use `Escape(value)` to return the object. - -Example: - -```c++ -v8::Local EmptyObj() { - Nan::EscapableHandleScope scope; - v8::Local obj = Nan::New(); - return scope.Escape(obj); -} -``` - diff --git a/node_modules/node-pty/node_modules/nan/doc/script.md b/node_modules/node-pty/node_modules/nan/doc/script.md deleted file mode 100644 index 945398f..0000000 --- a/node_modules/node-pty/node_modules/nan/doc/script.md +++ /dev/null @@ -1,38 +0,0 @@ -## Script - -NAN provides a `v8::Script` helpers as the API has changed over the supported versions of V8. - - - Nan::CompileScript() - - Nan::RunScript() - - - -### Nan::CompileScript() - -A wrapper around [`v8::ScriptCompiler::Compile()`](https://v8docs.nodesource.com/node-8.11/da/da5/classv8_1_1_script_compiler.html#a93f5072a0db55d881b969e9fc98e564b). - -Note that `Nan::BoundScript` is an alias for `v8::Script`. - -Signature: - -```c++ -Nan::MaybeLocal Nan::CompileScript( - v8::Local s, - const v8::ScriptOrigin& origin); -Nan::MaybeLocal Nan::CompileScript(v8::Local s); -``` - - - -### Nan::RunScript() - -Calls `script->Run()` or `script->BindToCurrentContext()->Run(Nan::GetCurrentContext())`. - -Note that `Nan::BoundScript` is an alias for `v8::Script` and `Nan::UnboundScript` is an alias for `v8::UnboundScript` where available and `v8::Script` on older versions of V8. - -Signature: - -```c++ -Nan::MaybeLocal Nan::RunScript(v8::Local script) -Nan::MaybeLocal Nan::RunScript(v8::Local script) -``` diff --git a/node_modules/node-pty/node_modules/nan/doc/string_bytes.md b/node_modules/node-pty/node_modules/nan/doc/string_bytes.md deleted file mode 100644 index 7c1bd32..0000000 --- a/node_modules/node-pty/node_modules/nan/doc/string_bytes.md +++ /dev/null @@ -1,62 +0,0 @@ -## Strings & Bytes - -Miscellaneous string & byte encoding and decoding functionality provided for compatibility across supported versions of V8 and Node. Implemented by NAN to ensure that all encoding types are supported, even for older versions of Node where they are missing. - - - Nan::Encoding - - Nan::Encode() - - Nan::DecodeBytes() - - Nan::DecodeWrite() - - - -### Nan::Encoding - -An enum representing the supported encoding types. A copy of `node::encoding` that is consistent across versions of Node. - -Definition: - -```c++ -enum Nan::Encoding { ASCII, UTF8, BASE64, UCS2, BINARY, HEX, BUFFER } -``` - - - -### Nan::Encode() - -A wrapper around `node::Encode()` that provides a consistent implementation across supported versions of Node. - -Signature: - -```c++ -v8::Local Nan::Encode(const void *buf, - size_t len, - enum Nan::Encoding encoding = BINARY); -``` - - - -### Nan::DecodeBytes() - -A wrapper around `node::DecodeBytes()` that provides a consistent implementation across supported versions of Node. - -Signature: - -```c++ -ssize_t Nan::DecodeBytes(v8::Local val, - enum Nan::Encoding encoding = BINARY); -``` - - - -### Nan::DecodeWrite() - -A wrapper around `node::DecodeWrite()` that provides a consistent implementation across supported versions of Node. - -Signature: - -```c++ -ssize_t Nan::DecodeWrite(char *buf, - size_t len, - v8::Local val, - enum Nan::Encoding encoding = BINARY); -``` diff --git a/node_modules/node-pty/node_modules/nan/doc/v8_internals.md b/node_modules/node-pty/node_modules/nan/doc/v8_internals.md deleted file mode 100644 index 88bd2de..0000000 --- a/node_modules/node-pty/node_modules/nan/doc/v8_internals.md +++ /dev/null @@ -1,199 +0,0 @@ -## V8 internals - -The hooks to access V8 internals—including GC and statistics—are different across the supported versions of V8, therefore NAN provides its own hooks that call the appropriate V8 methods. - - - NAN_GC_CALLBACK() - - Nan::AddGCEpilogueCallback() - - Nan::RemoveGCEpilogueCallback() - - Nan::AddGCPrologueCallback() - - Nan::RemoveGCPrologueCallback() - - Nan::GetHeapStatistics() - - Nan::SetCounterFunction() - - Nan::SetCreateHistogramFunction() - - Nan::SetAddHistogramSampleFunction() - - Nan::IdleNotification() - - Nan::LowMemoryNotification() - - Nan::ContextDisposedNotification() - - Nan::GetInternalFieldPointer() - - Nan::SetInternalFieldPointer() - - Nan::AdjustExternalMemory() - - - -### NAN_GC_CALLBACK(callbackname) - -Use `NAN_GC_CALLBACK` to declare your callbacks for `Nan::AddGCPrologueCallback()` and `Nan::AddGCEpilogueCallback()`. Your new method receives the arguments `v8::GCType type` and `v8::GCCallbackFlags flags`. - -```c++ -static Nan::Persistent callback; - -NAN_GC_CALLBACK(gcPrologueCallback) { - v8::Local argv[] = { Nan::New("prologue").ToLocalChecked() }; - Nan::MakeCallback(Nan::GetCurrentContext()->Global(), Nan::New(callback), 1, argv); -} - -NAN_METHOD(Hook) { - callback.Reset(To(args[0]).ToLocalChecked()); - Nan::AddGCPrologueCallback(gcPrologueCallback); - info.GetReturnValue().Set(info.Holder()); -} -``` - - -### Nan::AddGCEpilogueCallback() - -Signature: - -```c++ -void Nan::AddGCEpilogueCallback(v8::Isolate::GCEpilogueCallback callback, v8::GCType gc_type_filter = v8::kGCTypeAll) -``` - -Calls V8's [`AddGCEpilogueCallback()`](https://v8docs.nodesource.com/node-8.11/d5/dda/classv8_1_1_isolate.html#a580f976e4290cead62c2fc4dd396be3e). - - -### Nan::RemoveGCEpilogueCallback() - -Signature: - -```c++ -void Nan::RemoveGCEpilogueCallback(v8::Isolate::GCEpilogueCallback callback) -``` - -Calls V8's [`RemoveGCEpilogueCallback()`](https://v8docs.nodesource.com/node-8.11/d5/dda/classv8_1_1_isolate.html#adca9294555a3908e9f23c7bb0f0f284c). - - -### Nan::AddGCPrologueCallback() - -Signature: - -```c++ -void Nan::AddGCPrologueCallback(v8::Isolate::GCPrologueCallback, v8::GCType gc_type_filter callback) -``` - -Calls V8's [`AddGCPrologueCallback()`](https://v8docs.nodesource.com/node-8.11/d5/dda/classv8_1_1_isolate.html#a6dbef303603ebdb03da6998794ea05b8). - - -### Nan::RemoveGCPrologueCallback() - -Signature: - -```c++ -void Nan::RemoveGCPrologueCallback(v8::Isolate::GCPrologueCallback callback) -``` - -Calls V8's [`RemoveGCPrologueCallback()`](https://v8docs.nodesource.com/node-8.11/d5/dda/classv8_1_1_isolate.html#a5f72c7cda21415ce062bbe5c58abe09e). - - -### Nan::GetHeapStatistics() - -Signature: - -```c++ -void Nan::GetHeapStatistics(v8::HeapStatistics *heap_statistics) -``` - -Calls V8's [`GetHeapStatistics()`](https://v8docs.nodesource.com/node-8.11/d5/dda/classv8_1_1_isolate.html#a5593ac74687b713095c38987e5950b34). - - -### Nan::SetCounterFunction() - -Signature: - -```c++ -void Nan::SetCounterFunction(v8::CounterLookupCallback cb) -``` - -Calls V8's [`SetCounterFunction()`](https://v8docs.nodesource.com/node-8.11/d5/dda/classv8_1_1_isolate.html#a045d7754e62fa0ec72ae6c259b29af94). - - -### Nan::SetCreateHistogramFunction() - -Signature: - -```c++ -void Nan::SetCreateHistogramFunction(v8::CreateHistogramCallback cb) -``` - -Calls V8's [`SetCreateHistogramFunction()`](https://v8docs.nodesource.com/node-8.11/d5/dda/classv8_1_1_isolate.html#a542d67e85089cb3f92aadf032f99e732). - - -### Nan::SetAddHistogramSampleFunction() - -Signature: - -```c++ -void Nan::SetAddHistogramSampleFunction(v8::AddHistogramSampleCallback cb) -``` - -Calls V8's [`SetAddHistogramSampleFunction()`](https://v8docs.nodesource.com/node-8.11/d5/dda/classv8_1_1_isolate.html#aeb420b690bc2c216882d6fdd00ddd3ea). - - -### Nan::IdleNotification() - -Signature: - -```c++ -bool Nan::IdleNotification(int idle_time_in_ms) -``` - -Calls V8's [`IdleNotification()` or `IdleNotificationDeadline()`](https://v8docs.nodesource.com/node-8.11/d5/dda/classv8_1_1_isolate.html#ad6a2a02657f5425ad460060652a5a118) depending on V8 version. - - -### Nan::LowMemoryNotification() - -Signature: - -```c++ -void Nan::LowMemoryNotification() -``` - -Calls V8's [`LowMemoryNotification()`](https://v8docs.nodesource.com/node-8.11/d5/dda/classv8_1_1_isolate.html#a24647f61d6b41f69668094bdcd6ea91f). - - -### Nan::ContextDisposedNotification() - -Signature: - -```c++ -void Nan::ContextDisposedNotification() -``` - -Calls V8's [`ContextDisposedNotification()`](https://v8docs.nodesource.com/node-8.11/d5/dda/classv8_1_1_isolate.html#ad7f5dc559866343fe6cd8db1f134d48b). - - -### Nan::GetInternalFieldPointer() - -Gets a pointer to the internal field with at `index` from a V8 `Object` handle. - -Signature: - -```c++ -void* Nan::GetInternalFieldPointer(v8::Local object, int index) -``` - -Calls the Object's [`GetAlignedPointerFromInternalField()` or `GetPointerFromInternalField()`](https://v8docs.nodesource.com/node-8.11/db/d85/classv8_1_1_object.html#a580ea84afb26c005d6762eeb9e3c308f) depending on the version of V8. - - -### Nan::SetInternalFieldPointer() - -Sets the value of the internal field at `index` on a V8 `Object` handle. - -Signature: - -```c++ -void Nan::SetInternalFieldPointer(v8::Local object, int index, void* value) -``` - -Calls the Object's [`SetAlignedPointerInInternalField()` or `SetPointerInInternalField()`](https://v8docs.nodesource.com/node-8.11/db/d85/classv8_1_1_object.html#ab3c57184263cf29963ef0017bec82281) depending on the version of V8. - - -### Nan::AdjustExternalMemory() - -Signature: - -```c++ -int Nan::AdjustExternalMemory(int bytesChange) -``` - -Calls V8's [`AdjustAmountOfExternalAllocatedMemory()`](https://v8docs.nodesource.com/node-8.11/d5/dda/classv8_1_1_isolate.html#ae1a59cac60409d3922582c4af675473e). - diff --git a/node_modules/node-pty/node_modules/nan/doc/v8_misc.md b/node_modules/node-pty/node_modules/nan/doc/v8_misc.md deleted file mode 100644 index 8e2db20..0000000 --- a/node_modules/node-pty/node_modules/nan/doc/v8_misc.md +++ /dev/null @@ -1,85 +0,0 @@ -## Miscellaneous V8 Helpers - - - Nan::Utf8String - - Nan::GetCurrentContext() - - Nan::SetIsolateData() - - Nan::GetIsolateData() - - Nan::TypedArrayContents - - - -### Nan::Utf8String - -Converts an object to a UTF-8-encoded character array. If conversion to a string fails (e.g. due to an exception in the toString() method of the object) then the length() method returns 0 and the * operator returns NULL. The underlying memory used for this object is managed by the object. - -An implementation of [`v8::String::Utf8Value`](https://v8docs.nodesource.com/node-8.11/d4/d1b/classv8_1_1_string_1_1_utf8_value.html) that is consistent across all supported versions of V8. - -Definition: - -```c++ -class Nan::Utf8String { - public: - Nan::Utf8String(v8::Local from); - - int length() const; - - char* operator*(); - const char* operator*() const; -}; -``` - - -### Nan::GetCurrentContext() - -A call to [`v8::Isolate::GetCurrent()->GetCurrentContext()`](https://v8docs.nodesource.com/node-8.11/d5/dda/classv8_1_1_isolate.html#a81c7a1ed7001ae2a65e89107f75fd053) that works across all supported versions of V8. - -Signature: - -```c++ -v8::Local Nan::GetCurrentContext() -``` - - -### Nan::SetIsolateData() - -A helper to provide a consistent API to [`v8::Isolate#SetData()`](https://v8docs.nodesource.com/node-8.11/d5/dda/classv8_1_1_isolate.html#a7acadfe7965997e9c386a05f098fbe36). - -Signature: - -```c++ -void Nan::SetIsolateData(v8::Isolate *isolate, T *data) -``` - - - -### Nan::GetIsolateData() - -A helper to provide a consistent API to [`v8::Isolate#GetData()`](https://v8docs.nodesource.com/node-8.11/d5/dda/classv8_1_1_isolate.html#aabd223436bc1100a787dadaa024c6257). - -Signature: - -```c++ -T *Nan::GetIsolateData(v8::Isolate *isolate) -``` - - -### Nan::TypedArrayContents - -A helper class for accessing the contents of an ArrayBufferView (aka a typedarray) from C++. If the input array is not a valid typedarray, then the data pointer of TypedArrayContents will default to `NULL` and the length will be 0. If the data pointer is not compatible with the alignment requirements of type, an assertion error will fail. - -Note that you must store a reference to the `array` object while you are accessing its contents. - -Definition: - -```c++ -template -class Nan::TypedArrayContents { - public: - TypedArrayContents(v8::Local array); - - size_t length() const; - - T* const operator*(); - const T* const operator*() const; -}; -``` diff --git a/node_modules/node-pty/node_modules/nan/include_dirs.js b/node_modules/node-pty/node_modules/nan/include_dirs.js deleted file mode 100644 index 4f1dfb4..0000000 --- a/node_modules/node-pty/node_modules/nan/include_dirs.js +++ /dev/null @@ -1 +0,0 @@ -console.log(require('path').relative('.', __dirname)); diff --git a/node_modules/node-pty/node_modules/nan/nan.h b/node_modules/node-pty/node_modules/nan/nan.h deleted file mode 100644 index 514115d..0000000 --- a/node_modules/node-pty/node_modules/nan/nan.h +++ /dev/null @@ -1,2892 +0,0 @@ -/********************************************************************* - * NAN - Native Abstractions for Node.js - * - * Copyright (c) 2018 NAN contributors: - * - Rod Vagg - * - Benjamin Byholm - * - Trevor Norris - * - Nathan Rajlich - * - Brett Lawson - * - Ben Noordhuis - * - David Siegel - * - Michael Ira Krufky - * - * MIT License - * - * Version 2.14.0: current Node 12.2.0, Node 12: 0.12.18, Node 10: 0.10.48, iojs: 3.3.1 - * - * See https://github.com/nodejs/nan for the latest update to this file - **********************************************************************************/ - -#ifndef NAN_H_ -#define NAN_H_ - -#include - -#define NODE_0_10_MODULE_VERSION 11 -#define NODE_0_12_MODULE_VERSION 14 -#define ATOM_0_21_MODULE_VERSION 41 -#define IOJS_1_0_MODULE_VERSION 42 -#define IOJS_1_1_MODULE_VERSION 43 -#define IOJS_2_0_MODULE_VERSION 44 -#define IOJS_3_0_MODULE_VERSION 45 -#define NODE_4_0_MODULE_VERSION 46 -#define NODE_5_0_MODULE_VERSION 47 -#define NODE_6_0_MODULE_VERSION 48 -#define NODE_7_0_MODULE_VERSION 51 -#define NODE_8_0_MODULE_VERSION 57 -#define NODE_9_0_MODULE_VERSION 59 -#define NODE_10_0_MODULE_VERSION 64 -#define NODE_11_0_MODULE_VERSION 67 -#define NODE_12_0_MODULE_VERSION 72 - -#ifdef _MSC_VER -# define NAN_HAS_CPLUSPLUS_11 (_MSC_VER >= 1800) -#else -# define NAN_HAS_CPLUSPLUS_11 (__cplusplus >= 201103L) -#endif - -#if NODE_MODULE_VERSION >= IOJS_3_0_MODULE_VERSION && !NAN_HAS_CPLUSPLUS_11 -# error This version of node/NAN/v8 requires a C++11 compiler -#endif - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#if defined(_MSC_VER) -# pragma warning( push ) -# pragma warning( disable : 4530 ) -# include -# include -# include -# pragma warning( pop ) -#else -# include -# include -# include -#endif - -// uv helpers -#ifdef UV_VERSION_MAJOR -# ifndef UV_VERSION_PATCH -# define UV_VERSION_PATCH 0 -# endif -# define NAUV_UVVERSION ((UV_VERSION_MAJOR << 16) | \ - (UV_VERSION_MINOR << 8) | \ - (UV_VERSION_PATCH)) -#else -# define NAUV_UVVERSION 0x000b00 -#endif - -#if NAUV_UVVERSION < 0x000b0b -# ifdef WIN32 -# include -# else -# include -# endif -#endif - -namespace Nan { - -#define NAN_CONCAT(a, b) NAN_CONCAT_HELPER(a, b) -#define NAN_CONCAT_HELPER(a, b) a##b - -#define NAN_INLINE inline // TODO(bnoordhuis) Remove in v3.0.0. - -#if defined(__GNUC__) && \ - !(defined(V8_DISABLE_DEPRECATIONS) && V8_DISABLE_DEPRECATIONS) -# define NAN_DEPRECATED __attribute__((deprecated)) -#elif defined(_MSC_VER) && \ - !(defined(V8_DISABLE_DEPRECATIONS) && V8_DISABLE_DEPRECATIONS) -# define NAN_DEPRECATED __declspec(deprecated) -#else -# define NAN_DEPRECATED -#endif - -#if NAN_HAS_CPLUSPLUS_11 -# define NAN_DISALLOW_ASSIGN(CLASS) void operator=(const CLASS&) = delete; -# define NAN_DISALLOW_COPY(CLASS) CLASS(const CLASS&) = delete; -# define NAN_DISALLOW_MOVE(CLASS) \ - CLASS(CLASS&&) = delete; /* NOLINT(build/c++11) */ \ - void operator=(CLASS&&) = delete; -#else -# define NAN_DISALLOW_ASSIGN(CLASS) void operator=(const CLASS&); -# define NAN_DISALLOW_COPY(CLASS) CLASS(const CLASS&); -# define NAN_DISALLOW_MOVE(CLASS) -#endif - -#define NAN_DISALLOW_ASSIGN_COPY(CLASS) \ - NAN_DISALLOW_ASSIGN(CLASS) \ - NAN_DISALLOW_COPY(CLASS) - -#define NAN_DISALLOW_ASSIGN_MOVE(CLASS) \ - NAN_DISALLOW_ASSIGN(CLASS) \ - NAN_DISALLOW_MOVE(CLASS) - -#define NAN_DISALLOW_COPY_MOVE(CLASS) \ - NAN_DISALLOW_COPY(CLASS) \ - NAN_DISALLOW_MOVE(CLASS) - -#define NAN_DISALLOW_ASSIGN_COPY_MOVE(CLASS) \ - NAN_DISALLOW_ASSIGN(CLASS) \ - NAN_DISALLOW_COPY(CLASS) \ - NAN_DISALLOW_MOVE(CLASS) - -#define TYPE_CHECK(T, S) \ - while (false) { \ - *(static_cast(0)) = static_cast(0); \ - } - -//=== RegistrationFunction ===================================================== - -#if NODE_MODULE_VERSION < IOJS_3_0_MODULE_VERSION - typedef v8::Handle ADDON_REGISTER_FUNCTION_ARGS_TYPE; -#else - typedef v8::Local ADDON_REGISTER_FUNCTION_ARGS_TYPE; -#endif - -#define NAN_MODULE_INIT(name) \ - void name(Nan::ADDON_REGISTER_FUNCTION_ARGS_TYPE target) - -#if NODE_MAJOR_VERSION >= 10 || \ - NODE_MAJOR_VERSION == 9 && NODE_MINOR_VERSION >= 3 -#define NAN_MODULE_WORKER_ENABLED(module_name, registration) \ - extern "C" NODE_MODULE_EXPORT void \ - NAN_CONCAT(node_register_module_v, NODE_MODULE_VERSION)( \ - v8::Local exports, v8::Local module, \ - v8::Local context) \ - { \ - registration(exports); \ - } -#else -#define NAN_MODULE_WORKER_ENABLED(module_name, registration) \ - NODE_MODULE(module_name, registration) -#endif - -//=== CallbackInfo ============================================================= - -#include "nan_callbacks.h" // NOLINT(build/include) - -//============================================================================== - -#if (NODE_MODULE_VERSION < NODE_0_12_MODULE_VERSION) -typedef v8::Script UnboundScript; -typedef v8::Script BoundScript; -#else -typedef v8::UnboundScript UnboundScript; -typedef v8::Script BoundScript; -#endif - -#if (NODE_MODULE_VERSION < ATOM_0_21_MODULE_VERSION) -typedef v8::String::ExternalAsciiStringResource - ExternalOneByteStringResource; -#else -typedef v8::String::ExternalOneByteStringResource - ExternalOneByteStringResource; -#endif - -#if (NODE_MODULE_VERSION > NODE_0_10_MODULE_VERSION) -template -class NonCopyablePersistentTraits : - public v8::NonCopyablePersistentTraits {}; -template -class CopyablePersistentTraits : - public v8::CopyablePersistentTraits {}; - -template -class PersistentBase : - public v8::PersistentBase {}; - -template > -class Persistent; -#else -template class NonCopyablePersistentTraits; -template class PersistentBase; -template class WeakCallbackData; -template > -class Persistent; -#endif // NODE_MODULE_VERSION - -template -class Maybe { - public: - inline bool IsNothing() const { return !has_value_; } - inline bool IsJust() const { return has_value_; } - - inline T ToChecked() const { return FromJust(); } - inline void Check() const { FromJust(); } - - inline bool To(T* out) const { - if (IsJust()) *out = value_; - return IsJust(); - } - - inline T FromJust() const { -#if defined(V8_ENABLE_CHECKS) - assert(IsJust() && "FromJust is Nothing"); -#endif // V8_ENABLE_CHECKS - return value_; - } - - inline T FromMaybe(const T& default_value) const { - return has_value_ ? value_ : default_value; - } - - inline bool operator==(const Maybe &other) const { - return (IsJust() == other.IsJust()) && - (!IsJust() || FromJust() == other.FromJust()); - } - - inline bool operator!=(const Maybe &other) const { - return !operator==(other); - } - -#if defined(V8_MAJOR_VERSION) && (V8_MAJOR_VERSION > 4 || \ - (V8_MAJOR_VERSION == 4 && defined(V8_MINOR_VERSION) && V8_MINOR_VERSION >= 3)) - // Allow implicit conversions from v8::Maybe to Nan::Maybe. - Maybe(const v8::Maybe& that) // NOLINT(runtime/explicit) - : has_value_(that.IsJust()) - , value_(that.FromMaybe(T())) {} -#endif - - private: - Maybe() : has_value_(false) {} - explicit Maybe(const T& t) : has_value_(true), value_(t) {} - bool has_value_; - T value_; - - template - friend Maybe Nothing(); - template - friend Maybe Just(const U& u); -}; - -template -inline Maybe Nothing() { - return Maybe(); -} - -template -inline Maybe Just(const T& t) { - return Maybe(t); -} - -#if defined(V8_MAJOR_VERSION) && (V8_MAJOR_VERSION > 4 || \ - (V8_MAJOR_VERSION == 4 && defined(V8_MINOR_VERSION) && V8_MINOR_VERSION >= 3)) -# include "nan_maybe_43_inl.h" // NOLINT(build/include) -#else -# include "nan_maybe_pre_43_inl.h" // NOLINT(build/include) -#endif - -#include "nan_converters.h" // NOLINT(build/include) -#include "nan_new.h" // NOLINT(build/include) - -#if NAUV_UVVERSION < 0x000b17 -#define NAUV_WORK_CB(func) \ - void func(uv_async_t *async, int) -#else -#define NAUV_WORK_CB(func) \ - void func(uv_async_t *async) -#endif - -#if NAUV_UVVERSION >= 0x000b0b - -typedef uv_key_t nauv_key_t; - -inline int nauv_key_create(nauv_key_t *key) { - return uv_key_create(key); -} - -inline void nauv_key_delete(nauv_key_t *key) { - uv_key_delete(key); -} - -inline void* nauv_key_get(nauv_key_t *key) { - return uv_key_get(key); -} - -inline void nauv_key_set(nauv_key_t *key, void *value) { - uv_key_set(key, value); -} - -#else - -/* Implement thread local storage for older versions of libuv. - * This is essentially a backport of libuv commit 5d2434bf - * written by Ben Noordhuis, adjusted for names and inline. - */ - -#ifndef WIN32 - -typedef pthread_key_t nauv_key_t; - -inline int nauv_key_create(nauv_key_t* key) { - return -pthread_key_create(key, NULL); -} - -inline void nauv_key_delete(nauv_key_t* key) { - if (pthread_key_delete(*key)) - abort(); -} - -inline void* nauv_key_get(nauv_key_t* key) { - return pthread_getspecific(*key); -} - -inline void nauv_key_set(nauv_key_t* key, void* value) { - if (pthread_setspecific(*key, value)) - abort(); -} - -#else - -typedef struct { - DWORD tls_index; -} nauv_key_t; - -inline int nauv_key_create(nauv_key_t* key) { - key->tls_index = TlsAlloc(); - if (key->tls_index == TLS_OUT_OF_INDEXES) - return UV_ENOMEM; - return 0; -} - -inline void nauv_key_delete(nauv_key_t* key) { - if (TlsFree(key->tls_index) == FALSE) - abort(); - key->tls_index = TLS_OUT_OF_INDEXES; -} - -inline void* nauv_key_get(nauv_key_t* key) { - void* value = TlsGetValue(key->tls_index); - if (value == NULL) - if (GetLastError() != ERROR_SUCCESS) - abort(); - return value; -} - -inline void nauv_key_set(nauv_key_t* key, void* value) { - if (TlsSetValue(key->tls_index, value) == FALSE) - abort(); -} - -#endif -#endif - -#if NODE_MODULE_VERSION < IOJS_3_0_MODULE_VERSION -template -v8::Local New(v8::Handle); -#endif - -#if defined(V8_MAJOR_VERSION) && (V8_MAJOR_VERSION > 4 || \ - (V8_MAJOR_VERSION == 4 && defined(V8_MINOR_VERSION) && V8_MINOR_VERSION >= 3)) - typedef v8::WeakCallbackType WeakCallbackType; -#else -struct WeakCallbackType { - enum E {kParameter, kInternalFields}; - E type; - WeakCallbackType(E other) : type(other) {} // NOLINT(runtime/explicit) - inline bool operator==(E other) { return other == this->type; } - inline bool operator!=(E other) { return !operator==(other); } -}; -#endif - -template class WeakCallbackInfo; - -#if NODE_MODULE_VERSION > NODE_0_10_MODULE_VERSION -# include "nan_persistent_12_inl.h" // NOLINT(build/include) -#else -# include "nan_persistent_pre_12_inl.h" // NOLINT(build/include) -#endif - -namespace imp { - static const size_t kMaxLength = 0x3fffffff; - // v8::String::REPLACE_INVALID_UTF8 was introduced - // in node.js v0.10.29 and v0.8.27. -#if NODE_MAJOR_VERSION > 0 || \ - NODE_MINOR_VERSION > 10 || \ - NODE_MINOR_VERSION == 10 && NODE_PATCH_VERSION >= 29 || \ - NODE_MINOR_VERSION == 8 && NODE_PATCH_VERSION >= 27 - static const unsigned kReplaceInvalidUtf8 = v8::String::REPLACE_INVALID_UTF8; -#else - static const unsigned kReplaceInvalidUtf8 = 0; -#endif -} // end of namespace imp - -//=== HandleScope ============================================================== - -class HandleScope { - v8::HandleScope scope; - - public: -#if NODE_MODULE_VERSION > NODE_0_10_MODULE_VERSION - inline HandleScope() : scope(v8::Isolate::GetCurrent()) {} - inline static int NumberOfHandles() { - return v8::HandleScope::NumberOfHandles(v8::Isolate::GetCurrent()); - } -#else - inline HandleScope() : scope() {} - inline static int NumberOfHandles() { - return v8::HandleScope::NumberOfHandles(); - } -#endif - - private: - // Make it hard to create heap-allocated or illegal handle scopes by - // disallowing certain operations. - HandleScope(const HandleScope &); - void operator=(const HandleScope &); - void *operator new(size_t size); - void operator delete(void *, size_t) { - abort(); - } -}; - -class EscapableHandleScope { - public: -#if NODE_MODULE_VERSION > NODE_0_10_MODULE_VERSION - inline EscapableHandleScope() : scope(v8::Isolate::GetCurrent()) {} - - inline static int NumberOfHandles() { - return v8::EscapableHandleScope::NumberOfHandles(v8::Isolate::GetCurrent()); - } - - template - inline v8::Local Escape(v8::Local value) { - return scope.Escape(value); - } - - private: - v8::EscapableHandleScope scope; -#else - inline EscapableHandleScope() : scope() {} - - inline static int NumberOfHandles() { - return v8::HandleScope::NumberOfHandles(); - } - - template - inline v8::Local Escape(v8::Local value) { - return scope.Close(value); - } - - private: - v8::HandleScope scope; -#endif - - private: - // Make it hard to create heap-allocated or illegal handle scopes by - // disallowing certain operations. - EscapableHandleScope(const EscapableHandleScope &); - void operator=(const EscapableHandleScope &); - void *operator new(size_t size); - void operator delete(void *, size_t) { - abort(); - } -}; - -//=== TryCatch ================================================================= - -class TryCatch { - v8::TryCatch try_catch_; - friend void FatalException(const TryCatch&); - - public: -#if NODE_MODULE_VERSION > NODE_0_12_MODULE_VERSION - TryCatch() : try_catch_(v8::Isolate::GetCurrent()) {} -#endif - - inline bool HasCaught() const { return try_catch_.HasCaught(); } - - inline bool CanContinue() const { return try_catch_.CanContinue(); } - - inline v8::Local ReThrow() { -#if NODE_MODULE_VERSION < IOJS_3_0_MODULE_VERSION - return New(try_catch_.ReThrow()); -#else - return try_catch_.ReThrow(); -#endif - } - - inline v8::Local Exception() const { - return try_catch_.Exception(); - } - -#if defined(V8_MAJOR_VERSION) && (V8_MAJOR_VERSION > 4 || \ - (V8_MAJOR_VERSION == 4 && defined(V8_MINOR_VERSION) && V8_MINOR_VERSION >= 3)) - inline v8::MaybeLocal StackTrace() const { - v8::Isolate *isolate = v8::Isolate::GetCurrent(); - v8::EscapableHandleScope scope(isolate); - return scope.Escape(try_catch_.StackTrace(isolate->GetCurrentContext()) - .FromMaybe(v8::Local())); - } -#else - inline MaybeLocal StackTrace() const { - return try_catch_.StackTrace(); - } -#endif - - inline v8::Local Message() const { - return try_catch_.Message(); - } - - inline void Reset() { try_catch_.Reset(); } - - inline void SetVerbose(bool value) { try_catch_.SetVerbose(value); } - - inline void SetCaptureMessage(bool value) { - try_catch_.SetCaptureMessage(value); - } -}; - -v8::Local MakeCallback(v8::Local target, - v8::Local func, - int argc, - v8::Local* argv); -v8::Local MakeCallback(v8::Local target, - v8::Local symbol, - int argc, - v8::Local* argv); -v8::Local MakeCallback(v8::Local target, - const char* method, - int argc, - v8::Local* argv); - -// === AsyncResource =========================================================== - -class AsyncResource { - public: - AsyncResource( - v8::Local name - , v8::Local resource = New()) { -#if NODE_MODULE_VERSION >= NODE_9_0_MODULE_VERSION - v8::Isolate* isolate = v8::Isolate::GetCurrent(); - - if (resource.IsEmpty()) { - resource = New(); - } - - context = node::EmitAsyncInit(isolate, resource, name); -#endif - } - - AsyncResource( - const char* name - , v8::Local resource = New()) { -#if NODE_MODULE_VERSION >= NODE_9_0_MODULE_VERSION - v8::Isolate* isolate = v8::Isolate::GetCurrent(); - - if (resource.IsEmpty()) { - resource = New(); - } - - v8::Local name_string = - New(name).ToLocalChecked(); - context = node::EmitAsyncInit(isolate, resource, name_string); -#endif - } - - ~AsyncResource() { -#if NODE_MODULE_VERSION >= NODE_9_0_MODULE_VERSION - v8::Isolate* isolate = v8::Isolate::GetCurrent(); - node::EmitAsyncDestroy(isolate, context); -#endif - } - - inline MaybeLocal runInAsyncScope( - v8::Local target - , v8::Local func - , int argc - , v8::Local* argv) { -#if NODE_MODULE_VERSION < NODE_9_0_MODULE_VERSION - return MakeCallback(target, func, argc, argv); -#else - return node::MakeCallback( - v8::Isolate::GetCurrent(), target, func, argc, argv, context); -#endif - } - - inline MaybeLocal runInAsyncScope( - v8::Local target - , v8::Local symbol - , int argc - , v8::Local* argv) { -#if NODE_MODULE_VERSION < NODE_9_0_MODULE_VERSION - return MakeCallback(target, symbol, argc, argv); -#else - return node::MakeCallback( - v8::Isolate::GetCurrent(), target, symbol, argc, argv, context); -#endif - } - - inline MaybeLocal runInAsyncScope( - v8::Local target - , const char* method - , int argc - , v8::Local* argv) { -#if NODE_MODULE_VERSION < NODE_9_0_MODULE_VERSION - return MakeCallback(target, method, argc, argv); -#else - return node::MakeCallback( - v8::Isolate::GetCurrent(), target, method, argc, argv, context); -#endif - } - - private: - NAN_DISALLOW_ASSIGN_COPY_MOVE(AsyncResource) -#if NODE_MODULE_VERSION >= NODE_9_0_MODULE_VERSION - node::async_context context; -#endif -}; - -inline uv_loop_t* GetCurrentEventLoop() { -#if NODE_MAJOR_VERSION >= 10 || \ - NODE_MAJOR_VERSION == 9 && NODE_MINOR_VERSION >= 3 || \ - NODE_MAJOR_VERSION == 8 && NODE_MINOR_VERSION >= 10 - return node::GetCurrentEventLoop(v8::Isolate::GetCurrent()); -#else - return uv_default_loop(); -#endif -} - -//============ ================================================================= - -/* node 0.12 */ -#if NODE_MODULE_VERSION >= NODE_0_12_MODULE_VERSION - inline - void SetCounterFunction(v8::CounterLookupCallback cb) { - v8::Isolate::GetCurrent()->SetCounterFunction(cb); - } - - inline - void SetCreateHistogramFunction(v8::CreateHistogramCallback cb) { - v8::Isolate::GetCurrent()->SetCreateHistogramFunction(cb); - } - - inline - void SetAddHistogramSampleFunction(v8::AddHistogramSampleCallback cb) { - v8::Isolate::GetCurrent()->SetAddHistogramSampleFunction(cb); - } - -#if defined(V8_MAJOR_VERSION) && (V8_MAJOR_VERSION > 4 || \ - (V8_MAJOR_VERSION == 4 && defined(V8_MINOR_VERSION) && V8_MINOR_VERSION >= 3)) - inline bool IdleNotification(int idle_time_in_ms) { - return v8::Isolate::GetCurrent()->IdleNotificationDeadline( - idle_time_in_ms * 0.001); - } -# else - inline bool IdleNotification(int idle_time_in_ms) { - return v8::Isolate::GetCurrent()->IdleNotification(idle_time_in_ms); - } -#endif - - inline void LowMemoryNotification() { - v8::Isolate::GetCurrent()->LowMemoryNotification(); - } - - inline void ContextDisposedNotification() { - v8::Isolate::GetCurrent()->ContextDisposedNotification(); - } -#else - inline - void SetCounterFunction(v8::CounterLookupCallback cb) { - v8::V8::SetCounterFunction(cb); - } - - inline - void SetCreateHistogramFunction(v8::CreateHistogramCallback cb) { - v8::V8::SetCreateHistogramFunction(cb); - } - - inline - void SetAddHistogramSampleFunction(v8::AddHistogramSampleCallback cb) { - v8::V8::SetAddHistogramSampleFunction(cb); - } - - inline bool IdleNotification(int idle_time_in_ms) { - return v8::V8::IdleNotification(idle_time_in_ms); - } - - inline void LowMemoryNotification() { - v8::V8::LowMemoryNotification(); - } - - inline void ContextDisposedNotification() { - v8::V8::ContextDisposedNotification(); - } -#endif - -#if (NODE_MODULE_VERSION > NODE_0_10_MODULE_VERSION) // Node 0.12 - inline v8::Local Undefined() { -# if NODE_MODULE_VERSION < IOJS_3_0_MODULE_VERSION - EscapableHandleScope scope; - return scope.Escape(New(v8::Undefined(v8::Isolate::GetCurrent()))); -# else - return v8::Undefined(v8::Isolate::GetCurrent()); -# endif - } - - inline v8::Local Null() { -# if NODE_MODULE_VERSION < IOJS_3_0_MODULE_VERSION - EscapableHandleScope scope; - return scope.Escape(New(v8::Null(v8::Isolate::GetCurrent()))); -# else - return v8::Null(v8::Isolate::GetCurrent()); -# endif - } - - inline v8::Local True() { -# if NODE_MODULE_VERSION < IOJS_3_0_MODULE_VERSION - EscapableHandleScope scope; - return scope.Escape(New(v8::True(v8::Isolate::GetCurrent()))); -# else - return v8::True(v8::Isolate::GetCurrent()); -# endif - } - - inline v8::Local False() { -# if NODE_MODULE_VERSION < IOJS_3_0_MODULE_VERSION - EscapableHandleScope scope; - return scope.Escape(New(v8::False(v8::Isolate::GetCurrent()))); -# else - return v8::False(v8::Isolate::GetCurrent()); -# endif - } - - inline v8::Local EmptyString() { - return v8::String::Empty(v8::Isolate::GetCurrent()); - } - - inline int AdjustExternalMemory(int bc) { - return static_cast( - v8::Isolate::GetCurrent()->AdjustAmountOfExternalAllocatedMemory(bc)); - } - - inline void SetTemplate( - v8::Local templ - , const char *name - , v8::Local value) { - templ->Set(v8::Isolate::GetCurrent(), name, value); - } - - inline void SetTemplate( - v8::Local templ - , v8::Local name - , v8::Local value - , v8::PropertyAttribute attributes) { - templ->Set(name, value, attributes); - } - - inline v8::Local GetCurrentContext() { - return v8::Isolate::GetCurrent()->GetCurrentContext(); - } - - inline void* GetInternalFieldPointer( - v8::Local object - , int index) { - return object->GetAlignedPointerFromInternalField(index); - } - - inline void SetInternalFieldPointer( - v8::Local object - , int index - , void* value) { - object->SetAlignedPointerInInternalField(index, value); - } - -# define NAN_GC_CALLBACK(name) \ - void name(v8::Isolate *isolate, v8::GCType type, v8::GCCallbackFlags flags) - -#if NODE_MODULE_VERSION <= NODE_4_0_MODULE_VERSION - typedef v8::Isolate::GCEpilogueCallback GCEpilogueCallback; - typedef v8::Isolate::GCPrologueCallback GCPrologueCallback; -#else - typedef v8::Isolate::GCCallback GCEpilogueCallback; - typedef v8::Isolate::GCCallback GCPrologueCallback; -#endif - - inline void AddGCEpilogueCallback( - GCEpilogueCallback callback - , v8::GCType gc_type_filter = v8::kGCTypeAll) { - v8::Isolate::GetCurrent()->AddGCEpilogueCallback(callback, gc_type_filter); - } - - inline void RemoveGCEpilogueCallback( - GCEpilogueCallback callback) { - v8::Isolate::GetCurrent()->RemoveGCEpilogueCallback(callback); - } - - inline void AddGCPrologueCallback( - GCPrologueCallback callback - , v8::GCType gc_type_filter = v8::kGCTypeAll) { - v8::Isolate::GetCurrent()->AddGCPrologueCallback(callback, gc_type_filter); - } - - inline void RemoveGCPrologueCallback( - GCPrologueCallback callback) { - v8::Isolate::GetCurrent()->RemoveGCPrologueCallback(callback); - } - - inline void GetHeapStatistics( - v8::HeapStatistics *heap_statistics) { - v8::Isolate::GetCurrent()->GetHeapStatistics(heap_statistics); - } - -# define X(NAME) \ - inline v8::Local NAME(const char *msg) { \ - EscapableHandleScope scope; \ - return scope.Escape(v8::Exception::NAME(New(msg).ToLocalChecked())); \ - } \ - \ - inline \ - v8::Local NAME(v8::Local msg) { \ - return v8::Exception::NAME(msg); \ - } \ - \ - inline void Throw ## NAME(const char *msg) { \ - HandleScope scope; \ - v8::Isolate::GetCurrent()->ThrowException( \ - v8::Exception::NAME(New(msg).ToLocalChecked())); \ - } \ - \ - inline void Throw ## NAME(v8::Local msg) { \ - HandleScope scope; \ - v8::Isolate::GetCurrent()->ThrowException( \ - v8::Exception::NAME(msg)); \ - } - - X(Error) - X(RangeError) - X(ReferenceError) - X(SyntaxError) - X(TypeError) - -# undef X - - inline void ThrowError(v8::Local error) { - v8::Isolate::GetCurrent()->ThrowException(error); - } - - inline MaybeLocal NewBuffer( - char *data - , size_t length -#if NODE_MODULE_VERSION > IOJS_2_0_MODULE_VERSION - , node::Buffer::FreeCallback callback -#else - , node::smalloc::FreeCallback callback -#endif - , void *hint - ) { - // arbitrary buffer lengths requires - // NODE_MODULE_VERSION >= IOJS_3_0_MODULE_VERSION - assert(length <= imp::kMaxLength && "too large buffer"); -#if NODE_MODULE_VERSION > IOJS_2_0_MODULE_VERSION - return node::Buffer::New( - v8::Isolate::GetCurrent(), data, length, callback, hint); -#else - return node::Buffer::New(v8::Isolate::GetCurrent(), data, length, callback, - hint); -#endif - } - - inline MaybeLocal CopyBuffer( - const char *data - , uint32_t size - ) { - // arbitrary buffer lengths requires - // NODE_MODULE_VERSION >= IOJS_3_0_MODULE_VERSION - assert(size <= imp::kMaxLength && "too large buffer"); -#if NODE_MODULE_VERSION > IOJS_2_0_MODULE_VERSION - return node::Buffer::Copy( - v8::Isolate::GetCurrent(), data, size); -#else - return node::Buffer::New(v8::Isolate::GetCurrent(), data, size); -#endif - } - - inline MaybeLocal NewBuffer(uint32_t size) { - // arbitrary buffer lengths requires - // NODE_MODULE_VERSION >= IOJS_3_0_MODULE_VERSION - assert(size <= imp::kMaxLength && "too large buffer"); -#if NODE_MODULE_VERSION > IOJS_2_0_MODULE_VERSION - return node::Buffer::New( - v8::Isolate::GetCurrent(), size); -#else - return node::Buffer::New(v8::Isolate::GetCurrent(), size); -#endif - } - - inline MaybeLocal NewBuffer( - char* data - , uint32_t size - ) { - // arbitrary buffer lengths requires - // NODE_MODULE_VERSION >= IOJS_3_0_MODULE_VERSION - assert(size <= imp::kMaxLength && "too large buffer"); -#if NODE_MODULE_VERSION > IOJS_2_0_MODULE_VERSION - return node::Buffer::New(v8::Isolate::GetCurrent(), data, size); -#else - return node::Buffer::Use(v8::Isolate::GetCurrent(), data, size); -#endif - } - -#if defined(V8_MAJOR_VERSION) && (V8_MAJOR_VERSION > 4 || \ - (V8_MAJOR_VERSION == 4 && defined(V8_MINOR_VERSION) && V8_MINOR_VERSION >= 3)) - inline MaybeLocal - NewOneByteString(const uint8_t * value, int length = -1) { - return v8::String::NewFromOneByte(v8::Isolate::GetCurrent(), value, - v8::NewStringType::kNormal, length); - } - - inline MaybeLocal CompileScript( - v8::Local s - , const v8::ScriptOrigin& origin - ) { - v8::Isolate *isolate = v8::Isolate::GetCurrent(); - v8::EscapableHandleScope scope(isolate); - v8::ScriptCompiler::Source source(s, origin); - return scope.Escape( - v8::ScriptCompiler::Compile(isolate->GetCurrentContext(), &source) - .FromMaybe(v8::Local())); - } - - inline MaybeLocal CompileScript( - v8::Local s - ) { - v8::Isolate *isolate = v8::Isolate::GetCurrent(); - v8::EscapableHandleScope scope(isolate); - v8::ScriptCompiler::Source source(s); - return scope.Escape( - v8::ScriptCompiler::Compile(isolate->GetCurrentContext(), &source) - .FromMaybe(v8::Local())); - } - - inline MaybeLocal RunScript( - v8::Local script - ) { - v8::Isolate *isolate = v8::Isolate::GetCurrent(); - v8::EscapableHandleScope scope(isolate); - return scope.Escape(script->BindToCurrentContext() - ->Run(isolate->GetCurrentContext()) - .FromMaybe(v8::Local())); - } - - inline MaybeLocal RunScript( - v8::Local script - ) { - v8::Isolate *isolate = v8::Isolate::GetCurrent(); - v8::EscapableHandleScope scope(isolate); - return scope.Escape(script->Run(isolate->GetCurrentContext()) - .FromMaybe(v8::Local())); - } -#else - inline MaybeLocal - NewOneByteString(const uint8_t * value, int length = -1) { - return v8::String::NewFromOneByte(v8::Isolate::GetCurrent(), value, - v8::String::kNormalString, length); - } - - inline MaybeLocal CompileScript( - v8::Local s - , const v8::ScriptOrigin& origin - ) { - v8::ScriptCompiler::Source source(s, origin); - return v8::ScriptCompiler::Compile(v8::Isolate::GetCurrent(), &source); - } - - inline MaybeLocal CompileScript( - v8::Local s - ) { - v8::ScriptCompiler::Source source(s); - return v8::ScriptCompiler::Compile(v8::Isolate::GetCurrent(), &source); - } - - inline MaybeLocal RunScript( - v8::Local script - ) { - EscapableHandleScope scope; - return scope.Escape(script->BindToCurrentContext()->Run()); - } - - inline MaybeLocal RunScript( - v8::Local script - ) { - return script->Run(); - } -#endif - - NAN_DEPRECATED inline v8::Local MakeCallback( - v8::Local target - , v8::Local func - , int argc - , v8::Local* argv) { -#if NODE_MODULE_VERSION < IOJS_3_0_MODULE_VERSION - EscapableHandleScope scope; - return scope.Escape(New(node::MakeCallback( - v8::Isolate::GetCurrent(), target, func, argc, argv))); -#else -# if NODE_MODULE_VERSION >= NODE_9_0_MODULE_VERSION - AsyncResource res("nan:makeCallback"); - return res.runInAsyncScope(target, func, argc, argv) - .FromMaybe(v8::Local()); -# else - return node::MakeCallback( - v8::Isolate::GetCurrent(), target, func, argc, argv); -# endif // NODE_MODULE_VERSION >= NODE_9_0_MODULE_VERSION -#endif // NODE_MODULE_VERSION < IOJS_3_0_MODULE_VERSION - } - - NAN_DEPRECATED inline v8::Local MakeCallback( - v8::Local target - , v8::Local symbol - , int argc - , v8::Local* argv) { -#if NODE_MODULE_VERSION < IOJS_3_0_MODULE_VERSION - EscapableHandleScope scope; - return scope.Escape(New(node::MakeCallback( - v8::Isolate::GetCurrent(), target, symbol, argc, argv))); -#else -# if NODE_MODULE_VERSION >= NODE_9_0_MODULE_VERSION - AsyncResource res("nan:makeCallback"); - return res.runInAsyncScope(target, symbol, argc, argv) - .FromMaybe(v8::Local()); -# else - return node::MakeCallback( - v8::Isolate::GetCurrent(), target, symbol, argc, argv); -# endif // NODE_MODULE_VERSION >= NODE_9_0_MODULE_VERSION -#endif // NODE_MODULE_VERSION < IOJS_3_0_MODULE_VERSION - } - - NAN_DEPRECATED inline v8::Local MakeCallback( - v8::Local target - , const char* method - , int argc - , v8::Local* argv) { -#if NODE_MODULE_VERSION < IOJS_3_0_MODULE_VERSION - EscapableHandleScope scope; - return scope.Escape(New(node::MakeCallback( - v8::Isolate::GetCurrent(), target, method, argc, argv))); -#else -# if NODE_MODULE_VERSION >= NODE_9_0_MODULE_VERSION - AsyncResource res("nan:makeCallback"); - return res.runInAsyncScope(target, method, argc, argv) - .FromMaybe(v8::Local()); -# else - return node::MakeCallback( - v8::Isolate::GetCurrent(), target, method, argc, argv); -# endif // NODE_MODULE_VERSION >= NODE_9_0_MODULE_VERSION -#endif // NODE_MODULE_VERSION < IOJS_3_0_MODULE_VERSION - } - - inline void FatalException(const TryCatch& try_catch) { - node::FatalException(v8::Isolate::GetCurrent(), try_catch.try_catch_); - } - - inline v8::Local ErrnoException( - int errorno - , const char* syscall = NULL - , const char* message = NULL - , const char* path = NULL) { - return node::ErrnoException(v8::Isolate::GetCurrent(), errorno, syscall, - message, path); - } - - NAN_DEPRECATED inline v8::Local NanErrnoException( - int errorno - , const char* syscall = NULL - , const char* message = NULL - , const char* path = NULL) { - return ErrnoException(errorno, syscall, message, path); - } - - template - inline void SetIsolateData( - v8::Isolate *isolate - , T *data - ) { - isolate->SetData(0, data); - } - - template - inline T *GetIsolateData( - v8::Isolate *isolate - ) { - return static_cast(isolate->GetData(0)); - } - -class Utf8String { - public: - inline explicit Utf8String(v8::Local from) : - length_(0), str_(str_st_) { - HandleScope scope; - if (!from.IsEmpty()) { -#if NODE_MAJOR_VERSION >= 10 - v8::Local context = GetCurrentContext(); - v8::Local string = - from->ToString(context).FromMaybe(v8::Local()); -#else - v8::Local string = from->ToString(); -#endif - if (!string.IsEmpty()) { - size_t len = 3 * string->Length() + 1; - assert(len <= INT_MAX); - if (len > sizeof (str_st_)) { - str_ = static_cast(malloc(len)); - assert(str_ != 0); - } - const int flags = - v8::String::NO_NULL_TERMINATION | imp::kReplaceInvalidUtf8; -#if NODE_MAJOR_VERSION >= 11 - length_ = string->WriteUtf8(v8::Isolate::GetCurrent(), str_, - static_cast(len), 0, flags); -#else - // See https://github.com/nodejs/nan/issues/832. - // Disable the warning as there is no way around it. -#ifdef _MSC_VER -#pragma warning(push) -#pragma warning(disable : 4996) -#endif -#ifdef __GNUC__ -#pragma GCC diagnostic push -#pragma GCC diagnostic ignored "-Wdeprecated-declarations" -#endif - length_ = string->WriteUtf8(str_, static_cast(len), 0, flags); -#ifdef __GNUC__ -#pragma GCC diagnostic pop -#endif -#ifdef _MSC_VER -#pragma warning(pop) -#endif -#endif // NODE_MAJOR_VERSION < 11 - str_[length_] = '\0'; - } - } - } - - inline int length() const { - return length_; - } - - inline char* operator*() { return str_; } - inline const char* operator*() const { return str_; } - - inline ~Utf8String() { - if (str_ != str_st_) { - free(str_); - } - } - - private: - NAN_DISALLOW_ASSIGN_COPY_MOVE(Utf8String) - - int length_; - char *str_; - char str_st_[1024]; -}; - -#else // Node 0.8 and 0.10 - inline v8::Local Undefined() { - EscapableHandleScope scope; - return scope.Escape(New(v8::Undefined())); - } - - inline v8::Local Null() { - EscapableHandleScope scope; - return scope.Escape(New(v8::Null())); - } - - inline v8::Local True() { - EscapableHandleScope scope; - return scope.Escape(New(v8::True())); - } - - inline v8::Local False() { - EscapableHandleScope scope; - return scope.Escape(New(v8::False())); - } - - inline v8::Local EmptyString() { - return v8::String::Empty(); - } - - inline int AdjustExternalMemory(int bc) { - return static_cast(v8::V8::AdjustAmountOfExternalAllocatedMemory(bc)); - } - - inline void SetTemplate( - v8::Local templ - , const char *name - , v8::Local value) { - templ->Set(name, value); - } - - inline void SetTemplate( - v8::Local templ - , v8::Local name - , v8::Local value - , v8::PropertyAttribute attributes) { - templ->Set(name, value, attributes); - } - - inline v8::Local GetCurrentContext() { - return v8::Context::GetCurrent(); - } - - inline void* GetInternalFieldPointer( - v8::Local object - , int index) { - return object->GetPointerFromInternalField(index); - } - - inline void SetInternalFieldPointer( - v8::Local object - , int index - , void* value) { - object->SetPointerInInternalField(index, value); - } - -# define NAN_GC_CALLBACK(name) \ - void name(v8::GCType type, v8::GCCallbackFlags flags) - - inline void AddGCEpilogueCallback( - v8::GCEpilogueCallback callback - , v8::GCType gc_type_filter = v8::kGCTypeAll) { - v8::V8::AddGCEpilogueCallback(callback, gc_type_filter); - } - inline void RemoveGCEpilogueCallback( - v8::GCEpilogueCallback callback) { - v8::V8::RemoveGCEpilogueCallback(callback); - } - inline void AddGCPrologueCallback( - v8::GCPrologueCallback callback - , v8::GCType gc_type_filter = v8::kGCTypeAll) { - v8::V8::AddGCPrologueCallback(callback, gc_type_filter); - } - inline void RemoveGCPrologueCallback( - v8::GCPrologueCallback callback) { - v8::V8::RemoveGCPrologueCallback(callback); - } - inline void GetHeapStatistics( - v8::HeapStatistics *heap_statistics) { - v8::V8::GetHeapStatistics(heap_statistics); - } - -# define X(NAME) \ - inline v8::Local NAME(const char *msg) { \ - EscapableHandleScope scope; \ - return scope.Escape(v8::Exception::NAME(New(msg).ToLocalChecked())); \ - } \ - \ - inline \ - v8::Local NAME(v8::Local msg) { \ - return v8::Exception::NAME(msg); \ - } \ - \ - inline void Throw ## NAME(const char *msg) { \ - HandleScope scope; \ - v8::ThrowException(v8::Exception::NAME(New(msg).ToLocalChecked())); \ - } \ - \ - inline \ - void Throw ## NAME(v8::Local errmsg) { \ - HandleScope scope; \ - v8::ThrowException(v8::Exception::NAME(errmsg)); \ - } - - X(Error) - X(RangeError) - X(ReferenceError) - X(SyntaxError) - X(TypeError) - -# undef X - - inline void ThrowError(v8::Local error) { - v8::ThrowException(error); - } - - inline MaybeLocal NewBuffer( - char *data - , size_t length - , node::Buffer::free_callback callback - , void *hint - ) { - EscapableHandleScope scope; - // arbitrary buffer lengths requires - // NODE_MODULE_VERSION >= IOJS_3_0_MODULE_VERSION - assert(length <= imp::kMaxLength && "too large buffer"); - return scope.Escape( - New(node::Buffer::New(data, length, callback, hint)->handle_)); - } - - inline MaybeLocal CopyBuffer( - const char *data - , uint32_t size - ) { - EscapableHandleScope scope; - // arbitrary buffer lengths requires - // NODE_MODULE_VERSION >= IOJS_3_0_MODULE_VERSION - assert(size <= imp::kMaxLength && "too large buffer"); -#if NODE_MODULE_VERSION >= NODE_0_10_MODULE_VERSION - return scope.Escape(New(node::Buffer::New(data, size)->handle_)); -#else - return scope.Escape( - New(node::Buffer::New(const_cast(data), size)->handle_)); -#endif - } - - inline MaybeLocal NewBuffer(uint32_t size) { - // arbitrary buffer lengths requires - // NODE_MODULE_VERSION >= IOJS_3_0_MODULE_VERSION - EscapableHandleScope scope; - assert(size <= imp::kMaxLength && "too large buffer"); - return scope.Escape(New(node::Buffer::New(size)->handle_)); - } - - inline void FreeData(char *data, void *hint) { - (void) hint; // unused - delete[] data; - } - - inline MaybeLocal NewBuffer( - char* data - , uint32_t size - ) { - EscapableHandleScope scope; - // arbitrary buffer lengths requires - // NODE_MODULE_VERSION >= IOJS_3_0_MODULE_VERSION - assert(size <= imp::kMaxLength && "too large buffer"); - return scope.Escape( - New(node::Buffer::New(data, size, FreeData, NULL)->handle_)); - } - -namespace imp { -inline void -widenString(std::vector *ws, const uint8_t *s, int l) { - size_t len = static_cast(l); - if (l < 0) { - len = strlen(reinterpret_cast(s)); - } - assert(len <= INT_MAX && "string too long"); - ws->resize(len); - std::copy(s, s + len, ws->begin()); // NOLINT(build/include_what_you_use) -} -} // end of namespace imp - - inline MaybeLocal - NewOneByteString(const uint8_t * value, int length = -1) { - std::vector wideString; // NOLINT(build/include_what_you_use) - imp::widenString(&wideString, value, length); - return v8::String::New(wideString.data(), - static_cast(wideString.size())); - } - - inline MaybeLocal CompileScript( - v8::Local s - , const v8::ScriptOrigin& origin - ) { - return v8::Script::Compile(s, const_cast(&origin)); - } - - inline MaybeLocal CompileScript( - v8::Local s - ) { - return v8::Script::Compile(s); - } - - inline - MaybeLocal RunScript(v8::Local script) { - return script->Run(); - } - - inline v8::Local MakeCallback( - v8::Local target - , v8::Local func - , int argc - , v8::Local* argv) { - v8::HandleScope scope; - return scope.Close(New(node::MakeCallback(target, func, argc, argv))); - } - - inline v8::Local MakeCallback( - v8::Local target - , v8::Local symbol - , int argc - , v8::Local* argv) { - v8::HandleScope scope; - return scope.Close(New(node::MakeCallback(target, symbol, argc, argv))); - } - - inline v8::Local MakeCallback( - v8::Local target - , const char* method - , int argc - , v8::Local* argv) { - v8::HandleScope scope; - return scope.Close(New(node::MakeCallback(target, method, argc, argv))); - } - - inline void FatalException(const TryCatch& try_catch) { - node::FatalException(const_cast(try_catch.try_catch_)); - } - - inline v8::Local ErrnoException( - int errorno - , const char* syscall = NULL - , const char* message = NULL - , const char* path = NULL) { - return node::ErrnoException(errorno, syscall, message, path); - } - - NAN_DEPRECATED inline v8::Local NanErrnoException( - int errorno - , const char* syscall = NULL - , const char* message = NULL - , const char* path = NULL) { - return ErrnoException(errorno, syscall, message, path); - } - - - template - inline void SetIsolateData( - v8::Isolate *isolate - , T *data - ) { - isolate->SetData(data); - } - - template - inline T *GetIsolateData( - v8::Isolate *isolate - ) { - return static_cast(isolate->GetData()); - } - -class Utf8String { - public: - inline explicit Utf8String(v8::Local from) : - length_(0), str_(str_st_) { - v8::HandleScope scope; - if (!from.IsEmpty()) { - v8::Local string = from->ToString(); - if (!string.IsEmpty()) { - size_t len = 3 * string->Length() + 1; - assert(len <= INT_MAX); - if (len > sizeof (str_st_)) { - str_ = static_cast(malloc(len)); - assert(str_ != 0); - } - const int flags = - v8::String::NO_NULL_TERMINATION | imp::kReplaceInvalidUtf8; - length_ = string->WriteUtf8(str_, static_cast(len), 0, flags); - str_[length_] = '\0'; - } - } - } - - inline int length() const { - return length_; - } - - inline char* operator*() { return str_; } - inline const char* operator*() const { return str_; } - - inline ~Utf8String() { - if (str_ != str_st_) { - free(str_); - } - } - - private: - NAN_DISALLOW_ASSIGN_COPY_MOVE(Utf8String) - - int length_; - char *str_; - char str_st_[1024]; -}; - -#endif // NODE_MODULE_VERSION - -typedef void (*FreeCallback)(char *data, void *hint); - -typedef const FunctionCallbackInfo& NAN_METHOD_ARGS_TYPE; -typedef void NAN_METHOD_RETURN_TYPE; - -typedef const PropertyCallbackInfo& NAN_GETTER_ARGS_TYPE; -typedef void NAN_GETTER_RETURN_TYPE; - -typedef const PropertyCallbackInfo& NAN_SETTER_ARGS_TYPE; -typedef void NAN_SETTER_RETURN_TYPE; - -typedef const PropertyCallbackInfo& - NAN_PROPERTY_GETTER_ARGS_TYPE; -typedef void NAN_PROPERTY_GETTER_RETURN_TYPE; - -typedef const PropertyCallbackInfo& - NAN_PROPERTY_SETTER_ARGS_TYPE; -typedef void NAN_PROPERTY_SETTER_RETURN_TYPE; - -typedef const PropertyCallbackInfo& - NAN_PROPERTY_ENUMERATOR_ARGS_TYPE; -typedef void NAN_PROPERTY_ENUMERATOR_RETURN_TYPE; - -typedef const PropertyCallbackInfo& - NAN_PROPERTY_DELETER_ARGS_TYPE; -typedef void NAN_PROPERTY_DELETER_RETURN_TYPE; - -typedef const PropertyCallbackInfo& - NAN_PROPERTY_QUERY_ARGS_TYPE; -typedef void NAN_PROPERTY_QUERY_RETURN_TYPE; - -typedef const PropertyCallbackInfo& NAN_INDEX_GETTER_ARGS_TYPE; -typedef void NAN_INDEX_GETTER_RETURN_TYPE; - -typedef const PropertyCallbackInfo& NAN_INDEX_SETTER_ARGS_TYPE; -typedef void NAN_INDEX_SETTER_RETURN_TYPE; - -typedef const PropertyCallbackInfo& - NAN_INDEX_ENUMERATOR_ARGS_TYPE; -typedef void NAN_INDEX_ENUMERATOR_RETURN_TYPE; - -typedef const PropertyCallbackInfo& - NAN_INDEX_DELETER_ARGS_TYPE; -typedef void NAN_INDEX_DELETER_RETURN_TYPE; - -typedef const PropertyCallbackInfo& - NAN_INDEX_QUERY_ARGS_TYPE; -typedef void NAN_INDEX_QUERY_RETURN_TYPE; - -#define NAN_METHOD(name) \ - Nan::NAN_METHOD_RETURN_TYPE name(Nan::NAN_METHOD_ARGS_TYPE info) -#define NAN_GETTER(name) \ - Nan::NAN_GETTER_RETURN_TYPE name( \ - v8::Local property \ - , Nan::NAN_GETTER_ARGS_TYPE info) -#define NAN_SETTER(name) \ - Nan::NAN_SETTER_RETURN_TYPE name( \ - v8::Local property \ - , v8::Local value \ - , Nan::NAN_SETTER_ARGS_TYPE info) -#define NAN_PROPERTY_GETTER(name) \ - Nan::NAN_PROPERTY_GETTER_RETURN_TYPE name( \ - v8::Local property \ - , Nan::NAN_PROPERTY_GETTER_ARGS_TYPE info) -#define NAN_PROPERTY_SETTER(name) \ - Nan::NAN_PROPERTY_SETTER_RETURN_TYPE name( \ - v8::Local property \ - , v8::Local value \ - , Nan::NAN_PROPERTY_SETTER_ARGS_TYPE info) -#define NAN_PROPERTY_ENUMERATOR(name) \ - Nan::NAN_PROPERTY_ENUMERATOR_RETURN_TYPE name( \ - Nan::NAN_PROPERTY_ENUMERATOR_ARGS_TYPE info) -#define NAN_PROPERTY_DELETER(name) \ - Nan::NAN_PROPERTY_DELETER_RETURN_TYPE name( \ - v8::Local property \ - , Nan::NAN_PROPERTY_DELETER_ARGS_TYPE info) -#define NAN_PROPERTY_QUERY(name) \ - Nan::NAN_PROPERTY_QUERY_RETURN_TYPE name( \ - v8::Local property \ - , Nan::NAN_PROPERTY_QUERY_ARGS_TYPE info) -# define NAN_INDEX_GETTER(name) \ - Nan::NAN_INDEX_GETTER_RETURN_TYPE name( \ - uint32_t index \ - , Nan::NAN_INDEX_GETTER_ARGS_TYPE info) -#define NAN_INDEX_SETTER(name) \ - Nan::NAN_INDEX_SETTER_RETURN_TYPE name( \ - uint32_t index \ - , v8::Local value \ - , Nan::NAN_INDEX_SETTER_ARGS_TYPE info) -#define NAN_INDEX_ENUMERATOR(name) \ - Nan::NAN_INDEX_ENUMERATOR_RETURN_TYPE \ - name(Nan::NAN_INDEX_ENUMERATOR_ARGS_TYPE info) -#define NAN_INDEX_DELETER(name) \ - Nan::NAN_INDEX_DELETER_RETURN_TYPE name( \ - uint32_t index \ - , Nan::NAN_INDEX_DELETER_ARGS_TYPE info) -#define NAN_INDEX_QUERY(name) \ - Nan::NAN_INDEX_QUERY_RETURN_TYPE name( \ - uint32_t index \ - , Nan::NAN_INDEX_QUERY_ARGS_TYPE info) - -class Callback { - public: - Callback() {} - - explicit Callback(const v8::Local &fn) : handle_(fn) {} - - ~Callback() { - handle_.Reset(); - } - - bool operator==(const Callback &other) const { - return handle_ == other.handle_; - } - - bool operator!=(const Callback &other) const { - return !operator==(other); - } - - inline - v8::Local operator*() const { return GetFunction(); } - - NAN_DEPRECATED inline v8::Local operator()( - v8::Local target - , int argc = 0 - , v8::Local argv[] = 0) const { -#if NODE_MODULE_VERSION > NODE_0_10_MODULE_VERSION - v8::Isolate *isolate = v8::Isolate::GetCurrent(); -# if NODE_MODULE_VERSION >= NODE_9_0_MODULE_VERSION - AsyncResource async("nan:Callback:operator()"); - return Call_(isolate, target, argc, argv, &async) - .FromMaybe(v8::Local()); -# else - return Call_(isolate, target, argc, argv); -# endif // NODE_MODULE_VERSION >= NODE_9_0_MODULE_VERSION -#else - return Call_(target, argc, argv); -#endif // NODE_MODULE_VERSION > NODE_0_10_MODULE_VERSION - } - - NAN_DEPRECATED inline v8::Local operator()( - int argc = 0 - , v8::Local argv[] = 0) const { -#if NODE_MODULE_VERSION > NODE_0_10_MODULE_VERSION - v8::Isolate *isolate = v8::Isolate::GetCurrent(); - v8::EscapableHandleScope scope(isolate); -# if NODE_MODULE_VERSION >= NODE_9_0_MODULE_VERSION - AsyncResource async("nan:Callback:operator()"); - return scope.Escape(Call_(isolate, isolate->GetCurrentContext()->Global(), - argc, argv, &async) - .FromMaybe(v8::Local())); -# else - return scope.Escape( - Call_(isolate, isolate->GetCurrentContext()->Global(), argc, argv)); -# endif // NODE_MODULE_VERSION >= NODE_9_0_MODULE_VERSION -#else - v8::HandleScope scope; - return scope.Close(Call_(v8::Context::GetCurrent()->Global(), argc, argv)); -#endif // NODE_MODULE_VERSION > NODE_0_10_MODULE_VERSION - } - - inline MaybeLocal operator()( - AsyncResource* resource - , int argc = 0 - , v8::Local argv[] = 0) const { - return this->Call(argc, argv, resource); - } - - inline MaybeLocal operator()( - AsyncResource* resource - , v8::Local target - , int argc = 0 - , v8::Local argv[] = 0) const { - return this->Call(target, argc, argv, resource); - } - - // TODO(kkoopa): remove - inline void SetFunction(const v8::Local &fn) { - Reset(fn); - } - - inline void Reset(const v8::Local &fn) { - handle_.Reset(fn); - } - - inline void Reset() { - handle_.Reset(); - } - - inline v8::Local GetFunction() const { - return New(handle_); - } - - inline bool IsEmpty() const { - return handle_.IsEmpty(); - } - - // Deprecated: For async callbacks Use the versions that accept an - // AsyncResource. If this callback does not correspond to an async resource, - // that is, it is a synchronous function call on a non-empty JS stack, you - // should Nan::Call instead. - NAN_DEPRECATED inline v8::Local - Call(v8::Local target - , int argc - , v8::Local argv[]) const { -#if NODE_MODULE_VERSION > NODE_0_10_MODULE_VERSION - v8::Isolate *isolate = v8::Isolate::GetCurrent(); -# if NODE_MODULE_VERSION >= NODE_9_0_MODULE_VERSION - AsyncResource async("nan:Callback:Call"); - return Call_(isolate, target, argc, argv, &async) - .FromMaybe(v8::Local()); -# else - return Call_(isolate, target, argc, argv); -# endif // NODE_MODULE_VERSION >= NODE_9_0_MODULE_VERSION -#else - return Call_(target, argc, argv); -#endif - } - - // Deprecated: For async callbacks Use the versions that accept an - // AsyncResource. If this callback does not correspond to an async resource, - // that is, it is a synchronous function call on a non-empty JS stack, you - // should Nan::Call instead. - NAN_DEPRECATED inline v8::Local - Call(int argc, v8::Local argv[]) const { -#if NODE_MODULE_VERSION > NODE_0_10_MODULE_VERSION - v8::Isolate *isolate = v8::Isolate::GetCurrent(); - v8::EscapableHandleScope scope(isolate); -# if NODE_MODULE_VERSION >= NODE_9_0_MODULE_VERSION - AsyncResource async("nan:Callback:Call"); - return scope.Escape(Call_(isolate, isolate->GetCurrentContext()->Global(), - argc, argv, &async) - .FromMaybe(v8::Local())); -# else - return scope.Escape( - Call_(isolate, isolate->GetCurrentContext()->Global(), argc, argv)); -# endif // NODE_MODULE_VERSION >= NODE_9_0_MODULE_VERSION -#else - v8::HandleScope scope; - return scope.Close(Call_(v8::Context::GetCurrent()->Global(), argc, argv)); -#endif - } - - inline MaybeLocal - Call(v8::Local target - , int argc - , v8::Local argv[] - , AsyncResource* resource) const { -#if NODE_MODULE_VERSION >= NODE_9_0_MODULE_VERSION - v8::Isolate* isolate = v8::Isolate::GetCurrent(); - return Call_(isolate, target, argc, argv, resource); -#elif NODE_MODULE_VERSION > NODE_0_10_MODULE_VERSION - v8::Isolate *isolate = v8::Isolate::GetCurrent(); - return Call_(isolate, target, argc, argv); -#else - return Call_(target, argc, argv); -#endif - } - - inline MaybeLocal - Call(int argc, v8::Local argv[], AsyncResource* resource) const { -#if NODE_MODULE_VERSION >= NODE_9_0_MODULE_VERSION - v8::Isolate* isolate = v8::Isolate::GetCurrent(); - return Call(isolate->GetCurrentContext()->Global(), argc, argv, resource); -#elif NODE_MODULE_VERSION > NODE_0_10_MODULE_VERSION - v8::Isolate *isolate = v8::Isolate::GetCurrent(); - v8::EscapableHandleScope scope(isolate); - return scope.Escape( - Call_(isolate, isolate->GetCurrentContext()->Global(), argc, argv)); -#else - v8::HandleScope scope; - return scope.Close(Call_(v8::Context::GetCurrent()->Global(), argc, argv)); -#endif - } - - private: - NAN_DISALLOW_ASSIGN_COPY_MOVE(Callback) - Persistent handle_; - -#if NODE_MODULE_VERSION >= NODE_9_0_MODULE_VERSION - MaybeLocal Call_(v8::Isolate *isolate - , v8::Local target - , int argc - , v8::Local argv[] - , AsyncResource* resource) const { - EscapableHandleScope scope; - v8::Local func = New(handle_); - auto maybe = resource->runInAsyncScope(target, func, argc, argv); - v8::Local local; - if (!maybe.ToLocal(&local)) return MaybeLocal(); - return scope.Escape(local); - } -#elif NODE_MODULE_VERSION > NODE_0_10_MODULE_VERSION - v8::Local Call_(v8::Isolate *isolate - , v8::Local target - , int argc - , v8::Local argv[]) const { - EscapableHandleScope scope; - - v8::Local callback = New(handle_); -# if NODE_MODULE_VERSION < IOJS_3_0_MODULE_VERSION - return scope.Escape(New(node::MakeCallback( - isolate - , target - , callback - , argc - , argv - ))); -# else - return scope.Escape(node::MakeCallback( - isolate - , target - , callback - , argc - , argv - )); -# endif - } -#else - v8::Local Call_(v8::Local target - , int argc - , v8::Local argv[]) const { - EscapableHandleScope scope; - - v8::Local callback = New(handle_); - return scope.Escape(New(node::MakeCallback( - target - , callback - , argc - , argv - ))); - } -#endif -}; - -inline MaybeLocal Call( - const Nan::Callback& callback - , v8::Local recv - , int argc - , v8::Local argv[]) { - return Call(*callback, recv, argc, argv); -} - -inline MaybeLocal Call( - const Nan::Callback& callback - , int argc - , v8::Local argv[]) { -#if NODE_MODULE_VERSION > NODE_0_10_MODULE_VERSION - v8::Isolate* isolate = v8::Isolate::GetCurrent(); - v8::EscapableHandleScope scope(isolate); - return scope.Escape( - Call(*callback, isolate->GetCurrentContext()->Global(), argc, argv) - .FromMaybe(v8::Local())); -#else - EscapableHandleScope scope; - return scope.Escape( - Call(*callback, v8::Context::GetCurrent()->Global(), argc, argv) - .FromMaybe(v8::Local())); -#endif -} - -inline MaybeLocal Call( - v8::Local symbol - , v8::Local recv - , int argc - , v8::Local argv[]) { - EscapableHandleScope scope; - v8::Local fn_v = - Get(recv, symbol).FromMaybe(v8::Local()); - if (fn_v.IsEmpty() || !fn_v->IsFunction()) return v8::Local(); - v8::Local fn = fn_v.As(); - return scope.Escape( - Call(fn, recv, argc, argv).FromMaybe(v8::Local())); -} - -inline MaybeLocal Call( - const char* method - , v8::Local recv - , int argc - , v8::Local argv[]) { - EscapableHandleScope scope; - v8::Local method_string = - New(method).ToLocalChecked(); - return scope.Escape( - Call(method_string, recv, argc, argv).FromMaybe(v8::Local())); -} - -/* abstract */ class AsyncWorker { - public: - explicit AsyncWorker(Callback *callback_, - const char* resource_name = "nan:AsyncWorker") - : callback(callback_), errmsg_(NULL) { - request.data = this; - - HandleScope scope; - v8::Local obj = New(); - persistentHandle.Reset(obj); - async_resource = new AsyncResource(resource_name, obj); - } - - virtual ~AsyncWorker() { - HandleScope scope; - - if (!persistentHandle.IsEmpty()) - persistentHandle.Reset(); - delete callback; - delete[] errmsg_; - delete async_resource; - } - - virtual void WorkComplete() { - HandleScope scope; - - if (errmsg_ == NULL) - HandleOKCallback(); - else - HandleErrorCallback(); - delete callback; - callback = NULL; - } - - inline void SaveToPersistent( - const char *key, const v8::Local &value) { - HandleScope scope; - Set(New(persistentHandle), New(key).ToLocalChecked(), value).FromJust(); - } - - inline void SaveToPersistent( - const v8::Local &key, const v8::Local &value) { - HandleScope scope; - Set(New(persistentHandle), key, value).FromJust(); - } - - inline void SaveToPersistent( - uint32_t index, const v8::Local &value) { - HandleScope scope; - Set(New(persistentHandle), index, value).FromJust(); - } - - inline v8::Local GetFromPersistent(const char *key) const { - EscapableHandleScope scope; - return scope.Escape( - Get(New(persistentHandle), New(key).ToLocalChecked()) - .FromMaybe(v8::Local())); - } - - inline v8::Local - GetFromPersistent(const v8::Local &key) const { - EscapableHandleScope scope; - return scope.Escape( - Get(New(persistentHandle), key) - .FromMaybe(v8::Local())); - } - - inline v8::Local GetFromPersistent(uint32_t index) const { - EscapableHandleScope scope; - return scope.Escape( - Get(New(persistentHandle), index) - .FromMaybe(v8::Local())); - } - - virtual void Execute() = 0; - - uv_work_t request; - - virtual void Destroy() { - delete this; - } - - protected: - Persistent persistentHandle; - Callback *callback; - AsyncResource *async_resource; - - virtual void HandleOKCallback() { - HandleScope scope; - - callback->Call(0, NULL, async_resource); - } - - virtual void HandleErrorCallback() { - HandleScope scope; - - v8::Local argv[] = { - v8::Exception::Error(New(ErrorMessage()).ToLocalChecked()) - }; - callback->Call(1, argv, async_resource); - } - - void SetErrorMessage(const char *msg) { - delete[] errmsg_; - - size_t size = strlen(msg) + 1; - errmsg_ = new char[size]; - memcpy(errmsg_, msg, size); - } - - const char* ErrorMessage() const { - return errmsg_; - } - - private: - NAN_DISALLOW_ASSIGN_COPY_MOVE(AsyncWorker) - char *errmsg_; -}; - -/* abstract */ class AsyncBareProgressWorkerBase : public AsyncWorker { - public: - explicit AsyncBareProgressWorkerBase( - Callback *callback_, - const char* resource_name = "nan:AsyncBareProgressWorkerBase") - : AsyncWorker(callback_, resource_name) { - uv_async_init( - GetCurrentEventLoop() - , &async - , AsyncProgress_ - ); - async.data = this; - } - - virtual ~AsyncBareProgressWorkerBase() { - } - - virtual void WorkProgress() = 0; - - virtual void Destroy() { - uv_close(reinterpret_cast(&async), AsyncClose_); - } - - private: - inline static NAUV_WORK_CB(AsyncProgress_) { - AsyncBareProgressWorkerBase *worker = - static_cast(async->data); - worker->WorkProgress(); - } - - inline static void AsyncClose_(uv_handle_t* handle) { - AsyncBareProgressWorkerBase *worker = - static_cast(handle->data); - delete worker; - } - - protected: - uv_async_t async; -}; - -template -/* abstract */ -class AsyncBareProgressWorker : public AsyncBareProgressWorkerBase { - public: - explicit AsyncBareProgressWorker( - Callback *callback_, - const char* resource_name = "nan:AsyncBareProgressWorker") - : AsyncBareProgressWorkerBase(callback_, resource_name) { - uv_mutex_init(&async_lock); - } - - virtual ~AsyncBareProgressWorker() { - uv_mutex_destroy(&async_lock); - } - - class ExecutionProgress { - friend class AsyncBareProgressWorker; - public: - void Signal() const { - uv_mutex_lock(&that_->async_lock); - uv_async_send(&that_->async); - uv_mutex_unlock(&that_->async_lock); - } - - void Send(const T* data, size_t count) const { - that_->SendProgress_(data, count); - } - - private: - explicit ExecutionProgress(AsyncBareProgressWorker *that) : that_(that) {} - NAN_DISALLOW_ASSIGN_COPY_MOVE(ExecutionProgress) - AsyncBareProgressWorker* const that_; - }; - - virtual void Execute(const ExecutionProgress& progress) = 0; - virtual void HandleProgressCallback(const T *data, size_t size) = 0; - - protected: - uv_mutex_t async_lock; - - private: - void Execute() /*final override*/ { - ExecutionProgress progress(this); - Execute(progress); - } - - virtual void SendProgress_(const T *data, size_t count) = 0; -}; - -template -/* abstract */ -class AsyncProgressWorkerBase : public AsyncBareProgressWorker { - public: - explicit AsyncProgressWorkerBase( - Callback *callback_, - const char* resource_name = "nan:AsyncProgressWorkerBase") - : AsyncBareProgressWorker(callback_, resource_name), asyncdata_(NULL), - asyncsize_(0) { - } - - virtual ~AsyncProgressWorkerBase() { - delete[] asyncdata_; - } - - void WorkProgress() { - uv_mutex_lock(&this->async_lock); - T *data = asyncdata_; - size_t size = asyncsize_; - asyncdata_ = NULL; - asyncsize_ = 0; - uv_mutex_unlock(&this->async_lock); - - // Don't send progress events after we've already completed. - if (this->callback) { - this->HandleProgressCallback(data, size); - } - delete[] data; - } - - private: - void SendProgress_(const T *data, size_t count) { - T *new_data = new T[count]; - { - T *it = new_data; - std::copy(data, data + count, it); - } - - uv_mutex_lock(&this->async_lock); - T *old_data = asyncdata_; - asyncdata_ = new_data; - asyncsize_ = count; - uv_async_send(&this->async); - uv_mutex_unlock(&this->async_lock); - - delete[] old_data; - } - - T *asyncdata_; - size_t asyncsize_; -}; - -// This ensures compatibility to the previous un-templated AsyncProgressWorker -// class definition. -typedef AsyncProgressWorkerBase AsyncProgressWorker; - -template -/* abstract */ -class AsyncBareProgressQueueWorker : public AsyncBareProgressWorkerBase { - public: - explicit AsyncBareProgressQueueWorker( - Callback *callback_, - const char* resource_name = "nan:AsyncBareProgressQueueWorker") - : AsyncBareProgressWorkerBase(callback_, resource_name) { - } - - virtual ~AsyncBareProgressQueueWorker() { - } - - class ExecutionProgress { - friend class AsyncBareProgressQueueWorker; - public: - void Send(const T* data, size_t count) const { - that_->SendProgress_(data, count); - } - - private: - explicit ExecutionProgress(AsyncBareProgressQueueWorker *that) - : that_(that) {} - NAN_DISALLOW_ASSIGN_COPY_MOVE(ExecutionProgress) - AsyncBareProgressQueueWorker* const that_; - }; - - virtual void Execute(const ExecutionProgress& progress) = 0; - virtual void HandleProgressCallback(const T *data, size_t size) = 0; - - private: - void Execute() /*final override*/ { - ExecutionProgress progress(this); - Execute(progress); - } - - virtual void SendProgress_(const T *data, size_t count) = 0; -}; - -template -/* abstract */ -class AsyncProgressQueueWorker : public AsyncBareProgressQueueWorker { - public: - explicit AsyncProgressQueueWorker( - Callback *callback_, - const char* resource_name = "nan:AsyncProgressQueueWorker") - : AsyncBareProgressQueueWorker(callback_) { - uv_mutex_init(&async_lock); - } - - virtual ~AsyncProgressQueueWorker() { - uv_mutex_lock(&async_lock); - - while (!asyncdata_.empty()) { - std::pair &datapair = asyncdata_.front(); - T *data = datapair.first; - - asyncdata_.pop(); - - delete[] data; - } - - uv_mutex_unlock(&async_lock); - uv_mutex_destroy(&async_lock); - } - - void WorkComplete() { - WorkProgress(); - AsyncWorker::WorkComplete(); - } - - void WorkProgress() { - uv_mutex_lock(&async_lock); - - while (!asyncdata_.empty()) { - std::pair &datapair = asyncdata_.front(); - - T *data = datapair.first; - size_t size = datapair.second; - - asyncdata_.pop(); - uv_mutex_unlock(&async_lock); - - // Don't send progress events after we've already completed. - if (this->callback) { - this->HandleProgressCallback(data, size); - } - - delete[] data; - - uv_mutex_lock(&async_lock); - } - - uv_mutex_unlock(&async_lock); - } - - private: - void SendProgress_(const T *data, size_t count) { - T *new_data = new T[count]; - { - T *it = new_data; - std::copy(data, data + count, it); - } - - uv_mutex_lock(&async_lock); - asyncdata_.push(std::pair(new_data, count)); - uv_mutex_unlock(&async_lock); - - uv_async_send(&this->async); - } - - uv_mutex_t async_lock; - std::queue > asyncdata_; -}; - -inline void AsyncExecute (uv_work_t* req) { - AsyncWorker *worker = static_cast(req->data); - worker->Execute(); -} - -inline void AsyncExecuteComplete (uv_work_t* req) { - AsyncWorker* worker = static_cast(req->data); - worker->WorkComplete(); - worker->Destroy(); -} - -inline void AsyncQueueWorker (AsyncWorker* worker) { - uv_queue_work( - GetCurrentEventLoop() - , &worker->request - , AsyncExecute - , reinterpret_cast(AsyncExecuteComplete) - ); -} - -namespace imp { - -inline -ExternalOneByteStringResource const* -GetExternalResource(v8::Local str) { -#if NODE_MODULE_VERSION < ATOM_0_21_MODULE_VERSION - return str->GetExternalAsciiStringResource(); -#else - return str->GetExternalOneByteStringResource(); -#endif -} - -inline -bool -IsExternal(v8::Local str) { -#if NODE_MODULE_VERSION < ATOM_0_21_MODULE_VERSION - return str->IsExternalAscii(); -#else - return str->IsExternalOneByte(); -#endif -} - -} // end of namespace imp - -enum Encoding {ASCII, UTF8, BASE64, UCS2, BINARY, HEX, BUFFER}; - -#if NODE_MODULE_VERSION < NODE_0_10_MODULE_VERSION -# include "nan_string_bytes.h" // NOLINT(build/include) -#endif - -inline v8::Local Encode( - const void *buf, size_t len, enum Encoding encoding = BINARY) { -#if (NODE_MODULE_VERSION >= ATOM_0_21_MODULE_VERSION) - v8::Isolate* isolate = v8::Isolate::GetCurrent(); - node::encoding node_enc = static_cast(encoding); - - if (encoding == UCS2) { - return node::Encode( - isolate - , reinterpret_cast(buf) - , len / 2); - } else { - return node::Encode( - isolate - , reinterpret_cast(buf) - , len - , node_enc); - } -#elif (NODE_MODULE_VERSION > NODE_0_10_MODULE_VERSION) - return node::Encode( - v8::Isolate::GetCurrent() - , buf, len - , static_cast(encoding)); -#else -# if NODE_MODULE_VERSION >= NODE_0_10_MODULE_VERSION - return node::Encode(buf, len, static_cast(encoding)); -# else - return imp::Encode(reinterpret_cast(buf), len, encoding); -# endif -#endif -} - -inline ssize_t DecodeBytes( - v8::Local val, enum Encoding encoding = BINARY) { -#if (NODE_MODULE_VERSION > NODE_0_10_MODULE_VERSION) - return node::DecodeBytes( - v8::Isolate::GetCurrent() - , val - , static_cast(encoding)); -#else -# if (NODE_MODULE_VERSION < NODE_0_10_MODULE_VERSION) - if (encoding == BUFFER) { - return node::DecodeBytes(val, node::BINARY); - } -# endif - return node::DecodeBytes(val, static_cast(encoding)); -#endif -} - -inline ssize_t DecodeWrite( - char *buf - , size_t len - , v8::Local val - , enum Encoding encoding = BINARY) { -#if (NODE_MODULE_VERSION > NODE_0_10_MODULE_VERSION) - return node::DecodeWrite( - v8::Isolate::GetCurrent() - , buf - , len - , val - , static_cast(encoding)); -#else -# if (NODE_MODULE_VERSION < NODE_0_10_MODULE_VERSION) - if (encoding == BUFFER) { - return node::DecodeWrite(buf, len, val, node::BINARY); - } -# endif - return node::DecodeWrite( - buf - , len - , val - , static_cast(encoding)); -#endif -} - -inline void SetPrototypeTemplate( - v8::Local templ - , const char *name - , v8::Local value -) { - HandleScope scope; - SetTemplate(templ->PrototypeTemplate(), name, value); -} - -inline void SetPrototypeTemplate( - v8::Local templ - , v8::Local name - , v8::Local value - , v8::PropertyAttribute attributes -) { - HandleScope scope; - SetTemplate(templ->PrototypeTemplate(), name, value, attributes); -} - -inline void SetInstanceTemplate( - v8::Local templ - , const char *name - , v8::Local value -) { - HandleScope scope; - SetTemplate(templ->InstanceTemplate(), name, value); -} - -inline void SetInstanceTemplate( - v8::Local templ - , v8::Local name - , v8::Local value - , v8::PropertyAttribute attributes -) { - HandleScope scope; - SetTemplate(templ->InstanceTemplate(), name, value, attributes); -} - -namespace imp { - -// Note(@agnat): Helper to distinguish different receiver types. The first -// version deals with receivers derived from v8::Template. The second version -// handles everything else. The final argument only serves as discriminator and -// is unused. -template -inline -void -SetMethodAux(T recv, - v8::Local name, - v8::Local tpl, - v8::Template *) { - recv->Set(name, tpl); -} - -template -inline -void -SetMethodAux(T recv, - v8::Local name, - v8::Local tpl, - ...) { - Set(recv, name, GetFunction(tpl).ToLocalChecked()); -} - -} // end of namespace imp - -template class HandleType> -inline void SetMethod( - HandleType recv - , const char *name - , FunctionCallback callback) { - HandleScope scope; - v8::Local t = New(callback); - v8::Local fn_name = New(name).ToLocalChecked(); - t->SetClassName(fn_name); - // Note(@agnat): Pass an empty T* as discriminator. See note on - // SetMethodAux(...) above - imp::SetMethodAux(recv, fn_name, t, static_cast(0)); -} - -inline void SetPrototypeMethod( - v8::Local recv - , const char* name, FunctionCallback callback) { - HandleScope scope; - v8::Local t = New( - callback - , v8::Local() - , New(recv)); - v8::Local fn_name = New(name).ToLocalChecked(); - recv->PrototypeTemplate()->Set(fn_name, t); - t->SetClassName(fn_name); -} - -//=== Accessors and Such ======================================================= - -inline void SetAccessor( - v8::Local tpl - , v8::Local name - , GetterCallback getter - , SetterCallback setter = 0 - , v8::Local data = v8::Local() - , v8::AccessControl settings = v8::DEFAULT - , v8::PropertyAttribute attribute = v8::None - , imp::Sig signature = imp::Sig()) { - HandleScope scope; - - imp::NativeGetter getter_ = - imp::GetterCallbackWrapper; - imp::NativeSetter setter_ = - setter ? imp::SetterCallbackWrapper : 0; - - v8::Local otpl = New(); - otpl->SetInternalFieldCount(imp::kAccessorFieldCount); - v8::Local obj = NewInstance(otpl).ToLocalChecked(); - - obj->SetInternalField( - imp::kGetterIndex - , New(reinterpret_cast(getter))); - - if (setter != 0) { - obj->SetInternalField( - imp::kSetterIndex - , New(reinterpret_cast(setter))); - } - - if (!data.IsEmpty()) { - obj->SetInternalField(imp::kDataIndex, data); - } - - tpl->SetAccessor( - name - , getter_ - , setter_ - , obj - , settings - , attribute - , signature); -} - -inline bool SetAccessor( - v8::Local obj - , v8::Local name - , GetterCallback getter - , SetterCallback setter = 0 - , v8::Local data = v8::Local() - , v8::AccessControl settings = v8::DEFAULT - , v8::PropertyAttribute attribute = v8::None) { - HandleScope scope; - - imp::NativeGetter getter_ = - imp::GetterCallbackWrapper; - imp::NativeSetter setter_ = - setter ? imp::SetterCallbackWrapper : 0; - - v8::Local otpl = New(); - otpl->SetInternalFieldCount(imp::kAccessorFieldCount); - v8::Local dataobj = NewInstance(otpl).ToLocalChecked(); - - dataobj->SetInternalField( - imp::kGetterIndex - , New(reinterpret_cast(getter))); - - if (!data.IsEmpty()) { - dataobj->SetInternalField(imp::kDataIndex, data); - } - - if (setter) { - dataobj->SetInternalField( - imp::kSetterIndex - , New(reinterpret_cast(setter))); - } - -#if (NODE_MODULE_VERSION >= NODE_6_0_MODULE_VERSION) - return obj->SetAccessor( - GetCurrentContext() - , name - , getter_ - , setter_ - , dataobj - , settings - , attribute).FromMaybe(false); -#else - return obj->SetAccessor( - name - , getter_ - , setter_ - , dataobj - , settings - , attribute); -#endif -} - -inline void SetNamedPropertyHandler( - v8::Local tpl - , PropertyGetterCallback getter - , PropertySetterCallback setter = 0 - , PropertyQueryCallback query = 0 - , PropertyDeleterCallback deleter = 0 - , PropertyEnumeratorCallback enumerator = 0 - , v8::Local data = v8::Local()) { - HandleScope scope; - - imp::NativePropertyGetter getter_ = - imp::PropertyGetterCallbackWrapper; - imp::NativePropertySetter setter_ = - setter ? imp::PropertySetterCallbackWrapper : 0; - imp::NativePropertyQuery query_ = - query ? imp::PropertyQueryCallbackWrapper : 0; - imp::NativePropertyDeleter *deleter_ = - deleter ? imp::PropertyDeleterCallbackWrapper : 0; - imp::NativePropertyEnumerator enumerator_ = - enumerator ? imp::PropertyEnumeratorCallbackWrapper : 0; - - v8::Local otpl = New(); - otpl->SetInternalFieldCount(imp::kPropertyFieldCount); - v8::Local obj = NewInstance(otpl).ToLocalChecked(); - obj->SetInternalField( - imp::kPropertyGetterIndex - , New(reinterpret_cast(getter))); - - if (setter) { - obj->SetInternalField( - imp::kPropertySetterIndex - , New(reinterpret_cast(setter))); - } - - if (query) { - obj->SetInternalField( - imp::kPropertyQueryIndex - , New(reinterpret_cast(query))); - } - - if (deleter) { - obj->SetInternalField( - imp::kPropertyDeleterIndex - , New(reinterpret_cast(deleter))); - } - - if (enumerator) { - obj->SetInternalField( - imp::kPropertyEnumeratorIndex - , New(reinterpret_cast(enumerator))); - } - - if (!data.IsEmpty()) { - obj->SetInternalField(imp::kDataIndex, data); - } - -#if NODE_MODULE_VERSION > NODE_0_12_MODULE_VERSION - tpl->SetHandler(v8::NamedPropertyHandlerConfiguration( - getter_, setter_, query_, deleter_, enumerator_, obj)); -#else - tpl->SetNamedPropertyHandler( - getter_ - , setter_ - , query_ - , deleter_ - , enumerator_ - , obj); -#endif -} - -inline void SetIndexedPropertyHandler( - v8::Local tpl - , IndexGetterCallback getter - , IndexSetterCallback setter = 0 - , IndexQueryCallback query = 0 - , IndexDeleterCallback deleter = 0 - , IndexEnumeratorCallback enumerator = 0 - , v8::Local data = v8::Local()) { - HandleScope scope; - - imp::NativeIndexGetter getter_ = - imp::IndexGetterCallbackWrapper; - imp::NativeIndexSetter setter_ = - setter ? imp::IndexSetterCallbackWrapper : 0; - imp::NativeIndexQuery query_ = - query ? imp::IndexQueryCallbackWrapper : 0; - imp::NativeIndexDeleter deleter_ = - deleter ? imp::IndexDeleterCallbackWrapper : 0; - imp::NativeIndexEnumerator enumerator_ = - enumerator ? imp::IndexEnumeratorCallbackWrapper : 0; - - v8::Local otpl = New(); - otpl->SetInternalFieldCount(imp::kIndexPropertyFieldCount); - v8::Local obj = NewInstance(otpl).ToLocalChecked(); - obj->SetInternalField( - imp::kIndexPropertyGetterIndex - , New(reinterpret_cast(getter))); - - if (setter) { - obj->SetInternalField( - imp::kIndexPropertySetterIndex - , New(reinterpret_cast(setter))); - } - - if (query) { - obj->SetInternalField( - imp::kIndexPropertyQueryIndex - , New(reinterpret_cast(query))); - } - - if (deleter) { - obj->SetInternalField( - imp::kIndexPropertyDeleterIndex - , New(reinterpret_cast(deleter))); - } - - if (enumerator) { - obj->SetInternalField( - imp::kIndexPropertyEnumeratorIndex - , New(reinterpret_cast(enumerator))); - } - - if (!data.IsEmpty()) { - obj->SetInternalField(imp::kDataIndex, data); - } - -#if NODE_MODULE_VERSION > NODE_0_12_MODULE_VERSION - tpl->SetHandler(v8::IndexedPropertyHandlerConfiguration( - getter_, setter_, query_, deleter_, enumerator_, obj)); -#else - tpl->SetIndexedPropertyHandler( - getter_ - , setter_ - , query_ - , deleter_ - , enumerator_ - , obj); -#endif -} - -inline void SetCallHandler( - v8::Local tpl - , FunctionCallback callback - , v8::Local data = v8::Local()) { - HandleScope scope; - - v8::Local otpl = New(); - otpl->SetInternalFieldCount(imp::kFunctionFieldCount); - v8::Local obj = NewInstance(otpl).ToLocalChecked(); - - obj->SetInternalField( - imp::kFunctionIndex - , New(reinterpret_cast(callback))); - - if (!data.IsEmpty()) { - obj->SetInternalField(imp::kDataIndex, data); - } - - tpl->SetCallHandler(imp::FunctionCallbackWrapper, obj); -} - - -inline void SetCallAsFunctionHandler( - v8::Local tpl, - FunctionCallback callback, - v8::Local data = v8::Local()) { - HandleScope scope; - - v8::Local otpl = New(); - otpl->SetInternalFieldCount(imp::kFunctionFieldCount); - v8::Local obj = NewInstance(otpl).ToLocalChecked(); - - obj->SetInternalField( - imp::kFunctionIndex - , New(reinterpret_cast(callback))); - - if (!data.IsEmpty()) { - obj->SetInternalField(imp::kDataIndex, data); - } - - tpl->SetCallAsFunctionHandler(imp::FunctionCallbackWrapper, obj); -} - -//=== Weak Persistent Handling ================================================= - -#include "nan_weak.h" // NOLINT(build/include) - -//=== ObjectWrap =============================================================== - -#include "nan_object_wrap.h" // NOLINT(build/include) - -//=== HiddenValue/Private ====================================================== - -#include "nan_private.h" // NOLINT(build/include) - -//=== Export ================================================================== - -inline -void -Export(ADDON_REGISTER_FUNCTION_ARGS_TYPE target, const char *name, - FunctionCallback f) { - HandleScope scope; - - Set(target, New(name).ToLocalChecked(), - GetFunction(New(f)).ToLocalChecked()); -} - -//=== Tap Reverse Binding ===================================================== - -struct Tap { - explicit Tap(v8::Local t) : t_() { - HandleScope scope; - - t_.Reset(To(t).ToLocalChecked()); - } - - ~Tap() { t_.Reset(); } // not sure if neccessary - - inline void plan(int i) { - HandleScope scope; - v8::Local arg = New(i); - Call("plan", New(t_), 1, &arg); - } - - inline void ok(bool isOk, const char *msg = NULL) { - HandleScope scope; - v8::Local args[2]; - args[0] = New(isOk); - if (msg) args[1] = New(msg).ToLocalChecked(); - Call("ok", New(t_), msg ? 2 : 1, args); - } - - inline void pass(const char * msg = NULL) { - HandleScope scope; - v8::Local hmsg; - if (msg) hmsg = New(msg).ToLocalChecked(); - Call("pass", New(t_), msg ? 1 : 0, &hmsg); - } - - inline void end() { - HandleScope scope; - Call("end", New(t_), 0, NULL); - } - - private: - Persistent t_; -}; - -#define NAN_STRINGIZE2(x) #x -#define NAN_STRINGIZE(x) NAN_STRINGIZE2(x) -#define NAN_TEST_EXPRESSION(expression) \ - ( expression ), __FILE__ ":" NAN_STRINGIZE(__LINE__) ": " #expression - -#define NAN_EXPORT(target, function) Export(target, #function, function) - -#undef TYPE_CHECK - -//=== Generic Maybefication =================================================== - -namespace imp { - -template struct Maybefier; - -template struct Maybefier > { - inline static MaybeLocal convert(v8::Local v) { - return v; - } -}; - -template struct Maybefier > { - inline static MaybeLocal convert(MaybeLocal v) { - return v; - } -}; - -} // end of namespace imp - -template class MaybeMaybe> -inline MaybeLocal -MakeMaybe(MaybeMaybe v) { - return imp::Maybefier >::convert(v); -} - -//=== TypedArrayContents ======================================================= - -#include "nan_typedarray_contents.h" // NOLINT(build/include) - -//=== JSON ===================================================================== - -#include "nan_json.h" // NOLINT(build/include) - -} // end of namespace Nan - -#endif // NAN_H_ diff --git a/node_modules/node-pty/node_modules/nan/nan_callbacks.h b/node_modules/node-pty/node_modules/nan/nan_callbacks.h deleted file mode 100644 index 53ede84..0000000 --- a/node_modules/node-pty/node_modules/nan/nan_callbacks.h +++ /dev/null @@ -1,88 +0,0 @@ -/********************************************************************* - * NAN - Native Abstractions for Node.js - * - * Copyright (c) 2018 NAN contributors - * - * MIT License - ********************************************************************/ - -#ifndef NAN_CALLBACKS_H_ -#define NAN_CALLBACKS_H_ - -template class FunctionCallbackInfo; -template class PropertyCallbackInfo; -template class Global; - -typedef void(*FunctionCallback)(const FunctionCallbackInfo&); -typedef void(*GetterCallback) - (v8::Local, const PropertyCallbackInfo&); -typedef void(*SetterCallback)( - v8::Local, - v8::Local, - const PropertyCallbackInfo&); -typedef void(*PropertyGetterCallback)( - v8::Local, - const PropertyCallbackInfo&); -typedef void(*PropertySetterCallback)( - v8::Local, - v8::Local, - const PropertyCallbackInfo&); -typedef void(*PropertyEnumeratorCallback) - (const PropertyCallbackInfo&); -typedef void(*PropertyDeleterCallback)( - v8::Local, - const PropertyCallbackInfo&); -typedef void(*PropertyQueryCallback)( - v8::Local, - const PropertyCallbackInfo&); -typedef void(*IndexGetterCallback)( - uint32_t, - const PropertyCallbackInfo&); -typedef void(*IndexSetterCallback)( - uint32_t, - v8::Local, - const PropertyCallbackInfo&); -typedef void(*IndexEnumeratorCallback) - (const PropertyCallbackInfo&); -typedef void(*IndexDeleterCallback)( - uint32_t, - const PropertyCallbackInfo&); -typedef void(*IndexQueryCallback)( - uint32_t, - const PropertyCallbackInfo&); - -namespace imp { -typedef v8::Local Sig; - -static const int kDataIndex = 0; - -static const int kFunctionIndex = 1; -static const int kFunctionFieldCount = 2; - -static const int kGetterIndex = 1; -static const int kSetterIndex = 2; -static const int kAccessorFieldCount = 3; - -static const int kPropertyGetterIndex = 1; -static const int kPropertySetterIndex = 2; -static const int kPropertyEnumeratorIndex = 3; -static const int kPropertyDeleterIndex = 4; -static const int kPropertyQueryIndex = 5; -static const int kPropertyFieldCount = 6; - -static const int kIndexPropertyGetterIndex = 1; -static const int kIndexPropertySetterIndex = 2; -static const int kIndexPropertyEnumeratorIndex = 3; -static const int kIndexPropertyDeleterIndex = 4; -static const int kIndexPropertyQueryIndex = 5; -static const int kIndexPropertyFieldCount = 6; - -} // end of namespace imp - -#if NODE_MODULE_VERSION > NODE_0_10_MODULE_VERSION -# include "nan_callbacks_12_inl.h" // NOLINT(build/include) -#else -# include "nan_callbacks_pre_12_inl.h" // NOLINT(build/include) -#endif - -#endif // NAN_CALLBACKS_H_ diff --git a/node_modules/node-pty/node_modules/nan/nan_callbacks_12_inl.h b/node_modules/node-pty/node_modules/nan/nan_callbacks_12_inl.h deleted file mode 100644 index c27b18d..0000000 --- a/node_modules/node-pty/node_modules/nan/nan_callbacks_12_inl.h +++ /dev/null @@ -1,514 +0,0 @@ -/********************************************************************* - * NAN - Native Abstractions for Node.js - * - * Copyright (c) 2018 NAN contributors - * - * MIT License - ********************************************************************/ - -#ifndef NAN_CALLBACKS_12_INL_H_ -#define NAN_CALLBACKS_12_INL_H_ - -template -class ReturnValue { - v8::ReturnValue value_; - - public: - template - explicit inline ReturnValue(const v8::ReturnValue &value) : - value_(value) {} - template - explicit inline ReturnValue(const ReturnValue& that) - : value_(that.value_) { - TYPE_CHECK(T, S); - } - - // Handle setters - template inline void Set(const v8::Local &handle) { - TYPE_CHECK(T, S); - value_.Set(handle); - } - - template inline void Set(const Global &handle) { - TYPE_CHECK(T, S); -#if defined(V8_MAJOR_VERSION) && (V8_MAJOR_VERSION > 4 || \ - (V8_MAJOR_VERSION == 4 && defined(V8_MINOR_VERSION) && \ - (V8_MINOR_VERSION > 5 || (V8_MINOR_VERSION == 5 && \ - defined(V8_BUILD_NUMBER) && V8_BUILD_NUMBER >= 8)))) - value_.Set(handle); -#else - value_.Set(*reinterpret_cast*>(&handle)); - const_cast &>(handle).Reset(); -#endif - } - - // Fast primitive setters - inline void Set(bool value) { - TYPE_CHECK(T, v8::Boolean); - value_.Set(value); - } - - inline void Set(double i) { - TYPE_CHECK(T, v8::Number); - value_.Set(i); - } - - inline void Set(int32_t i) { - TYPE_CHECK(T, v8::Integer); - value_.Set(i); - } - - inline void Set(uint32_t i) { - TYPE_CHECK(T, v8::Integer); - value_.Set(i); - } - - // Fast JS primitive setters - inline void SetNull() { - TYPE_CHECK(T, v8::Primitive); - value_.SetNull(); - } - - inline void SetUndefined() { - TYPE_CHECK(T, v8::Primitive); - value_.SetUndefined(); - } - - inline void SetEmptyString() { - TYPE_CHECK(T, v8::String); - value_.SetEmptyString(); - } - - // Convenience getter for isolate - inline v8::Isolate *GetIsolate() const { - return value_.GetIsolate(); - } - - // Pointer setter: Uncompilable to prevent inadvertent misuse. - template - inline void Set(S *whatever) { TYPE_CHECK(S*, v8::Primitive); } -}; - -template -class FunctionCallbackInfo { - const v8::FunctionCallbackInfo &info_; - const v8::Local data_; - - public: - explicit inline FunctionCallbackInfo( - const v8::FunctionCallbackInfo &info - , v8::Local data) : - info_(info) - , data_(data) {} - - inline ReturnValue GetReturnValue() const { - return ReturnValue(info_.GetReturnValue()); - } - -#if NODE_MAJOR_VERSION < 10 - inline v8::Local Callee() const { return info_.Callee(); } -#endif - inline v8::Local Data() const { return data_; } - inline v8::Local Holder() const { return info_.Holder(); } - inline bool IsConstructCall() const { return info_.IsConstructCall(); } - inline int Length() const { return info_.Length(); } - inline v8::Local operator[](int i) const { return info_[i]; } - inline v8::Local This() const { return info_.This(); } - inline v8::Isolate *GetIsolate() const { return info_.GetIsolate(); } - - - protected: - static const int kHolderIndex = 0; - static const int kIsolateIndex = 1; - static const int kReturnValueDefaultValueIndex = 2; - static const int kReturnValueIndex = 3; - static const int kDataIndex = 4; - static const int kCalleeIndex = 5; - static const int kContextSaveIndex = 6; - static const int kArgsLength = 7; - - private: - NAN_DISALLOW_ASSIGN_COPY_MOVE(FunctionCallbackInfo) -}; - -template -class PropertyCallbackInfo { - const v8::PropertyCallbackInfo &info_; - const v8::Local data_; - - public: - explicit inline PropertyCallbackInfo( - const v8::PropertyCallbackInfo &info - , const v8::Local data) : - info_(info) - , data_(data) {} - - inline v8::Isolate* GetIsolate() const { return info_.GetIsolate(); } - inline v8::Local Data() const { return data_; } - inline v8::Local This() const { return info_.This(); } - inline v8::Local Holder() const { return info_.Holder(); } - inline ReturnValue GetReturnValue() const { - return ReturnValue(info_.GetReturnValue()); - } - - protected: - static const int kHolderIndex = 0; - static const int kIsolateIndex = 1; - static const int kReturnValueDefaultValueIndex = 2; - static const int kReturnValueIndex = 3; - static const int kDataIndex = 4; - static const int kThisIndex = 5; - static const int kArgsLength = 6; - - private: - NAN_DISALLOW_ASSIGN_COPY_MOVE(PropertyCallbackInfo) -}; - -namespace imp { -static -void FunctionCallbackWrapper(const v8::FunctionCallbackInfo &info) { - v8::Local obj = info.Data().As(); - FunctionCallback callback = reinterpret_cast( - reinterpret_cast( - obj->GetInternalField(kFunctionIndex).As()->Value())); - FunctionCallbackInfo - cbinfo(info, obj->GetInternalField(kDataIndex)); - callback(cbinfo); -} - -typedef void (*NativeFunction)(const v8::FunctionCallbackInfo &); - -#if NODE_MODULE_VERSION > NODE_0_12_MODULE_VERSION -static -void GetterCallbackWrapper( - v8::Local property - , const v8::PropertyCallbackInfo &info) { - v8::Local obj = info.Data().As(); - PropertyCallbackInfo - cbinfo(info, obj->GetInternalField(kDataIndex)); - GetterCallback callback = reinterpret_cast( - reinterpret_cast( - obj->GetInternalField(kGetterIndex).As()->Value())); - callback(property.As(), cbinfo); -} - -typedef void (*NativeGetter) - (v8::Local, const v8::PropertyCallbackInfo &); - -static -void SetterCallbackWrapper( - v8::Local property - , v8::Local value - , const v8::PropertyCallbackInfo &info) { - v8::Local obj = info.Data().As(); - PropertyCallbackInfo - cbinfo(info, obj->GetInternalField(kDataIndex)); - SetterCallback callback = reinterpret_cast( - reinterpret_cast( - obj->GetInternalField(kSetterIndex).As()->Value())); - callback(property.As(), value, cbinfo); -} - -typedef void (*NativeSetter)( - v8::Local - , v8::Local - , const v8::PropertyCallbackInfo &); -#else -static -void GetterCallbackWrapper( - v8::Local property - , const v8::PropertyCallbackInfo &info) { - v8::Local obj = info.Data().As(); - PropertyCallbackInfo - cbinfo(info, obj->GetInternalField(kDataIndex)); - GetterCallback callback = reinterpret_cast( - reinterpret_cast( - obj->GetInternalField(kGetterIndex).As()->Value())); - callback(property, cbinfo); -} - -typedef void (*NativeGetter) - (v8::Local, const v8::PropertyCallbackInfo &); - -static -void SetterCallbackWrapper( - v8::Local property - , v8::Local value - , const v8::PropertyCallbackInfo &info) { - v8::Local obj = info.Data().As(); - PropertyCallbackInfo - cbinfo(info, obj->GetInternalField(kDataIndex)); - SetterCallback callback = reinterpret_cast( - reinterpret_cast( - obj->GetInternalField(kSetterIndex).As()->Value())); - callback(property, value, cbinfo); -} - -typedef void (*NativeSetter)( - v8::Local - , v8::Local - , const v8::PropertyCallbackInfo &); -#endif - -#if NODE_MODULE_VERSION > NODE_0_12_MODULE_VERSION -static -void PropertyGetterCallbackWrapper( - v8::Local property - , const v8::PropertyCallbackInfo &info) { - v8::Local obj = info.Data().As(); - PropertyCallbackInfo - cbinfo(info, obj->GetInternalField(kDataIndex)); - PropertyGetterCallback callback = reinterpret_cast( - reinterpret_cast( - obj->GetInternalField(kPropertyGetterIndex) - .As()->Value())); - callback(property.As(), cbinfo); -} - -typedef void (*NativePropertyGetter) - (v8::Local, const v8::PropertyCallbackInfo &); - -static -void PropertySetterCallbackWrapper( - v8::Local property - , v8::Local value - , const v8::PropertyCallbackInfo &info) { - v8::Local obj = info.Data().As(); - PropertyCallbackInfo - cbinfo(info, obj->GetInternalField(kDataIndex)); - PropertySetterCallback callback = reinterpret_cast( - reinterpret_cast( - obj->GetInternalField(kPropertySetterIndex) - .As()->Value())); - callback(property.As(), value, cbinfo); -} - -typedef void (*NativePropertySetter)( - v8::Local - , v8::Local - , const v8::PropertyCallbackInfo &); - -static -void PropertyEnumeratorCallbackWrapper( - const v8::PropertyCallbackInfo &info) { - v8::Local obj = info.Data().As(); - PropertyCallbackInfo - cbinfo(info, obj->GetInternalField(kDataIndex)); - PropertyEnumeratorCallback callback = - reinterpret_cast(reinterpret_cast( - obj->GetInternalField(kPropertyEnumeratorIndex) - .As()->Value())); - callback(cbinfo); -} - -typedef void (*NativePropertyEnumerator) - (const v8::PropertyCallbackInfo &); - -static -void PropertyDeleterCallbackWrapper( - v8::Local property - , const v8::PropertyCallbackInfo &info) { - v8::Local obj = info.Data().As(); - PropertyCallbackInfo - cbinfo(info, obj->GetInternalField(kDataIndex)); - PropertyDeleterCallback callback = reinterpret_cast( - reinterpret_cast( - obj->GetInternalField(kPropertyDeleterIndex) - .As()->Value())); - callback(property.As(), cbinfo); -} - -typedef void (NativePropertyDeleter) - (v8::Local, const v8::PropertyCallbackInfo &); - -static -void PropertyQueryCallbackWrapper( - v8::Local property - , const v8::PropertyCallbackInfo &info) { - v8::Local obj = info.Data().As(); - PropertyCallbackInfo - cbinfo(info, obj->GetInternalField(kDataIndex)); - PropertyQueryCallback callback = reinterpret_cast( - reinterpret_cast( - obj->GetInternalField(kPropertyQueryIndex) - .As()->Value())); - callback(property.As(), cbinfo); -} - -typedef void (*NativePropertyQuery) - (v8::Local, const v8::PropertyCallbackInfo &); -#else -static -void PropertyGetterCallbackWrapper( - v8::Local property - , const v8::PropertyCallbackInfo &info) { - v8::Local obj = info.Data().As(); - PropertyCallbackInfo - cbinfo(info, obj->GetInternalField(kDataIndex)); - PropertyGetterCallback callback = reinterpret_cast( - reinterpret_cast( - obj->GetInternalField(kPropertyGetterIndex) - .As()->Value())); - callback(property, cbinfo); -} - -typedef void (*NativePropertyGetter) - (v8::Local, const v8::PropertyCallbackInfo &); - -static -void PropertySetterCallbackWrapper( - v8::Local property - , v8::Local value - , const v8::PropertyCallbackInfo &info) { - v8::Local obj = info.Data().As(); - PropertyCallbackInfo - cbinfo(info, obj->GetInternalField(kDataIndex)); - PropertySetterCallback callback = reinterpret_cast( - reinterpret_cast( - obj->GetInternalField(kPropertySetterIndex) - .As()->Value())); - callback(property, value, cbinfo); -} - -typedef void (*NativePropertySetter)( - v8::Local - , v8::Local - , const v8::PropertyCallbackInfo &); - -static -void PropertyEnumeratorCallbackWrapper( - const v8::PropertyCallbackInfo &info) { - v8::Local obj = info.Data().As(); - PropertyCallbackInfo - cbinfo(info, obj->GetInternalField(kDataIndex)); - PropertyEnumeratorCallback callback = - reinterpret_cast(reinterpret_cast( - obj->GetInternalField(kPropertyEnumeratorIndex) - .As()->Value())); - callback(cbinfo); -} - -typedef void (*NativePropertyEnumerator) - (const v8::PropertyCallbackInfo &); - -static -void PropertyDeleterCallbackWrapper( - v8::Local property - , const v8::PropertyCallbackInfo &info) { - v8::Local obj = info.Data().As(); - PropertyCallbackInfo - cbinfo(info, obj->GetInternalField(kDataIndex)); - PropertyDeleterCallback callback = reinterpret_cast( - reinterpret_cast( - obj->GetInternalField(kPropertyDeleterIndex) - .As()->Value())); - callback(property, cbinfo); -} - -typedef void (NativePropertyDeleter) - (v8::Local, const v8::PropertyCallbackInfo &); - -static -void PropertyQueryCallbackWrapper( - v8::Local property - , const v8::PropertyCallbackInfo &info) { - v8::Local obj = info.Data().As(); - PropertyCallbackInfo - cbinfo(info, obj->GetInternalField(kDataIndex)); - PropertyQueryCallback callback = reinterpret_cast( - reinterpret_cast( - obj->GetInternalField(kPropertyQueryIndex) - .As()->Value())); - callback(property, cbinfo); -} - -typedef void (*NativePropertyQuery) - (v8::Local, const v8::PropertyCallbackInfo &); -#endif - -static -void IndexGetterCallbackWrapper( - uint32_t index, const v8::PropertyCallbackInfo &info) { - v8::Local obj = info.Data().As(); - PropertyCallbackInfo - cbinfo(info, obj->GetInternalField(kDataIndex)); - IndexGetterCallback callback = reinterpret_cast( - reinterpret_cast( - obj->GetInternalField(kIndexPropertyGetterIndex) - .As()->Value())); - callback(index, cbinfo); -} - -typedef void (*NativeIndexGetter) - (uint32_t, const v8::PropertyCallbackInfo &); - -static -void IndexSetterCallbackWrapper( - uint32_t index - , v8::Local value - , const v8::PropertyCallbackInfo &info) { - v8::Local obj = info.Data().As(); - PropertyCallbackInfo - cbinfo(info, obj->GetInternalField(kDataIndex)); - IndexSetterCallback callback = reinterpret_cast( - reinterpret_cast( - obj->GetInternalField(kIndexPropertySetterIndex) - .As()->Value())); - callback(index, value, cbinfo); -} - -typedef void (*NativeIndexSetter)( - uint32_t - , v8::Local - , const v8::PropertyCallbackInfo &); - -static -void IndexEnumeratorCallbackWrapper( - const v8::PropertyCallbackInfo &info) { - v8::Local obj = info.Data().As(); - PropertyCallbackInfo - cbinfo(info, obj->GetInternalField(kDataIndex)); - IndexEnumeratorCallback callback = reinterpret_cast( - reinterpret_cast( - obj->GetInternalField( - kIndexPropertyEnumeratorIndex).As()->Value())); - callback(cbinfo); -} - -typedef void (*NativeIndexEnumerator) - (const v8::PropertyCallbackInfo &); - -static -void IndexDeleterCallbackWrapper( - uint32_t index, const v8::PropertyCallbackInfo &info) { - v8::Local obj = info.Data().As(); - PropertyCallbackInfo - cbinfo(info, obj->GetInternalField(kDataIndex)); - IndexDeleterCallback callback = reinterpret_cast( - reinterpret_cast( - obj->GetInternalField(kIndexPropertyDeleterIndex) - .As()->Value())); - callback(index, cbinfo); -} - -typedef void (*NativeIndexDeleter) - (uint32_t, const v8::PropertyCallbackInfo &); - -static -void IndexQueryCallbackWrapper( - uint32_t index, const v8::PropertyCallbackInfo &info) { - v8::Local obj = info.Data().As(); - PropertyCallbackInfo - cbinfo(info, obj->GetInternalField(kDataIndex)); - IndexQueryCallback callback = reinterpret_cast( - reinterpret_cast( - obj->GetInternalField(kIndexPropertyQueryIndex) - .As()->Value())); - callback(index, cbinfo); -} - -typedef void (*NativeIndexQuery) - (uint32_t, const v8::PropertyCallbackInfo &); -} // end of namespace imp - -#endif // NAN_CALLBACKS_12_INL_H_ diff --git a/node_modules/node-pty/node_modules/nan/nan_callbacks_pre_12_inl.h b/node_modules/node-pty/node_modules/nan/nan_callbacks_pre_12_inl.h deleted file mode 100644 index c9ba499..0000000 --- a/node_modules/node-pty/node_modules/nan/nan_callbacks_pre_12_inl.h +++ /dev/null @@ -1,520 +0,0 @@ -/********************************************************************* - * NAN - Native Abstractions for Node.js - * - * Copyright (c) 2018 NAN contributors - * - * MIT License - ********************************************************************/ - -#ifndef NAN_CALLBACKS_PRE_12_INL_H_ -#define NAN_CALLBACKS_PRE_12_INL_H_ - -namespace imp { -template class ReturnValueImp; -} // end of namespace imp - -template -class ReturnValue { - v8::Isolate *isolate_; - v8::Persistent *value_; - friend class imp::ReturnValueImp; - - public: - template - explicit inline ReturnValue(v8::Isolate *isolate, v8::Persistent *p) : - isolate_(isolate), value_(p) {} - template - explicit inline ReturnValue(const ReturnValue& that) - : isolate_(that.isolate_), value_(that.value_) { - TYPE_CHECK(T, S); - } - - // Handle setters - template inline void Set(const v8::Local &handle) { - TYPE_CHECK(T, S); - value_->Dispose(); - *value_ = v8::Persistent::New(handle); - } - - template inline void Set(const Global &handle) { - TYPE_CHECK(T, S); - value_->Dispose(); - *value_ = v8::Persistent::New(handle.persistent); - const_cast &>(handle).Reset(); - } - - // Fast primitive setters - inline void Set(bool value) { - v8::HandleScope scope; - - TYPE_CHECK(T, v8::Boolean); - value_->Dispose(); - *value_ = v8::Persistent::New(v8::Boolean::New(value)); - } - - inline void Set(double i) { - v8::HandleScope scope; - - TYPE_CHECK(T, v8::Number); - value_->Dispose(); - *value_ = v8::Persistent::New(v8::Number::New(i)); - } - - inline void Set(int32_t i) { - v8::HandleScope scope; - - TYPE_CHECK(T, v8::Integer); - value_->Dispose(); - *value_ = v8::Persistent::New(v8::Int32::New(i)); - } - - inline void Set(uint32_t i) { - v8::HandleScope scope; - - TYPE_CHECK(T, v8::Integer); - value_->Dispose(); - *value_ = v8::Persistent::New(v8::Uint32::NewFromUnsigned(i)); - } - - // Fast JS primitive setters - inline void SetNull() { - v8::HandleScope scope; - - TYPE_CHECK(T, v8::Primitive); - value_->Dispose(); - *value_ = v8::Persistent::New(v8::Null()); - } - - inline void SetUndefined() { - v8::HandleScope scope; - - TYPE_CHECK(T, v8::Primitive); - value_->Dispose(); - *value_ = v8::Persistent::New(v8::Undefined()); - } - - inline void SetEmptyString() { - v8::HandleScope scope; - - TYPE_CHECK(T, v8::String); - value_->Dispose(); - *value_ = v8::Persistent::New(v8::String::Empty()); - } - - // Convenience getter for isolate - inline v8::Isolate *GetIsolate() const { - return isolate_; - } - - // Pointer setter: Uncompilable to prevent inadvertent misuse. - template - inline void Set(S *whatever) { TYPE_CHECK(S*, v8::Primitive); } -}; - -template -class FunctionCallbackInfo { - const v8::Arguments &args_; - v8::Local data_; - ReturnValue return_value_; - v8::Persistent retval_; - - public: - explicit inline FunctionCallbackInfo( - const v8::Arguments &args - , v8::Local data) : - args_(args) - , data_(data) - , return_value_(args.GetIsolate(), &retval_) - , retval_(v8::Persistent::New(v8::Undefined())) {} - - inline ~FunctionCallbackInfo() { - retval_.Dispose(); - retval_.Clear(); - } - - inline ReturnValue GetReturnValue() const { - return ReturnValue(return_value_); - } - - inline v8::Local Callee() const { return args_.Callee(); } - inline v8::Local Data() const { return data_; } - inline v8::Local Holder() const { return args_.Holder(); } - inline bool IsConstructCall() const { return args_.IsConstructCall(); } - inline int Length() const { return args_.Length(); } - inline v8::Local operator[](int i) const { return args_[i]; } - inline v8::Local This() const { return args_.This(); } - inline v8::Isolate *GetIsolate() const { return args_.GetIsolate(); } - - - protected: - static const int kHolderIndex = 0; - static const int kIsolateIndex = 1; - static const int kReturnValueDefaultValueIndex = 2; - static const int kReturnValueIndex = 3; - static const int kDataIndex = 4; - static const int kCalleeIndex = 5; - static const int kContextSaveIndex = 6; - static const int kArgsLength = 7; - - private: - NAN_DISALLOW_ASSIGN_COPY_MOVE(FunctionCallbackInfo) -}; - -template -class PropertyCallbackInfoBase { - const v8::AccessorInfo &info_; - const v8::Local data_; - - public: - explicit inline PropertyCallbackInfoBase( - const v8::AccessorInfo &info - , const v8::Local data) : - info_(info) - , data_(data) {} - - inline v8::Isolate* GetIsolate() const { return info_.GetIsolate(); } - inline v8::Local Data() const { return data_; } - inline v8::Local This() const { return info_.This(); } - inline v8::Local Holder() const { return info_.Holder(); } - - protected: - static const int kHolderIndex = 0; - static const int kIsolateIndex = 1; - static const int kReturnValueDefaultValueIndex = 2; - static const int kReturnValueIndex = 3; - static const int kDataIndex = 4; - static const int kThisIndex = 5; - static const int kArgsLength = 6; - - private: - NAN_DISALLOW_ASSIGN_COPY_MOVE(PropertyCallbackInfoBase) -}; - -template -class PropertyCallbackInfo : public PropertyCallbackInfoBase { - ReturnValue return_value_; - v8::Persistent retval_; - - public: - explicit inline PropertyCallbackInfo( - const v8::AccessorInfo &info - , const v8::Local data) : - PropertyCallbackInfoBase(info, data) - , return_value_(info.GetIsolate(), &retval_) - , retval_(v8::Persistent::New(v8::Undefined())) {} - - inline ~PropertyCallbackInfo() { - retval_.Dispose(); - retval_.Clear(); - } - - inline ReturnValue GetReturnValue() const { return return_value_; } -}; - -template<> -class PropertyCallbackInfo : - public PropertyCallbackInfoBase { - ReturnValue return_value_; - v8::Persistent retval_; - - public: - explicit inline PropertyCallbackInfo( - const v8::AccessorInfo &info - , const v8::Local data) : - PropertyCallbackInfoBase(info, data) - , return_value_(info.GetIsolate(), &retval_) - , retval_(v8::Persistent::New(v8::Local())) {} - - inline ~PropertyCallbackInfo() { - retval_.Dispose(); - retval_.Clear(); - } - - inline ReturnValue GetReturnValue() const { - return return_value_; - } -}; - -template<> -class PropertyCallbackInfo : - public PropertyCallbackInfoBase { - ReturnValue return_value_; - v8::Persistent retval_; - - public: - explicit inline PropertyCallbackInfo( - const v8::AccessorInfo &info - , const v8::Local data) : - PropertyCallbackInfoBase(info, data) - , return_value_(info.GetIsolate(), &retval_) - , retval_(v8::Persistent::New(v8::Local())) {} - - inline ~PropertyCallbackInfo() { - retval_.Dispose(); - retval_.Clear(); - } - - inline ReturnValue GetReturnValue() const { - return return_value_; - } -}; - -template<> -class PropertyCallbackInfo : - public PropertyCallbackInfoBase { - ReturnValue return_value_; - v8::Persistent retval_; - - public: - explicit inline PropertyCallbackInfo( - const v8::AccessorInfo &info - , const v8::Local data) : - PropertyCallbackInfoBase(info, data) - , return_value_(info.GetIsolate(), &retval_) - , retval_(v8::Persistent::New(v8::Local())) {} - - inline ~PropertyCallbackInfo() { - retval_.Dispose(); - retval_.Clear(); - } - - inline ReturnValue GetReturnValue() const { - return return_value_; - } -}; - -namespace imp { -template -class ReturnValueImp : public ReturnValue { - public: - explicit ReturnValueImp(ReturnValue that) : - ReturnValue(that) {} - inline v8::Handle Value() { - return *ReturnValue::value_; - } -}; - -static -v8::Handle FunctionCallbackWrapper(const v8::Arguments &args) { - v8::Local obj = args.Data().As(); - FunctionCallback callback = reinterpret_cast( - reinterpret_cast( - obj->GetInternalField(kFunctionIndex).As()->Value())); - FunctionCallbackInfo - cbinfo(args, obj->GetInternalField(kDataIndex)); - callback(cbinfo); - return ReturnValueImp(cbinfo.GetReturnValue()).Value(); -} - -typedef v8::Handle (*NativeFunction)(const v8::Arguments &); - -static -v8::Handle GetterCallbackWrapper( - v8::Local property, const v8::AccessorInfo &info) { - v8::Local obj = info.Data().As(); - PropertyCallbackInfo - cbinfo(info, obj->GetInternalField(kDataIndex)); - GetterCallback callback = reinterpret_cast( - reinterpret_cast( - obj->GetInternalField(kGetterIndex).As()->Value())); - callback(property, cbinfo); - return ReturnValueImp(cbinfo.GetReturnValue()).Value(); -} - -typedef v8::Handle (*NativeGetter) - (v8::Local, const v8::AccessorInfo &); - -static -void SetterCallbackWrapper( - v8::Local property - , v8::Local value - , const v8::AccessorInfo &info) { - v8::Local obj = info.Data().As(); - PropertyCallbackInfo - cbinfo(info, obj->GetInternalField(kDataIndex)); - SetterCallback callback = reinterpret_cast( - reinterpret_cast( - obj->GetInternalField(kSetterIndex).As()->Value())); - callback(property, value, cbinfo); -} - -typedef void (*NativeSetter) - (v8::Local, v8::Local, const v8::AccessorInfo &); - -static -v8::Handle PropertyGetterCallbackWrapper( - v8::Local property, const v8::AccessorInfo &info) { - v8::Local obj = info.Data().As(); - PropertyCallbackInfo - cbinfo(info, obj->GetInternalField(kDataIndex)); - PropertyGetterCallback callback = reinterpret_cast( - reinterpret_cast( - obj->GetInternalField(kPropertyGetterIndex) - .As()->Value())); - callback(property, cbinfo); - return ReturnValueImp(cbinfo.GetReturnValue()).Value(); -} - -typedef v8::Handle (*NativePropertyGetter) - (v8::Local, const v8::AccessorInfo &); - -static -v8::Handle PropertySetterCallbackWrapper( - v8::Local property - , v8::Local value - , const v8::AccessorInfo &info) { - v8::Local obj = info.Data().As(); - PropertyCallbackInfo - cbinfo(info, obj->GetInternalField(kDataIndex)); - PropertySetterCallback callback = reinterpret_cast( - reinterpret_cast( - obj->GetInternalField(kPropertySetterIndex) - .As()->Value())); - callback(property, value, cbinfo); - return ReturnValueImp(cbinfo.GetReturnValue()).Value(); -} - -typedef v8::Handle (*NativePropertySetter) - (v8::Local, v8::Local, const v8::AccessorInfo &); - -static -v8::Handle PropertyEnumeratorCallbackWrapper( - const v8::AccessorInfo &info) { - v8::Local obj = info.Data().As(); - PropertyCallbackInfo - cbinfo(info, obj->GetInternalField(kDataIndex)); - PropertyEnumeratorCallback callback = - reinterpret_cast(reinterpret_cast( - obj->GetInternalField(kPropertyEnumeratorIndex) - .As()->Value())); - callback(cbinfo); - return ReturnValueImp(cbinfo.GetReturnValue()).Value(); -} - -typedef v8::Handle (*NativePropertyEnumerator) - (const v8::AccessorInfo &); - -static -v8::Handle PropertyDeleterCallbackWrapper( - v8::Local property - , const v8::AccessorInfo &info) { - v8::Local obj = info.Data().As(); - PropertyCallbackInfo - cbinfo(info, obj->GetInternalField(kDataIndex)); - PropertyDeleterCallback callback = reinterpret_cast( - reinterpret_cast( - obj->GetInternalField(kPropertyDeleterIndex) - .As()->Value())); - callback(property, cbinfo); - return ReturnValueImp(cbinfo.GetReturnValue()).Value(); -} - -typedef v8::Handle (NativePropertyDeleter) - (v8::Local, const v8::AccessorInfo &); - -static -v8::Handle PropertyQueryCallbackWrapper( - v8::Local property, const v8::AccessorInfo &info) { - v8::Local obj = info.Data().As(); - PropertyCallbackInfo - cbinfo(info, obj->GetInternalField(kDataIndex)); - PropertyQueryCallback callback = reinterpret_cast( - reinterpret_cast( - obj->GetInternalField(kPropertyQueryIndex) - .As()->Value())); - callback(property, cbinfo); - return ReturnValueImp(cbinfo.GetReturnValue()).Value(); -} - -typedef v8::Handle (*NativePropertyQuery) - (v8::Local, const v8::AccessorInfo &); - -static -v8::Handle IndexGetterCallbackWrapper( - uint32_t index, const v8::AccessorInfo &info) { - v8::Local obj = info.Data().As(); - PropertyCallbackInfo - cbinfo(info, obj->GetInternalField(kDataIndex)); - IndexGetterCallback callback = reinterpret_cast( - reinterpret_cast( - obj->GetInternalField(kIndexPropertyGetterIndex) - .As()->Value())); - callback(index, cbinfo); - return ReturnValueImp(cbinfo.GetReturnValue()).Value(); -} - -typedef v8::Handle (*NativeIndexGetter) - (uint32_t, const v8::AccessorInfo &); - -static -v8::Handle IndexSetterCallbackWrapper( - uint32_t index - , v8::Local value - , const v8::AccessorInfo &info) { - v8::Local obj = info.Data().As(); - PropertyCallbackInfo - cbinfo(info, obj->GetInternalField(kDataIndex)); - IndexSetterCallback callback = reinterpret_cast( - reinterpret_cast( - obj->GetInternalField(kIndexPropertySetterIndex) - .As()->Value())); - callback(index, value, cbinfo); - return ReturnValueImp(cbinfo.GetReturnValue()).Value(); -} - -typedef v8::Handle (*NativeIndexSetter) - (uint32_t, v8::Local, const v8::AccessorInfo &); - -static -v8::Handle IndexEnumeratorCallbackWrapper( - const v8::AccessorInfo &info) { - v8::Local obj = info.Data().As(); - PropertyCallbackInfo - cbinfo(info, obj->GetInternalField(kDataIndex)); - IndexEnumeratorCallback callback = reinterpret_cast( - reinterpret_cast( - obj->GetInternalField(kIndexPropertyEnumeratorIndex) - .As()->Value())); - callback(cbinfo); - return ReturnValueImp(cbinfo.GetReturnValue()).Value(); -} - -typedef v8::Handle (*NativeIndexEnumerator) - (const v8::AccessorInfo &); - -static -v8::Handle IndexDeleterCallbackWrapper( - uint32_t index, const v8::AccessorInfo &info) { - v8::Local obj = info.Data().As(); - PropertyCallbackInfo - cbinfo(info, obj->GetInternalField(kDataIndex)); - IndexDeleterCallback callback = reinterpret_cast( - reinterpret_cast( - obj->GetInternalField(kIndexPropertyDeleterIndex) - .As()->Value())); - callback(index, cbinfo); - return ReturnValueImp(cbinfo.GetReturnValue()).Value(); -} - -typedef v8::Handle (*NativeIndexDeleter) - (uint32_t, const v8::AccessorInfo &); - -static -v8::Handle IndexQueryCallbackWrapper( - uint32_t index, const v8::AccessorInfo &info) { - v8::Local obj = info.Data().As(); - PropertyCallbackInfo - cbinfo(info, obj->GetInternalField(kDataIndex)); - IndexQueryCallback callback = reinterpret_cast( - reinterpret_cast( - obj->GetInternalField(kIndexPropertyQueryIndex) - .As()->Value())); - callback(index, cbinfo); - return ReturnValueImp(cbinfo.GetReturnValue()).Value(); -} - -typedef v8::Handle (*NativeIndexQuery) - (uint32_t, const v8::AccessorInfo &); -} // end of namespace imp - -#endif // NAN_CALLBACKS_PRE_12_INL_H_ diff --git a/node_modules/node-pty/node_modules/nan/nan_converters.h b/node_modules/node-pty/node_modules/nan/nan_converters.h deleted file mode 100644 index c0b3272..0000000 --- a/node_modules/node-pty/node_modules/nan/nan_converters.h +++ /dev/null @@ -1,72 +0,0 @@ -/********************************************************************* - * NAN - Native Abstractions for Node.js - * - * Copyright (c) 2018 NAN contributors - * - * MIT License - ********************************************************************/ - -#ifndef NAN_CONVERTERS_H_ -#define NAN_CONVERTERS_H_ - -namespace imp { -template struct ToFactoryBase { - typedef MaybeLocal return_t; -}; -template struct ValueFactoryBase { typedef Maybe return_t; }; - -template struct ToFactory; - -template<> -struct ToFactory : ToFactoryBase { - static inline return_t convert(v8::Local val) { - if (val.IsEmpty() || !val->IsFunction()) return MaybeLocal(); - return MaybeLocal(val.As()); - } -}; - -#define X(TYPE) \ - template<> \ - struct ToFactory : ToFactoryBase { \ - static inline return_t convert(v8::Local val); \ - }; - -X(Boolean) -X(Number) -X(String) -X(Object) -X(Integer) -X(Uint32) -X(Int32) - -#undef X - -#define X(TYPE) \ - template<> \ - struct ToFactory : ValueFactoryBase { \ - static inline return_t convert(v8::Local val); \ - }; - -X(bool) -X(double) -X(int64_t) -X(uint32_t) -X(int32_t) - -#undef X -} // end of namespace imp - -template -inline -typename imp::ToFactory::return_t To(v8::Local val) { - return imp::ToFactory::convert(val); -} - -#if defined(V8_MAJOR_VERSION) && (V8_MAJOR_VERSION > 4 || \ - (V8_MAJOR_VERSION == 4 && defined(V8_MINOR_VERSION) && V8_MINOR_VERSION >= 3)) -# include "nan_converters_43_inl.h" -#else -# include "nan_converters_pre_43_inl.h" -#endif - -#endif // NAN_CONVERTERS_H_ diff --git a/node_modules/node-pty/node_modules/nan/nan_converters_43_inl.h b/node_modules/node-pty/node_modules/nan/nan_converters_43_inl.h deleted file mode 100644 index 41b72de..0000000 --- a/node_modules/node-pty/node_modules/nan/nan_converters_43_inl.h +++ /dev/null @@ -1,68 +0,0 @@ -/********************************************************************* - * NAN - Native Abstractions for Node.js - * - * Copyright (c) 2018 NAN contributors - * - * MIT License - ********************************************************************/ - -#ifndef NAN_CONVERTERS_43_INL_H_ -#define NAN_CONVERTERS_43_INL_H_ - -#define X(TYPE) \ -imp::ToFactory::return_t \ -imp::ToFactory::convert(v8::Local val) { \ - v8::Isolate *isolate = v8::Isolate::GetCurrent(); \ - v8::EscapableHandleScope scope(isolate); \ - return scope.Escape( \ - val->To ## TYPE(isolate->GetCurrentContext()) \ - .FromMaybe(v8::Local())); \ -} - -X(Number) -X(String) -X(Object) -X(Integer) -X(Uint32) -X(Int32) -// V8 <= 7.0 -#if V8_MAJOR_VERSION < 7 || (V8_MAJOR_VERSION == 7 && V8_MINOR_VERSION == 0) -X(Boolean) -#else -imp::ToFactory::return_t \ -imp::ToFactory::convert(v8::Local val) { \ - v8::Isolate *isolate = v8::Isolate::GetCurrent(); \ - v8::EscapableHandleScope scope(isolate); \ - return scope.Escape(val->ToBoolean(isolate)); \ -} -#endif - -#undef X - -#define X(TYPE, NAME) \ -imp::ToFactory::return_t \ -imp::ToFactory::convert(v8::Local val) { \ - v8::Isolate *isolate = v8::Isolate::GetCurrent(); \ - v8::HandleScope scope(isolate); \ - return val->NAME ## Value(isolate->GetCurrentContext()); \ -} - -X(double, Number) -X(int64_t, Integer) -X(uint32_t, Uint32) -X(int32_t, Int32) -// V8 <= 7.0 -#if V8_MAJOR_VERSION < 7 || (V8_MAJOR_VERSION == 7 && V8_MINOR_VERSION == 0) -X(bool, Boolean) -#else -imp::ToFactory::return_t \ -imp::ToFactory::convert(v8::Local val) { \ - v8::Isolate *isolate = v8::Isolate::GetCurrent(); \ - v8::HandleScope scope(isolate); \ - return Just(val->BooleanValue(isolate)); \ -} -#endif - -#undef X - -#endif // NAN_CONVERTERS_43_INL_H_ diff --git a/node_modules/node-pty/node_modules/nan/nan_converters_pre_43_inl.h b/node_modules/node-pty/node_modules/nan/nan_converters_pre_43_inl.h deleted file mode 100644 index ae0518a..0000000 --- a/node_modules/node-pty/node_modules/nan/nan_converters_pre_43_inl.h +++ /dev/null @@ -1,42 +0,0 @@ -/********************************************************************* - * NAN - Native Abstractions for Node.js - * - * Copyright (c) 2018 NAN contributors - * - * MIT License - ********************************************************************/ - -#ifndef NAN_CONVERTERS_PRE_43_INL_H_ -#define NAN_CONVERTERS_PRE_43_INL_H_ - -#define X(TYPE) \ -imp::ToFactory::return_t \ -imp::ToFactory::convert(v8::Local val) { \ - return val->To ## TYPE(); \ -} - -X(Boolean) -X(Number) -X(String) -X(Object) -X(Integer) -X(Uint32) -X(Int32) - -#undef X - -#define X(TYPE, NAME) \ -imp::ToFactory::return_t \ -imp::ToFactory::convert(v8::Local val) { \ - return Just(val->NAME ## Value()); \ -} - -X(bool, Boolean) -X(double, Number) -X(int64_t, Integer) -X(uint32_t, Uint32) -X(int32_t, Int32) - -#undef X - -#endif // NAN_CONVERTERS_PRE_43_INL_H_ diff --git a/node_modules/node-pty/node_modules/nan/nan_define_own_property_helper.h b/node_modules/node-pty/node_modules/nan/nan_define_own_property_helper.h deleted file mode 100644 index d710ef2..0000000 --- a/node_modules/node-pty/node_modules/nan/nan_define_own_property_helper.h +++ /dev/null @@ -1,29 +0,0 @@ -/********************************************************************* - * NAN - Native Abstractions for Node.js - * - * Copyright (c) 2018 NAN contributors - * - * MIT License - ********************************************************************/ - -#ifndef NAN_DEFINE_OWN_PROPERTY_HELPER_H_ -#define NAN_DEFINE_OWN_PROPERTY_HELPER_H_ - -namespace imp { - -inline Maybe DefineOwnPropertyHelper( - v8::PropertyAttribute current - , v8::Handle obj - , v8::Handle key - , v8::Handle value - , v8::PropertyAttribute attribs = v8::None) { - return !(current & v8::DontDelete) || // configurable OR - (!(current & v8::ReadOnly) && // writable AND - !((attribs ^ current) & ~v8::ReadOnly)) // same excluding RO - ? Just(obj->ForceSet(key, value, attribs)) - : Nothing(); -} - -} // end of namespace imp - -#endif // NAN_DEFINE_OWN_PROPERTY_HELPER_H_ diff --git a/node_modules/node-pty/node_modules/nan/nan_implementation_12_inl.h b/node_modules/node-pty/node_modules/nan/nan_implementation_12_inl.h deleted file mode 100644 index 255293a..0000000 --- a/node_modules/node-pty/node_modules/nan/nan_implementation_12_inl.h +++ /dev/null @@ -1,430 +0,0 @@ -/********************************************************************* - * NAN - Native Abstractions for Node.js - * - * Copyright (c) 2018 NAN contributors - * - * MIT License - ********************************************************************/ - -#ifndef NAN_IMPLEMENTATION_12_INL_H_ -#define NAN_IMPLEMENTATION_12_INL_H_ -//============================================================================== -// node v0.11 implementation -//============================================================================== - -namespace imp { - -//=== Array ==================================================================== - -Factory::return_t -Factory::New() { - return v8::Array::New(v8::Isolate::GetCurrent()); -} - -Factory::return_t -Factory::New(int length) { - return v8::Array::New(v8::Isolate::GetCurrent(), length); -} - -//=== Boolean ================================================================== - -Factory::return_t -Factory::New(bool value) { - return v8::Boolean::New(v8::Isolate::GetCurrent(), value); -} - -//=== Boolean Object =========================================================== - -Factory::return_t -Factory::New(bool value) { -#if (NODE_MODULE_VERSION >= NODE_6_0_MODULE_VERSION) - return v8::BooleanObject::New( - v8::Isolate::GetCurrent(), value).As(); -#else - return v8::BooleanObject::New(value).As(); -#endif -} - -//=== Context ================================================================== - -Factory::return_t -Factory::New( v8::ExtensionConfiguration* extensions - , v8::Local tmpl - , v8::Local obj) { - return v8::Context::New(v8::Isolate::GetCurrent(), extensions, tmpl, obj); -} - -//=== Date ===================================================================== - -#if defined(V8_MAJOR_VERSION) && (V8_MAJOR_VERSION > 4 || \ - (V8_MAJOR_VERSION == 4 && defined(V8_MINOR_VERSION) && V8_MINOR_VERSION >= 3)) -Factory::return_t -Factory::New(double value) { - v8::Isolate *isolate = v8::Isolate::GetCurrent(); - v8::EscapableHandleScope scope(isolate); - return scope.Escape(v8::Date::New(isolate->GetCurrentContext(), value) - .FromMaybe(v8::Local()).As()); -} -#else -Factory::return_t -Factory::New(double value) { - return v8::Date::New(v8::Isolate::GetCurrent(), value).As(); -} -#endif - -//=== External ================================================================= - -Factory::return_t -Factory::New(void * value) { - return v8::External::New(v8::Isolate::GetCurrent(), value); -} - -//=== Function ================================================================= - -Factory::return_t -Factory::New( FunctionCallback callback - , v8::Local data) { - v8::Isolate *isolate = v8::Isolate::GetCurrent(); - v8::EscapableHandleScope scope(isolate); - v8::Local tpl = v8::ObjectTemplate::New(isolate); - tpl->SetInternalFieldCount(imp::kFunctionFieldCount); - v8::Local obj = NewInstance(tpl).ToLocalChecked(); - - obj->SetInternalField( - imp::kFunctionIndex - , v8::External::New(isolate, reinterpret_cast(callback))); - - v8::Local val = v8::Local::New(isolate, data); - - if (!val.IsEmpty()) { - obj->SetInternalField(imp::kDataIndex, val); - } - -#if NODE_MAJOR_VERSION >= 10 - v8::Local context = isolate->GetCurrentContext(); - v8::Local function = - v8::Function::New(context, imp::FunctionCallbackWrapper, obj) - .ToLocalChecked(); -#else - v8::Local function = - v8::Function::New(isolate, imp::FunctionCallbackWrapper, obj); -#endif - - return scope.Escape(function); -} - -//=== Function Template ======================================================== - -Factory::return_t -Factory::New( FunctionCallback callback - , v8::Local data - , v8::Local signature) { - v8::Isolate *isolate = v8::Isolate::GetCurrent(); - if (callback) { - v8::EscapableHandleScope scope(isolate); - v8::Local tpl = v8::ObjectTemplate::New(isolate); - tpl->SetInternalFieldCount(imp::kFunctionFieldCount); - v8::Local obj = NewInstance(tpl).ToLocalChecked(); - - obj->SetInternalField( - imp::kFunctionIndex - , v8::External::New(isolate, reinterpret_cast(callback))); - v8::Local val = v8::Local::New(isolate, data); - - if (!val.IsEmpty()) { - obj->SetInternalField(imp::kDataIndex, val); - } - - return scope.Escape(v8::FunctionTemplate::New( isolate - , imp::FunctionCallbackWrapper - , obj - , signature)); - } else { - return v8::FunctionTemplate::New(isolate, 0, data, signature); - } -} - -//=== Number =================================================================== - -Factory::return_t -Factory::New(double value) { - return v8::Number::New(v8::Isolate::GetCurrent(), value); -} - -//=== Number Object ============================================================ - -Factory::return_t -Factory::New(double value) { - return v8::NumberObject::New( v8::Isolate::GetCurrent() - , value).As(); -} - -//=== Integer, Int32 and Uint32 ================================================ - -template -typename IntegerFactory::return_t -IntegerFactory::New(int32_t value) { - return To(T::New(v8::Isolate::GetCurrent(), value)); -} - -template -typename IntegerFactory::return_t -IntegerFactory::New(uint32_t value) { - return To(T::NewFromUnsigned(v8::Isolate::GetCurrent(), value)); -} - -Factory::return_t -Factory::New(int32_t value) { - return To( - v8::Uint32::NewFromUnsigned(v8::Isolate::GetCurrent(), value)); -} - -Factory::return_t -Factory::New(uint32_t value) { - return To( - v8::Uint32::NewFromUnsigned(v8::Isolate::GetCurrent(), value)); -} - -//=== Object =================================================================== - -Factory::return_t -Factory::New() { - return v8::Object::New(v8::Isolate::GetCurrent()); -} - -//=== Object Template ========================================================== - -Factory::return_t -Factory::New() { - return v8::ObjectTemplate::New(v8::Isolate::GetCurrent()); -} - -//=== RegExp =================================================================== - -#if defined(V8_MAJOR_VERSION) && (V8_MAJOR_VERSION > 4 || \ - (V8_MAJOR_VERSION == 4 && defined(V8_MINOR_VERSION) && V8_MINOR_VERSION >= 3)) -Factory::return_t -Factory::New( - v8::Local pattern - , v8::RegExp::Flags flags) { - v8::Isolate *isolate = v8::Isolate::GetCurrent(); - v8::EscapableHandleScope scope(isolate); - return scope.Escape( - v8::RegExp::New(isolate->GetCurrentContext(), pattern, flags) - .FromMaybe(v8::Local())); -} -#else -Factory::return_t -Factory::New( - v8::Local pattern - , v8::RegExp::Flags flags) { - return v8::RegExp::New(pattern, flags); -} -#endif - -//=== Script =================================================================== - -#if defined(V8_MAJOR_VERSION) && (V8_MAJOR_VERSION > 4 || \ - (V8_MAJOR_VERSION == 4 && defined(V8_MINOR_VERSION) && V8_MINOR_VERSION >= 3)) -Factory::return_t -Factory::New( v8::Local source) { - v8::Isolate *isolate = v8::Isolate::GetCurrent(); - v8::EscapableHandleScope scope(isolate); - v8::ScriptCompiler::Source src(source); - return scope.Escape( - v8::ScriptCompiler::Compile(isolate->GetCurrentContext(), &src) - .FromMaybe(v8::Local())); -} - -Factory::return_t -Factory::New( v8::Local source - , v8::ScriptOrigin const& origin) { - v8::Isolate *isolate = v8::Isolate::GetCurrent(); - v8::EscapableHandleScope scope(isolate); - v8::ScriptCompiler::Source src(source, origin); - return scope.Escape( - v8::ScriptCompiler::Compile(isolate->GetCurrentContext(), &src) - .FromMaybe(v8::Local())); -} -#else -Factory::return_t -Factory::New( v8::Local source) { - v8::ScriptCompiler::Source src(source); - return v8::ScriptCompiler::Compile(v8::Isolate::GetCurrent(), &src); -} - -Factory::return_t -Factory::New( v8::Local source - , v8::ScriptOrigin const& origin) { - v8::ScriptCompiler::Source src(source, origin); - return v8::ScriptCompiler::Compile(v8::Isolate::GetCurrent(), &src); -} -#endif - -//=== Signature ================================================================ - -Factory::return_t -Factory::New(Factory::FTH receiver) { - return v8::Signature::New(v8::Isolate::GetCurrent(), receiver); -} - -//=== String =================================================================== - -Factory::return_t -Factory::New() { - return v8::String::Empty(v8::Isolate::GetCurrent()); -} - -#if defined(V8_MAJOR_VERSION) && (V8_MAJOR_VERSION > 4 || \ - (V8_MAJOR_VERSION == 4 && defined(V8_MINOR_VERSION) && V8_MINOR_VERSION >= 3)) -Factory::return_t -Factory::New(const char * value, int length) { - return v8::String::NewFromUtf8( - v8::Isolate::GetCurrent(), value, v8::NewStringType::kNormal, length); -} - -Factory::return_t -Factory::New(std::string const& value) { - assert(value.size() <= INT_MAX && "string too long"); - return v8::String::NewFromUtf8(v8::Isolate::GetCurrent(), - value.data(), v8::NewStringType::kNormal, static_cast(value.size())); -} - -Factory::return_t -Factory::New(const uint16_t * value, int length) { - return v8::String::NewFromTwoByte(v8::Isolate::GetCurrent(), value, - v8::NewStringType::kNormal, length); -} - -Factory::return_t -Factory::New(v8::String::ExternalStringResource * value) { - return v8::String::NewExternalTwoByte(v8::Isolate::GetCurrent(), value); -} - -Factory::return_t -Factory::New(ExternalOneByteStringResource * value) { - return v8::String::NewExternalOneByte(v8::Isolate::GetCurrent(), value); -} -#else -Factory::return_t -Factory::New(const char * value, int length) { - return v8::String::NewFromUtf8(v8::Isolate::GetCurrent(), value, - v8::String::kNormalString, length); -} - -Factory::return_t -Factory::New( - std::string const& value) /* NOLINT(build/include_what_you_use) */ { - assert(value.size() <= INT_MAX && "string too long"); - return v8::String::NewFromUtf8(v8::Isolate::GetCurrent(), value.data(), - v8::String::kNormalString, - static_cast(value.size())); -} - -Factory::return_t -Factory::New(const uint16_t * value, int length) { - return v8::String::NewFromTwoByte(v8::Isolate::GetCurrent(), value, - v8::String::kNormalString, length); -} - -Factory::return_t -Factory::New(v8::String::ExternalStringResource * value) { - return v8::String::NewExternal(v8::Isolate::GetCurrent(), value); -} - -Factory::return_t -Factory::New(ExternalOneByteStringResource * value) { - return v8::String::NewExternal(v8::Isolate::GetCurrent(), value); -} -#endif - -//=== String Object ============================================================ - -// See https://github.com/nodejs/nan/pull/811#discussion_r224594980. -// Disable the warning as there is no way around it. -// TODO(bnoordhuis) Use isolate-based version in Node.js v12. -Factory::return_t -Factory::New(v8::Local value) { -// V8 > 7.0 -#if V8_MAJOR_VERSION > 7 || (V8_MAJOR_VERSION == 7 && V8_MINOR_VERSION > 0) - return v8::StringObject::New(v8::Isolate::GetCurrent(), value) - .As(); -#else -#ifdef _MSC_VER -#pragma warning(push) -#pragma warning(disable : 4996) -#endif -#ifdef __GNUC__ -#pragma GCC diagnostic push -#pragma GCC diagnostic ignored "-Wdeprecated-declarations" -#endif - return v8::StringObject::New(value).As(); -#ifdef __GNUC__ -#pragma GCC diagnostic pop -#endif -#ifdef _MSC_VER -#pragma warning(pop) -#endif -#endif -} - -//=== Unbound Script =========================================================== - -#if defined(V8_MAJOR_VERSION) && (V8_MAJOR_VERSION > 4 || \ - (V8_MAJOR_VERSION == 4 && defined(V8_MINOR_VERSION) && V8_MINOR_VERSION >= 3)) -Factory::return_t -Factory::New(v8::Local source) { - v8::ScriptCompiler::Source src(source); - return v8::ScriptCompiler::CompileUnboundScript( - v8::Isolate::GetCurrent(), &src); -} - -Factory::return_t -Factory::New( v8::Local source - , v8::ScriptOrigin const& origin) { - v8::ScriptCompiler::Source src(source, origin); - return v8::ScriptCompiler::CompileUnboundScript( - v8::Isolate::GetCurrent(), &src); -} -#else -Factory::return_t -Factory::New(v8::Local source) { - v8::ScriptCompiler::Source src(source); - return v8::ScriptCompiler::CompileUnbound(v8::Isolate::GetCurrent(), &src); -} - -Factory::return_t -Factory::New( v8::Local source - , v8::ScriptOrigin const& origin) { - v8::ScriptCompiler::Source src(source, origin); - return v8::ScriptCompiler::CompileUnbound(v8::Isolate::GetCurrent(), &src); -} -#endif - -} // end of namespace imp - -//=== Presistents and Handles ================================================== - -#if NODE_MODULE_VERSION < IOJS_3_0_MODULE_VERSION -template -inline v8::Local New(v8::Handle h) { - return v8::Local::New(v8::Isolate::GetCurrent(), h); -} -#endif - -template -inline v8::Local New(v8::Persistent const& p) { - return v8::Local::New(v8::Isolate::GetCurrent(), p); -} - -template -inline v8::Local New(Persistent const& p) { - return v8::Local::New(v8::Isolate::GetCurrent(), p); -} - -template -inline v8::Local New(Global const& p) { - return v8::Local::New(v8::Isolate::GetCurrent(), p); -} - -#endif // NAN_IMPLEMENTATION_12_INL_H_ diff --git a/node_modules/node-pty/node_modules/nan/nan_implementation_pre_12_inl.h b/node_modules/node-pty/node_modules/nan/nan_implementation_pre_12_inl.h deleted file mode 100644 index 1472421..0000000 --- a/node_modules/node-pty/node_modules/nan/nan_implementation_pre_12_inl.h +++ /dev/null @@ -1,263 +0,0 @@ -/********************************************************************* - * NAN - Native Abstractions for Node.js - * - * Copyright (c) 2018 NAN contributors - * - * MIT License - ********************************************************************/ - -#ifndef NAN_IMPLEMENTATION_PRE_12_INL_H_ -#define NAN_IMPLEMENTATION_PRE_12_INL_H_ - -//============================================================================== -// node v0.10 implementation -//============================================================================== - -namespace imp { - -//=== Array ==================================================================== - -Factory::return_t -Factory::New() { - return v8::Array::New(); -} - -Factory::return_t -Factory::New(int length) { - return v8::Array::New(length); -} - -//=== Boolean ================================================================== - -Factory::return_t -Factory::New(bool value) { - return v8::Boolean::New(value)->ToBoolean(); -} - -//=== Boolean Object =========================================================== - -Factory::return_t -Factory::New(bool value) { - return v8::BooleanObject::New(value).As(); -} - -//=== Context ================================================================== - -Factory::return_t -Factory::New( v8::ExtensionConfiguration* extensions - , v8::Local tmpl - , v8::Local obj) { - v8::Persistent ctx = v8::Context::New(extensions, tmpl, obj); - v8::Local lctx = v8::Local::New(ctx); - ctx.Dispose(); - return lctx; -} - -//=== Date ===================================================================== - -Factory::return_t -Factory::New(double value) { - return v8::Date::New(value).As(); -} - -//=== External ================================================================= - -Factory::return_t -Factory::New(void * value) { - return v8::External::New(value); -} - -//=== Function ================================================================= - -Factory::return_t -Factory::New( FunctionCallback callback - , v8::Local data) { - v8::HandleScope scope; - - return scope.Close(Factory::New( - callback, data, v8::Local()) - ->GetFunction()); -} - - -//=== FunctionTemplate ========================================================= - -Factory::return_t -Factory::New( FunctionCallback callback - , v8::Local data - , v8::Local signature) { - if (callback) { - v8::HandleScope scope; - - v8::Local tpl = v8::ObjectTemplate::New(); - tpl->SetInternalFieldCount(imp::kFunctionFieldCount); - v8::Local obj = tpl->NewInstance(); - - obj->SetInternalField( - imp::kFunctionIndex - , v8::External::New(reinterpret_cast(callback))); - - v8::Local val = v8::Local::New(data); - - if (!val.IsEmpty()) { - obj->SetInternalField(imp::kDataIndex, val); - } - - // Note(agnat): Emulate length argument here. Unfortunately, I couldn't find - // a way. Have at it though... - return scope.Close( - v8::FunctionTemplate::New(imp::FunctionCallbackWrapper - , obj - , signature)); - } else { - return v8::FunctionTemplate::New(0, data, signature); - } -} - -//=== Number =================================================================== - -Factory::return_t -Factory::New(double value) { - return v8::Number::New(value); -} - -//=== Number Object ============================================================ - -Factory::return_t -Factory::New(double value) { - return v8::NumberObject::New(value).As(); -} - -//=== Integer, Int32 and Uint32 ================================================ - -template -typename IntegerFactory::return_t -IntegerFactory::New(int32_t value) { - return To(T::New(value)); -} - -template -typename IntegerFactory::return_t -IntegerFactory::New(uint32_t value) { - return To(T::NewFromUnsigned(value)); -} - -Factory::return_t -Factory::New(int32_t value) { - return To(v8::Uint32::NewFromUnsigned(value)); -} - -Factory::return_t -Factory::New(uint32_t value) { - return To(v8::Uint32::NewFromUnsigned(value)); -} - - -//=== Object =================================================================== - -Factory::return_t -Factory::New() { - return v8::Object::New(); -} - -//=== Object Template ========================================================== - -Factory::return_t -Factory::New() { - return v8::ObjectTemplate::New(); -} - -//=== RegExp =================================================================== - -Factory::return_t -Factory::New( - v8::Local pattern - , v8::RegExp::Flags flags) { - return v8::RegExp::New(pattern, flags); -} - -//=== Script =================================================================== - -Factory::return_t -Factory::New( v8::Local source) { - return v8::Script::New(source); -} -Factory::return_t -Factory::New( v8::Local source - , v8::ScriptOrigin const& origin) { - return v8::Script::New(source, const_cast(&origin)); -} - -//=== Signature ================================================================ - -Factory::return_t -Factory::New(Factory::FTH receiver) { - return v8::Signature::New(receiver); -} - -//=== String =================================================================== - -Factory::return_t -Factory::New() { - return v8::String::Empty(); -} - -Factory::return_t -Factory::New(const char * value, int length) { - return v8::String::New(value, length); -} - -Factory::return_t -Factory::New( - std::string const& value) /* NOLINT(build/include_what_you_use) */ { - assert(value.size() <= INT_MAX && "string too long"); - return v8::String::New(value.data(), static_cast(value.size())); -} - -Factory::return_t -Factory::New(const uint16_t * value, int length) { - return v8::String::New(value, length); -} - -Factory::return_t -Factory::New(v8::String::ExternalStringResource * value) { - return v8::String::NewExternal(value); -} - -Factory::return_t -Factory::New(v8::String::ExternalAsciiStringResource * value) { - return v8::String::NewExternal(value); -} - -//=== String Object ============================================================ - -Factory::return_t -Factory::New(v8::Local value) { - return v8::StringObject::New(value).As(); -} - -} // end of namespace imp - -//=== Presistents and Handles ================================================== - -template -inline v8::Local New(v8::Handle h) { - return v8::Local::New(h); -} - -template -inline v8::Local New(v8::Persistent const& p) { - return v8::Local::New(p); -} - -template -inline v8::Local New(Persistent const& p) { - return v8::Local::New(p.persistent); -} - -template -inline v8::Local New(Global const& p) { - return v8::Local::New(p.persistent); -} - -#endif // NAN_IMPLEMENTATION_PRE_12_INL_H_ diff --git a/node_modules/node-pty/node_modules/nan/nan_json.h b/node_modules/node-pty/node_modules/nan/nan_json.h deleted file mode 100644 index 33ac8ba..0000000 --- a/node_modules/node-pty/node_modules/nan/nan_json.h +++ /dev/null @@ -1,166 +0,0 @@ -/********************************************************************* - * NAN - Native Abstractions for Node.js - * - * Copyright (c) 2018 NAN contributors - * - * MIT License - ********************************************************************/ - -#ifndef NAN_JSON_H_ -#define NAN_JSON_H_ - -#if NODE_MODULE_VERSION < NODE_0_12_MODULE_VERSION -#define NAN_JSON_H_NEED_PARSE 1 -#else -#define NAN_JSON_H_NEED_PARSE 0 -#endif // NODE_MODULE_VERSION < NODE_0_12_MODULE_VERSION - -#if NODE_MODULE_VERSION >= NODE_7_0_MODULE_VERSION -#define NAN_JSON_H_NEED_STRINGIFY 0 -#else -#define NAN_JSON_H_NEED_STRINGIFY 1 -#endif // NODE_MODULE_VERSION >= NODE_7_0_MODULE_VERSION - -class JSON { - public: - JSON() { -#if NAN_JSON_H_NEED_PARSE + NAN_JSON_H_NEED_STRINGIFY - Nan::HandleScope scope; - - Nan::MaybeLocal maybe_global_json = Nan::Get( - Nan::GetCurrentContext()->Global(), - Nan::New("JSON").ToLocalChecked() - ); - - assert(!maybe_global_json.IsEmpty() && "global JSON is empty"); - v8::Local val_global_json = maybe_global_json.ToLocalChecked(); - - assert(val_global_json->IsObject() && "global JSON is not an object"); - Nan::MaybeLocal maybe_obj_global_json = - Nan::To(val_global_json); - - assert(!maybe_obj_global_json.IsEmpty() && "global JSON object is empty"); - v8::Local global_json = maybe_obj_global_json.ToLocalChecked(); - -#if NAN_JSON_H_NEED_PARSE - Nan::MaybeLocal maybe_parse_method = Nan::Get( - global_json, Nan::New("parse").ToLocalChecked() - ); - - assert(!maybe_parse_method.IsEmpty() && "JSON.parse is empty"); - v8::Local parse_method = maybe_parse_method.ToLocalChecked(); - - assert(parse_method->IsFunction() && "JSON.parse is not a function"); - parse_cb_.Reset(parse_method.As()); -#endif // NAN_JSON_H_NEED_PARSE - -#if NAN_JSON_H_NEED_STRINGIFY - Nan::MaybeLocal maybe_stringify_method = Nan::Get( - global_json, Nan::New("stringify").ToLocalChecked() - ); - - assert(!maybe_stringify_method.IsEmpty() && "JSON.stringify is empty"); - v8::Local stringify_method = - maybe_stringify_method.ToLocalChecked(); - - assert( - stringify_method->IsFunction() && "JSON.stringify is not a function" - ); - stringify_cb_.Reset(stringify_method.As()); -#endif // NAN_JSON_H_NEED_STRINGIFY -#endif // NAN_JSON_H_NEED_PARSE + NAN_JSON_H_NEED_STRINGIFY - } - - inline - Nan::MaybeLocal Parse(v8::Local json_string) { - Nan::EscapableHandleScope scope; -#if NAN_JSON_H_NEED_PARSE - return scope.Escape(parse(json_string)); -#else - Nan::MaybeLocal result; -#if NODE_MODULE_VERSION >= NODE_0_12_MODULE_VERSION && \ - NODE_MODULE_VERSION <= IOJS_2_0_MODULE_VERSION - result = v8::JSON::Parse(json_string); -#else -#if NODE_MODULE_VERSION > NODE_6_0_MODULE_VERSION - v8::Local context_or_isolate = Nan::GetCurrentContext(); -#else - v8::Isolate* context_or_isolate = v8::Isolate::GetCurrent(); -#endif // NODE_MODULE_VERSION > NODE_6_0_MODULE_VERSION - result = v8::JSON::Parse(context_or_isolate, json_string); -#endif // NODE_MODULE_VERSION >= NODE_0_12_MODULE_VERSION && - // NODE_MODULE_VERSION <= IOJS_2_0_MODULE_VERSION - if (result.IsEmpty()) return v8::Local(); - return scope.Escape(result.ToLocalChecked()); -#endif // NAN_JSON_H_NEED_PARSE - } - - inline - Nan::MaybeLocal Stringify(v8::Local json_object) { - Nan::EscapableHandleScope scope; - Nan::MaybeLocal result = -#if NAN_JSON_H_NEED_STRINGIFY - Nan::To(stringify(json_object)); -#else - v8::JSON::Stringify(Nan::GetCurrentContext(), json_object); -#endif // NAN_JSON_H_NEED_STRINGIFY - if (result.IsEmpty()) return v8::Local(); - return scope.Escape(result.ToLocalChecked()); - } - - inline - Nan::MaybeLocal Stringify(v8::Local json_object, - v8::Local gap) { - Nan::EscapableHandleScope scope; - Nan::MaybeLocal result = -#if NAN_JSON_H_NEED_STRINGIFY - Nan::To(stringify(json_object, gap)); -#else - v8::JSON::Stringify(Nan::GetCurrentContext(), json_object, gap); -#endif // NAN_JSON_H_NEED_STRINGIFY - if (result.IsEmpty()) return v8::Local(); - return scope.Escape(result.ToLocalChecked()); - } - - private: - NAN_DISALLOW_ASSIGN_COPY_MOVE(JSON) -#if NAN_JSON_H_NEED_PARSE - Nan::Callback parse_cb_; -#endif // NAN_JSON_H_NEED_PARSE -#if NAN_JSON_H_NEED_STRINGIFY - Nan::Callback stringify_cb_; -#endif // NAN_JSON_H_NEED_STRINGIFY - -#if NAN_JSON_H_NEED_PARSE - inline v8::Local parse(v8::Local arg) { - assert(!parse_cb_.IsEmpty() && "parse_cb_ is empty"); - AsyncResource resource("nan:JSON.parse"); - return parse_cb_.Call(1, &arg, &resource).FromMaybe(v8::Local()); - } -#endif // NAN_JSON_H_NEED_PARSE - -#if NAN_JSON_H_NEED_STRINGIFY - inline v8::Local stringify(v8::Local arg) { - assert(!stringify_cb_.IsEmpty() && "stringify_cb_ is empty"); - AsyncResource resource("nan:JSON.stringify"); - return stringify_cb_.Call(1, &arg, &resource) - .FromMaybe(v8::Local()); - } - - inline v8::Local stringify(v8::Local arg, - v8::Local gap) { - assert(!stringify_cb_.IsEmpty() && "stringify_cb_ is empty"); - - v8::Local argv[] = { - arg, - Nan::Null(), - gap - }; - AsyncResource resource("nan:JSON.stringify"); - return stringify_cb_.Call(3, argv, &resource) - .FromMaybe(v8::Local()); - } -#endif // NAN_JSON_H_NEED_STRINGIFY -}; - -#endif // NAN_JSON_H_ diff --git a/node_modules/node-pty/node_modules/nan/nan_maybe_43_inl.h b/node_modules/node-pty/node_modules/nan/nan_maybe_43_inl.h deleted file mode 100644 index c04ce30..0000000 --- a/node_modules/node-pty/node_modules/nan/nan_maybe_43_inl.h +++ /dev/null @@ -1,356 +0,0 @@ -/********************************************************************* - * NAN - Native Abstractions for Node.js - * - * Copyright (c) 2018 NAN contributors - * - * MIT License - ********************************************************************/ - -#ifndef NAN_MAYBE_43_INL_H_ -#define NAN_MAYBE_43_INL_H_ - -template -using MaybeLocal = v8::MaybeLocal; - -inline -MaybeLocal ToDetailString(v8::Local val) { - v8::Isolate *isolate = v8::Isolate::GetCurrent(); - v8::EscapableHandleScope scope(isolate); - return scope.Escape(val->ToDetailString(isolate->GetCurrentContext()) - .FromMaybe(v8::Local())); -} - -inline -MaybeLocal ToArrayIndex(v8::Local val) { - v8::Isolate *isolate = v8::Isolate::GetCurrent(); - v8::EscapableHandleScope scope(isolate); - return scope.Escape(val->ToArrayIndex(isolate->GetCurrentContext()) - .FromMaybe(v8::Local())); -} - -inline -Maybe Equals(v8::Local a, v8::Local(b)) { - v8::Isolate *isolate = v8::Isolate::GetCurrent(); - v8::HandleScope scope(isolate); - return a->Equals(isolate->GetCurrentContext(), b); -} - -inline -MaybeLocal NewInstance(v8::Local h) { - v8::Isolate *isolate = v8::Isolate::GetCurrent(); - v8::EscapableHandleScope scope(isolate); - return scope.Escape(h->NewInstance(isolate->GetCurrentContext()) - .FromMaybe(v8::Local())); -} - -inline -MaybeLocal NewInstance( - v8::Local h - , int argc - , v8::Local argv[]) { - v8::Isolate *isolate = v8::Isolate::GetCurrent(); - v8::EscapableHandleScope scope(isolate); - return scope.Escape(h->NewInstance(isolate->GetCurrentContext(), argc, argv) - .FromMaybe(v8::Local())); -} - -inline -MaybeLocal NewInstance(v8::Local h) { - v8::Isolate *isolate = v8::Isolate::GetCurrent(); - v8::EscapableHandleScope scope(isolate); - return scope.Escape(h->NewInstance(isolate->GetCurrentContext()) - .FromMaybe(v8::Local())); -} - - -inline MaybeLocal GetFunction( - v8::Local t) { - v8::Isolate *isolate = v8::Isolate::GetCurrent(); - v8::EscapableHandleScope scope(isolate); - return scope.Escape(t->GetFunction(isolate->GetCurrentContext()) - .FromMaybe(v8::Local())); -} - -inline Maybe Set( - v8::Local obj - , v8::Local key - , v8::Local value) { - v8::Isolate *isolate = v8::Isolate::GetCurrent(); - v8::HandleScope scope(isolate); - return obj->Set(isolate->GetCurrentContext(), key, value); -} - -inline Maybe Set( - v8::Local obj - , uint32_t index - , v8::Local value) { - v8::Isolate *isolate = v8::Isolate::GetCurrent(); - v8::HandleScope scope(isolate); - return obj->Set(isolate->GetCurrentContext(), index, value); -} - -#if NODE_MODULE_VERSION < NODE_4_0_MODULE_VERSION -#include "nan_define_own_property_helper.h" // NOLINT(build/include) -#endif - -inline Maybe DefineOwnProperty( - v8::Local obj - , v8::Local key - , v8::Local value - , v8::PropertyAttribute attribs = v8::None) { - v8::Isolate *isolate = v8::Isolate::GetCurrent(); - v8::HandleScope scope(isolate); -#if NODE_MODULE_VERSION >= NODE_4_0_MODULE_VERSION - return obj->DefineOwnProperty(isolate->GetCurrentContext(), key, value, - attribs); -#else - Maybe maybeCurrent = - obj->GetPropertyAttributes(isolate->GetCurrentContext(), key); - if (maybeCurrent.IsNothing()) { - return Nothing(); - } - v8::PropertyAttribute current = maybeCurrent.FromJust(); - return imp::DefineOwnPropertyHelper(current, obj, key, value, attribs); -#endif -} - -NAN_DEPRECATED inline Maybe ForceSet( - v8::Local obj - , v8::Local key - , v8::Local value - , v8::PropertyAttribute attribs = v8::None) { - v8::Isolate *isolate = v8::Isolate::GetCurrent(); - v8::HandleScope scope(isolate); -#if NODE_MODULE_VERSION >= NODE_9_0_MODULE_VERSION - return key->IsName() - ? obj->DefineOwnProperty(isolate->GetCurrentContext(), - key.As(), value, attribs) - : Nothing(); -#else - return obj->ForceSet(isolate->GetCurrentContext(), key, value, attribs); -#endif -} - -inline MaybeLocal Get( - v8::Local obj - , v8::Local key) { - v8::Isolate *isolate = v8::Isolate::GetCurrent(); - v8::EscapableHandleScope scope(isolate); - return scope.Escape(obj->Get(isolate->GetCurrentContext(), key) - .FromMaybe(v8::Local())); -} - -inline -MaybeLocal Get(v8::Local obj, uint32_t index) { - v8::Isolate *isolate = v8::Isolate::GetCurrent(); - v8::EscapableHandleScope scope(isolate); - return scope.Escape(obj->Get(isolate->GetCurrentContext(), index) - .FromMaybe(v8::Local())); -} - -inline v8::PropertyAttribute GetPropertyAttributes( - v8::Local obj - , v8::Local key) { - v8::Isolate *isolate = v8::Isolate::GetCurrent(); - v8::HandleScope scope(isolate); - return obj->GetPropertyAttributes(isolate->GetCurrentContext(), key) - .FromJust(); -} - -inline Maybe Has( - v8::Local obj - , v8::Local key) { - v8::Isolate *isolate = v8::Isolate::GetCurrent(); - v8::HandleScope scope(isolate); - return obj->Has(isolate->GetCurrentContext(), key); -} - -inline Maybe Has(v8::Local obj, uint32_t index) { - v8::Isolate *isolate = v8::Isolate::GetCurrent(); - v8::HandleScope scope(isolate); - return obj->Has(isolate->GetCurrentContext(), index); -} - -inline Maybe Delete( - v8::Local obj - , v8::Local key) { - v8::Isolate *isolate = v8::Isolate::GetCurrent(); - v8::HandleScope scope(isolate); - return obj->Delete(isolate->GetCurrentContext(), key); -} - -inline -Maybe Delete(v8::Local obj, uint32_t index) { - v8::Isolate *isolate = v8::Isolate::GetCurrent(); - v8::HandleScope scope(isolate); - return obj->Delete(isolate->GetCurrentContext(), index); -} - -inline -MaybeLocal GetPropertyNames(v8::Local obj) { - v8::Isolate *isolate = v8::Isolate::GetCurrent(); - v8::EscapableHandleScope scope(isolate); - return scope.Escape(obj->GetPropertyNames(isolate->GetCurrentContext()) - .FromMaybe(v8::Local())); -} - -inline -MaybeLocal GetOwnPropertyNames(v8::Local obj) { - v8::Isolate *isolate = v8::Isolate::GetCurrent(); - v8::EscapableHandleScope scope(isolate); - return scope.Escape(obj->GetOwnPropertyNames(isolate->GetCurrentContext()) - .FromMaybe(v8::Local())); -} - -inline Maybe SetPrototype( - v8::Local obj - , v8::Local prototype) { - v8::Isolate *isolate = v8::Isolate::GetCurrent(); - v8::HandleScope scope(isolate); - return obj->SetPrototype(isolate->GetCurrentContext(), prototype); -} - -inline MaybeLocal ObjectProtoToString( - v8::Local obj) { - v8::Isolate *isolate = v8::Isolate::GetCurrent(); - v8::EscapableHandleScope scope(isolate); - return scope.Escape(obj->ObjectProtoToString(isolate->GetCurrentContext()) - .FromMaybe(v8::Local())); -} - -inline Maybe HasOwnProperty( - v8::Local obj - , v8::Local key) { - v8::Isolate *isolate = v8::Isolate::GetCurrent(); - v8::HandleScope scope(isolate); - return obj->HasOwnProperty(isolate->GetCurrentContext(), key); -} - -inline Maybe HasRealNamedProperty( - v8::Local obj - , v8::Local key) { - v8::Isolate *isolate = v8::Isolate::GetCurrent(); - v8::HandleScope scope(isolate); - return obj->HasRealNamedProperty(isolate->GetCurrentContext(), key); -} - -inline Maybe HasRealIndexedProperty( - v8::Local obj - , uint32_t index) { - v8::Isolate *isolate = v8::Isolate::GetCurrent(); - v8::HandleScope scope(isolate); - return obj->HasRealIndexedProperty(isolate->GetCurrentContext(), index); -} - -inline Maybe HasRealNamedCallbackProperty( - v8::Local obj - , v8::Local key) { - v8::Isolate *isolate = v8::Isolate::GetCurrent(); - v8::HandleScope scope(isolate); - return obj->HasRealNamedCallbackProperty(isolate->GetCurrentContext(), key); -} - -inline MaybeLocal GetRealNamedPropertyInPrototypeChain( - v8::Local obj - , v8::Local key) { - v8::Isolate *isolate = v8::Isolate::GetCurrent(); - v8::EscapableHandleScope scope(isolate); - return scope.Escape(obj->GetRealNamedPropertyInPrototypeChain( - isolate->GetCurrentContext(), key) - .FromMaybe(v8::Local())); -} - -inline MaybeLocal GetRealNamedProperty( - v8::Local obj - , v8::Local key) { - v8::Isolate *isolate = v8::Isolate::GetCurrent(); - v8::EscapableHandleScope scope(isolate); - return scope.Escape( - obj->GetRealNamedProperty(isolate->GetCurrentContext(), key) - .FromMaybe(v8::Local())); -} - -inline MaybeLocal CallAsFunction( - v8::Local obj - , v8::Local recv - , int argc - , v8::Local argv[]) { - v8::Isolate *isolate = v8::Isolate::GetCurrent(); - v8::EscapableHandleScope scope(isolate); - return scope.Escape( - obj->CallAsFunction(isolate->GetCurrentContext(), recv, argc, argv) - .FromMaybe(v8::Local())); -} - -inline MaybeLocal CallAsConstructor( - v8::Local obj - , int argc, v8::Local argv[]) { - v8::Isolate *isolate = v8::Isolate::GetCurrent(); - v8::EscapableHandleScope scope(isolate); - return scope.Escape( - obj->CallAsConstructor(isolate->GetCurrentContext(), argc, argv) - .FromMaybe(v8::Local())); -} - -inline -MaybeLocal GetSourceLine(v8::Local msg) { - v8::Isolate *isolate = v8::Isolate::GetCurrent(); - v8::EscapableHandleScope scope(isolate); - return scope.Escape(msg->GetSourceLine(isolate->GetCurrentContext()) - .FromMaybe(v8::Local())); -} - -inline Maybe GetLineNumber(v8::Local msg) { - v8::Isolate *isolate = v8::Isolate::GetCurrent(); - v8::HandleScope scope(isolate); - return msg->GetLineNumber(isolate->GetCurrentContext()); -} - -inline Maybe GetStartColumn(v8::Local msg) { - v8::Isolate *isolate = v8::Isolate::GetCurrent(); - v8::HandleScope scope(isolate); - return msg->GetStartColumn(isolate->GetCurrentContext()); -} - -inline Maybe GetEndColumn(v8::Local msg) { - v8::Isolate *isolate = v8::Isolate::GetCurrent(); - v8::HandleScope scope(isolate); - return msg->GetEndColumn(isolate->GetCurrentContext()); -} - -inline MaybeLocal CloneElementAt( - v8::Local array - , uint32_t index) { -#if (NODE_MODULE_VERSION >= NODE_6_0_MODULE_VERSION) - v8::Isolate *isolate = v8::Isolate::GetCurrent(); - v8::EscapableHandleScope scope(isolate); - v8::Local context = isolate->GetCurrentContext(); - v8::Local elem; - v8::Local obj; - if (!array->Get(context, index).ToLocal(&elem)) { - return scope.Escape(obj); - } - if (!elem->ToObject(context).ToLocal(&obj)) { - return scope.Escape(v8::Local()); - } - return scope.Escape(obj->Clone()); -#else - v8::Isolate *isolate = v8::Isolate::GetCurrent(); - v8::EscapableHandleScope scope(isolate); - return scope.Escape(array->CloneElementAt(isolate->GetCurrentContext(), index) - .FromMaybe(v8::Local())); -#endif -} - -inline MaybeLocal Call( - v8::Local fun - , v8::Local recv - , int argc - , v8::Local argv[]) { - v8::Isolate *isolate = v8::Isolate::GetCurrent(); - v8::EscapableHandleScope scope(isolate); - return scope.Escape(fun->Call(isolate->GetCurrentContext(), recv, argc, argv) - .FromMaybe(v8::Local())); -} - -#endif // NAN_MAYBE_43_INL_H_ diff --git a/node_modules/node-pty/node_modules/nan/nan_maybe_pre_43_inl.h b/node_modules/node-pty/node_modules/nan/nan_maybe_pre_43_inl.h deleted file mode 100644 index 83325ae..0000000 --- a/node_modules/node-pty/node_modules/nan/nan_maybe_pre_43_inl.h +++ /dev/null @@ -1,268 +0,0 @@ -/********************************************************************* - * NAN - Native Abstractions for Node.js - * - * Copyright (c) 2018 NAN contributors - * - * MIT License - ********************************************************************/ - -#ifndef NAN_MAYBE_PRE_43_INL_H_ -#define NAN_MAYBE_PRE_43_INL_H_ - -template -class MaybeLocal { - public: - inline MaybeLocal() : val_(v8::Local()) {} - - template -# if NODE_MODULE_VERSION >= NODE_0_12_MODULE_VERSION - inline - MaybeLocal(v8::Local that) : val_(that) {} // NOLINT(runtime/explicit) -# else - inline - MaybeLocal(v8::Local that) : // NOLINT(runtime/explicit) - val_(*reinterpret_cast*>(&that)) {} -# endif - - inline bool IsEmpty() const { return val_.IsEmpty(); } - - template - inline bool ToLocal(v8::Local *out) const { - *out = val_; - return !IsEmpty(); - } - - inline v8::Local ToLocalChecked() const { -#if defined(V8_ENABLE_CHECKS) - assert(!IsEmpty() && "ToLocalChecked is Empty"); -#endif // V8_ENABLE_CHECKS - return val_; - } - - template - inline v8::Local FromMaybe(v8::Local default_value) const { - return IsEmpty() ? default_value : v8::Local(val_); - } - - private: - v8::Local val_; -}; - -inline -MaybeLocal ToDetailString(v8::Handle val) { - return MaybeLocal(val->ToDetailString()); -} - -inline -MaybeLocal ToArrayIndex(v8::Handle val) { - return MaybeLocal(val->ToArrayIndex()); -} - -inline -Maybe Equals(v8::Handle a, v8::Handle(b)) { - return Just(a->Equals(b)); -} - -inline -MaybeLocal NewInstance(v8::Handle h) { - return MaybeLocal(h->NewInstance()); -} - -inline -MaybeLocal NewInstance( - v8::Local h - , int argc - , v8::Local argv[]) { - return MaybeLocal(h->NewInstance(argc, argv)); -} - -inline -MaybeLocal NewInstance(v8::Handle h) { - return MaybeLocal(h->NewInstance()); -} - -inline -MaybeLocal GetFunction(v8::Handle t) { - return MaybeLocal(t->GetFunction()); -} - -inline Maybe Set( - v8::Handle obj - , v8::Handle key - , v8::Handle value) { - return Just(obj->Set(key, value)); -} - -inline Maybe Set( - v8::Handle obj - , uint32_t index - , v8::Handle value) { - return Just(obj->Set(index, value)); -} - -#include "nan_define_own_property_helper.h" // NOLINT(build/include) - -inline Maybe DefineOwnProperty( - v8::Handle obj - , v8::Handle key - , v8::Handle value - , v8::PropertyAttribute attribs = v8::None) { - v8::PropertyAttribute current = obj->GetPropertyAttributes(key); - return imp::DefineOwnPropertyHelper(current, obj, key, value, attribs); -} - -NAN_DEPRECATED inline Maybe ForceSet( - v8::Handle obj - , v8::Handle key - , v8::Handle value - , v8::PropertyAttribute attribs = v8::None) { - return Just(obj->ForceSet(key, value, attribs)); -} - -inline MaybeLocal Get( - v8::Handle obj - , v8::Handle key) { - return MaybeLocal(obj->Get(key)); -} - -inline MaybeLocal Get( - v8::Handle obj - , uint32_t index) { - return MaybeLocal(obj->Get(index)); -} - -inline Maybe GetPropertyAttributes( - v8::Handle obj - , v8::Handle key) { - return Just(obj->GetPropertyAttributes(key)); -} - -inline Maybe Has( - v8::Handle obj - , v8::Handle key) { - return Just(obj->Has(key)); -} - -inline Maybe Has( - v8::Handle obj - , uint32_t index) { - return Just(obj->Has(index)); -} - -inline Maybe Delete( - v8::Handle obj - , v8::Handle key) { - return Just(obj->Delete(key)); -} - -inline Maybe Delete( - v8::Handle obj - , uint32_t index) { - return Just(obj->Delete(index)); -} - -inline -MaybeLocal GetPropertyNames(v8::Handle obj) { - return MaybeLocal(obj->GetPropertyNames()); -} - -inline -MaybeLocal GetOwnPropertyNames(v8::Handle obj) { - return MaybeLocal(obj->GetOwnPropertyNames()); -} - -inline Maybe SetPrototype( - v8::Handle obj - , v8::Handle prototype) { - return Just(obj->SetPrototype(prototype)); -} - -inline MaybeLocal ObjectProtoToString( - v8::Handle obj) { - return MaybeLocal(obj->ObjectProtoToString()); -} - -inline Maybe HasOwnProperty( - v8::Handle obj - , v8::Handle key) { - return Just(obj->HasOwnProperty(key)); -} - -inline Maybe HasRealNamedProperty( - v8::Handle obj - , v8::Handle key) { - return Just(obj->HasRealNamedProperty(key)); -} - -inline Maybe HasRealIndexedProperty( - v8::Handle obj - , uint32_t index) { - return Just(obj->HasRealIndexedProperty(index)); -} - -inline Maybe HasRealNamedCallbackProperty( - v8::Handle obj - , v8::Handle key) { - return Just(obj->HasRealNamedCallbackProperty(key)); -} - -inline MaybeLocal GetRealNamedPropertyInPrototypeChain( - v8::Handle obj - , v8::Handle key) { - return MaybeLocal( - obj->GetRealNamedPropertyInPrototypeChain(key)); -} - -inline MaybeLocal GetRealNamedProperty( - v8::Handle obj - , v8::Handle key) { - return MaybeLocal(obj->GetRealNamedProperty(key)); -} - -inline MaybeLocal CallAsFunction( - v8::Handle obj - , v8::Handle recv - , int argc - , v8::Handle argv[]) { - return MaybeLocal(obj->CallAsFunction(recv, argc, argv)); -} - -inline MaybeLocal CallAsConstructor( - v8::Handle obj - , int argc - , v8::Local argv[]) { - return MaybeLocal(obj->CallAsConstructor(argc, argv)); -} - -inline -MaybeLocal GetSourceLine(v8::Handle msg) { - return MaybeLocal(msg->GetSourceLine()); -} - -inline Maybe GetLineNumber(v8::Handle msg) { - return Just(msg->GetLineNumber()); -} - -inline Maybe GetStartColumn(v8::Handle msg) { - return Just(msg->GetStartColumn()); -} - -inline Maybe GetEndColumn(v8::Handle msg) { - return Just(msg->GetEndColumn()); -} - -inline MaybeLocal CloneElementAt( - v8::Handle array - , uint32_t index) { - return MaybeLocal(array->CloneElementAt(index)); -} - -inline MaybeLocal Call( - v8::Local fun - , v8::Local recv - , int argc - , v8::Local argv[]) { - return MaybeLocal(fun->Call(recv, argc, argv)); -} - -#endif // NAN_MAYBE_PRE_43_INL_H_ diff --git a/node_modules/node-pty/node_modules/nan/nan_new.h b/node_modules/node-pty/node_modules/nan/nan_new.h deleted file mode 100644 index cdf8bbe..0000000 --- a/node_modules/node-pty/node_modules/nan/nan_new.h +++ /dev/null @@ -1,340 +0,0 @@ -/********************************************************************* - * NAN - Native Abstractions for Node.js - * - * Copyright (c) 2018 NAN contributors - * - * MIT License - ********************************************************************/ - -#ifndef NAN_NEW_H_ -#define NAN_NEW_H_ - -namespace imp { // scnr - -// TODO(agnat): Generalize -template v8::Local To(v8::Local i); - -template <> -inline -v8::Local -To(v8::Local i) { - return Nan::To(i).ToLocalChecked(); -} - -template <> -inline -v8::Local -To(v8::Local i) { - return Nan::To(i).ToLocalChecked(); -} - -template <> -inline -v8::Local -To(v8::Local i) { - return Nan::To(i).ToLocalChecked(); -} - -template struct FactoryBase { - typedef v8::Local return_t; -}; - -template struct MaybeFactoryBase { - typedef MaybeLocal return_t; -}; - -template struct Factory; - -template <> -struct Factory : FactoryBase { - static inline return_t New(); - static inline return_t New(int length); -}; - -template <> -struct Factory : FactoryBase { - static inline return_t New(bool value); -}; - -template <> -struct Factory : FactoryBase { - static inline return_t New(bool value); -}; - -template <> -struct Factory : FactoryBase { - static inline - return_t - New( v8::ExtensionConfiguration* extensions = NULL - , v8::Local tmpl = v8::Local() - , v8::Local obj = v8::Local()); -}; - -template <> -struct Factory : MaybeFactoryBase { - static inline return_t New(double value); -}; - -template <> -struct Factory : FactoryBase { - static inline return_t New(void *value); -}; - -template <> -struct Factory : FactoryBase { - static inline - return_t - New( FunctionCallback callback - , v8::Local data = v8::Local()); -}; - -template <> -struct Factory : FactoryBase { - static inline - return_t - New( FunctionCallback callback = NULL - , v8::Local data = v8::Local() - , v8::Local signature = v8::Local()); -}; - -template <> -struct Factory : FactoryBase { - static inline return_t New(double value); -}; - -template <> -struct Factory : FactoryBase { - static inline return_t New(double value); -}; - -template -struct IntegerFactory : FactoryBase { - typedef typename FactoryBase::return_t return_t; - static inline return_t New(int32_t value); - static inline return_t New(uint32_t value); -}; - -template <> -struct Factory : IntegerFactory {}; - -template <> -struct Factory : IntegerFactory {}; - -template <> -struct Factory : FactoryBase { - static inline return_t New(int32_t value); - static inline return_t New(uint32_t value); -}; - -template <> -struct Factory : FactoryBase { - static inline return_t New(); -}; - -template <> -struct Factory : FactoryBase { - static inline return_t New(); -}; - -template <> -struct Factory : MaybeFactoryBase { - static inline return_t New( - v8::Local pattern, v8::RegExp::Flags flags); -}; - -template <> -struct Factory : MaybeFactoryBase { - static inline return_t New( v8::Local source); - static inline return_t New( v8::Local source - , v8::ScriptOrigin const& origin); -}; - -template <> -struct Factory : FactoryBase { - typedef v8::Local FTH; - static inline return_t New(FTH receiver = FTH()); -}; - -template <> -struct Factory : MaybeFactoryBase { - static inline return_t New(); - static inline return_t New(const char *value, int length = -1); - static inline return_t New(const uint16_t *value, int length = -1); - static inline return_t New(std::string const& value); - - static inline return_t New(v8::String::ExternalStringResource * value); - static inline return_t New(ExternalOneByteStringResource * value); -}; - -template <> -struct Factory : FactoryBase { - static inline return_t New(v8::Local value); -}; - -} // end of namespace imp - -#if (NODE_MODULE_VERSION >= 12) - -namespace imp { - -template <> -struct Factory : MaybeFactoryBase { - static inline return_t New( v8::Local source); - static inline return_t New( v8::Local source - , v8::ScriptOrigin const& origin); -}; - -} // end of namespace imp - -# include "nan_implementation_12_inl.h" - -#else // NODE_MODULE_VERSION >= 12 - -# include "nan_implementation_pre_12_inl.h" - -#endif - -//=== API ====================================================================== - -template -typename imp::Factory::return_t -New() { - return imp::Factory::New(); -} - -template -typename imp::Factory::return_t -New(A0 arg0) { - return imp::Factory::New(arg0); -} - -template -typename imp::Factory::return_t -New(A0 arg0, A1 arg1) { - return imp::Factory::New(arg0, arg1); -} - -template -typename imp::Factory::return_t -New(A0 arg0, A1 arg1, A2 arg2) { - return imp::Factory::New(arg0, arg1, arg2); -} - -template -typename imp::Factory::return_t -New(A0 arg0, A1 arg1, A2 arg2, A3 arg3) { - return imp::Factory::New(arg0, arg1, arg2, arg3); -} - -// Note(agnat): When passing overloaded function pointers to template functions -// as generic arguments the compiler needs help in picking the right overload. -// These two functions handle New and New with -// all argument variations. - -// v8::Function and v8::FunctionTemplate with one or two arguments -template -typename imp::Factory::return_t -New( FunctionCallback callback - , v8::Local data = v8::Local()) { - return imp::Factory::New(callback, data); -} - -// v8::Function and v8::FunctionTemplate with three arguments -template -typename imp::Factory::return_t -New( FunctionCallback callback - , v8::Local data = v8::Local() - , A2 a2 = A2()) { - return imp::Factory::New(callback, data, a2); -} - -// Convenience - -#if NODE_MODULE_VERSION < IOJS_3_0_MODULE_VERSION -template inline v8::Local New(v8::Handle h); -#endif - -#if NODE_MODULE_VERSION > NODE_0_10_MODULE_VERSION -template - inline v8::Local New(v8::Persistent const& p); -#else -template inline v8::Local New(v8::Persistent const& p); -#endif -template -inline v8::Local New(Persistent const& p); -template -inline v8::Local New(Global const& p); - -inline -imp::Factory::return_t -New(bool value) { - return New(value); -} - -inline -imp::Factory::return_t -New(int32_t value) { - return New(value); -} - -inline -imp::Factory::return_t -New(uint32_t value) { - return New(value); -} - -inline -imp::Factory::return_t -New(double value) { - return New(value); -} - -inline -imp::Factory::return_t -New(std::string const& value) { // NOLINT(build/include_what_you_use) - return New(value); -} - -inline -imp::Factory::return_t -New(const char * value, int length) { - return New(value, length); -} - -inline -imp::Factory::return_t -New(const uint16_t * value, int length) { - return New(value, length); -} - -inline -imp::Factory::return_t -New(const char * value) { - return New(value); -} - -inline -imp::Factory::return_t -New(const uint16_t * value) { - return New(value); -} - -inline -imp::Factory::return_t -New(v8::String::ExternalStringResource * value) { - return New(value); -} - -inline -imp::Factory::return_t -New(ExternalOneByteStringResource * value) { - return New(value); -} - -inline -imp::Factory::return_t -New(v8::Local pattern, v8::RegExp::Flags flags) { - return New(pattern, flags); -} - -#endif // NAN_NEW_H_ diff --git a/node_modules/node-pty/node_modules/nan/nan_object_wrap.h b/node_modules/node-pty/node_modules/nan/nan_object_wrap.h deleted file mode 100644 index 386affa..0000000 --- a/node_modules/node-pty/node_modules/nan/nan_object_wrap.h +++ /dev/null @@ -1,156 +0,0 @@ -/********************************************************************* - * NAN - Native Abstractions for Node.js - * - * Copyright (c) 2018 NAN contributors - * - * MIT License - ********************************************************************/ - -#ifndef NAN_OBJECT_WRAP_H_ -#define NAN_OBJECT_WRAP_H_ - -class ObjectWrap { - public: - ObjectWrap() { - refs_ = 0; - } - - - virtual ~ObjectWrap() { - if (persistent().IsEmpty()) { - return; - } - - persistent().ClearWeak(); - persistent().Reset(); - } - - - template - static inline T* Unwrap(v8::Local object) { - assert(!object.IsEmpty()); - assert(object->InternalFieldCount() > 0); - // Cast to ObjectWrap before casting to T. A direct cast from void - // to T won't work right when T has more than one base class. - void* ptr = GetInternalFieldPointer(object, 0); - ObjectWrap* wrap = static_cast(ptr); - return static_cast(wrap); - } - - - inline v8::Local handle() const { - return New(handle_); - } - - - inline Persistent& persistent() { - return handle_; - } - - - protected: - inline void Wrap(v8::Local object) { - assert(persistent().IsEmpty()); - assert(object->InternalFieldCount() > 0); - SetInternalFieldPointer(object, 0, this); - persistent().Reset(object); - MakeWeak(); - } - -#if defined(V8_MAJOR_VERSION) && (V8_MAJOR_VERSION > 4 || \ - (V8_MAJOR_VERSION == 4 && defined(V8_MINOR_VERSION) && V8_MINOR_VERSION >= 3)) - - inline void MakeWeak() { - persistent().v8::PersistentBase::SetWeak( - this, WeakCallback, v8::WeakCallbackType::kParameter); -#if NODE_MAJOR_VERSION < 10 - // FIXME(bnoordhuis) Probably superfluous in older Node.js versions too. - persistent().MarkIndependent(); -#endif - } - -#elif NODE_MODULE_VERSION > NODE_0_10_MODULE_VERSION - - inline void MakeWeak() { - persistent().v8::PersistentBase::SetWeak(this, WeakCallback); - persistent().MarkIndependent(); - } - -#else - - inline void MakeWeak() { - persistent().persistent.MakeWeak(this, WeakCallback); - persistent().MarkIndependent(); - } - -#endif - - /* Ref() marks the object as being attached to an event loop. - * Refed objects will not be garbage collected, even if - * all references are lost. - */ - virtual void Ref() { - assert(!persistent().IsEmpty()); - persistent().ClearWeak(); - refs_++; - } - - /* Unref() marks an object as detached from the event loop. This is its - * default state. When an object with a "weak" reference changes from - * attached to detached state it will be freed. Be careful not to access - * the object after making this call as it might be gone! - * (A "weak reference" means an object that only has a - * persistant handle.) - * - * DO NOT CALL THIS FROM DESTRUCTOR - */ - virtual void Unref() { - assert(!persistent().IsEmpty()); - assert(!persistent().IsWeak()); - assert(refs_ > 0); - if (--refs_ == 0) - MakeWeak(); - } - - int refs_; // ro - - private: - NAN_DISALLOW_ASSIGN_COPY_MOVE(ObjectWrap) -#if defined(V8_MAJOR_VERSION) && (V8_MAJOR_VERSION > 4 || \ - (V8_MAJOR_VERSION == 4 && defined(V8_MINOR_VERSION) && V8_MINOR_VERSION >= 3)) - - static void - WeakCallback(v8::WeakCallbackInfo const& info) { - ObjectWrap* wrap = info.GetParameter(); - assert(wrap->refs_ == 0); - wrap->handle_.Reset(); - delete wrap; - } - -#elif NODE_MODULE_VERSION > NODE_0_10_MODULE_VERSION - - static void - WeakCallback(v8::WeakCallbackData const& data) { - ObjectWrap* wrap = data.GetParameter(); - assert(wrap->refs_ == 0); - assert(wrap->handle_.IsNearDeath()); - wrap->handle_.Reset(); - delete wrap; - } - -#else - - static void WeakCallback(v8::Persistent value, void *data) { - ObjectWrap *wrap = static_cast(data); - assert(wrap->refs_ == 0); - assert(wrap->handle_.IsNearDeath()); - wrap->handle_.Reset(); - delete wrap; - } - -#endif - Persistent handle_; -}; - - -#endif // NAN_OBJECT_WRAP_H_ diff --git a/node_modules/node-pty/node_modules/nan/nan_persistent_12_inl.h b/node_modules/node-pty/node_modules/nan/nan_persistent_12_inl.h deleted file mode 100644 index d9649e8..0000000 --- a/node_modules/node-pty/node_modules/nan/nan_persistent_12_inl.h +++ /dev/null @@ -1,132 +0,0 @@ -/********************************************************************* - * NAN - Native Abstractions for Node.js - * - * Copyright (c) 2018 NAN contributors - * - * MIT License - ********************************************************************/ - -#ifndef NAN_PERSISTENT_12_INL_H_ -#define NAN_PERSISTENT_12_INL_H_ - -template class Persistent : - public v8::Persistent { - public: - inline Persistent() : v8::Persistent() {} - - template inline Persistent(v8::Local that) : - v8::Persistent(v8::Isolate::GetCurrent(), that) {} - - template - inline - Persistent(const v8::Persistent &that) : // NOLINT(runtime/explicit) - v8::Persistent(v8::Isolate::GetCurrent(), that) {} - - inline void Reset() { v8::PersistentBase::Reset(); } - - template - inline void Reset(const v8::Local &other) { - v8::PersistentBase::Reset(v8::Isolate::GetCurrent(), other); - } - - template - inline void Reset(const v8::PersistentBase &other) { - v8::PersistentBase::Reset(v8::Isolate::GetCurrent(), other); - } - - template - inline void SetWeak( - P *parameter - , typename WeakCallbackInfo

::Callback callback - , WeakCallbackType type); - - private: - inline T *operator*() const { return *PersistentBase::persistent; } - - template - inline void Copy(const Persistent &that) { - TYPE_CHECK(T, S); - - this->Reset(); - - if (!that.IsEmpty()) { - this->Reset(that); - M::Copy(that, this); - } - } -}; - -#if defined(V8_MAJOR_VERSION) && (V8_MAJOR_VERSION > 4 || \ - (V8_MAJOR_VERSION == 4 && defined(V8_MINOR_VERSION) && V8_MINOR_VERSION >= 3)) -template -class Global : public v8::Global { - public: - inline Global() : v8::Global() {} - - template inline Global(v8::Local that) : - v8::Global(v8::Isolate::GetCurrent(), that) {} - - template - inline - Global(const v8::PersistentBase &that) : // NOLINT(runtime/explicit) - v8::Global(v8::Isolate::GetCurrent(), that) {} - - inline void Reset() { v8::PersistentBase::Reset(); } - - template - inline void Reset(const v8::Local &other) { - v8::PersistentBase::Reset(v8::Isolate::GetCurrent(), other); - } - - template - inline void Reset(const v8::PersistentBase &other) { - v8::PersistentBase::Reset(v8::Isolate::GetCurrent(), other); - } - - template - inline void SetWeak( - P *parameter - , typename WeakCallbackInfo

::Callback callback - , WeakCallbackType type) { - reinterpret_cast*>(this)->SetWeak( - parameter, callback, type); - } -}; -#else -template -class Global : public v8::UniquePersistent { - public: - inline Global() : v8::UniquePersistent() {} - - template inline Global(v8::Local that) : - v8::UniquePersistent(v8::Isolate::GetCurrent(), that) {} - - template - inline - Global(const v8::PersistentBase &that) : // NOLINT(runtime/explicit) - v8::UniquePersistent(v8::Isolate::GetCurrent(), that) {} - - inline void Reset() { v8::PersistentBase::Reset(); } - - template - inline void Reset(const v8::Local &other) { - v8::PersistentBase::Reset(v8::Isolate::GetCurrent(), other); - } - - template - inline void Reset(const v8::PersistentBase &other) { - v8::PersistentBase::Reset(v8::Isolate::GetCurrent(), other); - } - - template - inline void SetWeak( - P *parameter - , typename WeakCallbackInfo

::Callback callback - , WeakCallbackType type) { - reinterpret_cast*>(this)->SetWeak( - parameter, callback, type); - } -}; -#endif - -#endif // NAN_PERSISTENT_12_INL_H_ diff --git a/node_modules/node-pty/node_modules/nan/nan_persistent_pre_12_inl.h b/node_modules/node-pty/node_modules/nan/nan_persistent_pre_12_inl.h deleted file mode 100644 index 4c9c59d..0000000 --- a/node_modules/node-pty/node_modules/nan/nan_persistent_pre_12_inl.h +++ /dev/null @@ -1,242 +0,0 @@ -/********************************************************************* - * NAN - Native Abstractions for Node.js - * - * Copyright (c) 2018 NAN contributors - * - * MIT License - ********************************************************************/ - -#ifndef NAN_PERSISTENT_PRE_12_INL_H_ -#define NAN_PERSISTENT_PRE_12_INL_H_ - -template -class PersistentBase { - v8::Persistent persistent; - template - friend v8::Local New(const PersistentBase &p); - template - friend v8::Local New(const Persistent &p); - template - friend v8::Local New(const Global &p); - template friend class ReturnValue; - - public: - inline PersistentBase() : - persistent() {} - - inline void Reset() { - persistent.Dispose(); - persistent.Clear(); - } - - template - inline void Reset(const v8::Local &other) { - TYPE_CHECK(T, S); - - if (!persistent.IsEmpty()) { - persistent.Dispose(); - } - - if (other.IsEmpty()) { - persistent.Clear(); - } else { - persistent = v8::Persistent::New(other); - } - } - - template - inline void Reset(const PersistentBase &other) { - TYPE_CHECK(T, S); - - if (!persistent.IsEmpty()) { - persistent.Dispose(); - } - - if (other.IsEmpty()) { - persistent.Clear(); - } else { - persistent = v8::Persistent::New(other.persistent); - } - } - - inline bool IsEmpty() const { return persistent.IsEmpty(); } - - inline void Empty() { persistent.Clear(); } - - template - inline bool operator==(const PersistentBase &that) const { - return this->persistent == that.persistent; - } - - template - inline bool operator==(const v8::Local &that) const { - return this->persistent == that; - } - - template - inline bool operator!=(const PersistentBase &that) const { - return !operator==(that); - } - - template - inline bool operator!=(const v8::Local &that) const { - return !operator==(that); - } - - template - inline void SetWeak( - P *parameter - , typename WeakCallbackInfo

::Callback callback - , WeakCallbackType type); - - inline void ClearWeak() { persistent.ClearWeak(); } - - inline void MarkIndependent() { persistent.MarkIndependent(); } - - inline bool IsIndependent() const { return persistent.IsIndependent(); } - - inline bool IsNearDeath() const { return persistent.IsNearDeath(); } - - inline bool IsWeak() const { return persistent.IsWeak(); } - - private: - inline explicit PersistentBase(v8::Persistent that) : - persistent(that) { } - inline explicit PersistentBase(T *val) : persistent(val) {} - template friend class Persistent; - template friend class Global; - friend class ObjectWrap; -}; - -template -class NonCopyablePersistentTraits { - public: - typedef Persistent > - NonCopyablePersistent; - static const bool kResetInDestructor = false; - template - inline static void Copy(const Persistent &source, - NonCopyablePersistent *dest) { - Uncompilable(); - } - - template inline static void Uncompilable() { - TYPE_CHECK(O, v8::Primitive); - } -}; - -template -struct CopyablePersistentTraits { - typedef Persistent > CopyablePersistent; - static const bool kResetInDestructor = true; - template - static inline void Copy(const Persistent &source, - CopyablePersistent *dest) {} -}; - -template class Persistent : - public PersistentBase { - public: - inline Persistent() {} - - template inline Persistent(v8::Handle that) - : PersistentBase(v8::Persistent::New(that)) { - TYPE_CHECK(T, S); - } - - inline Persistent(const Persistent &that) : PersistentBase() { - Copy(that); - } - - template - inline Persistent(const Persistent &that) : - PersistentBase() { - Copy(that); - } - - inline Persistent &operator=(const Persistent &that) { - Copy(that); - return *this; - } - - template - inline Persistent &operator=(const Persistent &that) { - Copy(that); - return *this; - } - - inline ~Persistent() { - if (M::kResetInDestructor) this->Reset(); - } - - private: - inline T *operator*() const { return *PersistentBase::persistent; } - - template - inline void Copy(const Persistent &that) { - TYPE_CHECK(T, S); - - this->Reset(); - - if (!that.IsEmpty()) { - this->persistent = v8::Persistent::New(that.persistent); - M::Copy(that, this); - } - } -}; - -template -class Global : public PersistentBase { - struct RValue { - inline explicit RValue(Global* obj) : object(obj) {} - Global* object; - }; - - public: - inline Global() : PersistentBase(0) { } - - template - inline Global(v8::Local that) // NOLINT(runtime/explicit) - : PersistentBase(v8::Persistent::New(that)) { - TYPE_CHECK(T, S); - } - - template - inline Global(const PersistentBase &that) // NOLINT(runtime/explicit) - : PersistentBase(that) { - TYPE_CHECK(T, S); - } - /** - * Move constructor. - */ - inline Global(RValue rvalue) // NOLINT(runtime/explicit) - : PersistentBase(rvalue.object->persistent) { - rvalue.object->Reset(); - } - inline ~Global() { this->Reset(); } - /** - * Move via assignment. - */ - template - inline Global &operator=(Global rhs) { - TYPE_CHECK(T, S); - this->Reset(rhs.persistent); - rhs.Reset(); - return *this; - } - /** - * Cast operator for moves. - */ - inline operator RValue() { return RValue(this); } - /** - * Pass allows returning uniques from functions, etc. - */ - Global Pass() { return Global(RValue(this)); } - - private: - Global(Global &); - void operator=(Global &); - template friend class ReturnValue; -}; - -#endif // NAN_PERSISTENT_PRE_12_INL_H_ diff --git a/node_modules/node-pty/node_modules/nan/nan_private.h b/node_modules/node-pty/node_modules/nan/nan_private.h deleted file mode 100644 index 15f44cc..0000000 --- a/node_modules/node-pty/node_modules/nan/nan_private.h +++ /dev/null @@ -1,73 +0,0 @@ -/********************************************************************* - * NAN - Native Abstractions for Node.js - * - * Copyright (c) 2018 NAN contributors - * - * MIT License - ********************************************************************/ - -#ifndef NAN_PRIVATE_H_ -#define NAN_PRIVATE_H_ - -inline Maybe -HasPrivate(v8::Local object, v8::Local key) { - HandleScope scope; -#if NODE_MODULE_VERSION >= NODE_6_0_MODULE_VERSION - v8::Isolate *isolate = v8::Isolate::GetCurrent(); - v8::Local context = isolate->GetCurrentContext(); - v8::Local private_key = v8::Private::ForApi(isolate, key); - return object->HasPrivate(context, private_key); -#else - return Just(!object->GetHiddenValue(key).IsEmpty()); -#endif -} - -inline MaybeLocal -GetPrivate(v8::Local object, v8::Local key) { -#if NODE_MODULE_VERSION >= NODE_6_0_MODULE_VERSION - v8::Isolate *isolate = v8::Isolate::GetCurrent(); - v8::EscapableHandleScope scope(isolate); - v8::Local context = isolate->GetCurrentContext(); - v8::Local private_key = v8::Private::ForApi(isolate, key); - v8::MaybeLocal v = object->GetPrivate(context, private_key); - return scope.Escape(v.ToLocalChecked()); -#else - EscapableHandleScope scope; - v8::Local v = object->GetHiddenValue(key); - if (v.IsEmpty()) { - v = Undefined(); - } - return scope.Escape(v); -#endif -} - -inline Maybe SetPrivate( - v8::Local object, - v8::Local key, - v8::Local value) { -#if NODE_MODULE_VERSION >= NODE_6_0_MODULE_VERSION - HandleScope scope; - v8::Isolate *isolate = v8::Isolate::GetCurrent(); - v8::Local context = isolate->GetCurrentContext(); - v8::Local private_key = v8::Private::ForApi(isolate, key); - return object->SetPrivate(context, private_key, value); -#else - return Just(object->SetHiddenValue(key, value)); -#endif -} - -inline Maybe DeletePrivate( - v8::Local object, - v8::Local key) { -#if NODE_MODULE_VERSION >= NODE_6_0_MODULE_VERSION - HandleScope scope; - v8::Isolate *isolate = v8::Isolate::GetCurrent(); - v8::Local private_key = v8::Private::ForApi(isolate, key); - return object->DeletePrivate(isolate->GetCurrentContext(), private_key); -#else - return Just(object->DeleteHiddenValue(key)); -#endif -} - -#endif // NAN_PRIVATE_H_ - diff --git a/node_modules/node-pty/node_modules/nan/nan_string_bytes.h b/node_modules/node-pty/node_modules/nan/nan_string_bytes.h deleted file mode 100644 index a2e6437..0000000 --- a/node_modules/node-pty/node_modules/nan/nan_string_bytes.h +++ /dev/null @@ -1,305 +0,0 @@ -// Copyright Joyent, Inc. and other Node contributors. -// -// 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. - -#ifndef NAN_STRING_BYTES_H_ -#define NAN_STRING_BYTES_H_ - -// Decodes a v8::Local or Buffer to a raw char* - -namespace imp { - -using v8::Local; -using v8::Object; -using v8::String; -using v8::Value; - - -//// Base 64 //// - -#define base64_encoded_size(size) ((size + 2 - ((size + 2) % 3)) / 3 * 4) - - - -//// HEX //// - -static bool contains_non_ascii_slow(const char* buf, size_t len) { - for (size_t i = 0; i < len; ++i) { - if (buf[i] & 0x80) return true; - } - return false; -} - - -static bool contains_non_ascii(const char* src, size_t len) { - if (len < 16) { - return contains_non_ascii_slow(src, len); - } - - const unsigned bytes_per_word = sizeof(void*); - const unsigned align_mask = bytes_per_word - 1; - const unsigned unaligned = reinterpret_cast(src) & align_mask; - - if (unaligned > 0) { - const unsigned n = bytes_per_word - unaligned; - if (contains_non_ascii_slow(src, n)) return true; - src += n; - len -= n; - } - - -#if defined(__x86_64__) || defined(_WIN64) - const uintptr_t mask = 0x8080808080808080ll; -#else - const uintptr_t mask = 0x80808080l; -#endif - - const uintptr_t* srcw = reinterpret_cast(src); - - for (size_t i = 0, n = len / bytes_per_word; i < n; ++i) { - if (srcw[i] & mask) return true; - } - - const unsigned remainder = len & align_mask; - if (remainder > 0) { - const size_t offset = len - remainder; - if (contains_non_ascii_slow(src + offset, remainder)) return true; - } - - return false; -} - - -static void force_ascii_slow(const char* src, char* dst, size_t len) { - for (size_t i = 0; i < len; ++i) { - dst[i] = src[i] & 0x7f; - } -} - - -static void force_ascii(const char* src, char* dst, size_t len) { - if (len < 16) { - force_ascii_slow(src, dst, len); - return; - } - - const unsigned bytes_per_word = sizeof(void*); - const unsigned align_mask = bytes_per_word - 1; - const unsigned src_unalign = reinterpret_cast(src) & align_mask; - const unsigned dst_unalign = reinterpret_cast(dst) & align_mask; - - if (src_unalign > 0) { - if (src_unalign == dst_unalign) { - const unsigned unalign = bytes_per_word - src_unalign; - force_ascii_slow(src, dst, unalign); - src += unalign; - dst += unalign; - len -= src_unalign; - } else { - force_ascii_slow(src, dst, len); - return; - } - } - -#if defined(__x86_64__) || defined(_WIN64) - const uintptr_t mask = ~0x8080808080808080ll; -#else - const uintptr_t mask = ~0x80808080l; -#endif - - const uintptr_t* srcw = reinterpret_cast(src); - uintptr_t* dstw = reinterpret_cast(dst); - - for (size_t i = 0, n = len / bytes_per_word; i < n; ++i) { - dstw[i] = srcw[i] & mask; - } - - const unsigned remainder = len & align_mask; - if (remainder > 0) { - const size_t offset = len - remainder; - force_ascii_slow(src + offset, dst + offset, remainder); - } -} - - -static size_t base64_encode(const char* src, - size_t slen, - char* dst, - size_t dlen) { - // We know how much we'll write, just make sure that there's space. - assert(dlen >= base64_encoded_size(slen) && - "not enough space provided for base64 encode"); - - dlen = base64_encoded_size(slen); - - unsigned a; - unsigned b; - unsigned c; - unsigned i; - unsigned k; - unsigned n; - - static const char table[] = "ABCDEFGHIJKLMNOPQRSTUVWXYZ" - "abcdefghijklmnopqrstuvwxyz" - "0123456789+/"; - - i = 0; - k = 0; - n = slen / 3 * 3; - - while (i < n) { - a = src[i + 0] & 0xff; - b = src[i + 1] & 0xff; - c = src[i + 2] & 0xff; - - dst[k + 0] = table[a >> 2]; - dst[k + 1] = table[((a & 3) << 4) | (b >> 4)]; - dst[k + 2] = table[((b & 0x0f) << 2) | (c >> 6)]; - dst[k + 3] = table[c & 0x3f]; - - i += 3; - k += 4; - } - - if (n != slen) { - switch (slen - n) { - case 1: - a = src[i + 0] & 0xff; - dst[k + 0] = table[a >> 2]; - dst[k + 1] = table[(a & 3) << 4]; - dst[k + 2] = '='; - dst[k + 3] = '='; - break; - - case 2: - a = src[i + 0] & 0xff; - b = src[i + 1] & 0xff; - dst[k + 0] = table[a >> 2]; - dst[k + 1] = table[((a & 3) << 4) | (b >> 4)]; - dst[k + 2] = table[(b & 0x0f) << 2]; - dst[k + 3] = '='; - break; - } - } - - return dlen; -} - - -static size_t hex_encode(const char* src, size_t slen, char* dst, size_t dlen) { - // We know how much we'll write, just make sure that there's space. - assert(dlen >= slen * 2 && - "not enough space provided for hex encode"); - - dlen = slen * 2; - for (uint32_t i = 0, k = 0; k < dlen; i += 1, k += 2) { - static const char hex[] = "0123456789abcdef"; - uint8_t val = static_cast(src[i]); - dst[k + 0] = hex[val >> 4]; - dst[k + 1] = hex[val & 15]; - } - - return dlen; -} - - - -static Local Encode(const char* buf, - size_t buflen, - enum Encoding encoding) { - assert(buflen <= node::Buffer::kMaxLength); - if (!buflen && encoding != BUFFER) - return New("").ToLocalChecked(); - - Local val; - switch (encoding) { - case BUFFER: - return CopyBuffer(buf, buflen).ToLocalChecked(); - - case ASCII: - if (contains_non_ascii(buf, buflen)) { - char* out = new char[buflen]; - force_ascii(buf, out, buflen); - val = New(out, buflen).ToLocalChecked(); - delete[] out; - } else { - val = New(buf, buflen).ToLocalChecked(); - } - break; - - case UTF8: - val = New(buf, buflen).ToLocalChecked(); - break; - - case BINARY: { - // TODO(isaacs) use ExternalTwoByteString? - const unsigned char *cbuf = reinterpret_cast(buf); - uint16_t * twobytebuf = new uint16_t[buflen]; - for (size_t i = 0; i < buflen; i++) { - // XXX is the following line platform independent? - twobytebuf[i] = cbuf[i]; - } - val = New(twobytebuf, buflen).ToLocalChecked(); - delete[] twobytebuf; - break; - } - - case BASE64: { - size_t dlen = base64_encoded_size(buflen); - char* dst = new char[dlen]; - - size_t written = base64_encode(buf, buflen, dst, dlen); - assert(written == dlen); - - val = New(dst, dlen).ToLocalChecked(); - delete[] dst; - break; - } - - case UCS2: { - const uint16_t* data = reinterpret_cast(buf); - val = New(data, buflen / 2).ToLocalChecked(); - break; - } - - case HEX: { - size_t dlen = buflen * 2; - char* dst = new char[dlen]; - size_t written = hex_encode(buf, buflen, dst, dlen); - assert(written == dlen); - - val = New(dst, dlen).ToLocalChecked(); - delete[] dst; - break; - } - - default: - assert(0 && "unknown encoding"); - break; - } - - return val; -} - -#undef base64_encoded_size - -} // end of namespace imp - -#endif // NAN_STRING_BYTES_H_ diff --git a/node_modules/node-pty/node_modules/nan/nan_typedarray_contents.h b/node_modules/node-pty/node_modules/nan/nan_typedarray_contents.h deleted file mode 100644 index d28ae32..0000000 --- a/node_modules/node-pty/node_modules/nan/nan_typedarray_contents.h +++ /dev/null @@ -1,90 +0,0 @@ -/********************************************************************* - * NAN - Native Abstractions for Node.js - * - * Copyright (c) 2018 NAN contributors - * - * MIT License - ********************************************************************/ - -#ifndef NAN_TYPEDARRAY_CONTENTS_H_ -#define NAN_TYPEDARRAY_CONTENTS_H_ - -template -class TypedArrayContents { - public: - inline explicit TypedArrayContents(v8::Local from) : - length_(0), data_(NULL) { - HandleScope scope; - - size_t length = 0; - void* data = NULL; - -#if defined(V8_MAJOR_VERSION) && (V8_MAJOR_VERSION > 4 || \ - (V8_MAJOR_VERSION == 4 && defined(V8_MINOR_VERSION) && V8_MINOR_VERSION >= 3)) - - if (from->IsArrayBufferView()) { - v8::Local array = - v8::Local::Cast(from); - - const size_t byte_length = array->ByteLength(); - const ptrdiff_t byte_offset = array->ByteOffset(); - v8::Local buffer = array->Buffer(); - - length = byte_length / sizeof(T); - data = static_cast(buffer->GetContents().Data()) + byte_offset; - } - -#else - - if (from->IsObject() && !from->IsNull()) { - v8::Local array = v8::Local::Cast(from); - - MaybeLocal buffer = Get(array, - New("buffer").ToLocalChecked()); - MaybeLocal byte_length = Get(array, - New("byteLength").ToLocalChecked()); - MaybeLocal byte_offset = Get(array, - New("byteOffset").ToLocalChecked()); - - if (!buffer.IsEmpty() && - !byte_length.IsEmpty() && byte_length.ToLocalChecked()->IsUint32() && - !byte_offset.IsEmpty() && byte_offset.ToLocalChecked()->IsUint32()) { - data = array->GetIndexedPropertiesExternalArrayData(); - if(data) { - length = byte_length.ToLocalChecked()->Uint32Value() / sizeof(T); - } - } - } - -#endif - -#if defined(_MSC_VER) && _MSC_VER >= 1900 || __cplusplus >= 201103L - assert(reinterpret_cast(data) % alignof (T) == 0); -#elif defined(_MSC_VER) && _MSC_VER >= 1600 || defined(__GNUC__) - assert(reinterpret_cast(data) % __alignof(T) == 0); -#else - assert(reinterpret_cast(data) % sizeof (T) == 0); -#endif - - length_ = length; - data_ = static_cast(data); - } - - inline size_t length() const { return length_; } - inline T* operator*() { return data_; } - inline const T* operator*() const { return data_; } - - private: - NAN_DISALLOW_ASSIGN_COPY_MOVE(TypedArrayContents) - - //Disable heap allocation - void *operator new(size_t size); - void operator delete(void *, size_t) { - abort(); - } - - size_t length_; - T* data_; -}; - -#endif // NAN_TYPEDARRAY_CONTENTS_H_ diff --git a/node_modules/node-pty/node_modules/nan/nan_weak.h b/node_modules/node-pty/node_modules/nan/nan_weak.h deleted file mode 100644 index 7e7ab07..0000000 --- a/node_modules/node-pty/node_modules/nan/nan_weak.h +++ /dev/null @@ -1,437 +0,0 @@ -/********************************************************************* - * NAN - Native Abstractions for Node.js - * - * Copyright (c) 2018 NAN contributors - * - * MIT License - ********************************************************************/ - -#ifndef NAN_WEAK_H_ -#define NAN_WEAK_H_ - -static const int kInternalFieldsInWeakCallback = 2; -static const int kNoInternalFieldIndex = -1; - -#if defined(V8_MAJOR_VERSION) && (V8_MAJOR_VERSION > 4 || \ - (V8_MAJOR_VERSION == 4 && defined(V8_MINOR_VERSION) && V8_MINOR_VERSION >= 3)) -# define NAN_WEAK_PARAMETER_CALLBACK_DATA_TYPE_ \ - v8::WeakCallbackInfo > const& -# define NAN_WEAK_TWOFIELD_CALLBACK_DATA_TYPE_ \ - NAN_WEAK_PARAMETER_CALLBACK_DATA_TYPE_ -# define NAN_WEAK_PARAMETER_CALLBACK_SIG_ NAN_WEAK_PARAMETER_CALLBACK_DATA_TYPE_ -# define NAN_WEAK_TWOFIELD_CALLBACK_SIG_ NAN_WEAK_TWOFIELD_CALLBACK_DATA_TYPE_ -#elif NODE_MODULE_VERSION > IOJS_1_1_MODULE_VERSION -# define NAN_WEAK_PARAMETER_CALLBACK_DATA_TYPE_ \ - v8::PhantomCallbackData > const& -# define NAN_WEAK_TWOFIELD_CALLBACK_DATA_TYPE_ \ - NAN_WEAK_PARAMETER_CALLBACK_DATA_TYPE_ -# define NAN_WEAK_PARAMETER_CALLBACK_SIG_ NAN_WEAK_PARAMETER_CALLBACK_DATA_TYPE_ -# define NAN_WEAK_TWOFIELD_CALLBACK_SIG_ NAN_WEAK_TWOFIELD_CALLBACK_DATA_TYPE_ -#elif NODE_MODULE_VERSION > NODE_0_12_MODULE_VERSION -# define NAN_WEAK_PARAMETER_CALLBACK_DATA_TYPE_ \ - v8::PhantomCallbackData > const& -# define NAN_WEAK_TWOFIELD_CALLBACK_DATA_TYPE_ \ - v8::InternalFieldsCallbackData, void> const& -# define NAN_WEAK_PARAMETER_CALLBACK_SIG_ NAN_WEAK_PARAMETER_CALLBACK_DATA_TYPE_ -# define NAN_WEAK_TWOFIELD_CALLBACK_SIG_ NAN_WEAK_TWOFIELD_CALLBACK_DATA_TYPE_ -#elif NODE_MODULE_VERSION > NODE_0_10_MODULE_VERSION -# define NAN_WEAK_CALLBACK_DATA_TYPE_ \ - v8::WeakCallbackData > const& -# define NAN_WEAK_CALLBACK_SIG_ NAN_WEAK_CALLBACK_DATA_TYPE_ -#else -# define NAN_WEAK_CALLBACK_DATA_TYPE_ void * -# define NAN_WEAK_CALLBACK_SIG_ \ - v8::Persistent, NAN_WEAK_CALLBACK_DATA_TYPE_ -#endif - -template -class WeakCallbackInfo { - public: - typedef void (*Callback)(const WeakCallbackInfo& data); - WeakCallbackInfo( - Persistent *persistent - , Callback callback - , void *parameter - , void *field1 = 0 - , void *field2 = 0) : - callback_(callback), isolate_(0), parameter_(parameter) { - std::memcpy(&persistent_, persistent, sizeof (v8::Persistent)); - internal_fields_[0] = field1; - internal_fields_[1] = field2; - } - inline v8::Isolate *GetIsolate() const { return isolate_; } - inline T *GetParameter() const { return static_cast(parameter_); } - inline void *GetInternalField(int index) const { - assert((index == 0 || index == 1) && "internal field index out of bounds"); - if (index == 0) { - return internal_fields_[0]; - } else { - return internal_fields_[1]; - } - } - - private: - NAN_DISALLOW_ASSIGN_COPY_MOVE(WeakCallbackInfo) - Callback callback_; - v8::Isolate *isolate_; - void *parameter_; - void *internal_fields_[kInternalFieldsInWeakCallback]; - v8::Persistent persistent_; - template friend class Persistent; - template friend class PersistentBase; -#if NODE_MODULE_VERSION <= NODE_0_12_MODULE_VERSION -# if NODE_MODULE_VERSION > NODE_0_10_MODULE_VERSION - template - static void invoke(NAN_WEAK_CALLBACK_SIG_ data); - template - static WeakCallbackInfo *unwrap(NAN_WEAK_CALLBACK_DATA_TYPE_ data); -# else - static void invoke(NAN_WEAK_CALLBACK_SIG_ data); - static WeakCallbackInfo *unwrap(NAN_WEAK_CALLBACK_DATA_TYPE_ data); -# endif -#else -# if defined(V8_MAJOR_VERSION) && (V8_MAJOR_VERSION > 4 || \ - (V8_MAJOR_VERSION == 4 && defined(V8_MINOR_VERSION) && V8_MINOR_VERSION >= 3)) - template - static void invokeparameter(NAN_WEAK_PARAMETER_CALLBACK_SIG_ data); - template - static void invoketwofield(NAN_WEAK_TWOFIELD_CALLBACK_SIG_ data); -# else - static void invokeparameter(NAN_WEAK_PARAMETER_CALLBACK_SIG_ data); - static void invoketwofield(NAN_WEAK_TWOFIELD_CALLBACK_SIG_ data); -# endif - static WeakCallbackInfo *unwrapparameter( - NAN_WEAK_PARAMETER_CALLBACK_DATA_TYPE_ data); - static WeakCallbackInfo *unwraptwofield( - NAN_WEAK_TWOFIELD_CALLBACK_DATA_TYPE_ data); -#endif -}; - - -#if defined(V8_MAJOR_VERSION) && (V8_MAJOR_VERSION > 4 || \ - (V8_MAJOR_VERSION == 4 && defined(V8_MINOR_VERSION) && V8_MINOR_VERSION >= 3)) - -template -template -void -WeakCallbackInfo::invokeparameter(NAN_WEAK_PARAMETER_CALLBACK_SIG_ data) { - WeakCallbackInfo *cbinfo = unwrapparameter(data); - if (isFirstPass) { - cbinfo->persistent_.Reset(); - data.SetSecondPassCallback(invokeparameter); - } else { - cbinfo->callback_(*cbinfo); - delete cbinfo; - } -} - -template -template -void -WeakCallbackInfo::invoketwofield(NAN_WEAK_TWOFIELD_CALLBACK_SIG_ data) { - WeakCallbackInfo *cbinfo = unwraptwofield(data); - if (isFirstPass) { - cbinfo->persistent_.Reset(); - data.SetSecondPassCallback(invoketwofield); - } else { - cbinfo->callback_(*cbinfo); - delete cbinfo; - } -} - -template -WeakCallbackInfo *WeakCallbackInfo::unwrapparameter( - NAN_WEAK_PARAMETER_CALLBACK_DATA_TYPE_ data) { - WeakCallbackInfo *cbinfo = - static_cast*>(data.GetParameter()); - cbinfo->isolate_ = data.GetIsolate(); - return cbinfo; -} - -template -WeakCallbackInfo *WeakCallbackInfo::unwraptwofield( - NAN_WEAK_TWOFIELD_CALLBACK_DATA_TYPE_ data) { - WeakCallbackInfo *cbinfo = - static_cast*>(data.GetInternalField(0)); - cbinfo->isolate_ = data.GetIsolate(); - return cbinfo; -} - -#undef NAN_WEAK_PARAMETER_CALLBACK_SIG_ -#undef NAN_WEAK_TWOFIELD_CALLBACK_SIG_ -#undef NAN_WEAK_PARAMETER_CALLBACK_DATA_TYPE_ -#undef NAN_WEAK_TWOFIELD_CALLBACK_DATA_TYPE_ -# elif NODE_MODULE_VERSION > NODE_0_12_MODULE_VERSION - -template -void -WeakCallbackInfo::invokeparameter(NAN_WEAK_PARAMETER_CALLBACK_SIG_ data) { - WeakCallbackInfo *cbinfo = unwrapparameter(data); - cbinfo->persistent_.Reset(); - cbinfo->callback_(*cbinfo); - delete cbinfo; -} - -template -void -WeakCallbackInfo::invoketwofield(NAN_WEAK_TWOFIELD_CALLBACK_SIG_ data) { - WeakCallbackInfo *cbinfo = unwraptwofield(data); - cbinfo->persistent_.Reset(); - cbinfo->callback_(*cbinfo); - delete cbinfo; -} - -template -WeakCallbackInfo *WeakCallbackInfo::unwrapparameter( - NAN_WEAK_PARAMETER_CALLBACK_DATA_TYPE_ data) { - WeakCallbackInfo *cbinfo = - static_cast*>(data.GetParameter()); - cbinfo->isolate_ = data.GetIsolate(); - return cbinfo; -} - -template -WeakCallbackInfo *WeakCallbackInfo::unwraptwofield( - NAN_WEAK_TWOFIELD_CALLBACK_DATA_TYPE_ data) { - WeakCallbackInfo *cbinfo = - static_cast*>(data.GetInternalField1()); - cbinfo->isolate_ = data.GetIsolate(); - return cbinfo; -} - -#undef NAN_WEAK_PARAMETER_CALLBACK_SIG_ -#undef NAN_WEAK_TWOFIELD_CALLBACK_SIG_ -#undef NAN_WEAK_PARAMETER_CALLBACK_DATA_TYPE_ -#undef NAN_WEAK_TWOFIELD_CALLBACK_DATA_TYPE_ -#elif NODE_MODULE_VERSION > NODE_0_10_MODULE_VERSION - -template -template -void WeakCallbackInfo::invoke(NAN_WEAK_CALLBACK_SIG_ data) { - WeakCallbackInfo *cbinfo = unwrap(data); - cbinfo->persistent_.Reset(); - cbinfo->callback_(*cbinfo); - delete cbinfo; -} - -template -template -WeakCallbackInfo *WeakCallbackInfo::unwrap( - NAN_WEAK_CALLBACK_DATA_TYPE_ data) { - void *parameter = data.GetParameter(); - WeakCallbackInfo *cbinfo = - static_cast*>(parameter); - cbinfo->isolate_ = data.GetIsolate(); - return cbinfo; -} - -#undef NAN_WEAK_CALLBACK_SIG_ -#undef NAN_WEAK_CALLBACK_DATA_TYPE_ -#else - -template -void WeakCallbackInfo::invoke(NAN_WEAK_CALLBACK_SIG_ data) { - WeakCallbackInfo *cbinfo = unwrap(data); - cbinfo->persistent_.Dispose(); - cbinfo->persistent_.Clear(); - cbinfo->callback_(*cbinfo); - delete cbinfo; -} - -template -WeakCallbackInfo *WeakCallbackInfo::unwrap( - NAN_WEAK_CALLBACK_DATA_TYPE_ data) { - WeakCallbackInfo *cbinfo = - static_cast*>(data); - cbinfo->isolate_ = v8::Isolate::GetCurrent(); - return cbinfo; -} - -#undef NAN_WEAK_CALLBACK_SIG_ -#undef NAN_WEAK_CALLBACK_DATA_TYPE_ -#endif - -#if defined(V8_MAJOR_VERSION) && (V8_MAJOR_VERSION > 4 || \ - (V8_MAJOR_VERSION == 4 && defined(V8_MINOR_VERSION) && V8_MINOR_VERSION >= 3)) -template -template -inline void Persistent::SetWeak( - P *parameter - , typename WeakCallbackInfo

::Callback callback - , WeakCallbackType type) { - WeakCallbackInfo

*wcbd; - if (type == WeakCallbackType::kParameter) { - wcbd = new WeakCallbackInfo

( - reinterpret_cast*>(this) - , callback - , parameter); - v8::PersistentBase::SetWeak( - wcbd - , WeakCallbackInfo

::template invokeparameter - , type); - } else { - v8::Local* self_v(reinterpret_cast*>(this)); - assert((*self_v)->IsObject()); - v8::Local self((*self_v).As()); - int count = self->InternalFieldCount(); - void *internal_fields[kInternalFieldsInWeakCallback] = {0, 0}; - for (int i = 0; i < count && i < kInternalFieldsInWeakCallback; i++) { - internal_fields[i] = self->GetAlignedPointerFromInternalField(i); - } - wcbd = new WeakCallbackInfo

( - reinterpret_cast*>(this) - , callback - , 0 - , internal_fields[0] - , internal_fields[1]); - self->SetAlignedPointerInInternalField(0, wcbd); - v8::PersistentBase::SetWeak( - static_cast*>(0) - , WeakCallbackInfo

::template invoketwofield - , type); - } -} -#elif NODE_MODULE_VERSION > IOJS_1_1_MODULE_VERSION -template -template -inline void Persistent::SetWeak( - P *parameter - , typename WeakCallbackInfo

::Callback callback - , WeakCallbackType type) { - WeakCallbackInfo

*wcbd; - if (type == WeakCallbackType::kParameter) { - wcbd = new WeakCallbackInfo

( - reinterpret_cast*>(this) - , callback - , parameter); - v8::PersistentBase::SetPhantom( - wcbd - , WeakCallbackInfo

::invokeparameter); - } else { - v8::Local* self_v(reinterpret_cast*>(this)); - assert((*self_v)->IsObject()); - v8::Local self((*self_v).As()); - int count = self->InternalFieldCount(); - void *internal_fields[kInternalFieldsInWeakCallback] = {0, 0}; - for (int i = 0; i < count && i < kInternalFieldsInWeakCallback; i++) { - internal_fields[i] = self->GetAlignedPointerFromInternalField(i); - } - wcbd = new WeakCallbackInfo

( - reinterpret_cast*>(this) - , callback - , 0 - , internal_fields[0] - , internal_fields[1]); - self->SetAlignedPointerInInternalField(0, wcbd); - v8::PersistentBase::SetPhantom( - static_cast*>(0) - , WeakCallbackInfo

::invoketwofield - , 0 - , count > 1 ? 1 : kNoInternalFieldIndex); - } -} -#elif NODE_MODULE_VERSION > NODE_0_12_MODULE_VERSION -template -template -inline void Persistent::SetWeak( - P *parameter - , typename WeakCallbackInfo

::Callback callback - , WeakCallbackType type) { - WeakCallbackInfo

*wcbd; - if (type == WeakCallbackType::kParameter) { - wcbd = new WeakCallbackInfo

( - reinterpret_cast*>(this) - , callback - , parameter); - v8::PersistentBase::SetPhantom( - wcbd - , WeakCallbackInfo

::invokeparameter); - } else { - v8::Local* self_v(reinterpret_cast*>(this)); - assert((*self_v)->IsObject()); - v8::Local self((*self_v).As()); - int count = self->InternalFieldCount(); - void *internal_fields[kInternalFieldsInWeakCallback] = {0, 0}; - for (int i = 0; i < count && i < kInternalFieldsInWeakCallback; i++) { - internal_fields[i] = self->GetAlignedPointerFromInternalField(i); - } - wcbd = new WeakCallbackInfo

( - reinterpret_cast*>(this) - , callback - , 0 - , internal_fields[0] - , internal_fields[1]); - self->SetAlignedPointerInInternalField(0, wcbd); - v8::PersistentBase::SetPhantom( - WeakCallbackInfo

::invoketwofield - , 0 - , count > 1 ? 1 : kNoInternalFieldIndex); - } -} -#elif NODE_MODULE_VERSION > NODE_0_10_MODULE_VERSION -template -template -inline void Persistent::SetWeak( - P *parameter - , typename WeakCallbackInfo

::Callback callback - , WeakCallbackType type) { - WeakCallbackInfo

*wcbd; - if (type == WeakCallbackType::kParameter) { - wcbd = new WeakCallbackInfo

( - reinterpret_cast*>(this) - , callback - , parameter); - v8::PersistentBase::SetWeak(wcbd, WeakCallbackInfo

::invoke); - } else { - v8::Local* self_v(reinterpret_cast*>(this)); - assert((*self_v)->IsObject()); - v8::Local self((*self_v).As()); - int count = self->InternalFieldCount(); - void *internal_fields[kInternalFieldsInWeakCallback] = {0, 0}; - for (int i = 0; i < count && i < kInternalFieldsInWeakCallback; i++) { - internal_fields[i] = self->GetAlignedPointerFromInternalField(i); - } - wcbd = new WeakCallbackInfo

( - reinterpret_cast*>(this) - , callback - , 0 - , internal_fields[0] - , internal_fields[1]); - v8::PersistentBase::SetWeak(wcbd, WeakCallbackInfo

::invoke); - } -} -#else -template -template -inline void PersistentBase::SetWeak( - P *parameter - , typename WeakCallbackInfo

::Callback callback - , WeakCallbackType type) { - WeakCallbackInfo

*wcbd; - if (type == WeakCallbackType::kParameter) { - wcbd = new WeakCallbackInfo

( - reinterpret_cast*>(this) - , callback - , parameter); - persistent.MakeWeak(wcbd, WeakCallbackInfo

::invoke); - } else { - v8::Local* self_v(reinterpret_cast*>(this)); - assert((*self_v)->IsObject()); - v8::Local self((*self_v).As()); - int count = self->InternalFieldCount(); - void *internal_fields[kInternalFieldsInWeakCallback] = {0, 0}; - for (int i = 0; i < count && i < kInternalFieldsInWeakCallback; i++) { - internal_fields[i] = self->GetPointerFromInternalField(i); - } - wcbd = new WeakCallbackInfo

( - reinterpret_cast*>(this) - , callback - , 0 - , internal_fields[0] - , internal_fields[1]); - persistent.MakeWeak(wcbd, WeakCallbackInfo

::invoke); - } -} -#endif - -#endif // NAN_WEAK_H_ diff --git a/node_modules/node-pty/node_modules/nan/package.json b/node_modules/node-pty/node_modules/nan/package.json deleted file mode 100644 index 302da5e..0000000 --- a/node_modules/node-pty/node_modules/nan/package.json +++ /dev/null @@ -1,109 +0,0 @@ -{ - "name": "nan", - "version": "2.14.0", - "description": "Native Abstractions for Node.js: C++ header for Node 0.8 -> 11 compatibility", - "main": "include_dirs.js", - "repository": { - "type": "git", - "url": "git://github.com/nodejs/nan.git" - }, - "scripts": { - "test": "tap --gc --stderr test/js/*-test.js", - "test:worker": "node --experimental-worker test/tap-as-worker.js --gc --stderr test/js/*-test.js", - "rebuild-tests": "node-gyp rebuild --msvs_version=2015 --directory test", - "docs": "doc/.build.sh" - }, - "contributors": [ - { - "name": "Rod Vagg", - "email": "r@va.gg", - "url": "https://github.com/rvagg" - }, - { - "name": "Benjamin Byholm", - "email": "bbyholm@abo.fi", - "url": "https://github.com/kkoopa/" - }, - { - "name": "Trevor Norris", - "email": "trev.norris@gmail.com", - "url": "https://github.com/trevnorris" - }, - { - "name": "Nathan Rajlich", - "email": "nathan@tootallnate.net", - "url": "https://github.com/TooTallNate" - }, - { - "name": "Brett Lawson", - "email": "brett19@gmail.com", - "url": "https://github.com/brett19" - }, - { - "name": "Ben Noordhuis", - "email": "info@bnoordhuis.nl", - "url": "https://github.com/bnoordhuis" - }, - { - "name": "David Siegel", - "email": "david@artcom.de", - "url": "https://github.com/agnat" - }, - { - "name": "Michael Ira Krufky", - "email": "mkrufky@gmail.com", - "url": "https://github.com/mkrufky" - } - ], - "devDependencies": { - "bindings": "~1.2.1", - "commander": "^2.8.1", - "glob": "^5.0.14", - "request": "=2.81.0", - "node-gyp": "~3.6.2", - "readable-stream": "^2.1.4", - "tap": "~0.7.1", - "xtend": "~4.0.0" - }, - "license": "MIT", - "gitHead": "1dcc61bd06d84e389bfd5311b2b1492a14c74201", - "bugs": { - "url": "https://github.com/nodejs/nan/issues" - }, - "homepage": "https://github.com/nodejs/nan#readme", - "_id": "nan@2.14.0", - "_npmVersion": "5.6.0", - "_nodeVersion": "9.6.0", - "_npmUser": { - "name": "kkoopa", - "email": "bbyholm@abo.fi" - }, - "dist": { - "integrity": "sha512-INOFj37C7k3AfaNTtX8RhsTw7qRy7eLET14cROi9+5HAVbbHuIWUHEauBv5qT4Av2tWasiTY1Jw6puUNqRJXQg==", - "shasum": "7818f722027b2459a86f0295d434d1fc2336c52c", - "tarball": "https://registry.npmjs.org/nan/-/nan-2.14.0.tgz", - "fileCount": 46, - "unpackedSize": 417060, - "npm-signature": "-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJc3bXpCRA9TVsSAnZWagAApycP/2mhtcraLrh5RRziC2xM\nUKDaEjBIznHn7PqDWecW3HW/CGrUfmuxpDCBlE2fBm2cxF26nB/CV6xoD2W1\nkyu4MkRcKiAvNW0h4a5sTwXey0U6xc8JRBhBTWgfiY2aQoA4fIO5akmbIa/w\nyT6tspFQ0BQWKBrxlSOqfQ/lARU4Dzy2eiKu1aWMffQecgqOPTrlb5/QxFsr\nUmfdePyO2odVrjDiiNJsfkHeMh66ED4n7szrRjwkz7FTkoEF0dMOw/bWJU2X\nEYVziHG7rm9B4Blzv6KtqG4Y9Gty8epOG+itSLQcc088H86TXYXJn6y75+lf\n1Lw5E9lxw5XLfVnE7uzr0NVHhcj/M3RaGzXySi7v2AWMbF6wqxtAdebdNaew\nIpc3+NVj2OjA/79bzzhU76MG0PrYURE8UmVugHZHGp9L1PraD/jWqCT1JMGE\n1qGu2dSlsqoyNe9Y1pTs/kc+I4KLjwDqo14NyQQk8quvkyHrQ66oO5lAPN4U\n5ms7vR+FOZYrtX7jQDTAs9N169N0IxhGwgsUH4zRza2RkkdTzsjyEnPhqlrI\n6tIrfYldrudrGtcNmLJqY7fTUA86L3f7SQvlnpfsDPUFagfwQr4Uz9JE8q1k\nhbe8CqTuhbET2AZNFlBxf0ii3ipwNXXJtB/0hIVQCfud1vbdS1IuOibc2/YY\n6ep0\r\n=AZxH\r\n-----END PGP SIGNATURE-----\r\n" - }, - "maintainers": [ - { - "name": "kkoopa", - "email": "bbyholm@abo.fi" - }, - { - "name": "rvagg", - "email": "rod@vagg.org" - } - ], - "directories": {}, - "_npmOperationalInternal": { - "host": "s3://npm-registry-packages", - "tmp": "tmp/nan_2.14.0_1558033896058_0.6879275796293267" - }, - "_hasShrinkwrap": false, - "_shasum": "7818f722027b2459a86f0295d434d1fc2336c52c", - "_from": "nan@^2.14.0", - "_resolved": "https://registry.npmjs.org/nan/-/nan-2.14.0.tgz", - "readme": "ERROR: No README data found!" -} diff --git a/node_modules/node-pty/node_modules/nan/tools/1to2.js b/node_modules/node-pty/node_modules/nan/tools/1to2.js deleted file mode 100755 index 337f8bf..0000000 --- a/node_modules/node-pty/node_modules/nan/tools/1to2.js +++ /dev/null @@ -1,412 +0,0 @@ -#!/usr/bin/env node -/********************************************************************* - * NAN - Native Abstractions for Node.js - * - * Copyright (c) 2018 NAN contributors - * - * MIT License - ********************************************************************/ - -var commander = require('commander'), - fs = require('fs'), - glob = require('glob'), - groups = [], - total = 0, - warning1 = '/* ERROR: Rewrite using Buffer */\n', - warning2 = '\\/\\* ERROR\\: Rewrite using Buffer \\*\\/\\n', - length, - i; - -fs.readFile(__dirname + '/package.json', 'utf8', function (err, data) { - if (err) { - throw err; - } - - commander - .version(JSON.parse(data).version) - .usage('[options] ') - .parse(process.argv); - - if (!process.argv.slice(2).length) { - commander.outputHelp(); - } -}); - -/* construct strings representing regular expressions - each expression contains a unique group allowing for identification of the match - the index of this key group, relative to the regular expression in question, - is indicated by the first array member */ - -/* simple substistutions, key group is the entire match, 0 */ -groups.push([0, [ - '_NAN_', - 'NODE_SET_METHOD', - 'NODE_SET_PROTOTYPE_METHOD', - 'NanAsciiString', - 'NanEscapeScope', - 'NanReturnValue', - 'NanUcs2String'].join('|')]); - -/* substitutions of parameterless macros, key group is 1 */ -groups.push([1, ['(', [ - 'NanEscapableScope', - 'NanReturnNull', - 'NanReturnUndefined', - 'NanScope'].join('|'), ')\\(\\)'].join('')]); - -/* replace TryCatch with NanTryCatch once, gobbling possible namespace, key group 2 */ -groups.push([2, '(?:(?:v8\\:\\:)?|(Nan)?)(TryCatch)']); - -/* NanNew("string") will likely not fail a ToLocalChecked(), key group 1 */ -groups.push([1, ['(NanNew)', '(\\("[^\\"]*"[^\\)]*\\))(?!\\.ToLocalChecked\\(\\))'].join('')]); - -/* Removed v8 APIs, warn that the code needs rewriting using node::Buffer, key group 2 */ -groups.push([2, ['(', warning2, ')?', '^.*?(', [ - 'GetIndexedPropertiesExternalArrayDataLength', - 'GetIndexedPropertiesExternalArrayData', - 'GetIndexedPropertiesExternalArrayDataType', - 'GetIndexedPropertiesPixelData', - 'GetIndexedPropertiesPixelDataLength', - 'HasIndexedPropertiesInExternalArrayData', - 'HasIndexedPropertiesInPixelData', - 'SetIndexedPropertiesToExternalArrayData', - 'SetIndexedPropertiesToPixelData'].join('|'), ')'].join('')]); - -/* No need for NanScope in V8-exposed methods, key group 2 */ -groups.push([2, ['((', [ - 'NAN_METHOD', - 'NAN_GETTER', - 'NAN_SETTER', - 'NAN_PROPERTY_GETTER', - 'NAN_PROPERTY_SETTER', - 'NAN_PROPERTY_ENUMERATOR', - 'NAN_PROPERTY_DELETER', - 'NAN_PROPERTY_QUERY', - 'NAN_INDEX_GETTER', - 'NAN_INDEX_SETTER', - 'NAN_INDEX_ENUMERATOR', - 'NAN_INDEX_DELETER', - 'NAN_INDEX_QUERY'].join('|'), ')\\([^\\)]*\\)\\s*\\{)\\s*NanScope\\(\\)\\s*;'].join('')]); - -/* v8::Value::ToXXXXXXX returns v8::MaybeLocal, key group 3 */ -groups.push([3, ['([\\s\\(\\)])([^\\s\\(\\)]+)->(', [ - 'Boolean', - 'Number', - 'String', - 'Object', - 'Integer', - 'Uint32', - 'Int32'].join('|'), ')\\('].join('')]); - -/* v8::Value::XXXXXXXValue returns v8::Maybe, key group 3 */ -groups.push([3, ['([\\s\\(\\)])([^\\s\\(\\)]+)->((?:', [ - 'Boolean', - 'Number', - 'Integer', - 'Uint32', - 'Int32'].join('|'), ')Value)\\('].join('')]); - -/* NAN_WEAK_CALLBACK macro was removed, write out callback definition, key group 1 */ -groups.push([1, '(NAN_WEAK_CALLBACK)\\(([^\\s\\)]+)\\)']); - -/* node::ObjectWrap and v8::Persistent have been replaced with Nan implementations, key group 1 */ -groups.push([1, ['(', [ - 'NanDisposePersistent', - 'NanObjectWrapHandle'].join('|'), ')\\s*\\(\\s*([^\\s\\)]+)'].join('')]); - -/* Since NanPersistent there is no need for NanMakeWeakPersistent, key group 1 */ -groups.push([1, '(NanMakeWeakPersistent)\\s*\\(\\s*([^\\s,]+)\\s*,\\s*']); - -/* Many methods of v8::Object and others now return v8::MaybeLocal, key group 3 */ -groups.push([3, ['([\\s])([^\\s]+)->(', [ - 'GetEndColumn', - 'GetFunction', - 'GetLineNumber', - 'NewInstance', - 'GetPropertyNames', - 'GetOwnPropertyNames', - 'GetSourceLine', - 'GetStartColumn', - 'ObjectProtoToString', - 'ToArrayIndex', - 'ToDetailString', - 'CallAsConstructor', - 'CallAsFunction', - 'CloneElementAt', - 'Delete', - 'ForceSet', - 'Get', - 'GetPropertyAttributes', - 'GetRealNamedProperty', - 'GetRealNamedPropertyInPrototypeChain', - 'Has', - 'HasOwnProperty', - 'HasRealIndexedProperty', - 'HasRealNamedCallbackProperty', - 'HasRealNamedProperty', - 'Set', - 'SetAccessor', - 'SetIndexedPropertyHandler', - 'SetNamedPropertyHandler', - 'SetPrototype'].join('|'), ')\\('].join('')]); - -/* You should get an error if any of these fail anyways, - or handle the error better, it is indicated either way, key group 2 */ -groups.push([2, ['NanNew(<(?:v8\\:\\:)?(', ['Date', 'String', 'RegExp'].join('|'), ')>)(\\([^\\)]*\\))(?!\\.ToLocalChecked\\(\\))'].join('')]); - -/* v8::Value::Equals now returns a v8::Maybe, key group 3 */ -groups.push([3, '([\\s\\(\\)])([^\\s\\(\\)]+)->(Equals)\\(([^\\s\\)]+)']); - -/* NanPersistent makes this unnecessary, key group 1 */ -groups.push([1, '(NanAssignPersistent)(?:]+>)?\\(([^,]+),\\s*']); - -/* args has been renamed to info, key group 2 */ -groups.push([2, '(\\W)(args)(\\W)']) - -/* node::ObjectWrap was replaced with NanObjectWrap, key group 2 */ -groups.push([2, '(\\W)(?:node\\:\\:)?(ObjectWrap)(\\W)']); - -/* v8::Persistent was replaced with NanPersistent, key group 2 */ -groups.push([2, '(\\W)(?:v8\\:\\:)?(Persistent)(\\W)']); - -/* counts the number of capturing groups in a well-formed regular expression, - ignoring non-capturing groups and escaped parentheses */ -function groupcount(s) { - var positive = s.match(/\((?!\?)/g), - negative = s.match(/\\\(/g); - return (positive ? positive.length : 0) - (negative ? negative.length : 0); -} - -/* compute the absolute position of each key group in the joined master RegExp */ -for (i = 1, length = groups.length; i < length; i++) { - total += groupcount(groups[i - 1][1]); - groups[i][0] += total; -} - -/* create the master RegExp, whis is the union of all the groups' expressions */ -master = new RegExp(groups.map(function (a) { return a[1]; }).join('|'), 'gm'); - -/* replacement function for String.replace, receives 21 arguments */ -function replace() { - /* simple expressions */ - switch (arguments[groups[0][0]]) { - case '_NAN_': - return 'NAN_'; - case 'NODE_SET_METHOD': - return 'NanSetMethod'; - case 'NODE_SET_PROTOTYPE_METHOD': - return 'NanSetPrototypeMethod'; - case 'NanAsciiString': - return 'NanUtf8String'; - case 'NanEscapeScope': - return 'scope.Escape'; - case 'NanReturnNull': - return 'info.GetReturnValue().SetNull'; - case 'NanReturnValue': - return 'info.GetReturnValue().Set'; - case 'NanUcs2String': - return 'v8::String::Value'; - default: - } - - /* macros without arguments */ - switch (arguments[groups[1][0]]) { - case 'NanEscapableScope': - return 'NanEscapableScope scope' - case 'NanReturnUndefined': - return 'return'; - case 'NanScope': - return 'NanScope scope'; - default: - } - - /* TryCatch, emulate negative backref */ - if (arguments[groups[2][0]] === 'TryCatch') { - return arguments[groups[2][0] - 1] ? arguments[0] : 'NanTryCatch'; - } - - /* NanNew("foo") --> NanNew("foo").ToLocalChecked() */ - if (arguments[groups[3][0]] === 'NanNew') { - return [arguments[0], '.ToLocalChecked()'].join(''); - } - - /* insert warning for removed functions as comment on new line above */ - switch (arguments[groups[4][0]]) { - case 'GetIndexedPropertiesExternalArrayData': - case 'GetIndexedPropertiesExternalArrayDataLength': - case 'GetIndexedPropertiesExternalArrayDataType': - case 'GetIndexedPropertiesPixelData': - case 'GetIndexedPropertiesPixelDataLength': - case 'HasIndexedPropertiesInExternalArrayData': - case 'HasIndexedPropertiesInPixelData': - case 'SetIndexedPropertiesToExternalArrayData': - case 'SetIndexedPropertiesToPixelData': - return arguments[groups[4][0] - 1] ? arguments[0] : [warning1, arguments[0]].join(''); - default: - } - - /* remove unnecessary NanScope() */ - switch (arguments[groups[5][0]]) { - case 'NAN_GETTER': - case 'NAN_METHOD': - case 'NAN_SETTER': - case 'NAN_INDEX_DELETER': - case 'NAN_INDEX_ENUMERATOR': - case 'NAN_INDEX_GETTER': - case 'NAN_INDEX_QUERY': - case 'NAN_INDEX_SETTER': - case 'NAN_PROPERTY_DELETER': - case 'NAN_PROPERTY_ENUMERATOR': - case 'NAN_PROPERTY_GETTER': - case 'NAN_PROPERTY_QUERY': - case 'NAN_PROPERTY_SETTER': - return arguments[groups[5][0] - 1]; - default: - } - - /* Value converstion */ - switch (arguments[groups[6][0]]) { - case 'Boolean': - case 'Int32': - case 'Integer': - case 'Number': - case 'Object': - case 'String': - case 'Uint32': - return [arguments[groups[6][0] - 2], 'NanTo(', arguments[groups[6][0] - 1]].join(''); - default: - } - - /* other value conversion */ - switch (arguments[groups[7][0]]) { - case 'BooleanValue': - return [arguments[groups[7][0] - 2], 'NanTo(', arguments[groups[7][0] - 1]].join(''); - case 'Int32Value': - return [arguments[groups[7][0] - 2], 'NanTo(', arguments[groups[7][0] - 1]].join(''); - case 'IntegerValue': - return [arguments[groups[7][0] - 2], 'NanTo(', arguments[groups[7][0] - 1]].join(''); - case 'Uint32Value': - return [arguments[groups[7][0] - 2], 'NanTo(', arguments[groups[7][0] - 1]].join(''); - default: - } - - /* NAN_WEAK_CALLBACK */ - if (arguments[groups[8][0]] === 'NAN_WEAK_CALLBACK') { - return ['template\nvoid ', - arguments[groups[8][0] + 1], '(const NanWeakCallbackInfo &data)'].join(''); - } - - /* use methods on NAN classes instead */ - switch (arguments[groups[9][0]]) { - case 'NanDisposePersistent': - return [arguments[groups[9][0] + 1], '.Reset('].join(''); - case 'NanObjectWrapHandle': - return [arguments[groups[9][0] + 1], '->handle('].join(''); - default: - } - - /* use method on NanPersistent instead */ - if (arguments[groups[10][0]] === 'NanMakeWeakPersistent') { - return arguments[groups[10][0] + 1] + '.SetWeak('; - } - - /* These return Maybes, the upper ones take no arguments */ - switch (arguments[groups[11][0]]) { - case 'GetEndColumn': - case 'GetFunction': - case 'GetLineNumber': - case 'GetOwnPropertyNames': - case 'GetPropertyNames': - case 'GetSourceLine': - case 'GetStartColumn': - case 'NewInstance': - case 'ObjectProtoToString': - case 'ToArrayIndex': - case 'ToDetailString': - return [arguments[groups[11][0] - 2], 'Nan', arguments[groups[11][0]], '(', arguments[groups[11][0] - 1]].join(''); - case 'CallAsConstructor': - case 'CallAsFunction': - case 'CloneElementAt': - case 'Delete': - case 'ForceSet': - case 'Get': - case 'GetPropertyAttributes': - case 'GetRealNamedProperty': - case 'GetRealNamedPropertyInPrototypeChain': - case 'Has': - case 'HasOwnProperty': - case 'HasRealIndexedProperty': - case 'HasRealNamedCallbackProperty': - case 'HasRealNamedProperty': - case 'Set': - case 'SetAccessor': - case 'SetIndexedPropertyHandler': - case 'SetNamedPropertyHandler': - case 'SetPrototype': - return [arguments[groups[11][0] - 2], 'Nan', arguments[groups[11][0]], '(', arguments[groups[11][0] - 1], ', '].join(''); - default: - } - - /* Automatic ToLocalChecked(), take it or leave it */ - switch (arguments[groups[12][0]]) { - case 'Date': - case 'String': - case 'RegExp': - return ['NanNew', arguments[groups[12][0] - 1], arguments[groups[12][0] + 1], '.ToLocalChecked()'].join(''); - default: - } - - /* NanEquals is now required for uniformity */ - if (arguments[groups[13][0]] === 'Equals') { - return [arguments[groups[13][0] - 1], 'NanEquals(', arguments[groups[13][0] - 1], ', ', arguments[groups[13][0] + 1]].join(''); - } - - /* use method on replacement class instead */ - if (arguments[groups[14][0]] === 'NanAssignPersistent') { - return [arguments[groups[14][0] + 1], '.Reset('].join(''); - } - - /* args --> info */ - if (arguments[groups[15][0]] === 'args') { - return [arguments[groups[15][0] - 1], 'info', arguments[groups[15][0] + 1]].join(''); - } - - /* ObjectWrap --> NanObjectWrap */ - if (arguments[groups[16][0]] === 'ObjectWrap') { - return [arguments[groups[16][0] - 1], 'NanObjectWrap', arguments[groups[16][0] + 1]].join(''); - } - - /* Persistent --> NanPersistent */ - if (arguments[groups[17][0]] === 'Persistent') { - return [arguments[groups[17][0] - 1], 'NanPersistent', arguments[groups[17][0] + 1]].join(''); - } - - /* This should not happen. A switch is probably missing a case if it does. */ - throw 'Unhandled match: ' + arguments[0]; -} - -/* reads a file, runs replacement and writes it back */ -function processFile(file) { - fs.readFile(file, {encoding: 'utf8'}, function (err, data) { - if (err) { - throw err; - } - - /* run replacement twice, might need more runs */ - fs.writeFile(file, data.replace(master, replace).replace(master, replace), function (err) { - if (err) { - throw err; - } - }); - }); -} - -/* process file names from command line and process the identified files */ -for (i = 2, length = process.argv.length; i < length; i++) { - glob(process.argv[i], function (err, matches) { - if (err) { - throw err; - } - matches.forEach(processFile); - }); -} diff --git a/node_modules/node-pty/node_modules/nan/tools/README.md b/node_modules/node-pty/node_modules/nan/tools/README.md deleted file mode 100644 index 7f07e4b..0000000 --- a/node_modules/node-pty/node_modules/nan/tools/README.md +++ /dev/null @@ -1,14 +0,0 @@ -1to2 naively converts source code files from NAN 1 to NAN 2. There will be erroneous conversions, -false positives and missed opportunities. The input files are rewritten in place. Make sure that -you have backups. You will have to manually review the changes afterwards and do some touchups. - -```sh -$ tools/1to2.js - - Usage: 1to2 [options] - - Options: - - -h, --help output usage information - -V, --version output the version number -``` diff --git a/node_modules/node-pty/node_modules/nan/tools/package.json b/node_modules/node-pty/node_modules/nan/tools/package.json deleted file mode 100644 index 2dcdd78..0000000 --- a/node_modules/node-pty/node_modules/nan/tools/package.json +++ /dev/null @@ -1,19 +0,0 @@ -{ - "name": "1to2", - "version": "1.0.0", - "description": "NAN 1 -> 2 Migration Script", - "main": "1to2.js", - "repository": { - "type": "git", - "url": "git://github.com/nodejs/nan.git" - }, - "contributors": [ - "Benjamin Byholm (https://github.com/kkoopa/)", - "Mathias Küsel (https://github.com/mathiask88/)" - ], - "dependencies": { - "glob": "~5.0.10", - "commander": "~2.8.1" - }, - "license": "MIT" -} diff --git a/node_modules/node-pty/package.json b/node_modules/node-pty/package.json deleted file mode 100644 index 82fae37..0000000 --- a/node_modules/node-pty/package.json +++ /dev/null @@ -1,89 +0,0 @@ -{ - "name": "node-pty", - "description": "Fork pseudoterminals in Node.JS", - "author": { - "name": "Microsoft Corporation" - }, - "version": "0.9.0", - "license": "MIT", - "main": "./lib/index.js", - "types": "./typings/node-pty.d.ts", - "repository": { - "type": "git", - "url": "git://github.com/Tyriar/node-pty.git" - }, - "homepage": "https://github.com/Tyriar/node-pty", - "bugs": { - "url": "https://github.com/Tyriar/node-pty/issues" - }, - "keywords": [ - "pty", - "tty", - "terminal", - "pseudoterminal", - "forkpty", - "openpty" - ], - "scripts": { - "tsc": "tsc", - "watch": "tsc -w", - "lint": "tslint 'src/**/*.ts'", - "install": "node scripts/install.js", - "postinstall": "node scripts/post-install.js", - "test": "cross-env NODE_ENV=test mocha -R spec --exit lib/*.test.js", - "prepare": "npm run tsc", - "prepublishOnly": "npm run tsc" - }, - "dependencies": { - "nan": "^2.14.0" - }, - "devDependencies": { - "@types/mocha": "^5.0.0", - "@types/node": "8", - "cross-env": "^5.1.4", - "mocha": "^5.0.5", - "ps-list": "^6.0.0", - "tslint": "^5.12.1", - "tslint-consistent-codestyle": "^1.15.0", - "typescript": "3.4" - }, - "gitHead": "beac2b8c8badae230074d88cd0cd08da95daafc5", - "_id": "node-pty@0.9.0", - "_npmVersion": "6.4.1", - "_nodeVersion": "8.16.2", - "_npmUser": { - "name": "tyriar", - "email": "tyriar@tyriar.com" - }, - "dist": { - "integrity": "sha512-MBnCQl83FTYOu7B4xWw10AW77AAh7ThCE1VXEv+JeWj8mSpGo+0bwgsV+b23ljBFwEM9OmsOv3kM27iUPPm84g==", - "shasum": "8f9bcc0d1c5b970a3184ffd533d862c7eb6590a6", - "tarball": "https://registry.npmjs.org/node-pty/-/node-pty-0.9.0.tgz", - "fileCount": 243, - "unpackedSize": 1079779, - "npm-signature": "-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJdr0CpCRA9TVsSAnZWagAAvQoP/0G3Jy4bgYG7P44M7AkK\n7eegnmVgFp+t6PP7UqM4K6y8ex2/CLdl7UMRO0LFiJs7PnWGtEgXAIyC9Tmu\nJ8fkNly2/hAZdXU5C8E2NopUVb7QFjaaNshDkkVbn6pRiVG/Uo1Z4TW4Ijny\nqnDflc53cAzcepb2SnmNV7WqPUSlnY0jq2zPHJFfa4goj6+BU/V/VkYbH/eV\nFjejs5AufMRfG/3lM/R9/yNMNtNRraFRbZE9x6+yW6Wli4QPhw3ITJ1R2gPZ\nq2GjMRvrYmXWDr8pROrfAjSGpkaLpGNrIQbNDMtl5P9MfInBAH34zPurwV+J\ntx65FZ5ifCbeSU7b3f1JVkoLA09pAJpu/6Xk4xhsYfvacZxOcMCwlQ6UzAUA\n9gsVieq4acx1KbtlKIjvrgN3UrsdTvVDb5jlslD+7kD0Ux4jiXaiCblw0fyj\nMgxgN2xADa2wsihSgcSsW8wIp7X+K0VV5k0HgJ7iQpVtEZrN41UJ4hIH/toU\n+XEkQo1wqsjlXHVZocxIhwNYrSmoEWTlXW0OTC2tCWYkkIkY33JNRSEkWlHg\noNMjX4Gjt9769my7Us94K8yORg3xyEC0b859xSL70M71/zRuHFwn6hWa/z5i\nqmbLfyhz+AZkywh45CJ6H3BqSjLed/70CfVSfqy58j1NqcKy7oqtCiFjYWKf\nOwd4\r\n=jQ/c\r\n-----END PGP SIGNATURE-----\r\n" - }, - "maintainers": [ - { - "email": "alros@microsoft.com", - "name": "alexr00" - }, - { - "email": "npmjs@microsoft.com", - "name": "microsoft" - }, - { - "email": "tyriar@tyriar.com", - "name": "tyriar" - } - ], - "directories": {}, - "_npmOperationalInternal": { - "host": "s3://npm-registry-packages", - "tmp": "tmp/node-pty_0.9.0_1571766440764_0.5541740518865894" - }, - "_hasShrinkwrap": false, - "_shasum": "8f9bcc0d1c5b970a3184ffd533d862c7eb6590a6", - "_from": "node-pty@", - "_resolved": "https://registry.npmjs.org/node-pty/-/node-pty-0.9.0.tgz" -} diff --git a/node_modules/node-pty/scripts/install.js b/node_modules/node-pty/scripts/install.js deleted file mode 100644 index d88b7f1..0000000 --- a/node_modules/node-pty/scripts/install.js +++ /dev/null @@ -1,18 +0,0 @@ -'use strict' - -const os = require('os'); -const path = require('path'); -const spawn = require('child_process').spawn; - -const gypArgs = ['rebuild']; -if (process.env.NODE_PTY_DEBUG) { - gypArgs.push('--debug'); -} -const gypProcess = spawn(os.platform() === 'win32' ? 'node-gyp.cmd' : 'node-gyp', gypArgs, { - cwd: path.join(__dirname, '..'), - stdio: 'inherit' -}); - -gypProcess.on('exit', function (code) { - process.exit(code); -}); diff --git a/node_modules/node-pty/scripts/post-install.js b/node_modules/node-pty/scripts/post-install.js deleted file mode 100644 index 2c026ee..0000000 --- a/node_modules/node-pty/scripts/post-install.js +++ /dev/null @@ -1,41 +0,0 @@ -var fs = require('fs'); -var path = require('path'); - -var RELEASE_DIR = path.join(__dirname, '..', 'build', 'Release'); -var BUILD_FILES = [ - path.join(RELEASE_DIR, 'conpty.node'), - path.join(RELEASE_DIR, 'conpty.pdb'), - path.join(RELEASE_DIR, 'conpty_console_list.node'), - path.join(RELEASE_DIR, 'conpty_console_list.pdb'), - path.join(RELEASE_DIR, 'pty.node'), - path.join(RELEASE_DIR, 'pty.pdb'), - path.join(RELEASE_DIR, 'winpty-agent.exe'), - path.join(RELEASE_DIR, 'winpty-agent.pdb'), - path.join(RELEASE_DIR, 'winpty.dll'), - path.join(RELEASE_DIR, 'winpty.pdb') -]; - -cleanFolderRecursive = function(folder) { - var files = []; - if( fs.existsSync(folder) ) { - files = fs.readdirSync(folder); - files.forEach(function(file,index) { - var curPath = path.join(folder, file); - if(fs.lstatSync(curPath).isDirectory()) { // recurse - cleanFolderRecursive(curPath); - fs.rmdirSync(curPath); - } else if (BUILD_FILES.indexOf(curPath) < 0){ // delete file - fs.unlinkSync(curPath); - } - }); - } -}; - -try { - cleanFolderRecursive(RELEASE_DIR); -} catch(e) { - console.log(e); - //process.exit(1); -} finally { - process.exit(0); -} diff --git a/node_modules/node-pty/scripts/publish.js b/node_modules/node-pty/scripts/publish.js deleted file mode 100644 index 968531e..0000000 --- a/node_modules/node-pty/scripts/publish.js +++ /dev/null @@ -1,62 +0,0 @@ -/** - * Copyright (c) 2019, Microsoft Corporation (MIT License). - */ - -const cp = require('child_process'); -const fs = require('fs'); -const path = require('path'); -const packageJson = require('../package.json'); - -// Setup auth -fs.writeFileSync(`${process.env['HOME']}/.npmrc`, `//registry.npmjs.org/:_authToken=${process.env['NPM_AUTH_TOKEN']}`); - -// Determine if this is a stable or beta release -const publishedVersions = getPublishedVersions(); -const isStableRelease = publishedVersions.indexOf(packageJson.version) === -1; - -// Get the next version -let nextVersion = isStableRelease ? packageJson.version : getNextBetaVersion(); -console.log(`Publishing version: ${nextVersion}`); - -// Set the version in package.json -const packageJsonFile = path.resolve(__dirname, '..', 'package.json'); -packageJson.version = nextVersion; -fs.writeFileSync(packageJsonFile, JSON.stringify(packageJson, null, 2)); - -// Publish -const args = ['publish']; -if (!isStableRelease) { - args.push('--tag', 'beta'); -} -const result = cp.spawn('npm', args, { stdio: 'inherit' }); -result.on('exit', code => process.exit(code)); - -function getNextBetaVersion() { - if (!/^[0-9]+\.[0-9]+\.[0-9]+$/.exec(packageJson.version)) { - console.error('The package.json version must be of the form x.y.z'); - process.exit(1); - } - const tag = 'beta'; - const stableVersion = packageJson.version.split('.'); - const nextStableVersion = `${stableVersion[0]}.${parseInt(stableVersion[1]) + 1}.0`; - const publishedVersions = getPublishedVersions(nextStableVersion, tag); - if (publishedVersions.length === 0) { - return `${nextStableVersion}-${tag}1`; - } - const latestPublishedVersion = publishedVersions.sort((a, b) => { - const aVersion = parseInt(a.substr(a.search(/[0-9]+$/))); - const bVersion = parseInt(b.substr(b.search(/[0-9]+$/))); - return aVersion > bVersion ? -1 : 1; - })[0]; - const latestTagVersion = parseInt(latestPublishedVersion.substr(latestPublishedVersion.search(/[0-9]+$/)), 10); - return `${nextStableVersion}-${tag}${latestTagVersion + 1}`; -} - -function getPublishedVersions(version, tag) { - const versionsProcess = cp.spawnSync('npm', ['view', packageJson.name, 'versions', '--json']); - const versionsJson = JSON.parse(versionsProcess.stdout); - if (tag) { - return versionsJson.filter(v => !v.search(new RegExp(`${version}-${tag}[0-9]+`))); - } - return versionsJson; -} diff --git a/node_modules/node-pty/src/conpty_console_list_agent.ts b/node_modules/node-pty/src/conpty_console_list_agent.ts deleted file mode 100644 index 2aec542..0000000 --- a/node_modules/node-pty/src/conpty_console_list_agent.ts +++ /dev/null @@ -1,19 +0,0 @@ -/** - * Copyright (c) 2019, Microsoft Corporation (MIT License). - * - * This module fetches the console process list for a particular PID. It must be - * called from a different process (child_process.fork) as there can only be a - * single console attached to a process. - */ - -let getConsoleProcessList: any; -try { - getConsoleProcessList = require('../build/Release/conpty_console_list.node').getConsoleProcessList; -} catch (err) { - getConsoleProcessList = require('../build/Debug/conpty_console_list.node').getConsoleProcessList; -} - -const shellPid = parseInt(process.argv[2], 10); -const consoleProcessList = getConsoleProcessList(shellPid); -process.send({ consoleProcessList }); -process.exit(0); diff --git a/node_modules/node-pty/src/eventEmitter2.test.ts b/node_modules/node-pty/src/eventEmitter2.test.ts deleted file mode 100644 index a65bfc2..0000000 --- a/node_modules/node-pty/src/eventEmitter2.test.ts +++ /dev/null @@ -1,30 +0,0 @@ -/** - * Copyright (c) 2019, Microsoft Corporation (MIT License). - */ - -import * as assert from 'assert'; -import { EventEmitter2 } from './eventEmitter2'; - -describe('EventEmitter2', () => { - it('should fire listeners multiple times', () => { - const order: string[] = []; - const emitter = new EventEmitter2(); - emitter.event(data => order.push(data + 'a')); - emitter.event(data => order.push(data + 'b')); - emitter.fire(1); - emitter.fire(2); - assert.deepEqual(order, [ '1a', '1b', '2a', '2b' ]); - }); - - it('should not fire listeners once disposed', () => { - const order: string[] = []; - const emitter = new EventEmitter2(); - emitter.event(data => order.push(data + 'a')); - const disposeB = emitter.event(data => order.push(data + 'b')); - emitter.event(data => order.push(data + 'c')); - emitter.fire(1); - disposeB.dispose(); - emitter.fire(2); - assert.deepEqual(order, [ '1a', '1b', '1c', '2a', '2c' ]); - }); -}); diff --git a/node_modules/node-pty/src/eventEmitter2.ts b/node_modules/node-pty/src/eventEmitter2.ts deleted file mode 100644 index 6779d0c..0000000 --- a/node_modules/node-pty/src/eventEmitter2.ts +++ /dev/null @@ -1,48 +0,0 @@ -/** - * Copyright (c) 2019, Microsoft Corporation (MIT License). - */ - -import { IDisposable } from './types'; - -interface IListener { - (e: T): void; -} - -export interface IEvent { - (listener: (e: T) => any): IDisposable; -} - -export class EventEmitter2 { - private _listeners: IListener[] = []; - private _event?: IEvent; - - public get event(): IEvent { - if (!this._event) { - this._event = (listener: (e: T) => any) => { - this._listeners.push(listener); - const disposable = { - dispose: () => { - for (let i = 0; i < this._listeners.length; i++) { - if (this._listeners[i] === listener) { - this._listeners.splice(i, 1); - return; - } - } - } - }; - return disposable; - }; - } - return this._event; - } - - public fire(data: T): void { - const queue: IListener[] = []; - for (let i = 0; i < this._listeners.length; i++) { - queue.push(this._listeners[i]); - } - for (let i = 0; i < queue.length; i++) { - queue[i].call(undefined, data); - } - } -} diff --git a/node_modules/node-pty/src/index.ts b/node_modules/node-pty/src/index.ts deleted file mode 100644 index 53d0322..0000000 --- a/node_modules/node-pty/src/index.ts +++ /dev/null @@ -1,51 +0,0 @@ -/** - * Copyright (c) 2012-2015, Christopher Jeffrey, Peter Sunde (MIT License) - * Copyright (c) 2016, Daniel Imms (MIT License). - * Copyright (c) 2018, Microsoft Corporation (MIT License). - */ - -import { ITerminal, IPtyOpenOptions, IPtyForkOptions, IWindowsPtyForkOptions } from './interfaces'; -import { ArgvOrCommandLine } from './types'; - -let terminalCtor: any; -if (process.platform === 'win32') { - terminalCtor = require('./windowsTerminal').WindowsTerminal; -} else { - terminalCtor = require('./unixTerminal').UnixTerminal; -} - -/** - * Forks a process as a pseudoterminal. - * @param file The file to launch. - * @param args The file's arguments as argv (string[]) or in a pre-escaped - * CommandLine format (string). Note that the CommandLine option is only - * available on Windows and is expected to be escaped properly. - * @param options The options of the terminal. - * @throws When the file passed to spawn with does not exists. - * @see CommandLineToArgvW https://msdn.microsoft.com/en-us/library/windows/desktop/bb776391(v=vs.85).aspx - * @see Parsing C++ Comamnd-Line Arguments https://msdn.microsoft.com/en-us/library/17w5ykft.aspx - * @see GetCommandLine https://msdn.microsoft.com/en-us/library/windows/desktop/ms683156.aspx - */ -export function spawn(file?: string, args?: ArgvOrCommandLine, opt?: IPtyForkOptions | IWindowsPtyForkOptions): ITerminal { - return new terminalCtor(file, args, opt); -} - -/** @deprecated */ -export function fork(file?: string, args?: ArgvOrCommandLine, opt?: IPtyForkOptions | IWindowsPtyForkOptions): ITerminal { - return new terminalCtor(file, args, opt); -} - -/** @deprecated */ -export function createTerminal(file?: string, args?: ArgvOrCommandLine, opt?: IPtyForkOptions | IWindowsPtyForkOptions): ITerminal { - return new terminalCtor(file, args, opt); -} - -export function open(options: IPtyOpenOptions): ITerminal { - return terminalCtor.open(options); -} - -/** - * Expose the native API when not Windows, note that this is not public API and - * could be removed at any time. - */ -export const native = (process.platform !== 'win32' ? require('../build/Release/pty.node') : null); diff --git a/node_modules/node-pty/src/interfaces.ts b/node_modules/node-pty/src/interfaces.ts deleted file mode 100644 index f100e0e..0000000 --- a/node_modules/node-pty/src/interfaces.ts +++ /dev/null @@ -1,136 +0,0 @@ -/** - * Copyright (c) 2016, Daniel Imms (MIT License). - * Copyright (c) 2018, Microsoft Corporation (MIT License). - */ - -import * as net from 'net'; - -export interface IProcessEnv { - [key: string]: string; -} - -export interface ITerminal { - /** - * Gets the name of the process. - */ - process: string; - - /** - * Gets the process ID. - */ - pid: number; - - /** - * The socket for the master file descriptor. This is not supported on - * Windows. - */ - master: net.Socket; - - /** - * The socket for the slave file descriptor. This is not supported on Windows. - */ - slave: net.Socket; - - /** - * Writes data to the socket. - * @param data The data to write. - */ - write(data: string): void; - - /** - * Resize the pty. - * @param cols The number of columns. - * @param rows The number of rows. - */ - resize(cols: number, rows: number): void; - - /** - * Close, kill and destroy the socket. - */ - destroy(): void; - - /** - * Kill the pty. - * @param signal The signal to send, by default this is SIGHUP. This is not - * supported on Windows. - */ - kill(signal?: string): void; - - /** - * Set the pty socket encoding. - */ - setEncoding(encoding: string | null): void; - - /** - * Resume the pty socket. - */ - resume(): void; - - /** - * Pause the pty socket. - */ - pause(): void; - - /** - * Alias for ITerminal.on(eventName, listener). - */ - addListener(eventName: string, listener: (...args: any[]) => any): void; - - /** - * Adds the listener function to the end of the listeners array for the event - * named eventName. - * @param eventName The event name. - * @param listener The callback function - */ - on(eventName: string, listener: (...args: any[]) => any): void; - - /** - * Returns a copy of the array of listeners for the event named eventName. - */ - listeners(eventName: string): Function[]; - - /** - * Removes the specified listener from the listener array for the event named - * eventName. - */ - removeListener(eventName: string, listener: (...args: any[]) => any): void; - - /** - * Removes all listeners, or those of the specified eventName. - */ - removeAllListeners(eventName: string): void; - - /** - * Adds a one time listener function for the event named eventName. The next - * time eventName is triggered, this listener is removed and then invoked. - */ - once(eventName: string, listener: (...args: any[]) => any): void; -} - -interface IBasePtyForkOptions { - name?: string; - cols?: number; - rows?: number; - cwd?: string; - env?: { [key: string]: string }; - encoding?: string; - handleFlowControl?: boolean; - flowControlPause?: string; - flowControlResume?: string; -} - -export interface IPtyForkOptions extends IBasePtyForkOptions { - uid?: number; - gid?: number; -} - -export interface IWindowsPtyForkOptions extends IBasePtyForkOptions { - useConpty?: boolean; - conptyInheritCursor?: boolean; -} - -export interface IPtyOpenOptions { - cols?: number; - rows?: number; - encoding?: string; -} diff --git a/node_modules/node-pty/src/native.d.ts b/node_modules/node-pty/src/native.d.ts deleted file mode 100644 index 3212e3b..0000000 --- a/node_modules/node-pty/src/native.d.ts +++ /dev/null @@ -1,54 +0,0 @@ -/** - * Copyright (c) 2018, Microsoft Corporation (MIT License). - */ - -interface IConptyNative { - startProcess(file: string, cols: number, rows: number, debug: boolean, pipeName: string, conptyInheritCursor: boolean): IConptyProcess; - connect(ptyId: number, commandLine: string, cwd: string, env: string[], onExitCallback: (exitCode: number) => void): { pid: number }; - resize(ptyId: number, cols: number, rows: number): void; - kill(ptyId: number): void; -} - -interface IWinptyNative { - startProcess(file: string, commandLine: string, env: string[], cwd: string, cols: number, rows: number, debug: boolean): IWinptyProcess; - resize(processHandle: number, cols: number, rows: number): void; - kill(pid: number, innerPidHandle: number): void; - getProcessList(pid: number): number[]; - getExitCode(innerPidHandle: number): number; -} - -interface IUnixNative { - fork(file: string, args: string[], parsedEnv: string[], cwd: string, cols: number, rows: number, uid: number, gid: number, useUtf8: boolean, onExitCallback: (code: number, signal: number) => void): IUnixProcess; - open(cols: number, rows: number): IUnixOpenProcess; - process(fd: number, pty: string): string; - resize(fd: number, cols: number, rows: number): void; -} - -interface IConptyProcess { - pty: number; - fd: number; - conin: string; - conout: string; -} - -interface IWinptyProcess { - pty: number; - fd: number; - conin: string; - conout: string; - pid: number; - innerPid: number; - innerPidHandle: number; -} - -interface IUnixProcess { - fd: number; - pid: number; - pty: string; -} - -interface IUnixOpenProcess { - master: number; - slave: number; - pty: string; -} diff --git a/node_modules/node-pty/src/terminal.test.ts b/node_modules/node-pty/src/terminal.test.ts deleted file mode 100644 index dba011f..0000000 --- a/node_modules/node-pty/src/terminal.test.ts +++ /dev/null @@ -1,66 +0,0 @@ -/** - * Copyright (c) 2017, Daniel Imms (MIT License). - * Copyright (c) 2018, Microsoft Corporation (MIT License). - */ - -import * as assert from 'assert'; -import { WindowsTerminal } from './windowsTerminal'; -import { UnixTerminal } from './unixTerminal'; -import { pollUntil } from './testUtils.test'; - -const terminalConstructor = (process.platform === 'win32') ? WindowsTerminal : UnixTerminal; -const SHELL = (process.platform === 'win32') ? 'cmd.exe' : '/bin/bash'; - -let terminalCtor: WindowsTerminal | UnixTerminal; -if (process.platform === 'win32') { - terminalCtor = require('./windowsTerminal'); -} else { - terminalCtor = require('./unixTerminal'); -} - - -describe('Terminal', () => { - describe('constructor', () => { - it('should do basic type checks', () => { - assert.throws( - () => new (terminalCtor)('a', 'b', { 'name': {} }), - 'name must be a string (not a object)' - ); - }); - }); - - describe('automatic flow control', () => { - it('should respect ctor flow control options', () => { - const pty = new terminalConstructor(SHELL, [], {handleFlowControl: true, flowControlPause: 'abc', flowControlResume: '123'}); - assert.equal(pty.handleFlowControl, true); - assert.equal((pty as any)._flowControlPause, 'abc'); - assert.equal((pty as any)._flowControlResume, '123'); - }); - // TODO: I don't think this test ever worked due to pollUntil being used incorrectly - // it('should do flow control automatically', async function(): Promise { - // // Flow control doesn't work on Windows - // if (process.platform === 'win32') { - // return; - // } - - // this.timeout(10000); - // const pty = new terminalConstructor(SHELL, [], {handleFlowControl: true, flowControlPause: 'PAUSE', flowControlResume: 'RESUME'}); - // let read: string = ''; - // pty.on('data', data => read += data); - // pty.on('pause', () => read += 'paused'); - // pty.on('resume', () => read += 'resumed'); - // pty.write('1'); - // pty.write('PAUSE'); - // pty.write('2'); - // pty.write('RESUME'); - // pty.write('3'); - // await pollUntil(() => { - // return stripEscapeSequences(read).endsWith('1pausedresumed23'); - // }, 100, 10); - // }); - }); -}); - -function stripEscapeSequences(data: string): string { - return data.replace(/\u001b\[0K/, ''); -} diff --git a/node_modules/node-pty/src/terminal.ts b/node_modules/node-pty/src/terminal.ts deleted file mode 100644 index fb7f609..0000000 --- a/node_modules/node-pty/src/terminal.ts +++ /dev/null @@ -1,195 +0,0 @@ -/** - * Copyright (c) 2012-2015, Christopher Jeffrey (MIT License) - * Copyright (c) 2016, Daniel Imms (MIT License). - * Copyright (c) 2018, Microsoft Corporation (MIT License). - */ - -import { Socket } from 'net'; -import { EventEmitter } from 'events'; -import { ITerminal, IPtyForkOptions } from './interfaces'; -import { EventEmitter2, IEvent } from './eventEmitter2'; -import { IExitEvent } from './types'; - -export const DEFAULT_COLS: number = 80; -export const DEFAULT_ROWS: number = 24; - -/** - * Default messages to indicate PAUSE/RESUME for automatic flow control. - * To avoid conflicts with rebound XON/XOFF control codes (such as on-my-zsh), - * the sequences can be customized in `IPtyForkOptions`. - */ -const FLOW_CONTROL_PAUSE = '\x13'; // defaults to XOFF -const FLOW_CONTROL_RESUME = '\x11'; // defaults to XON - -export abstract class Terminal implements ITerminal { - protected _socket: Socket; - protected _pid: number; - protected _fd: number; - protected _pty: any; - - protected _file: string; - protected _name: string; - protected _cols: number; - protected _rows: number; - - protected _readable: boolean; - protected _writable: boolean; - - protected _internalee: EventEmitter; - private _flowControlPause: string; - private _flowControlResume: string; - public handleFlowControl: boolean; - - private _onData = new EventEmitter2(); - public get onData(): IEvent { return this._onData.event; } - private _onExit = new EventEmitter2(); - public get onExit(): IEvent { return this._onExit.event; } - - public get pid(): number { return this._pid; } - public get cols(): number { return this._cols; } - public get rows(): number { return this._rows; } - - constructor(opt?: IPtyForkOptions) { - // for 'close' - this._internalee = new EventEmitter(); - - if (!opt) { - return; - } - - // Do basic type checks here in case node-pty is being used within JavaScript. If the wrong - // types go through to the C++ side it can lead to hard to diagnose exceptions. - this._checkType('name', opt.name ? opt.name : null, 'string'); - this._checkType('cols', opt.cols ? opt.cols : null, 'number'); - this._checkType('rows', opt.rows ? opt.rows : null, 'number'); - this._checkType('cwd', opt.cwd ? opt.cwd : null, 'string'); - this._checkType('env', opt.env ? opt.env : null, 'object'); - this._checkType('uid', opt.uid ? opt.uid : null, 'number'); - this._checkType('gid', opt.gid ? opt.gid : null, 'number'); - this._checkType('encoding', opt.encoding ? opt.encoding : null, 'string'); - - // setup flow control handling - this.handleFlowControl = !!(opt.handleFlowControl); - this._flowControlPause = opt.flowControlPause || FLOW_CONTROL_PAUSE; - this._flowControlResume = opt.flowControlResume || FLOW_CONTROL_RESUME; - } - - protected abstract _write(data: string): void; - - public write(data: string): void { - if (this.handleFlowControl) { - // PAUSE/RESUME messages are not forwarded to the pty - if (data === this._flowControlPause) { - this.pause(); - return; - } - if (data === this._flowControlResume) { - this.resume(); - return; - } - } - // everything else goes to the real pty - this._write(data); - } - - protected _forwardEvents(): void { - this.on('data', e => this._onData.fire(e)); - this.on('exit', (exitCode, signal) => this._onExit.fire({ exitCode, signal })); - } - - private _checkType(name: string, value: any, type: string): void { - if (value && typeof value !== type) { - throw new Error(`${name} must be a ${type} (not a ${typeof value})`); - } - } - - /** See net.Socket.end */ - public end(data: string): void { - this._socket.end(data); - } - - /** See stream.Readable.pipe */ - public pipe(dest: any, options: any): any { - return this._socket.pipe(dest, options); - } - - /** See net.Socket.pause */ - public pause(): Socket { - return this._socket.pause(); - } - - /** See net.Socket.resume */ - public resume(): Socket { - return this._socket.resume(); - } - - /** See net.Socket.setEncoding */ - public setEncoding(encoding: string | null): void { - if ((this._socket)._decoder) { - delete (this._socket)._decoder; - } - if (encoding) { - this._socket.setEncoding(encoding); - } - } - - public addListener(eventName: string, listener: (...args: any[]) => any): void { this.on(eventName, listener); } - public on(eventName: string, listener: (...args: any[]) => any): void { - if (eventName === 'close') { - this._internalee.on('close', listener); - return; - } - this._socket.on(eventName, listener); - } - - public emit(eventName: string, ...args: any[]): any { - if (eventName === 'close') { - return this._internalee.emit.apply(this._internalee, arguments); - } - return this._socket.emit.apply(this._socket, arguments); - } - - public listeners(eventName: string): Function[] { - return this._socket.listeners(eventName); - } - - public removeListener(eventName: string, listener: (...args: any[]) => any): void { - this._socket.removeListener(eventName, listener); - } - - public removeAllListeners(eventName: string): void { - this._socket.removeAllListeners(eventName); - } - - public once(eventName: string, listener: (...args: any[]) => any): void { - this._socket.once(eventName, listener); - } - - public abstract resize(cols: number, rows: number): void; - public abstract destroy(): void; - public abstract kill(signal?: string): void; - - public abstract get process(): string; - public abstract get master(): Socket; - public abstract get slave(): Socket; - - protected _close(): void { - this._socket.writable = false; - this._socket.readable = false; - this.write = () => {}; - this.end = () => {}; - this._writable = false; - this._readable = false; - } - - protected _parseEnv(env: {[key: string]: string}): string[] { - const keys = Object.keys(env || {}); - const pairs = []; - - for (let i = 0; i < keys.length; i++) { - pairs.push(keys[i] + '=' + env[keys[i]]); - } - - return pairs; - } -} diff --git a/node_modules/node-pty/src/testUtils.test.ts b/node_modules/node-pty/src/testUtils.test.ts deleted file mode 100644 index 0bdabff..0000000 --- a/node_modules/node-pty/src/testUtils.test.ts +++ /dev/null @@ -1,23 +0,0 @@ -/** - * Copyright (c) 2019, Microsoft Corporation (MIT License). - */ - -export function pollUntil(cb: () => boolean, timeout: number, interval: number): Promise { - return new Promise((resolve, reject) => { - const intervalId = setInterval(() => { - if (cb()) { - clearInterval(intervalId); - clearTimeout(timeoutId); - resolve(); - } - }, interval); - const timeoutId = setTimeout(() => { - clearInterval(intervalId); - if (cb()) { - resolve(); - } else { - reject(); - } - }, timeout); - }); -} diff --git a/node_modules/node-pty/src/types.ts b/node_modules/node-pty/src/types.ts deleted file mode 100644 index 94c2ac7..0000000 --- a/node_modules/node-pty/src/types.ts +++ /dev/null @@ -1,15 +0,0 @@ -/** - * Copyright (c) 2017, Daniel Imms (MIT License). - * Copyright (c) 2018, Microsoft Corporation (MIT License). - */ - -export type ArgvOrCommandLine = string[] | string; - -export interface IExitEvent { - exitCode: number; - signal: number | undefined; -} - -export interface IDisposable { - dispose(): void; -} diff --git a/node_modules/node-pty/src/unix/pty.cc b/node_modules/node-pty/src/unix/pty.cc deleted file mode 100644 index d2f4c11..0000000 --- a/node_modules/node-pty/src/unix/pty.cc +++ /dev/null @@ -1,708 +0,0 @@ -/** - * Copyright (c) 2012-2015, Christopher Jeffrey (MIT License) - * Copyright (c) 2017, Daniel Imms (MIT License) - * - * pty.cc: - * This file is responsible for starting processes - * with pseudo-terminal file descriptors. - * - * See: - * man pty - * man tty_ioctl - * man termios - * man forkpty - */ - -/** - * Includes - */ - -#include -#include -#include -#include -#include - -#include -#include -#include -#include -#include - -/* forkpty */ -/* http://www.gnu.org/software/gnulib/manual/html_node/forkpty.html */ -#if defined(__GLIBC__) || defined(__CYGWIN__) -#include -#elif defined(__APPLE__) || defined(__OpenBSD__) || defined(__NetBSD__) -#include -#elif defined(__FreeBSD__) -#include -#elif defined(__sun) -#include /* for I_PUSH */ -#else -#include -#endif - -#include /* tcgetattr, tty_ioctl */ - -/* Some platforms name VWERASE and VDISCARD differently */ -#if !defined(VWERASE) && defined(VWERSE) -#define VWERASE VWERSE -#endif -#if !defined(VDISCARD) && defined(VDISCRD) -#define VDISCARD VDISCRD -#endif - -/* environ for execvpe */ -/* node/src/node_child_process.cc */ -#if defined(__APPLE__) && !TARGET_OS_IPHONE -#include -#define environ (*_NSGetEnviron()) -#else -extern char **environ; -#endif - -/* for pty_getproc */ -#if defined(__linux__) -#include -#include -#elif defined(__APPLE__) -#include -#include -#endif - -/** - * Structs - */ - -struct pty_baton { - Nan::Persistent cb; - int exit_code; - int signal_code; - pid_t pid; - uv_async_t async; - uv_thread_t tid; -}; - -/** - * Methods - */ - -NAN_METHOD(PtyFork); -NAN_METHOD(PtyOpen); -NAN_METHOD(PtyResize); -NAN_METHOD(PtyGetProc); - -/** - * Functions - */ - -static int -pty_execvpe(const char *, char **, char **); - -static int -pty_nonblock(int); - -static char * -pty_getproc(int, char *); - -static int -pty_openpty(int *, int *, char *, - const struct termios *, - const struct winsize *); - -static pid_t -pty_forkpty(int *, char *, - const struct termios *, - const struct winsize *); - -static void -pty_waitpid(void *); - -static void -pty_after_waitpid(uv_async_t *); - -static void -pty_after_close(uv_handle_t *); - -NAN_METHOD(PtyFork) { - Nan::HandleScope scope; - - if (info.Length() != 10 || - !info[0]->IsString() || - !info[1]->IsArray() || - !info[2]->IsArray() || - !info[3]->IsString() || - !info[4]->IsNumber() || - !info[5]->IsNumber() || - !info[6]->IsNumber() || - !info[7]->IsNumber() || - !info[8]->IsBoolean() || - !info[9]->IsFunction()) { - return Nan::ThrowError( - "Usage: pty.fork(file, args, env, cwd, cols, rows, uid, gid, utf8, onexit)"); - } - - // Make sure the process still listens to SIGINT - signal(SIGINT, SIG_DFL); - - // file - Nan::Utf8String file(info[0]); - - // args - int i = 0; - v8::Local argv_ = v8::Local::Cast(info[1]); - int argc = argv_->Length(); - int argl = argc + 1 + 1; - char **argv = new char*[argl]; - argv[0] = strdup(*file); - argv[argl-1] = NULL; - for (; i < argc; i++) { - Nan::Utf8String arg(Nan::Get(argv_, i).ToLocalChecked()); - argv[i+1] = strdup(*arg); - } - - // env - i = 0; - v8::Local env_ = v8::Local::Cast(info[2]); - int envc = env_->Length(); - char **env = new char*[envc+1]; - env[envc] = NULL; - for (; i < envc; i++) { - Nan::Utf8String pair(Nan::Get(env_, i).ToLocalChecked()); - env[i] = strdup(*pair); - } - - // cwd - Nan::Utf8String cwd_(info[3]); - char *cwd = strdup(*cwd_); - - // size - struct winsize winp; - winp.ws_col = info[4]->IntegerValue(Nan::GetCurrentContext()).FromJust(); - winp.ws_row = info[5]->IntegerValue(Nan::GetCurrentContext()).FromJust(); - winp.ws_xpixel = 0; - winp.ws_ypixel = 0; - - // termios - struct termios t = termios(); - struct termios *term = &t; - term->c_iflag = ICRNL | IXON | IXANY | IMAXBEL | BRKINT; - if (Nan::To(info[8]).FromJust()) { -#if defined(IUTF8) - term->c_iflag |= IUTF8; -#endif - } - term->c_oflag = OPOST | ONLCR; - term->c_cflag = CREAD | CS8 | HUPCL; - term->c_lflag = ICANON | ISIG | IEXTEN | ECHO | ECHOE | ECHOK | ECHOKE | ECHOCTL; - - term->c_cc[VEOF] = 4; - term->c_cc[VEOL] = -1; - term->c_cc[VEOL2] = -1; - term->c_cc[VERASE] = 0x7f; - term->c_cc[VWERASE] = 23; - term->c_cc[VKILL] = 21; - term->c_cc[VREPRINT] = 18; - term->c_cc[VINTR] = 3; - term->c_cc[VQUIT] = 0x1c; - term->c_cc[VSUSP] = 26; - term->c_cc[VSTART] = 17; - term->c_cc[VSTOP] = 19; - term->c_cc[VLNEXT] = 22; - term->c_cc[VDISCARD] = 15; - term->c_cc[VMIN] = 1; - term->c_cc[VTIME] = 0; - - #if (__APPLE__) - term->c_cc[VDSUSP] = 25; - term->c_cc[VSTATUS] = 20; - #endif - - cfsetispeed(term, B38400); - cfsetospeed(term, B38400); - - // uid / gid - int uid = info[6]->IntegerValue(Nan::GetCurrentContext()).FromJust(); - int gid = info[7]->IntegerValue(Nan::GetCurrentContext()).FromJust(); - - // fork the pty - int master = -1; - pid_t pid = pty_forkpty(&master, nullptr, term, &winp); - - if (pid) { - for (i = 0; i < argl; i++) free(argv[i]); - delete[] argv; - for (i = 0; i < envc; i++) free(env[i]); - delete[] env; - free(cwd); - } - - switch (pid) { - case -1: - return Nan::ThrowError("forkpty(3) failed."); - case 0: - if (strlen(cwd)) { - if (chdir(cwd) == -1) { - perror("chdir(2) failed."); - _exit(1); - } - } - - if (uid != -1 && gid != -1) { - if (setgid(gid) == -1) { - perror("setgid(2) failed."); - _exit(1); - } - if (setuid(uid) == -1) { - perror("setuid(2) failed."); - _exit(1); - } - } - - pty_execvpe(argv[0], argv, env); - - perror("execvp(3) failed."); - _exit(1); - default: - if (pty_nonblock(master) == -1) { - return Nan::ThrowError("Could not set master fd to nonblocking."); - } - - v8::Local obj = Nan::New(); - Nan::Set(obj, - Nan::New("fd").ToLocalChecked(), - Nan::New(master)); - Nan::Set(obj, - Nan::New("pid").ToLocalChecked(), - Nan::New(pid)); - Nan::Set(obj, - Nan::New("pty").ToLocalChecked(), - Nan::New(ptsname(master)).ToLocalChecked()); - - pty_baton *baton = new pty_baton(); - baton->exit_code = 0; - baton->signal_code = 0; - baton->cb.Reset(v8::Local::Cast(info[9])); - baton->pid = pid; - baton->async.data = baton; - - uv_async_init(uv_default_loop(), &baton->async, pty_after_waitpid); - - uv_thread_create(&baton->tid, pty_waitpid, static_cast(baton)); - - return info.GetReturnValue().Set(obj); - } - - return info.GetReturnValue().SetUndefined(); -} - -NAN_METHOD(PtyOpen) { - Nan::HandleScope scope; - - if (info.Length() != 2 || - !info[0]->IsNumber() || - !info[1]->IsNumber()) { - return Nan::ThrowError("Usage: pty.open(cols, rows)"); - } - - // size - struct winsize winp; - winp.ws_col = info[0]->IntegerValue(Nan::GetCurrentContext()).FromJust(); - winp.ws_row = info[1]->IntegerValue(Nan::GetCurrentContext()).FromJust(); - winp.ws_xpixel = 0; - winp.ws_ypixel = 0; - - // pty - int master, slave; - int ret = pty_openpty(&master, &slave, nullptr, NULL, &winp); - - if (ret == -1) { - return Nan::ThrowError("openpty(3) failed."); - } - - if (pty_nonblock(master) == -1) { - return Nan::ThrowError("Could not set master fd to nonblocking."); - } - - if (pty_nonblock(slave) == -1) { - return Nan::ThrowError("Could not set slave fd to nonblocking."); - } - - v8::Local obj = Nan::New(); - Nan::Set(obj, - Nan::New("master").ToLocalChecked(), - Nan::New(master)); - Nan::Set(obj, - Nan::New("slave").ToLocalChecked(), - Nan::New(slave)); - Nan::Set(obj, - Nan::New("pty").ToLocalChecked(), - Nan::New(ptsname(master)).ToLocalChecked()); - - return info.GetReturnValue().Set(obj); -} - -NAN_METHOD(PtyResize) { - Nan::HandleScope scope; - - if (info.Length() != 3 || - !info[0]->IsNumber() || - !info[1]->IsNumber() || - !info[2]->IsNumber()) { - return Nan::ThrowError("Usage: pty.resize(fd, cols, rows)"); - } - - int fd = info[0]->IntegerValue(Nan::GetCurrentContext()).FromJust(); - - struct winsize winp; - winp.ws_col = info[1]->IntegerValue(Nan::GetCurrentContext()).FromJust(); - winp.ws_row = info[2]->IntegerValue(Nan::GetCurrentContext()).FromJust(); - winp.ws_xpixel = 0; - winp.ws_ypixel = 0; - - if (ioctl(fd, TIOCSWINSZ, &winp) == -1) { - switch (errno) { - case EBADF: return Nan::ThrowError("ioctl(2) failed, EBADF"); - case EFAULT: return Nan::ThrowError("ioctl(2) failed, EFAULT"); - case EINVAL: return Nan::ThrowError("ioctl(2) failed, EINVAL"); - case ENOTTY: return Nan::ThrowError("ioctl(2) failed, ENOTTY"); - } - return Nan::ThrowError("ioctl(2) failed"); - } - - return info.GetReturnValue().SetUndefined(); -} - -/** - * Foreground Process Name - */ -NAN_METHOD(PtyGetProc) { - Nan::HandleScope scope; - - if (info.Length() != 2 || - !info[0]->IsNumber() || - !info[1]->IsString()) { - return Nan::ThrowError("Usage: pty.process(fd, tty)"); - } - - int fd = info[0]->IntegerValue(Nan::GetCurrentContext()).FromJust(); - - Nan::Utf8String tty_(info[1]); - char *tty = strdup(*tty_); - char *name = pty_getproc(fd, tty); - free(tty); - - if (name == NULL) { - return info.GetReturnValue().SetUndefined(); - } - - v8::Local name_ = Nan::New(name).ToLocalChecked(); - free(name); - return info.GetReturnValue().Set(name_); -} - -/** - * execvpe - */ - -// execvpe(3) is not portable. -// http://www.gnu.org/software/gnulib/manual/html_node/execvpe.html -static int -pty_execvpe(const char *file, char **argv, char **envp) { - char **old = environ; - environ = envp; - int ret = execvp(file, argv); - environ = old; - return ret; -} - -/** - * Nonblocking FD - */ - -static int -pty_nonblock(int fd) { - int flags = fcntl(fd, F_GETFL, 0); - if (flags == -1) return -1; - return fcntl(fd, F_SETFL, flags | O_NONBLOCK); -} - -/** - * pty_waitpid - * Wait for SIGCHLD to read exit status. - */ - -static void -pty_waitpid(void *data) { - int ret; - int stat_loc; - - pty_baton *baton = static_cast(data); - - errno = 0; - - if ((ret = waitpid(baton->pid, &stat_loc, 0)) != baton->pid) { - if (ret == -1 && errno == EINTR) { - return pty_waitpid(baton); - } - if (ret == -1 && errno == ECHILD) { - // XXX node v0.8.x seems to have this problem. - // waitpid is already handled elsewhere. - ; - } else { - assert(false); - } - } - - if (WIFEXITED(stat_loc)) { - baton->exit_code = WEXITSTATUS(stat_loc); // errno? - } - - if (WIFSIGNALED(stat_loc)) { - baton->signal_code = WTERMSIG(stat_loc); - } - - uv_async_send(&baton->async); -} - -/** - * pty_after_waitpid - * Callback after exit status has been read. - */ - -static void -pty_after_waitpid(uv_async_t *async) { - Nan::HandleScope scope; - pty_baton *baton = static_cast(async->data); - - v8::Local argv[] = { - Nan::New(baton->exit_code), - Nan::New(baton->signal_code), - }; - - v8::Local cb = Nan::New(baton->cb); - baton->cb.Reset(); - memset(&baton->cb, -1, sizeof(baton->cb)); - Nan::AsyncResource resource("pty_after_waitpid"); - resource.runInAsyncScope(Nan::GetCurrentContext()->Global(), cb, 2, argv); - - uv_close((uv_handle_t *)async, pty_after_close); -} - -/** - * pty_after_close - * uv_close() callback - free handle data - */ - -static void -pty_after_close(uv_handle_t *handle) { - uv_async_t *async = (uv_async_t *)handle; - pty_baton *baton = static_cast(async->data); - delete baton; -} - -/** - * pty_getproc - * Taken from tmux. - */ - -// Taken from: tmux (http://tmux.sourceforge.net/) -// Copyright (c) 2009 Nicholas Marriott -// Copyright (c) 2009 Joshua Elsasser -// Copyright (c) 2009 Todd Carson -// -// Permission to use, copy, modify, and distribute this software for any -// purpose with or without fee is hereby granted, provided that the above -// copyright notice and this permission notice appear in all copies. -// -// THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES -// WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF -// MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR -// ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES -// WHATSOEVER RESULTING FROM LOSS OF MIND, USE, DATA OR PROFITS, WHETHER -// IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING -// OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - -#if defined(__linux__) - -static char * -pty_getproc(int fd, char *tty) { - FILE *f; - char *path, *buf; - size_t len; - int ch; - pid_t pgrp; - int r; - - if ((pgrp = tcgetpgrp(fd)) == -1) { - return NULL; - } - - r = asprintf(&path, "/proc/%lld/cmdline", (long long)pgrp); - if (r == -1 || path == NULL) return NULL; - - if ((f = fopen(path, "r")) == NULL) { - free(path); - return NULL; - } - - free(path); - - len = 0; - buf = NULL; - while ((ch = fgetc(f)) != EOF) { - if (ch == '\0') break; - buf = (char *)realloc(buf, len + 2); - if (buf == NULL) return NULL; - buf[len++] = ch; - } - - if (buf != NULL) { - buf[len] = '\0'; - } - - fclose(f); - return buf; -} - -#elif defined(__APPLE__) - -static char * -pty_getproc(int fd, char *tty) { - int mib[4] = { CTL_KERN, KERN_PROC, KERN_PROC_PID, 0 }; - size_t size; - struct kinfo_proc kp; - - if ((mib[3] = tcgetpgrp(fd)) == -1) { - return NULL; - } - - size = sizeof kp; - if (sysctl(mib, 4, &kp, &size, NULL, 0) == -1) { - return NULL; - } - - if (*kp.kp_proc.p_comm == '\0') { - return NULL; - } - - return strdup(kp.kp_proc.p_comm); -} - -#else - -static char * -pty_getproc(int fd, char *tty) { - return NULL; -} - -#endif - -/** - * openpty(3) / forkpty(3) - */ - -static int -pty_openpty(int *amaster, - int *aslave, - char *name, - const struct termios *termp, - const struct winsize *winp) { -#if defined(__sun) - char *slave_name; - int slave; - int master = open("/dev/ptmx", O_RDWR | O_NOCTTY); - if (master == -1) return -1; - if (amaster) *amaster = master; - - if (grantpt(master) == -1) goto err; - if (unlockpt(master) == -1) goto err; - - slave_name = ptsname(master); - if (slave_name == NULL) goto err; - if (name) strcpy(name, slave_name); - - slave = open(slave_name, O_RDWR | O_NOCTTY); - if (slave == -1) goto err; - if (aslave) *aslave = slave; - - ioctl(slave, I_PUSH, "ptem"); - ioctl(slave, I_PUSH, "ldterm"); - ioctl(slave, I_PUSH, "ttcompat"); - - if (termp) tcsetattr(slave, TCSAFLUSH, termp); - if (winp) ioctl(slave, TIOCSWINSZ, winp); - - return 0; - -err: - close(master); - return -1; -#else - return openpty(amaster, aslave, name, (termios *)termp, (winsize *)winp); -#endif -} - -static pid_t -pty_forkpty(int *amaster, - char *name, - const struct termios *termp, - const struct winsize *winp) { -#if defined(__sun) - int master, slave; - - int ret = pty_openpty(&master, &slave, name, termp, winp); - if (ret == -1) return -1; - if (amaster) *amaster = master; - - pid_t pid = fork(); - - switch (pid) { - case -1: - close(master); - close(slave); - return -1; - case 0: - close(master); - - setsid(); - -#if defined(TIOCSCTTY) - // glibc does this - if (ioctl(slave, TIOCSCTTY, NULL) == -1) { - _exit(1); - } -#endif - - dup2(slave, 0); - dup2(slave, 1); - dup2(slave, 2); - - if (slave > 2) close(slave); - - return 0; - default: - close(slave); - return pid; - } - - return -1; -#else - return forkpty(amaster, name, (termios *)termp, (winsize *)winp); -#endif -} - -/** - * Init - */ - -NAN_MODULE_INIT(init) { - Nan::HandleScope scope; - Nan::Export(target, "fork", PtyFork); - Nan::Export(target, "open", PtyOpen); - Nan::Export(target, "resize", PtyResize); - Nan::Export(target, "process", PtyGetProc); -} - -NODE_MODULE(pty, init) diff --git a/node_modules/node-pty/src/unixTerminal.test.ts b/node_modules/node-pty/src/unixTerminal.test.ts deleted file mode 100644 index b9d330f..0000000 --- a/node_modules/node-pty/src/unixTerminal.test.ts +++ /dev/null @@ -1,108 +0,0 @@ -/** - * Copyright (c) 2017, Daniel Imms (MIT License). - * Copyright (c) 2018, Microsoft Corporation (MIT License). - */ - -import { UnixTerminal } from './unixTerminal'; -import * as assert from 'assert'; -import * as path from 'path'; -import { pollUntil } from './testUtils.test'; - -const FIXTURES_PATH = path.normalize(path.join(__dirname, '..', 'fixtures', 'utf8-character.txt')); - -if (process.platform !== 'win32') { - describe('UnixTerminal', () => { - describe('Constructor', () => { - it('should set a valid pts name', () => { - const term = new UnixTerminal('/bin/bash', [], {}); - let regExp; - if (process.platform === 'linux') { - // https://linux.die.net/man/4/pts - regExp = /^\/dev\/pts\/\d+$/; - } - if (process.platform === 'darwin') { - // https://developer.apple.com/legacy/library/documentation/Darwin/Reference/ManPages/man4/pty.4.html - regExp = /^\/dev\/tty[p-sP-S][a-z0-9]+$/; - } - if (regExp) { - assert.ok(regExp.test((term)._pty), '"' + (term)._pty + '" should match ' + regExp.toString()); - } - }); - }); - - describe('PtyForkEncodingOption', () => { - it('should default to utf8', (done) => { - const term = new UnixTerminal('/bin/bash', [ '-c', `cat "${FIXTURES_PATH}"` ]); - term.on('data', (data) => { - assert.equal(typeof data, 'string'); - assert.equal(data, '\u00E6'); - done(); - }); - }); - it('should return a Buffer when encoding is null', (done) => { - const term = new UnixTerminal('/bin/bash', [ '-c', `cat "${FIXTURES_PATH}"` ], { - encoding: null - }); - term.on('data', (data) => { - assert.equal(typeof data, 'object'); - assert.ok(data instanceof Buffer); - assert.equal(0xC3, data[0]); - assert.equal(0xA6, data[1]); - done(); - }); - }); - it('should support other encodings', (done) => { - const text = 'test æ!'; - const term = new UnixTerminal(null, ['-c', 'echo "' + text + '"'], { - encoding: 'base64' - }); - let buffer = ''; - term.on('data', (data) => { - assert.equal(typeof data, 'string'); - buffer += data; - }); - term.on('exit', () => { - assert.equal(Buffer.alloc(8, buffer, 'base64').toString().replace('\r', '').replace('\n', ''), text); - done(); - }); - }); - }); - - describe('open', () => { - let term: UnixTerminal; - - afterEach(() => { - if (term) { - term.slave.destroy(); - term.master.destroy(); - } - }); - - it('should open a pty with access to a master and slave socket', (done) => { - let doneCalled = false; - term = UnixTerminal.open({}); - - let slavebuf = ''; - term.slave.on('data', (data) => { - slavebuf += data; - }); - - let masterbuf = ''; - term.master.on('data', (data) => { - masterbuf += data; - }); - - pollUntil(() => { - if (masterbuf === 'slave\r\nmaster\r\n' && slavebuf === 'master\n') { - done(); - return true; - } - return false; - }, 200, 10); - - term.slave.write('slave\n'); - term.master.write('master\n'); - }); - }); - }); -} diff --git a/node_modules/node-pty/src/unixTerminal.ts b/node_modules/node-pty/src/unixTerminal.ts deleted file mode 100644 index 58e4567..0000000 --- a/node_modules/node-pty/src/unixTerminal.ts +++ /dev/null @@ -1,299 +0,0 @@ -/** - * Copyright (c) 2012-2015, Christopher Jeffrey (MIT License) - * Copyright (c) 2016, Daniel Imms (MIT License). - * Copyright (c) 2018, Microsoft Corporation (MIT License). - */ -import * as net from 'net'; -import { Terminal, DEFAULT_COLS, DEFAULT_ROWS } from './terminal'; -import { IProcessEnv, IPtyForkOptions, IPtyOpenOptions } from './interfaces'; -import { ArgvOrCommandLine } from './types'; -import { assign } from './utils'; - -let pty: IUnixNative; -try { - pty = require('../build/Release/pty.node'); -} catch (outerError) { - try { - pty = require('../build/Debug/pty.node'); - } catch (innerError) { - console.error('innerError', innerError); - // Re-throw the exception from the Release require if the Debug require fails as well - throw outerError; - } -} - -const DEFAULT_FILE = 'sh'; -const DEFAULT_NAME = 'xterm'; -const DESTROY_SOCKET_TIMEOUT_MS = 200; - -export class UnixTerminal extends Terminal { - protected _fd: number; - protected _pty: string; - - protected _file: string; - protected _name: string; - - protected _readable: boolean; - protected _writable: boolean; - - private _boundClose: boolean; - private _emittedClose: boolean; - private _master: net.Socket; - private _slave: net.Socket; - - public get master(): net.Socket { return this._master; } - public get slave(): net.Socket { return this._slave; } - - constructor(file?: string, args?: ArgvOrCommandLine, opt?: IPtyForkOptions) { - super(opt); - - if (typeof args === 'string') { - throw new Error('args as a string is not supported on unix.'); - } - - // Initialize arguments - args = args || []; - file = file || DEFAULT_FILE; - opt = opt || {}; - opt.env = opt.env || process.env; - - this._cols = opt.cols || DEFAULT_COLS; - this._rows = opt.rows || DEFAULT_ROWS; - const uid = opt.uid || -1; - const gid = opt.gid || -1; - const env = assign({}, opt.env); - - if (opt.env === process.env) { - this._sanitizeEnv(env); - } - - const cwd = opt.cwd || process.cwd(); - const name = opt.name || env.TERM || DEFAULT_NAME; - env.TERM = name; - const parsedEnv = this._parseEnv(env); - - const encoding = (opt.encoding === undefined ? 'utf8' : opt.encoding); - - const onexit = (code: number, signal: number) => { - // XXX Sometimes a data event is emitted after exit. Wait til socket is - // destroyed. - if (!this._emittedClose) { - if (this._boundClose) { - return; - } - this._boundClose = true; - // From macOS High Sierra 10.13.2 sometimes the socket never gets - // closed. A timeout is applied here to avoid the terminal never being - // destroyed when this occurs. - let timeout = setTimeout(() => { - timeout = null; - // Destroying the socket now will cause the close event to fire - this._socket.destroy(); - }, DESTROY_SOCKET_TIMEOUT_MS); - this.once('close', () => { - if (timeout !== null) { - clearTimeout(timeout); - } - this.emit('exit', code, signal); - }); - return; - } - this.emit('exit', code, signal); - }; - - // fork - const term = pty.fork(file, args, parsedEnv, cwd, this._cols, this._rows, uid, gid, (encoding === 'utf8'), onexit); - - this._socket = new PipeSocket(term.fd); - if (encoding !== null) { - this._socket.setEncoding(encoding); - } - - // setup - this._socket.on('error', (err: any) => { - // NOTE: fs.ReadStream gets EAGAIN twice at first: - if (err.code) { - if (~err.code.indexOf('EAGAIN')) { - return; - } - } - - // close - this._close(); - // EIO on exit from fs.ReadStream: - if (!this._emittedClose) { - this._emittedClose = true; - this.emit('close'); - } - - // EIO, happens when someone closes our child process: the only process in - // the terminal. - // node < 0.6.14: errno 5 - // node >= 0.6.14: read EIO - if (err.code) { - if (~err.code.indexOf('errno 5') || ~err.code.indexOf('EIO')) { - return; - } - } - - // throw anything else - if (this.listeners('error').length < 2) { - throw err; - } - }); - - this._pid = term.pid; - this._fd = term.fd; - this._pty = term.pty; - - this._file = file; - this._name = name; - - this._readable = true; - this._writable = true; - - this._socket.on('close', () => { - if (this._emittedClose) { - return; - } - this._emittedClose = true; - this._close(); - this.emit('close'); - }); - - this._forwardEvents(); - } - - protected _write(data: string): void { - this._socket.write(data); - } - - /** - * openpty - */ - - public static open(opt: IPtyOpenOptions): UnixTerminal { - const self: UnixTerminal = Object.create(UnixTerminal.prototype); - opt = opt || {}; - - if (arguments.length > 1) { - opt = { - cols: arguments[1], - rows: arguments[2] - }; - } - - const cols = opt.cols || DEFAULT_COLS; - const rows = opt.rows || DEFAULT_ROWS; - const encoding = (opt.encoding === undefined ? 'utf8' : opt.encoding); - - // open - const term: IUnixOpenProcess = pty.open(cols, rows); - - self._master = new PipeSocket(term.master); - if (encoding !== null) { - self._master.setEncoding(encoding); - } - self._master.resume(); - - self._slave = new PipeSocket(term.slave); - if (encoding !== null) { - self._slave.setEncoding(encoding); - } - self._slave.resume(); - - self._socket = self._master; - self._pid = null; - self._fd = term.master; - self._pty = term.pty; - - self._file = process.argv[0] || 'node'; - self._name = process.env.TERM || ''; - - self._readable = true; - self._writable = true; - - self._socket.on('error', err => { - self._close(); - if (self.listeners('error').length < 2) { - throw err; - } - }); - - self._socket.on('close', () => { - self._close(); - }); - - return self; - } - - public destroy(): void { - this._close(); - - // Need to close the read stream so node stops reading a dead file - // descriptor. Then we can safely SIGHUP the shell. - this._socket.once('close', () => { - this.kill('SIGHUP'); - }); - - this._socket.destroy(); - } - - public kill(signal?: string): void { - try { - process.kill(this.pid, signal || 'SIGHUP'); - } catch (e) { /* swallow */ } - } - - /** - * Gets the name of the process. - */ - public get process(): string { - return pty.process(this._fd, this._pty) || this._file; - } - - /** - * TTY - */ - - public resize(cols: number, rows: number): void { - if (cols <= 0 || rows <= 0 || isNaN(cols) || isNaN(rows) || cols === Infinity || rows === Infinity) { - throw new Error('resizing must be done using positive cols and rows'); - } - pty.resize(this._fd, cols, rows); - this._cols = cols; - this._rows = rows; - } - - private _sanitizeEnv(env: IProcessEnv): void { - // Make sure we didn't start our server from inside tmux. - delete env['TMUX']; - delete env['TMUX_PANE']; - - // Make sure we didn't start our server from inside screen. - // http://web.mit.edu/gnu/doc/html/screen_20.html - delete env['STY']; - delete env['WINDOW']; - - // Delete some variables that might confuse our terminal. - delete env['WINDOWID']; - delete env['TERMCAP']; - delete env['COLUMNS']; - delete env['LINES']; - } -} - -/** - * Wraps net.Socket to force the handle type "PIPE" by temporarily overwriting - * tty_wrap.guessHandleType. - * See: https://github.com/chjj/pty.js/issues/103 - */ -class PipeSocket extends net.Socket { - constructor(fd: number) { - const { Pipe, constants } = (process).binding('pipe_wrap'); // tslint:disable-line - // @types/node has fd as string? https://github.com/DefinitelyTyped/DefinitelyTyped/pull/18275 - const handle = new Pipe(constants.SOCKET); - handle.open(fd); - super({ handle }); - } -} diff --git a/node_modules/node-pty/src/utils.ts b/node_modules/node-pty/src/utils.ts deleted file mode 100644 index 6306c8b..0000000 --- a/node_modules/node-pty/src/utils.ts +++ /dev/null @@ -1,9 +0,0 @@ -/** - * Copyright (c) 2017, Daniel Imms (MIT License). - * Copyright (c) 2018, Microsoft Corporation (MIT License). - */ - -export function assign(target: any, ...sources: any[]): any { - sources.forEach(source => Object.keys(source).forEach(key => target[key] = source[key])); - return target; -} diff --git a/node_modules/node-pty/src/win/conpty.cc b/node_modules/node-pty/src/win/conpty.cc deleted file mode 100644 index 4500f6e..0000000 --- a/node_modules/node-pty/src/win/conpty.cc +++ /dev/null @@ -1,455 +0,0 @@ -/** - * Copyright (c) 2013-2015, Christopher Jeffrey, Peter Sunde (MIT License) - * Copyright (c) 2016, Daniel Imms (MIT License). - * Copyright (c) 2018, Microsoft Corporation (MIT License). - * - * pty.cc: - * This file is responsible for starting processes - * with pseudo-terminal file descriptors. - */ - -// node versions lower than 10 define this as 0x502 which disables many of the definitions needed to compile -#include -#if NODE_MODULE_VERSION <= 57 - #define _WIN32_WINNT 0x600 -#endif - -#include -#include -#include // PathCombine, PathIsRelative -#include -#include -#include -#include -#include -#include "path_util.h" - -extern "C" void init(v8::Local); - -// Taken from the RS5 Windows SDK, but redefined here in case we're targeting <= 17134 -#ifndef PROC_THREAD_ATTRIBUTE_PSEUDOCONSOLE -#define PROC_THREAD_ATTRIBUTE_PSEUDOCONSOLE \ - ProcThreadAttributeValue(22, FALSE, TRUE, FALSE) - -typedef VOID* HPCON; -typedef HRESULT (__stdcall *PFNCREATEPSEUDOCONSOLE)(COORD c, HANDLE hIn, HANDLE hOut, DWORD dwFlags, HPCON* phpcon); -typedef HRESULT (__stdcall *PFNRESIZEPSEUDOCONSOLE)(HPCON hpc, COORD newSize); -typedef void (__stdcall *PFNCLOSEPSEUDOCONSOLE)(HPCON hpc); - -#endif - -struct pty_baton { - int id; - HANDLE hIn; - HANDLE hOut; - HPCON hpc; - - HANDLE hShell; - HANDLE hWait; - Nan::Callback cb; - uv_async_t async; - uv_thread_t tid; - - pty_baton(int _id, HANDLE _hIn, HANDLE _hOut, HPCON _hpc) : id(_id), hIn(_hIn), hOut(_hOut), hpc(_hpc) {}; -}; - -static std::vector ptyHandles; -static volatile LONG ptyCounter; - -static pty_baton* get_pty_baton(int id) { - for (size_t i = 0; i < ptyHandles.size(); ++i) { - pty_baton* ptyHandle = ptyHandles[i]; - if (ptyHandle->id == id) { - return ptyHandle; - } - } - return nullptr; -} - -template -std::vector vectorFromString(const std::basic_string &str) { - return std::vector(str.begin(), str.end()); -} - -void throwNanError(const Nan::FunctionCallbackInfo* info, const char* text, const bool getLastError) { - std::stringstream errorText; - errorText << text; - if (getLastError) { - errorText << ", error code: " << GetLastError(); - } - Nan::ThrowError(errorText.str().c_str()); - (*info).GetReturnValue().SetUndefined(); -} - -// Returns a new server named pipe. It has not yet been connected. -bool createDataServerPipe(bool write, - std::wstring kind, - HANDLE* hServer, - std::wstring &name, - const std::wstring &pipeName) -{ - *hServer = INVALID_HANDLE_VALUE; - - name = L"\\\\.\\pipe\\" + pipeName + L"-" + kind; - - const DWORD winOpenMode = PIPE_ACCESS_INBOUND | PIPE_ACCESS_OUTBOUND | FILE_FLAG_FIRST_PIPE_INSTANCE/* | FILE_FLAG_OVERLAPPED */; - - SECURITY_ATTRIBUTES sa = {}; - sa.nLength = sizeof(sa); - - *hServer = CreateNamedPipeW( - name.c_str(), - /*dwOpenMode=*/winOpenMode, - /*dwPipeMode=*/PIPE_TYPE_BYTE | PIPE_READMODE_BYTE | PIPE_WAIT, - /*nMaxInstances=*/1, - /*nOutBufferSize=*/0, - /*nInBufferSize=*/0, - /*nDefaultTimeOut=*/30000, - &sa); - - return *hServer != INVALID_HANDLE_VALUE; -} - -HRESULT CreateNamedPipesAndPseudoConsole(COORD size, - DWORD dwFlags, - HANDLE *phInput, - HANDLE *phOutput, - HPCON* phPC, - std::wstring& inName, - std::wstring& outName, - const std::wstring& pipeName) -{ - HANDLE hLibrary = LoadLibraryExW(L"kernel32.dll", 0, 0); - bool fLoadedDll = hLibrary != nullptr; - if (fLoadedDll) - { - PFNCREATEPSEUDOCONSOLE const pfnCreate = (PFNCREATEPSEUDOCONSOLE)GetProcAddress((HMODULE)hLibrary, "CreatePseudoConsole"); - if (pfnCreate) - { - if (phPC == NULL || phInput == NULL || phOutput == NULL) - { - return E_INVALIDARG; - } - - bool success = createDataServerPipe(true, L"in", phInput, inName, pipeName); - if (!success) - { - return HRESULT_FROM_WIN32(GetLastError()); - } - success = createDataServerPipe(false, L"out", phOutput, outName, pipeName); - if (!success) - { - return HRESULT_FROM_WIN32(GetLastError()); - } - return pfnCreate(size, *phInput, *phOutput, dwFlags, phPC); - } - else - { - // Failed to find CreatePseudoConsole in kernel32. This is likely because - // the user is not running a build of Windows that supports that API. - // We should fall back to winpty in this case. - return HRESULT_FROM_WIN32(GetLastError()); - } - } - - // Failed to find kernel32. This is realy unlikely - honestly no idea how - // this is even possible to hit. But if it does happen, fall back to winpty. - return HRESULT_FROM_WIN32(GetLastError()); -} - -static NAN_METHOD(PtyStartProcess) { - Nan::HandleScope scope; - - v8::Local marshal; - std::wstring inName, outName; - BOOL fSuccess = FALSE; - std::unique_ptr mutableCommandline; - PROCESS_INFORMATION _piClient{}; - - if (info.Length() != 6 || - !info[0]->IsString() || - !info[1]->IsNumber() || - !info[2]->IsNumber() || - !info[3]->IsBoolean() || - !info[4]->IsString() || - !info[5]->IsBoolean()) { - Nan::ThrowError("Usage: pty.startProcess(file, cols, rows, debug, pipeName, inheritCursor)"); - return; - } - - const std::wstring filename(path_util::to_wstring(Nan::Utf8String(info[0]))); - const SHORT cols = info[1]->Uint32Value(Nan::GetCurrentContext()).FromJust(); - const SHORT rows = info[2]->Uint32Value(Nan::GetCurrentContext()).FromJust(); - const bool debug = Nan::To(info[3]).FromJust(); - const std::wstring pipeName(path_util::to_wstring(Nan::Utf8String(info[4]))); - const bool inheritCursor = Nan::To(info[5]).FromJust(); - - // use environment 'Path' variable to determine location of - // the relative path that we have recieved (e.g cmd.exe) - std::wstring shellpath; - if (::PathIsRelativeW(filename.c_str())) { - shellpath = path_util::get_shell_path(filename.c_str()); - } else { - shellpath = filename; - } - - std::string shellpath_(shellpath.begin(), shellpath.end()); - - if (shellpath.empty() || !path_util::file_exists(shellpath)) { - std::stringstream why; - why << "File not found: " << shellpath_; - Nan::ThrowError(why.str().c_str()); - return; - } - - HANDLE hIn, hOut; - HPCON hpc; - HRESULT hr = CreateNamedPipesAndPseudoConsole({cols, rows}, inheritCursor ? 1/*PSEUDOCONSOLE_INHERIT_CURSOR*/ : 0, &hIn, &hOut, &hpc, inName, outName, pipeName); - - // Restore default handling of ctrl+c - SetConsoleCtrlHandler(NULL, FALSE); - - // Set return values - marshal = Nan::New(); - - if (SUCCEEDED(hr)) { - // We were able to instantiate a conpty - const int ptyId = InterlockedIncrement(&ptyCounter); - Nan::Set(marshal, Nan::New("pty").ToLocalChecked(), Nan::New(ptyId)); - ptyHandles.insert(ptyHandles.end(), new pty_baton(ptyId, hIn, hOut, hpc)); - } else { - Nan::ThrowError("Cannot launch conpty"); - return; - } - - Nan::Set(marshal, Nan::New("fd").ToLocalChecked(), Nan::New(-1)); - { - std::string coninPipeNameStr(inName.begin(), inName.end()); - Nan::Set(marshal, Nan::New("conin").ToLocalChecked(), Nan::New(coninPipeNameStr).ToLocalChecked()); - - std::string conoutPipeNameStr(outName.begin(), outName.end()); - Nan::Set(marshal, Nan::New("conout").ToLocalChecked(), Nan::New(conoutPipeNameStr).ToLocalChecked()); - } - info.GetReturnValue().Set(marshal); -} - -VOID CALLBACK OnProcessExitWinEvent( - _In_ PVOID context, - _In_ BOOLEAN TimerOrWaitFired) { - pty_baton *baton = static_cast(context); - - // Fire OnProcessExit - uv_async_send(&baton->async); -} - -static void OnProcessExit(uv_async_t *async) { - Nan::HandleScope scope; - pty_baton *baton = static_cast(async->data); - - UnregisterWait(baton->hWait); - - // Get exit code - DWORD exitCode = 0; - GetExitCodeProcess(baton->hShell, &exitCode); - - // Call function - v8::Local args[1] = { - Nan::New(exitCode) - }; - - Nan::AsyncResource asyncResource("node-pty.callback"); - baton->cb.Call(1, args, &asyncResource); - // Clean up - baton->cb.Reset(); -} - -static NAN_METHOD(PtyConnect) { - Nan::HandleScope scope; - - // If we're working with conpty's we need to call ConnectNamedPipe here AFTER - // the Socket has attempted to connect to the other end, then actually - // spawn the process here. - - std::stringstream errorText; - BOOL fSuccess = FALSE; - - if (info.Length() != 5 || - !info[0]->IsNumber() || - !info[1]->IsString() || - !info[2]->IsString() || - !info[3]->IsArray() || - !info[4]->IsFunction()) { - Nan::ThrowError("Usage: pty.connect(id, cmdline, cwd, env, exitCallback)"); - return; - } - - const int id = info[0]->Int32Value(Nan::GetCurrentContext()).FromJust(); - const std::wstring cmdline(path_util::to_wstring(Nan::Utf8String(info[1]))); - const std::wstring cwd(path_util::to_wstring(Nan::Utf8String(info[2]))); - const v8::Local envValues = info[3].As(); - const v8::Local exitCallback = v8::Local::Cast(info[4]); - - // Prepare command line - std::unique_ptr mutableCommandline = std::make_unique(cmdline.length() + 1); - HRESULT hr = StringCchCopyW(mutableCommandline.get(), cmdline.length() + 1, cmdline.c_str()); - - // Prepare cwd - std::unique_ptr mutableCwd = std::make_unique(cwd.length() + 1); - hr = StringCchCopyW(mutableCwd.get(), cwd.length() + 1, cwd.c_str()); - - // Prepare environment - std::wstring env; - if (!envValues.IsEmpty()) { - std::wstringstream envBlock; - for(uint32_t i = 0; i < envValues->Length(); i++) { - std::wstring envValue(path_util::to_wstring(Nan::Utf8String(Nan::Get(envValues, i).ToLocalChecked()))); - envBlock << envValue << L'\0'; - } - envBlock << L'\0'; - env = envBlock.str(); - } - auto envV = vectorFromString(env); - LPWSTR envArg = envV.empty() ? nullptr : envV.data(); - - // Fetch pty handle from ID and start process - pty_baton* handle = get_pty_baton(id); - - BOOL success = ConnectNamedPipe(handle->hIn, nullptr); - success = ConnectNamedPipe(handle->hOut, nullptr); - - // Attach the pseudoconsole to the client application we're creating - STARTUPINFOEXW siEx{0}; - siEx.StartupInfo.cb = sizeof(STARTUPINFOEXW); - siEx.StartupInfo.dwFlags |= STARTF_USESTDHANDLES; - siEx.StartupInfo.hStdError = nullptr; - siEx.StartupInfo.hStdInput = nullptr; - siEx.StartupInfo.hStdOutput = nullptr; - - SIZE_T size = 0; - InitializeProcThreadAttributeList(NULL, 1, 0, &size); - BYTE *attrList = new BYTE[size]; - siEx.lpAttributeList = reinterpret_cast(attrList); - - fSuccess = InitializeProcThreadAttributeList(siEx.lpAttributeList, 1, 0, &size); - if (!fSuccess) { - return throwNanError(&info, "InitializeProcThreadAttributeList failed", true); - } - fSuccess = UpdateProcThreadAttribute(siEx.lpAttributeList, - 0, - PROC_THREAD_ATTRIBUTE_PSEUDOCONSOLE, - handle->hpc, - sizeof(HPCON), - NULL, - NULL); - if (!fSuccess) { - return throwNanError(&info, "UpdateProcThreadAttribute failed", true); - } - - PROCESS_INFORMATION piClient{}; - fSuccess = !!CreateProcessW( - nullptr, - mutableCommandline.get(), - nullptr, // lpProcessAttributes - nullptr, // lpThreadAttributes - false, // bInheritHandles VERY IMPORTANT that this is false - EXTENDED_STARTUPINFO_PRESENT | CREATE_UNICODE_ENVIRONMENT, // dwCreationFlags - envArg, // lpEnvironment - mutableCwd.get(), // lpCurrentDirectory - &siEx.StartupInfo, // lpStartupInfo - &piClient // lpProcessInformation - ); - if (!fSuccess) { - return throwNanError(&info, "Cannot create process", true); - } - - // Update handle - handle->hShell = piClient.hProcess; - handle->cb.Reset(exitCallback); - handle->async.data = handle; - - // Setup OnProcessExit callback - uv_async_init(uv_default_loop(), &handle->async, OnProcessExit); - - // Setup Windows wait for process exit event - RegisterWaitForSingleObject(&handle->hWait, piClient.hProcess, OnProcessExitWinEvent, (PVOID)handle, INFINITE, WT_EXECUTEONLYONCE); - - // Return - v8::Local marshal = Nan::New(); - Nan::Set(marshal, Nan::New("pid").ToLocalChecked(), Nan::New(piClient.dwProcessId)); - info.GetReturnValue().Set(marshal); -} - -static NAN_METHOD(PtyResize) { - Nan::HandleScope scope; - - if (info.Length() != 3 || - !info[0]->IsNumber() || - !info[1]->IsNumber() || - !info[2]->IsNumber()) { - Nan::ThrowError("Usage: pty.resize(id, cols, rows)"); - return; - } - - int id = info[0]->Int32Value(Nan::GetCurrentContext()).FromJust(); - SHORT cols = info[1]->Uint32Value(Nan::GetCurrentContext()).FromJust(); - SHORT rows = info[2]->Uint32Value(Nan::GetCurrentContext()).FromJust(); - - const pty_baton* handle = get_pty_baton(id); - - HANDLE hLibrary = LoadLibraryExW(L"kernel32.dll", 0, 0); - bool fLoadedDll = hLibrary != nullptr; - if (fLoadedDll) - { - PFNRESIZEPSEUDOCONSOLE const pfnResizePseudoConsole = (PFNRESIZEPSEUDOCONSOLE)GetProcAddress((HMODULE)hLibrary, "ResizePseudoConsole"); - if (pfnResizePseudoConsole) - { - COORD size = {cols, rows}; - pfnResizePseudoConsole(handle->hpc, size); - } - } - - return info.GetReturnValue().SetUndefined(); -} - -static NAN_METHOD(PtyKill) { - Nan::HandleScope scope; - - if (info.Length() != 1 || - !info[0]->IsNumber()) { - Nan::ThrowError("Usage: pty.kill(id)"); - return; - } - - int id = info[0]->Int32Value(Nan::GetCurrentContext()).FromJust(); - - const pty_baton* handle = get_pty_baton(id); - - HANDLE hLibrary = LoadLibraryExW(L"kernel32.dll", 0, 0); - bool fLoadedDll = hLibrary != nullptr; - if (fLoadedDll) - { - PFNCLOSEPSEUDOCONSOLE const pfnClosePseudoConsole = (PFNCLOSEPSEUDOCONSOLE)GetProcAddress((HMODULE)hLibrary, "ClosePseudoConsole"); - if (pfnClosePseudoConsole) - { - pfnClosePseudoConsole(handle->hpc); - } - } - - CloseHandle(handle->hShell); - - return info.GetReturnValue().SetUndefined(); -} - -/** -* Init -*/ - -extern "C" void init(v8::Local target) { - Nan::HandleScope scope; - Nan::SetMethod(target, "startProcess", PtyStartProcess); - Nan::SetMethod(target, "connect", PtyConnect); - Nan::SetMethod(target, "resize", PtyResize); - Nan::SetMethod(target, "kill", PtyKill); -}; - -NODE_MODULE(pty, init); diff --git a/node_modules/node-pty/src/win/conpty_console_list.cc b/node_modules/node-pty/src/win/conpty_console_list.cc deleted file mode 100644 index be135ba..0000000 --- a/node_modules/node-pty/src/win/conpty_console_list.cc +++ /dev/null @@ -1,43 +0,0 @@ -/** - * Copyright (c) 2019, Microsoft Corporation (MIT License). - */ - -#include -#include - -static NAN_METHOD(ApiConsoleProcessList) { - if (info.Length() != 1 || - !info[0]->IsNumber()) { - Nan::ThrowError("Usage: getConsoleProcessList(shellPid)"); - return; - } - - const SHORT pid = info[0]->Uint32Value(Nan::GetCurrentContext()).FromJust(); - - if (!FreeConsole()) { - Nan::ThrowError("FreeConsole failed"); - } - if (!AttachConsole(pid)) { - Nan::ThrowError("AttachConsole failed"); - } - auto processList = std::vector(64); - auto processCount = GetConsoleProcessList(&processList[0], processList.size()); - if (processList.size() < processCount) { - processList.resize(processCount); - processCount = GetConsoleProcessList(&processList[0], processList.size()); - } - FreeConsole(); - - v8::Local result = Nan::New(); - for (DWORD i = 0; i < processCount; i++) { - Nan::Set(result, i, Nan::New(processList[i])); - } - info.GetReturnValue().Set(result); -} - -extern "C" void init(v8::Local target) { - Nan::HandleScope scope; - Nan::SetMethod(target, "getConsoleProcessList", ApiConsoleProcessList); -}; - -NODE_MODULE(pty, init); diff --git a/node_modules/node-pty/src/win/path_util.cc b/node_modules/node-pty/src/win/path_util.cc deleted file mode 100644 index 4e69f30..0000000 --- a/node_modules/node-pty/src/win/path_util.cc +++ /dev/null @@ -1,73 +0,0 @@ -/** - * Copyright (c) 2013-2015, Christopher Jeffrey, Peter Sunde (MIT License) - * Copyright (c) 2016, Daniel Imms (MIT License). - * Copyright (c) 2018, Microsoft Corporation (MIT License). - */ - -#include -#include // PathCombine - -#include "path_util.h" - -namespace path_util { - -const wchar_t* to_wstring(const Nan::Utf8String& str) { - const char *bytes = *str; - unsigned int sizeOfStr = MultiByteToWideChar(CP_UTF8, 0, bytes, -1, NULL, 0); - wchar_t *output = new wchar_t[sizeOfStr]; - MultiByteToWideChar(CP_UTF8, 0, bytes, -1, output, sizeOfStr); - return output; -} - -bool file_exists(std::wstring filename) { - DWORD attr = ::GetFileAttributesW(filename.c_str()); - if (attr == INVALID_FILE_ATTRIBUTES || (attr & FILE_ATTRIBUTE_DIRECTORY)) { - return false; - } - return true; -} - -// cmd.exe -> C:\Windows\system32\cmd.exe -std::wstring get_shell_path(std::wstring filename) { - std::wstring shellpath; - - if (file_exists(filename)) { - return shellpath; - } - - wchar_t buffer_[MAX_ENV]; - int read = ::GetEnvironmentVariableW(L"Path", buffer_, MAX_ENV); - if (!read) { - return shellpath; - } - - std::wstring delimiter = L";"; - size_t pos = 0; - std::vector paths; - std::wstring buffer(buffer_); - while ((pos = buffer.find(delimiter)) != std::wstring::npos) { - paths.push_back(buffer.substr(0, pos)); - buffer.erase(0, pos + delimiter.length()); - } - - const wchar_t *filename_ = filename.c_str(); - - for (int i = 0; i < paths.size(); ++i) { - std::wstring path = paths[i]; - wchar_t searchPath[MAX_PATH]; - ::PathCombineW(searchPath, const_cast(path.c_str()), filename_); - - if (searchPath == NULL) { - continue; - } - - if (file_exists(searchPath)) { - shellpath = searchPath; - break; - } - } - - return shellpath; -} - -} // namespace path_util diff --git a/node_modules/node-pty/src/win/path_util.h b/node_modules/node-pty/src/win/path_util.h deleted file mode 100644 index 8dd58d2..0000000 --- a/node_modules/node-pty/src/win/path_util.h +++ /dev/null @@ -1,22 +0,0 @@ -/** - * Copyright (c) 2013-2015, Christopher Jeffrey, Peter Sunde (MIT License) - * Copyright (c) 2016, Daniel Imms (MIT License). - * Copyright (c) 2018, Microsoft Corporation (MIT License). - */ - -#ifndef NODE_PTY_PATH_UTIL_H_ -#define NODE_PTY_PATH_UTIL_H_ - -#include - -#define MAX_ENV 65536 - -namespace path_util { - -const wchar_t* to_wstring(const Nan::Utf8String& str); -bool file_exists(std::wstring filename); -std::wstring get_shell_path(std::wstring filename); - -} // namespace path_util - -#endif // NODE_PTY_PATH_UTIL_H_ diff --git a/node_modules/node-pty/src/win/winpty.cc b/node_modules/node-pty/src/win/winpty.cc deleted file mode 100644 index b054dee..0000000 --- a/node_modules/node-pty/src/win/winpty.cc +++ /dev/null @@ -1,312 +0,0 @@ -/** - * Copyright (c) 2013-2015, Christopher Jeffrey, Peter Sunde (MIT License) - * Copyright (c) 2016, Daniel Imms (MIT License). - * Copyright (c) 2018, Microsoft Corporation (MIT License). - * - * pty.cc: - * This file is responsible for starting processes - * with pseudo-terminal file descriptors. - */ - -#include -#include -#include // PathCombine, PathIsRelative -#include -#include -#include -#include -#include -#include - -#include "path_util.h" - -/** -* Misc -*/ -extern "C" void init(v8::Local); - -#define WINPTY_DBG_VARIABLE TEXT("WINPTYDBG") - -/** -* winpty -*/ -static std::vector ptyHandles; -static volatile LONG ptyCounter; - -/** -* Helpers -*/ - -static winpty_t *get_pipe_handle(int handle) { - for (size_t i = 0; i < ptyHandles.size(); ++i) { - winpty_t *ptyHandle = ptyHandles[i]; - int current = (int)winpty_agent_process(ptyHandle); - if (current == handle) { - return ptyHandle; - } - } - return nullptr; -} - -static bool remove_pipe_handle(int handle) { - for (size_t i = 0; i < ptyHandles.size(); ++i) { - winpty_t *ptyHandle = ptyHandles[i]; - if ((int)winpty_agent_process(ptyHandle) == handle) { - winpty_free(ptyHandle); - ptyHandles.erase(ptyHandles.begin() + i); - ptyHandle = nullptr; - return true; - } - } - return false; -} - -void throw_winpty_error(const char *generalMsg, winpty_error_ptr_t error_ptr) { - std::stringstream why; - std::wstring msg(winpty_error_msg(error_ptr)); - std::string msg_(msg.begin(), msg.end()); - why << generalMsg << ": " << msg_; - Nan::ThrowError(why.str().c_str()); - winpty_error_free(error_ptr); -} - -static NAN_METHOD(PtyGetExitCode) { - Nan::HandleScope scope; - - if (info.Length() != 1 || - !info[0]->IsNumber()) { - Nan::ThrowError("Usage: pty.getExitCode(pidHandle)"); - return; - } - - DWORD exitCode = 0; - GetExitCodeProcess((HANDLE)info[0]->IntegerValue(Nan::GetCurrentContext()).FromJust(), &exitCode); - - info.GetReturnValue().Set(Nan::New(exitCode)); -} - -static NAN_METHOD(PtyGetProcessList) { - Nan::HandleScope scope; - - if (info.Length() != 1 || - !info[0]->IsNumber()) { - Nan::ThrowError("Usage: pty.getProcessList(pid)"); - return; - } - - int pid = info[0]->Int32Value(Nan::GetCurrentContext()).FromJust(); - - winpty_t *pc = get_pipe_handle(pid); - if (pc == nullptr) { - info.GetReturnValue().Set(Nan::New(0)); - return; - } - int processList[64]; - const int processCount = 64; - int actualCount = winpty_get_console_process_list(pc, processList, processCount, nullptr); - - v8::Local result = Nan::New(actualCount); - for (uint32_t i = 0; i < actualCount; i++) { - Nan::Set(result, i, Nan::New(processList[i])); - } - info.GetReturnValue().Set(result); -} - -static NAN_METHOD(PtyStartProcess) { - Nan::HandleScope scope; - - if (info.Length() != 7 || - !info[0]->IsString() || - !info[1]->IsString() || - !info[2]->IsArray() || - !info[3]->IsString() || - !info[4]->IsNumber() || - !info[5]->IsNumber() || - !info[6]->IsBoolean()) { - Nan::ThrowError("Usage: pty.startProcess(file, cmdline, env, cwd, cols, rows, debug)"); - return; - } - - std::stringstream why; - - const wchar_t *filename = path_util::to_wstring(Nan::Utf8String(info[0])); - const wchar_t *cmdline = path_util::to_wstring(Nan::Utf8String(info[1])); - const wchar_t *cwd = path_util::to_wstring(Nan::Utf8String(info[3])); - - // create environment block - std::wstring env; - const v8::Local envValues = v8::Local::Cast(info[2]); - if (!envValues.IsEmpty()) { - - std::wstringstream envBlock; - - for(uint32_t i = 0; i < envValues->Length(); i++) { - std::wstring envValue(path_util::to_wstring(Nan::Utf8String(Nan::Get(envValues, i).ToLocalChecked()))); - envBlock << envValue << L'\0'; - } - - env = envBlock.str(); - } - - // use environment 'Path' variable to determine location of - // the relative path that we have recieved (e.g cmd.exe) - std::wstring shellpath; - if (::PathIsRelativeW(filename)) { - shellpath = path_util::get_shell_path(filename); - } else { - shellpath = filename; - } - - std::string shellpath_(shellpath.begin(), shellpath.end()); - - if (shellpath.empty() || !path_util::file_exists(shellpath)) { - why << "File not found: " << shellpath_; - Nan::ThrowError(why.str().c_str()); - goto cleanup; - } - - int cols = info[4]->Int32Value(Nan::GetCurrentContext()).FromJust(); - int rows = info[5]->Int32Value(Nan::GetCurrentContext()).FromJust(); - bool debug = Nan::To(info[6]).FromJust(); - - // Enable/disable debugging - SetEnvironmentVariable(WINPTY_DBG_VARIABLE, debug ? "1" : NULL); // NULL = deletes variable - - // Create winpty config - winpty_error_ptr_t error_ptr = nullptr; - winpty_config_t* winpty_config = winpty_config_new(0, &error_ptr); - if (winpty_config == nullptr) { - throw_winpty_error("Error creating WinPTY config", error_ptr); - goto cleanup; - } - winpty_error_free(error_ptr); - - // Set pty size on config - winpty_config_set_initial_size(winpty_config, cols, rows); - - // Start the pty agent - winpty_t *pc = winpty_open(winpty_config, &error_ptr); - winpty_config_free(winpty_config); - if (pc == nullptr) { - throw_winpty_error("Error launching WinPTY agent", error_ptr); - goto cleanup; - } - winpty_error_free(error_ptr); - - // Save pty struct for later use - ptyHandles.insert(ptyHandles.end(), pc); - - // Create winpty spawn config - winpty_spawn_config_t* config = winpty_spawn_config_new(WINPTY_SPAWN_FLAG_AUTO_SHUTDOWN, shellpath.c_str(), cmdline, cwd, env.c_str(), &error_ptr); - if (config == nullptr) { - throw_winpty_error("Error creating WinPTY spawn config", error_ptr); - goto cleanup; - } - winpty_error_free(error_ptr); - - // Spawn the new process - HANDLE handle = nullptr; - BOOL spawnSuccess = winpty_spawn(pc, config, &handle, nullptr, nullptr, &error_ptr); - winpty_spawn_config_free(config); - if (!spawnSuccess) { - throw_winpty_error("Unable to start terminal process", error_ptr); - goto cleanup; - } - winpty_error_free(error_ptr); - - // Set return values - v8::Local marshal = Nan::New(); - Nan::Set(marshal, Nan::New("innerPid").ToLocalChecked(), Nan::New((int)GetProcessId(handle))); - Nan::Set(marshal, Nan::New("innerPidHandle").ToLocalChecked(), Nan::New((int)handle)); - Nan::Set(marshal, Nan::New("pid").ToLocalChecked(), Nan::New((int)winpty_agent_process(pc))); - Nan::Set(marshal, Nan::New("pty").ToLocalChecked(), Nan::New(InterlockedIncrement(&ptyCounter))); - Nan::Set(marshal, Nan::New("fd").ToLocalChecked(), Nan::New(-1)); - { - LPCWSTR coninPipeName = winpty_conin_name(pc); - std::wstring coninPipeNameWStr(coninPipeName); - std::string coninPipeNameStr(coninPipeNameWStr.begin(), coninPipeNameWStr.end()); - Nan::Set(marshal, Nan::New("conin").ToLocalChecked(), Nan::New(coninPipeNameStr).ToLocalChecked()); - LPCWSTR conoutPipeName = winpty_conout_name(pc); - std::wstring conoutPipeNameWStr(conoutPipeName); - std::string conoutPipeNameStr(conoutPipeNameWStr.begin(), conoutPipeNameWStr.end()); - Nan::Set(marshal, Nan::New("conout").ToLocalChecked(), Nan::New(conoutPipeNameStr).ToLocalChecked()); - } - info.GetReturnValue().Set(marshal); - - goto cleanup; - -cleanup: - delete filename; - delete cmdline; - delete cwd; -} - -static NAN_METHOD(PtyResize) { - Nan::HandleScope scope; - - if (info.Length() != 3 || - !info[0]->IsNumber() || - !info[1]->IsNumber() || - !info[2]->IsNumber()) { - Nan::ThrowError("Usage: pty.resize(pid, cols, rows)"); - return; - } - - int handle = info[0]->Int32Value(Nan::GetCurrentContext()).FromJust(); - int cols = info[1]->Int32Value(Nan::GetCurrentContext()).FromJust(); - int rows = info[2]->Int32Value(Nan::GetCurrentContext()).FromJust(); - - winpty_t *pc = get_pipe_handle(handle); - - if (pc == nullptr) { - Nan::ThrowError("The pty doesn't appear to exist"); - return; - } - BOOL success = winpty_set_size(pc, cols, rows, nullptr); - if (!success) { - Nan::ThrowError("The pty could not be resized"); - return; - } - - return info.GetReturnValue().SetUndefined(); -} - -static NAN_METHOD(PtyKill) { - Nan::HandleScope scope; - - if (info.Length() != 2 || - !info[0]->IsNumber() || - !info[1]->IsNumber()) { - Nan::ThrowError("Usage: pty.kill(pid, innerPidHandle)"); - return; - } - - int handle = info[0]->Int32Value(Nan::GetCurrentContext()).FromJust(); - HANDLE innerPidHandle = (HANDLE)info[1]->Int32Value(Nan::GetCurrentContext()).FromJust(); - - winpty_t *pc = get_pipe_handle(handle); - if (pc == nullptr) { - Nan::ThrowError("Pty seems to have been killed already"); - return; - } - - assert(remove_pipe_handle(handle)); - CloseHandle(innerPidHandle); - - return info.GetReturnValue().SetUndefined(); -} - -/** -* Init -*/ - -extern "C" void init(v8::Local target) { - Nan::HandleScope scope; - Nan::SetMethod(target, "startProcess", PtyStartProcess); - Nan::SetMethod(target, "resize", PtyResize); - Nan::SetMethod(target, "kill", PtyKill); - Nan::SetMethod(target, "getExitCode", PtyGetExitCode); - Nan::SetMethod(target, "getProcessList", PtyGetProcessList); -}; - -NODE_MODULE(pty, init); diff --git a/node_modules/node-pty/src/windowsPtyAgent.test.ts b/node_modules/node-pty/src/windowsPtyAgent.test.ts deleted file mode 100644 index dc2104b..0000000 --- a/node_modules/node-pty/src/windowsPtyAgent.test.ts +++ /dev/null @@ -1,94 +0,0 @@ -/** - * Copyright (c) 2017, Daniel Imms (MIT License). - * Copyright (c) 2018, Microsoft Corporation (MIT License). - */ - -import * as assert from 'assert'; -import { argsToCommandLine } from './windowsPtyAgent'; - -function check(file: string, args: string | string[], expected: string): void { - assert.equal(argsToCommandLine(file, args), expected); -} - -if (process.platform === 'win32') { - describe('argsToCommandLine', () => { - describe('Plain strings', () => { - it('doesn\'t quote plain string', () => { - check('asdf', [], 'asdf'); - }); - it('doesn\'t escape backslashes', () => { - check('\\asdf\\qwer\\', [], '\\asdf\\qwer\\'); - }); - it('doesn\'t escape multiple backslashes', () => { - check('asdf\\\\qwer', [], 'asdf\\\\qwer'); - }); - it('adds backslashes before quotes', () => { - check('"asdf"qwer"', [], '\\"asdf\\"qwer\\"'); - }); - it('escapes backslashes before quotes', () => { - check('asdf\\"qwer', [], 'asdf\\\\\\"qwer'); - }); - }); - - describe('Quoted strings', () => { - it('quotes string with spaces', () => { - check('asdf qwer', [], '"asdf qwer"'); - }); - it('quotes empty string', () => { - check('', [], '""'); - }); - it('quotes string with tabs', () => { - check('asdf\tqwer', [], '"asdf\tqwer"'); - }); - it('escapes only the last backslash', () => { - check('\\asdf \\qwer\\', [], '"\\asdf \\qwer\\\\"'); - }); - it('doesn\'t escape multiple backslashes', () => { - check('asdf \\\\qwer', [], '"asdf \\\\qwer"'); - }); - it('escapes backslashes before quotes', () => { - check('asdf \\"qwer', [], '"asdf \\\\\\"qwer"'); - }); - it('escapes multiple backslashes at the end', () => { - check('asdf qwer\\\\', [], '"asdf qwer\\\\\\\\"'); - }); - }); - - describe('Multiple arguments', () => { - it('joins arguments with spaces', () => { - check('asdf', ['qwer zxcv', '', '"'], 'asdf "qwer zxcv" "" \\"'); - }); - it('array argument all in quotes', () => { - check('asdf', ['"surounded by quotes"'], 'asdf \\"surounded by quotes\\"'); - }); - it('array argument quotes in the middle', () => { - check('asdf', ['quotes "in the" middle'], 'asdf "quotes \\"in the\\" middle"'); - }); - it('array argument quotes near start', () => { - check('asdf', ['"quotes" near start'], 'asdf "\\"quotes\\" near start"'); - }); - it('array argument quotes near end', () => { - check('asdf', ['quotes "near end"'], 'asdf "quotes \\"near end\\""'); - }); - }); - - describe('Args as CommandLine', () => { - it('should handle empty string', () => { - check('file', '', 'file'); - }); - it('should not change args', () => { - check('file', 'foo bar baz', 'file foo bar baz'); - check('file', 'foo \\ba"r \baz', 'file foo \\ba"r \baz'); - }); - }); - - describe('Real-world cases', () => { - it('quotes within quotes', () => { - check('cmd.exe', ['/c', 'powershell -noexit -command \'Set-location \"C:\\user\"\''], 'cmd.exe /c "powershell -noexit -command \'Set-location \\\"C:\\user\\"\'"'); - }); - it('space within quotes', () => { - check('cmd.exe', ['/k', '"C:\\Users\\alros\\Desktop\\test script.bat"'], 'cmd.exe /k \\"C:\\Users\\alros\\Desktop\\test script.bat\\"'); - }); - }); - }); -} diff --git a/node_modules/node-pty/src/windowsPtyAgent.ts b/node_modules/node-pty/src/windowsPtyAgent.ts deleted file mode 100644 index cf8b65d..0000000 --- a/node_modules/node-pty/src/windowsPtyAgent.ts +++ /dev/null @@ -1,313 +0,0 @@ -/** - * Copyright (c) 2012-2015, Christopher Jeffrey, Peter Sunde (MIT License) - * Copyright (c) 2016, Daniel Imms (MIT License). - * Copyright (c) 2018, Microsoft Corporation (MIT License). - */ - -import * as os from 'os'; -import * as path from 'path'; -import { Socket } from 'net'; -import { ArgvOrCommandLine } from './types'; -import { fork } from 'child_process'; - -let conptyNative: IConptyNative; -let winptyNative: IWinptyNative; - -/** - * The amount of time to wait for additional data after the conpty shell process has exited before - * shutting down the socket. The timer will be reset if a new data event comes in after the timer - * has started. - */ -const FLUSH_DATA_INTERVAL = 20; - -/** - * This agent sits between the WindowsTerminal class and provides a common interface for both conpty - * and winpty. - */ -export class WindowsPtyAgent { - private _inSocket: Socket; - private _outSocket: Socket; - private _pid: number; - private _innerPid: number; - private _innerPidHandle: number; - private _closeTimeout: NodeJS.Timer; - private _exitCode: number | undefined; - - private _fd: any; - private _pty: number; - private _ptyNative: IConptyNative | IWinptyNative; - - public get inSocket(): Socket { return this._inSocket; } - public get outSocket(): Socket { return this._outSocket; } - public get fd(): any { return this._fd; } - public get innerPid(): number { return this._innerPid; } - public get pty(): number { return this._pty; } - - constructor( - file: string, - args: ArgvOrCommandLine, - env: string[], - cwd: string, - cols: number, - rows: number, - debug: boolean, - private _useConpty: boolean | undefined, - conptyInheritCursor: boolean = false - ) { - if (this._useConpty === undefined || this._useConpty === true) { - this._useConpty = this._getWindowsBuildNumber() >= 18309; - } - if (this._useConpty) { - if (!conptyNative) { - try { - conptyNative = require('../build/Release/conpty.node'); - } catch (outerError) { - try { - conptyNative = require('../build/Debug/conpty.node'); - } catch (innerError) { - console.error('innerError', innerError); - // Re-throw the exception from the Release require if the Debug require fails as well - throw outerError; - } - } - } - } else { - if (!winptyNative) { - try { - winptyNative = require('../build/Release/pty.node'); - } catch (outerError) { - try { - winptyNative = require('../build/Debug/pty.node'); - } catch (innerError) { - console.error('innerError', innerError); - // Re-throw the exception from the Release require if the Debug require fails as well - throw outerError; - } - } - } - } - this._ptyNative = this._useConpty ? conptyNative : winptyNative; - - // Sanitize input variable. - cwd = path.resolve(cwd); - - // Compose command line - const commandLine = argsToCommandLine(file, args); - - // Open pty session. - let term: IConptyProcess | IWinptyProcess; - if (this._useConpty) { - term = (this._ptyNative as IConptyNative).startProcess(file, cols, rows, debug, this._generatePipeName(), conptyInheritCursor); - } else { - term = (this._ptyNative as IWinptyNative).startProcess(file, commandLine, env, cwd, cols, rows, debug); - this._pid = (term as IWinptyProcess).pid; - this._innerPid = (term as IWinptyProcess).innerPid; - this._innerPidHandle = (term as IWinptyProcess).innerPidHandle; - } - - // Not available on windows. - this._fd = term.fd; - - // Generated incremental number that has no real purpose besides using it - // as a terminal id. - this._pty = term.pty; - - // Create terminal pipe IPC channel and forward to a local unix socket. - this._outSocket = new Socket(); - this._outSocket.setEncoding('utf8'); - this._outSocket.connect(term.conout, () => { - // TODO: Emit event on agent instead of socket? - - // Emit ready event. - this._outSocket.emit('ready_datapipe'); - }); - - this._inSocket = new Socket(); - this._inSocket.setEncoding('utf8'); - this._inSocket.connect(term.conin); - // TODO: Wait for ready event? - - if (this._useConpty) { - const connect = (this._ptyNative as IConptyNative).connect(this._pty, commandLine, cwd, env, c => this._$onProcessExit(c) -); - this._innerPid = connect.pid; - } - } - - public resize(cols: number, rows: number): void { - if (this._useConpty) { - if (this._exitCode !== undefined) { - throw new Error('Cannot resize a pty that has already exited'); - } - this._ptyNative.resize(this._pty, cols, rows); - return; - } - this._ptyNative.resize(this._pid, cols, rows); - } - - public kill(): void { - this._inSocket.readable = false; - this._inSocket.writable = false; - this._outSocket.readable = false; - this._outSocket.writable = false; - // Tell the agent to kill the pty, this releases handles to the process - if (this._useConpty) { - this._getConsoleProcessList().then(consoleProcessList => { - consoleProcessList.forEach((pid: number) => { - try { - process.kill(pid); - } catch (e) { - // Ignore if process cannot be found (kill ESRCH error) - } - }); - (this._ptyNative as IConptyNative).kill(this._pty); - }); - } else { - (this._ptyNative as IWinptyNative).kill(this._pid, this._innerPidHandle); - // Since pty.kill closes the handle it will kill most processes by itself - // and process IDs can be reused as soon as all handles to them are - // dropped, we want to immediately kill the entire console process list. - // If we do not force kill all processes here, node servers in particular - // seem to become detached and remain running (see - // Microsoft/vscode#26807). - const processList: number[] = (this._ptyNative as IWinptyNative).getProcessList(this._pid); - processList.forEach(pid => { - try { - process.kill(pid); - } catch (e) { - // Ignore if process cannot be found (kill ESRCH error) - } - }); - } - } - - private _getConsoleProcessList(): Promise { - return new Promise(resolve => { - const agent = fork(path.join(__dirname, 'conpty_console_list_agent'), [ this._innerPid.toString() ]); - agent.on('message', message => { - clearTimeout(timeout); - resolve(message.consoleProcessList); - }); - const timeout = setTimeout(() => { - // Something went wrong, just send back the shell PID - agent.kill(); - resolve([ this._innerPid ]); - }, 5000); - }); - } - - public get exitCode(): number { - if (this._useConpty) { - return this._exitCode; - } - return (this._ptyNative as IWinptyNative).getExitCode(this._innerPidHandle); - } - - private _getWindowsBuildNumber(): number { - const osVersion = (/(\d+)\.(\d+)\.(\d+)/g).exec(os.release()); - let buildNumber: number = 0; - if (osVersion && osVersion.length === 4) { - buildNumber = parseInt(osVersion[3]); - } - return buildNumber; - } - - private _generatePipeName(): string { - return `conpty-${Math.random() * 10000000}`; - } - - /** - * Triggered from the native side when a contpy process exits. - */ - private _$onProcessExit(exitCode: number): void { - this._exitCode = exitCode; - this._flushDataAndCleanUp(); - this._outSocket.on('data', () => this._flushDataAndCleanUp()); - } - - private _flushDataAndCleanUp(): void { - if (this._closeTimeout) { - clearTimeout(this._closeTimeout); - } - this._closeTimeout = setTimeout(() => this._cleanUpProcess(), FLUSH_DATA_INTERVAL); - } - - private _cleanUpProcess(): void { - this._inSocket.readable = false; - this._inSocket.writable = false; - this._outSocket.readable = false; - this._outSocket.writable = false; - this._outSocket.destroy(); - } -} - -// Convert argc/argv into a Win32 command-line following the escaping convention -// documented on MSDN (e.g. see CommandLineToArgvW documentation). Copied from -// winpty project. -export function argsToCommandLine(file: string, args: ArgvOrCommandLine): string { - if (isCommandLine(args)) { - if (args.length === 0) { - return file; - } - return `${argsToCommandLine(file, [])} ${args}`; - } - const argv = [file]; - Array.prototype.push.apply(argv, args); - let result = ''; - for (let argIndex = 0; argIndex < argv.length; argIndex++) { - if (argIndex > 0) { - result += ' '; - } - const arg = argv[argIndex]; - // if it is empty or it contains whitespace and is not already quoted - const hasLopsidedEnclosingQuote = xOr((arg[0] !== '"'), (arg[arg.length - 1] !== '"')); - const hasNoEnclosingQuotes = ((arg[0] !== '"') && (arg[arg.length - 1] !== '"')); - const quote = - arg === '' || - (arg.indexOf(' ') !== -1 || - arg.indexOf('\t') !== -1) && - ((arg.length > 1) && - (hasLopsidedEnclosingQuote || hasNoEnclosingQuotes)); - if (quote) { - result += '\"'; - } - let bsCount = 0; - for (let i = 0; i < arg.length; i++) { - const p = arg[i]; - if (p === '\\') { - bsCount++; - } else if (p === '"') { - result += repeatText('\\', bsCount * 2 + 1); - result += '"'; - bsCount = 0; - } else { - result += repeatText('\\', bsCount); - bsCount = 0; - result += p; - } - } - if (quote) { - result += repeatText('\\', bsCount * 2); - result += '\"'; - } else { - result += repeatText('\\', bsCount); - } - } - return result; -} - -function isCommandLine(args: ArgvOrCommandLine): args is string { - return typeof args === 'string'; -} - -function repeatText(text: string, count: number): string { - let result = ''; - for (let i = 0; i < count; i++) { - result += text; - } - return result; -} - -function xOr(arg1: boolean, arg2: boolean): boolean { - return ((arg1 && !arg2) || (!arg1 && arg2)); -} diff --git a/node_modules/node-pty/src/windowsTerminal.test.ts b/node_modules/node-pty/src/windowsTerminal.test.ts deleted file mode 100644 index 9044162..0000000 --- a/node_modules/node-pty/src/windowsTerminal.test.ts +++ /dev/null @@ -1,205 +0,0 @@ -/** - * Copyright (c) 2017, Daniel Imms (MIT License). - * Copyright (c) 2018, Microsoft Corporation (MIT License). - */ - -import * as fs from 'fs'; -import * as assert from 'assert'; -import { WindowsTerminal } from './windowsTerminal'; -import * as path from 'path'; -import * as psList from 'ps-list'; - -interface IProcessState { - // Whether the PID must exist or must not exist - [pid: number]: boolean; -} - -interface IWindowsProcessTreeResult { - name: string; - pid: number; -} - -function pollForProcessState(desiredState: IProcessState, intervalMs: number = 100, timeoutMs: number = 2000): Promise { - return new Promise(resolve => { - let tries = 0; - const interval = setInterval(() => { - psList({ all: true }).then(ps => { - let success = true; - const pids = Object.keys(desiredState).map(k => parseInt(k, 10)); - pids.forEach(pid => { - if (desiredState[pid]) { - if (!ps.some(p => p.pid === pid)) { - success = false; - } - } else { - if (ps.some(p => p.pid === pid)) { - success = false; - } - } - }); - if (success) { - clearInterval(interval); - resolve(); - return; - } - tries++; - if (tries * intervalMs >= timeoutMs) { - clearInterval(interval); - const processListing = pids.map(k => `${k}: ${desiredState[k]}`).join('\n'); - assert.fail(`Bad process state, expected:\n${processListing}`); - resolve(); - } - }); - }, intervalMs); - }); -} - -function pollForProcessTreeSize(pid: number, size: number, intervalMs: number = 100, timeoutMs: number = 2000): Promise { - return new Promise(resolve => { - let tries = 0; - const interval = setInterval(() => { - psList({ all: true }).then(ps => { - const openList: IWindowsProcessTreeResult[] = []; - openList.push(ps.filter(p => p.pid === pid).map(p => { - return { name: p.name, pid: p.pid }; - })[0]); - const list: IWindowsProcessTreeResult[] = []; - while (openList.length) { - const current = openList.shift(); - ps.filter(p => p.ppid === current.pid).map(p => { - return { name: p.name, pid: p.pid }; - }).forEach(p => openList.push(p)); - list.push(current); - } - const success = list.length === size; - if (success) { - clearInterval(interval); - resolve(list); - return; - } - tries++; - if (tries * intervalMs >= timeoutMs) { - clearInterval(interval); - assert.fail(`Bad process state, expected: ${size}, actual: ${list.length}`); - resolve(); - } - }); - }, intervalMs); - }); -} - -if (process.platform === 'win32') { - describe('WindowsTerminal', () => { - describe('kill', () => { - it('should not crash parent process', (done) => { - const term = new WindowsTerminal('cmd.exe', [], {}); - term.kill(); - // Add done call to deferred function queue to ensure the kill call has completed - (term)._defer(done); - }); - it('should kill the process tree', function (done: Mocha.Done): void { - this.timeout(5000); - const term = new WindowsTerminal('cmd.exe', [], {}); - // Start sub-processes - term.write('powershell.exe\r'); - term.write('notepad.exe\r'); - term.write('node.exe\r'); - pollForProcessTreeSize(term.pid, 4, 500, 5000).then(list => { - assert.equal(list[0].name, 'cmd.exe'); - assert.equal(list[1].name, 'powershell.exe'); - assert.equal(list[2].name, 'notepad.exe'); - assert.equal(list[3].name, 'node.exe'); - term.kill(); - const desiredState: IProcessState = {}; - desiredState[list[0].pid] = false; - desiredState[list[1].pid] = false; - desiredState[list[2].pid] = true; - desiredState[list[3].pid] = false; - pollForProcessState(desiredState).then(() => { - // Kill notepad before done - process.kill(list[2].pid); - done(); - }); - }); - }); - }); - - describe('resize', () => { - it('should throw a non-native exception when resizing an invalid value', () => { - const term = new WindowsTerminal('cmd.exe', [], {}); - assert.throws(() => term.resize(-1, -1)); - assert.throws(() => term.resize(0, 0)); - assert.doesNotThrow(() => term.resize(1, 1)); - }); - it('should throw an non-native exception when resizing a killed terminal', (done) => { - const term = new WindowsTerminal('cmd.exe', [], {}); - (term)._defer(() => { - term.on('exit', () => { - assert.throws(() => term.resize(1, 1)); - done(); - }); - term.destroy(); - }); - }); - }); - - describe('Args as CommandLine', () => { - it('should not fail running a file containing a space in the path', (done) => { - const spaceFolder = path.resolve(__dirname, '..', 'fixtures', 'space folder'); - if (!fs.existsSync(spaceFolder)) { - fs.mkdirSync(spaceFolder); - } - - const cmdCopiedPath = path.resolve(spaceFolder, 'cmd.exe'); - const data = fs.readFileSync(`${process.env.windir}\\System32\\cmd.exe`); - fs.writeFileSync(cmdCopiedPath, data); - - if (!fs.existsSync(cmdCopiedPath)) { - // Skip test if git bash isn't installed - return; - } - const term = new WindowsTerminal(cmdCopiedPath, '/c echo "hello world"', {}); - let result = ''; - term.on('data', (data) => { - result += data; - }); - term.on('exit', () => { - assert.ok(result.indexOf('hello world') >= 1); - done(); - }); - }); - }); - - describe('env', () => { - it('should set environment variables of the shell', (done) => { - const term = new WindowsTerminal('cmd.exe', '/C echo %FOO%', { env: { FOO: 'BAR' }}); - let result = ''; - term.on('data', (data) => { - result += data; - }); - term.on('exit', () => { - assert.ok(result.indexOf('BAR') >= 0); - done(); - }); - }); - }); - - describe('On close', () => { - it('should return process zero exit codes', (done) => { - const term = new WindowsTerminal('cmd.exe', '/C exit'); - term.on('exit', (code) => { - assert.equal(code, 0); - done(); - }); - }); - - it('should return process non-zero exit codes', (done) => { - const term = new WindowsTerminal('cmd.exe', '/C exit 2'); - term.on('exit', (code) => { - assert.equal(code, 2); - done(); - }); - }); - }); - }); -} diff --git a/node_modules/node-pty/src/windowsTerminal.ts b/node_modules/node-pty/src/windowsTerminal.ts deleted file mode 100644 index b076288..0000000 --- a/node_modules/node-pty/src/windowsTerminal.ts +++ /dev/null @@ -1,187 +0,0 @@ -/** - * Copyright (c) 2012-2015, Christopher Jeffrey, Peter Sunde (MIT License) - * Copyright (c) 2016, Daniel Imms (MIT License). - * Copyright (c) 2018, Microsoft Corporation (MIT License). - */ - -import { Socket } from 'net'; -import { Terminal, DEFAULT_COLS, DEFAULT_ROWS } from './terminal'; -import { WindowsPtyAgent } from './windowsPtyAgent'; -import { IPtyOpenOptions, IWindowsPtyForkOptions } from './interfaces'; -import { ArgvOrCommandLine } from './types'; -import { assign } from './utils'; - -const DEFAULT_FILE = 'cmd.exe'; -const DEFAULT_NAME = 'Windows Shell'; - -export class WindowsTerminal extends Terminal { - private _isReady: boolean; - private _deferreds: any[]; - private _agent: WindowsPtyAgent; - - constructor(file?: string, args?: ArgvOrCommandLine, opt?: IWindowsPtyForkOptions) { - super(opt); - - // Initialize arguments - args = args || []; - file = file || DEFAULT_FILE; - opt = opt || {}; - opt.env = opt.env || process.env; - - if (opt.encoding) { - console.warn('Setting encoding on Windows is not supported'); - } - - const env = assign({}, opt.env); - this._cols = opt.cols || DEFAULT_COLS; - this._rows = opt.rows || DEFAULT_ROWS; - const cwd = opt.cwd || process.cwd(); - const name = opt.name || env.TERM || DEFAULT_NAME; - const parsedEnv = this._parseEnv(env); - - // If the terminal is ready - this._isReady = false; - - // Functions that need to run after `ready` event is emitted. - this._deferreds = []; - - // Create new termal. - this._agent = new WindowsPtyAgent(file, args, parsedEnv, cwd, this._cols, this._rows, false, opt.useConpty, opt.conptyInheritCursor); - this._socket = this._agent.outSocket; - - // Not available until `ready` event emitted. - this._pid = this._agent.innerPid; - this._fd = this._agent.fd; - this._pty = this._agent.pty; - - // The forked windows terminal is not available until `ready` event is - // emitted. - this._socket.on('ready_datapipe', () => { - - // These events needs to be forwarded. - ['connect', 'data', 'end', 'timeout', 'drain'].forEach(event => { - this._socket.on(event, () => { - - // Wait until the first data event is fired then we can run deferreds. - if (!this._isReady && event === 'data') { - - // Terminal is now ready and we can avoid having to defer method - // calls. - this._isReady = true; - - // Execute all deferred methods - this._deferreds.forEach(fn => { - // NB! In order to ensure that `this` has all its references - // updated any variable that need to be available in `this` before - // the deferred is run has to be declared above this forEach - // statement. - fn.run(); - }); - - // Reset - this._deferreds = []; - - } - }); - }); - - // Shutdown if `error` event is emitted. - this._socket.on('error', err => { - // Close terminal session. - this._close(); - - // EIO, happens when someone closes our child process: the only process - // in the terminal. - // node < 0.6.14: errno 5 - // node >= 0.6.14: read EIO - if ((err).code) { - if (~(err).code.indexOf('errno 5') || ~(err).code.indexOf('EIO')) return; - } - - // Throw anything else. - if (this.listeners('error').length < 2) { - throw err; - } - }); - - // Cleanup after the socket is closed. - this._socket.on('close', () => { - this.emit('exit', this._agent.exitCode); - this._close(); - }); - - }); - - this._file = file; - this._name = name; - - this._readable = true; - this._writable = true; - - this._forwardEvents(); - } - - protected _write(data: string): void { - this._defer(this._doWrite, data); - } - - private _doWrite(data: string): void { - this._agent.inSocket.write(data); - } - - /** - * openpty - */ - - public static open(options?: IPtyOpenOptions): void { - throw new Error('open() not supported on windows, use Fork() instead.'); - } - - /** - * TTY - */ - - public resize(cols: number, rows: number): void { - if (cols <= 0 || rows <= 0 || isNaN(cols) || isNaN(rows) || cols === Infinity || rows === Infinity) { - throw new Error('resizing must be done using positive cols and rows'); - } - this._defer(() => { - this._agent.resize(cols, rows); - this._cols = cols; - this._rows = rows; - }); - } - - public destroy(): void { - this._defer(() => { - this.kill(); - }); - } - - public kill(signal?: string): void { - this._defer(() => { - if (signal) { - throw new Error('Signals not supported on windows.'); - } - this._close(); - this._agent.kill(); - }); - } - - private _defer(deferredFn: (arg?: A) => void, arg?: A): void { - // If the terminal is ready, execute. - if (this._isReady) { - deferredFn.call(this, arg); - return; - } - - // Queue until terminal is ready. - this._deferreds.push({ - run: () => deferredFn.call(this, arg) - }); - } - - public get process(): string { return this._name; } - public get master(): Socket { throw new Error('master is not supported on Windows'); } - public get slave(): Socket { throw new Error('slave is not supported on Windows'); } -} diff --git a/node_modules/node-pty/typings/node-pty.d.ts b/node_modules/node-pty/typings/node-pty.d.ts deleted file mode 100644 index 5b1e0e4..0000000 --- a/node_modules/node-pty/typings/node-pty.d.ts +++ /dev/null @@ -1,202 +0,0 @@ -/** - * Copyright (c) 2017, Daniel Imms (MIT License). - * Copyright (c) 2018, Microsoft Corporation (MIT License). - */ - -declare module 'node-pty' { - /** - * Forks a process as a pseudoterminal. - * @param file The file to launch. - * @param args The file's arguments as argv (string[]) or in a pre-escaped CommandLine format - * (string). Note that the CommandLine option is only available on Windows and is expected to be - * escaped properly. - * @param options The options of the terminal. - * @see CommandLineToArgvW https://msdn.microsoft.com/en-us/library/windows/desktop/bb776391(v=vs.85).aspx - * @see Parsing C++ Comamnd-Line Arguments https://msdn.microsoft.com/en-us/library/17w5ykft.aspx - * @see GetCommandLine https://msdn.microsoft.com/en-us/library/windows/desktop/ms683156.aspx - */ - export function spawn(file: string, args: string[] | string, options: IPtyForkOptions | IWindowsPtyForkOptions): IPty; - - export interface IBasePtyForkOptions { - - /** - * Name of the terminal to be set in environment ($TERM variable). - */ - name?: string; - - /** - * Number of intial cols of the pty. - */ - cols?: number; - - /** - * Number of initial rows of the pty. - */ - rows?: number; - - /** - * Working directory to be set for the slave program. - */ - cwd?: string; - - /** - * Environment to be set for the slave program. - */ - env?: { [key: string]: string }; - - /** - * String encoding of the underlying pty. - * If set, incoming data will be decoded to strings and outgoing strings to bytes applying this encoding. - * If unset, incoming data will be delivered as raw bytes (Buffer type). - * By default 'utf8' is assumed, to unset it explicitly set it to `null`. - */ - encoding?: string | null; - - /** - * (EXPERIMENTAL) - * Whether to enable flow control handling (false by default). If enabled a message of `flowControlPause` - * will pause the socket and thus blocking the slave program execution due to buffer back pressure. - * A message of `flowControlResume` will resume the socket into flow mode. - * For performance reasons only a single message as a whole will match (no message part matching). - * If flow control is enabled the `flowControlPause` and `flowControlResume` messages are not forwarded to - * the underlying pseudoterminal. - */ - handleFlowControl?: boolean; - - /** - * (EXPERIMENTAL) - * The string that should pause the pty when `handleFlowControl` is true. Default is XOFF ('\x13'). - */ - flowControlPause?: string; - - /** - * (EXPERIMENTAL) - * The string that should resume the pty when `handleFlowControl` is true. Default is XON ('\x11'). - */ - flowControlResume?: string; - } - - export interface IPtyForkOptions extends IBasePtyForkOptions { - /** - * Security warning: use this option with great caution, as opened file descriptors - * with higher privileges might leak to the slave program. - */ - uid?: number; - gid?: number; - } - - export interface IWindowsPtyForkOptions extends IBasePtyForkOptions { - /** - * Whether to use the ConPTY system on Windows. When this is not set, ConPTY will be used when - * the Windows build number is >= 18309 (instead of winpty). Note that ConPTY is available from - * build 17134 but is too unstable to enable by default. - * - * This setting does nothing on non-Windows. - */ - useConpty?: boolean; - - /** - * Whether to use PSEUDOCONSOLE_INHERIT_CURSOR in conpty. - * @see https://docs.microsoft.com/en-us/windows/console/createpseudoconsole - */ - conptyInheritCursor?: boolean; - } - - /** - * An interface representing a pseudoterminal, on Windows this is emulated via the winpty library. - */ - export interface IPty { - /** - * The process ID of the outer process. - */ - readonly pid: number; - - /** - * The column size in characters. - */ - readonly cols: number; - - /** - * The row size in characters. - */ - readonly rows: number; - - /** - * The title of the active process. - */ - readonly process: string; - - /** - * (EXPERIMENTAL) - * Whether to handle flow control. Useful to disable/re-enable flow control during runtime. - * Use this for binary data that is likely to contain the `flowControlPause` string by accident. - */ - handleFlowControl: boolean; - - /** - * Adds an event listener for when a data event fires. This happens when data is returned from - * the pty. - * @returns an `IDisposable` to stop listening. - */ - readonly onData: IEvent; - - /** - * Adds an event listener for when an exit event fires. This happens when the pty exits. - * @returns an `IDisposable` to stop listening. - */ - readonly onExit: IEvent<{ exitCode: number, signal?: number }>; - - /** - * Adds a listener to the data event, fired when data is returned from the pty. - * @param event The name of the event. - * @param listener The callback function. - * @deprecated Use IPty.onData - */ - on(event: 'data', listener: (data: string) => void): void; - - /** - * Adds a listener to the exit event, fired when the pty exits. - * @param event The name of the event. - * @param listener The callback function, exitCode is the exit code of the process and signal is - * the signal that triggered the exit. signal is not supported on Windows. - * @deprecated Use IPty.onExit - */ - on(event: 'exit', listener: (exitCode: number, signal?: number) => void): void; - - /** - * Resizes the dimensions of the pty. - * @param columns THe number of columns to use. - * @param rows The number of rows to use. - */ - resize(columns: number, rows: number): void; - - /** - * Writes data to the pty. - * @param data The data to write. - */ - write(data: string): void; - - /** - * Kills the pty. - * @param signal The signal to use, defaults to SIGHUP. This parameter is not supported on - * Windows. - * @throws Will throw when signal is used on Windows. - */ - kill(signal?: string): void; - } - - /** - * An object that can be disposed via a dispose function. - */ - export interface IDisposable { - dispose(): void; - } - - /** - * An event that can be listened to. - * @returns an `IDisposable` to stop listening. - */ - export interface IEvent { - (listener: (e: T) => any): IDisposable; - } -} diff --git a/node_modules/node-static/LICENSE b/node_modules/node-static/LICENSE deleted file mode 100644 index 8f85526..0000000 --- a/node_modules/node-static/LICENSE +++ /dev/null @@ -1,20 +0,0 @@ -Copyright (c) 2010-14 Alexis Sellier - -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. diff --git a/node_modules/node-static/README.md b/node_modules/node-static/README.md deleted file mode 100644 index 70eec00..0000000 --- a/node_modules/node-static/README.md +++ /dev/null @@ -1,234 +0,0 @@ -node-static -=========== - -> a simple, *rfc 2616 compliant* file streaming module for [node](http://nodejs.org) - -node-static understands and supports *conditional GET* and *HEAD* requests. -node-static was inspired by some of the other static-file serving modules out there, -such as node-paperboy and antinode. - -Synopsis --------- - -```js -var static = require('node-static'); - -// -// Create a node-static server instance to serve the './public' folder -// -var file = new static.Server('./public'); - -require('http').createServer(function (request, response) { - request.addListener('end', function () { - // - // Serve files! - // - file.serve(request, response); - }).resume(); -}).listen(8080); -``` - -API ---- - -### Creating a node-static Server # - -Creating a file server instance is as simple as: - -```js -new static.Server(); -``` - -This will serve files in the current directory. If you want to serve files in a specific -directory, pass it as the first argument: - -```js -new static.Server('./public'); -``` - -You can also specify how long the client is supposed to cache the files node-static serves: - -```js -new static.Server('./public', { cache: 3600 }); -``` - -This will set the `Cache-Control` header, telling clients to cache the file for an hour. -This is the default setting. - -### Serving files under a directory # - -To serve files under a directory, simply call the `serve` method on a `Server` instance, passing it -the HTTP request and response object: - -```js -var static = require('node-static'); - -var fileServer = new static.Server('./public'); - -require('http').createServer(function (request, response) { - request.addListener('end', function () { - fileServer.serve(request, response); - }).resume(); -}).listen(8080); -``` - -### Serving specific files # - -If you want to serve a specific file, like an error page for example, use the `serveFile` method: - -```js -fileServer.serveFile('/error.html', 500, {}, request, response); -``` - -This will serve the `error.html` file, from under the file root directory, with a `500` status code. -For example, you could serve an error page, when the initial request wasn't found: - -```js -require('http').createServer(function (request, response) { - request.addListener('end', function () { - fileServer.serve(request, response, function (e, res) { - if (e && (e.status === 404)) { // If the file wasn't found - fileServer.serveFile('/not-found.html', 404, {}, request, response); - } - }); - }).resume(); -}).listen(8080); -``` - -More on intercepting errors bellow. - -### Intercepting errors & Listening # - -An optional callback can be passed as last argument, it will be called every time a file -has been served successfully, or if there was an error serving the file: - -```js -var static = require('node-static'); - -var fileServer = new static.Server('./public'); - -require('http').createServer(function (request, response) { - request.addListener('end', function () { - fileServer.serve(request, response, function (err, result) { - if (err) { // There was an error serving the file - console.error("Error serving " + request.url + " - " + err.message); - - // Respond to the client - response.writeHead(err.status, err.headers); - response.end(); - } - }); - }).resume(); -}).listen(8080); -``` - -Note that if you pass a callback, and there is an error serving the file, node-static -*will not* respond to the client. This gives you the opportunity to re-route the request, -or handle it differently. - -For example, you may want to interpret a request as a static request, but if the file isn't found, -send it to an application. - -If you only want to *listen* for errors, you can use *event listeners*: - -```js -fileServer.serve(request, response).addListener('error', function (err) { - console.error("Error serving " + request.url + " - " + err.message); -}); -``` - -With this method, you don't have to explicitly send the response back, in case of an error. - -### Options when creating an instance of `Server` # - -#### `cache` # - -Sets the `Cache-Control` header. - -example: `{ cache: 7200 }` - -Passing a number will set the cache duration to that number of seconds. -Passing `false` will disable the `Cache-Control` header. - -> Defaults to `3600` - - -#### `serverInfo` # - -Sets the `Server` header. - -example: `{ serverInfo: "myserver" }` - -> Defaults to `node-static/{version}` - -#### `headers` # - -Sets response headers. - -example: `{ 'X-Hello': 'World!' }` - -> defaults to `{}` - -#### `gzip` # - -Enable support for sending compressed responses. This will enable a check for a -file with the same name plus '.gz' in the same folder. If the compressed file is -found and the client has indicated support for gzip file transfer, the contents -of the .gz file will be sent in place of the uncompressed file along with a -Content-Encoding: gzip header to inform the client the data has been compressed. - -example: `{ gzip: true }` -example: `{ gzip: /^\/text/ }` - -Passing `true` will enable this check for all files. -Passing a RegExp instance will only enable this check if the content-type of the -respond would match that RegExp using its test() method. - -> Defaults to `false` - -#### `indexFile` # - -Choose a custom index file when serving up directories. - -example: `{ indexFile: "index.htm" }` - -> Defaults to `index.html` - - -Command Line Interface ----------------------- - -`node-static` also provides a CLI. - -### Installation # - -```sh -$ npm install -g node-static -``` - -### Example Usage # - -```sh -# serve up the current directory -$ static -serving "." at http://127.0.0.1:8080 - -# serve up a different directory -$ static public -serving "public" at http://127.0.0.1:8080 - -# specify additional headers (this one is useful for development) -$ static -H '{"Cache-Control": "no-cache, must-revalidate"}' -serving "." at http://127.0.0.1:8080 - -# set cache control max age -$ static -c 7200 -serving "." at http://127.0.0.1:8080 - -# expose the server to your local network -$ static -a 0.0.0.0 -serving "." at http://0.0.0.0:8080 - -# show help message, including all options -$ static -h -``` diff --git a/node_modules/node-static/benchmark/node-static-0.3.0.txt b/node_modules/node-static/benchmark/node-static-0.3.0.txt deleted file mode 100644 index c6083ea..0000000 --- a/node_modules/node-static/benchmark/node-static-0.3.0.txt +++ /dev/null @@ -1,43 +0,0 @@ -This is ApacheBench, Version 2.3 <$Revision: 655654 $> -Copyright 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/ -Licensed to The Apache Software Foundation, http://www.apache.org/ - -Benchmarking 127.0.0.1 (be patient) - - -Server Software: node-static/0.3.0 -Server Hostname: 127.0.0.1 -Server Port: 8080 - -Document Path: /lib/node-static.js -Document Length: 6038 bytes - -Concurrency Level: 20 -Time taken for tests: 2.323 seconds -Complete requests: 10000 -Failed requests: 0 -Write errors: 0 -Total transferred: 63190000 bytes -HTML transferred: 60380000 bytes -Requests per second: 4304.67 [#/sec] (mean) -Time per request: 4.646 [ms] (mean) -Time per request: 0.232 [ms] (mean, across all concurrent requests) -Transfer rate: 26563.66 [Kbytes/sec] received - -Connection Times (ms) - min mean[+/-sd] median max -Connect: 0 0 0.2 0 3 -Processing: 1 4 1.4 4 28 -Waiting: 1 4 1.3 4 18 -Total: 2 5 1.5 4 28 - -Percentage of the requests served within a certain time (ms) - 50% 4 - 66% 5 - 75% 5 - 80% 5 - 90% 5 - 95% 6 - 98% 8 - 99% 9 - 100% 28 (longest request) diff --git a/node_modules/node-static/bin/cli.js b/node_modules/node-static/bin/cli.js deleted file mode 100755 index ecdab3f..0000000 --- a/node_modules/node-static/bin/cli.js +++ /dev/null @@ -1,131 +0,0 @@ -#!/usr/bin/env node - -var fs = require('fs'), - tty = require('tty'), - statik = require('./../lib/node-static'); - - var argv = require('optimist') - .usage([ - 'USAGE: $0 [-p ] []', - 'simple, rfc 2616 compliant file streaming module for node'] - .join('\n\n')) - .option('port', { - alias: 'p', - 'default': 8080, - description: 'TCP port at which the files will be served' - }) - .option('host-address', { - alias: 'a', - 'default': '127.0.0.1', - description: 'the local network interface at which to listen' - }) - .option('cache', { - alias: 'c', - description: '"Cache-Control" header setting, defaults to 3600' - }) - .option('version', { - alias: 'v', - description: 'node-static version' - }) - .option('headers', { - alias: 'H', - description: 'additional headers (in JSON format)' - }) - .option('header-file', { - alias: 'f', - description: 'JSON file of additional headers' - }) - .option('gzip', { - alias: 'z', - description: 'enable compression (tries to serve file of same name plus \'.gz\')' - }) - .option('spa', { - description: 'serve the content as a single page app by redirecting all non-file requests to the index html file' - }) - .option('indexFile', { - alias: 'i', - 'default': 'index.html', - description: 'specify a custom index file when serving up directories' - }) - .option('help', { - alias: 'h', - description: 'display this help message' - }) - .argv; - - var dir = argv._[0] || '.'; - - var colors = require('colors'); - - var log = function(request, response, statusCode) { - var d = new Date(); - var seconds = d.getSeconds() < 10? '0'+d.getSeconds() : d.getSeconds(), - datestr = d.getHours() + ':' + d.getMinutes() + ':' + seconds, - line = datestr + ' [' + response.statusCode + ']: ' + request.url, - colorized = line; - if (tty.isatty(process.stdout.fd)) - colorized = (response.statusCode >= 500) ? line.red.bold : - (response.statusCode >= 400) ? line.red : - line; - console.log(colorized); - }; - - var file, options; - -if (argv.help) { - require('optimist').showHelp(console.log); - process.exit(0); -} - -if (argv.version) { - console.log('node-static', statik.version.join('.')); - process.exit(0); -} - -if (argv.cache) { - (options = options || {}).cache = argv.cache; -} - -if (argv.headers) { - (options = options || {}).headers = JSON.parse(argv.headers); -} - -if (argv['header-file']) { - (options = options || {}).headers = - JSON.parse(fs.readFileSync(argv['header-file'])); -} - -if (argv.gzip) { - (options = options || {}).gzip = true; -} - -if (argv.indexFile) { - (options = options || {}).indexFile = argv['indexFile']; -} - -file = new(statik.Server)(dir, options); - -require('http').createServer(function (request, response) { - request.addListener('end', function () { - var callback = function(e, rsp) { - if (e && e.status === 404) { - response.writeHead(e.status, e.headers); - response.end("Not Found"); - log(request, response); - } else { - log(request, response); - } - }; - - if (argv['spa'] && request.url.indexOf(".") == -1) { - file.serveFile(argv['indexFile'], 200, {}, request, response); - } else { - file.serve(request, response, callback); - } - }).resume(); -}).listen(+argv.port, argv['host-address']); - -console.log('serving "' + dir + '" at http://' + argv['host-address'] + ':' + argv.port); -if (argv.spa) { - console.log('serving as a single page app (all non-file requests redirect to ' + argv['indexFile'] +')'); -} diff --git a/node_modules/node-static/examples/file-server.js b/node_modules/node-static/examples/file-server.js deleted file mode 100644 index 4f0796e..0000000 --- a/node_modules/node-static/examples/file-server.js +++ /dev/null @@ -1,20 +0,0 @@ -var static = require('../lib/node-static'); - -// -// Create a node-static server to serve the current directory -// -var file = new static.Server('.', { cache: 7200, headers: {'X-Hello':'World!'} }); - -require('http').createServer(function (request, response) { - file.serve(request, response, function (err, res) { - if (err) { // An error as occured - console.error("> Error serving " + request.url + " - " + err.message); - response.writeHead(err.status, err.headers); - response.end(); - } else { // The file was served successfully - console.log("> " + request.url + " - " + res.message); - } - }); -}).listen(8080); - -console.log("> node-static is listening on http://127.0.0.1:8080"); diff --git a/node_modules/node-static/lib/node-static.js b/node_modules/node-static/lib/node-static.js deleted file mode 100644 index 15d8144..0000000 --- a/node_modules/node-static/lib/node-static.js +++ /dev/null @@ -1,393 +0,0 @@ -var fs = require('fs') - , events = require('events') - , buffer = require('buffer') - , http = require('http') - , url = require('url') - , path = require('path') - , mime = require('mime') - , util = require('./node-static/util'); - -// Current version -var version = [0, 7, 9]; - -var Server = function (root, options) { - if (root && (typeof(root) === 'object')) { options = root; root = null } - - // resolve() doesn't normalize (to lowercase) drive letters on Windows - this.root = path.normalize(path.resolve(root || '.')); - this.options = options || {}; - this.cache = 3600; - - this.defaultHeaders = {}; - this.options.headers = this.options.headers || {}; - - this.options.indexFile = this.options.indexFile || "index.html"; - - if ('cache' in this.options) { - if (typeof(this.options.cache) === 'number') { - this.cache = this.options.cache; - } else if (! this.options.cache) { - this.cache = false; - } - } - - if ('serverInfo' in this.options) { - this.serverInfo = this.options.serverInfo.toString(); - } else { - this.serverInfo = 'node-static/' + version.join('.'); - } - - this.defaultHeaders['server'] = this.serverInfo; - - if (this.cache !== false) { - this.defaultHeaders['cache-control'] = 'max-age=' + this.cache; - } - - for (var k in this.defaultHeaders) { - this.options.headers[k] = this.options.headers[k] || - this.defaultHeaders[k]; - } -}; - -Server.prototype.serveDir = function (pathname, req, res, finish) { - var htmlIndex = path.join(pathname, this.options.indexFile), - that = this; - - fs.stat(htmlIndex, function (e, stat) { - if (!e) { - var status = 200; - var headers = {}; - var originalPathname = decodeURI(url.parse(req.url).pathname); - if (originalPathname.length && originalPathname.charAt(originalPathname.length - 1) !== '/') { - return finish(301, { 'Location': originalPathname + '/' }); - } else { - that.respond(null, status, headers, [htmlIndex], stat, req, res, finish); - } - } else { - // Stream a directory of files as a single file. - fs.readFile(path.join(pathname, 'index.json'), function (e, contents) { - if (e) { return finish(404, {}) } - var index = JSON.parse(contents); - streamFiles(index.files); - }); - } - }); - function streamFiles(files) { - util.mstat(pathname, files, function (e, stat) { - if (e) { return finish(404, {}) } - that.respond(pathname, 200, {}, files, stat, req, res, finish); - }); - } -}; - -Server.prototype.serveFile = function (pathname, status, headers, req, res) { - var that = this; - var promise = new(events.EventEmitter); - - pathname = this.resolve(pathname); - - fs.stat(pathname, function (e, stat) { - if (e) { - return promise.emit('error', e); - } - that.respond(null, status, headers, [pathname], stat, req, res, function (status, headers) { - that.finish(status, headers, req, res, promise); - }); - }); - return promise; -}; - -Server.prototype.finish = function (status, headers, req, res, promise, callback) { - var result = { - status: status, - headers: headers, - message: http.STATUS_CODES[status] - }; - - headers['server'] = this.serverInfo; - - if (!status || status >= 400) { - if (callback) { - callback(result); - } else { - if (promise.listeners('error').length > 0) { - promise.emit('error', result); - } - else { - res.writeHead(status, headers); - res.end(); - } - } - } else { - // Don't end the request here, if we're streaming; - // it's taken care of in `prototype.stream`. - if (status !== 200 || req.method !== 'GET') { - res.writeHead(status, headers); - res.end(); - } - callback && callback(null, result); - promise.emit('success', result); - } -}; - -Server.prototype.servePath = function (pathname, status, headers, req, res, finish) { - var that = this, - promise = new(events.EventEmitter); - - pathname = this.resolve(pathname); - - // Make sure we're not trying to access a - // file outside of the root. - if (pathname.indexOf(that.root) === 0) { - fs.stat(pathname, function (e, stat) { - if (e) { - finish(404, {}); - } else if (stat.isFile()) { // Stream a single file. - that.respond(null, status, headers, [pathname], stat, req, res, finish); - } else if (stat.isDirectory()) { // Stream a directory of files. - that.serveDir(pathname, req, res, finish); - } else { - finish(400, {}); - } - }); - } else { - // Forbidden - finish(403, {}); - } - return promise; -}; - -Server.prototype.resolve = function (pathname) { - return path.resolve(path.join(this.root, pathname)); -}; - -Server.prototype.serve = function (req, res, callback) { - var that = this, - promise = new(events.EventEmitter), - pathname; - - var finish = function (status, headers) { - that.finish(status, headers, req, res, promise, callback); - }; - - try { - pathname = decodeURI(url.parse(req.url).pathname); - } - catch(e) { - return process.nextTick(function() { - return finish(400, {}); - }); - } - - process.nextTick(function () { - that.servePath(pathname, 200, {}, req, res, finish).on('success', function (result) { - promise.emit('success', result); - }).on('error', function (err) { - promise.emit('error'); - }); - }); - if (! callback) { return promise } -}; - -/* Check if we should consider sending a gzip version of the file based on the - * file content type and client's Accept-Encoding header value. - */ -Server.prototype.gzipOk = function (req, contentType) { - var enable = this.options.gzip; - if(enable && - (typeof enable === 'boolean' || - (contentType && (enable instanceof RegExp) && enable.test(contentType)))) { - var acceptEncoding = req.headers['accept-encoding']; - return acceptEncoding && acceptEncoding.indexOf("gzip") >= 0; - } - return false; -} - -/* Send a gzipped version of the file if the options and the client indicate gzip is enabled and - * we find a .gz file mathing the static resource requested. - */ -Server.prototype.respondGzip = function (pathname, status, contentType, _headers, files, stat, req, res, finish) { - var that = this; - if (files.length == 1 && this.gzipOk(req, contentType)) { - var gzFile = files[0] + ".gz"; - fs.stat(gzFile, function (e, gzStat) { - if (!e && gzStat.isFile()) { - var vary = _headers['Vary']; - _headers['Vary'] = (vary && vary != 'Accept-Encoding' ? vary + ', ' : '') + 'Accept-Encoding'; - _headers['Content-Encoding'] = 'gzip'; - stat.size = gzStat.size; - files = [gzFile]; - } - that.respondNoGzip(pathname, status, contentType, _headers, files, stat, req, res, finish); - }); - } else { - // Client doesn't want gzip or we're sending multiple files - that.respondNoGzip(pathname, status, contentType, _headers, files, stat, req, res, finish); - } -} - -Server.prototype.parseByteRange = function (req, stat) { - var byteRange = { - from: 0, - to: 0, - valid: false - } - - var rangeHeader = req.headers['range']; - var flavor = 'bytes='; - - if (rangeHeader) { - if (rangeHeader.indexOf(flavor) == 0 && rangeHeader.indexOf(',') == -1) { - /* Parse */ - rangeHeader = rangeHeader.substr(flavor.length).split('-'); - byteRange.from = parseInt(rangeHeader[0]); - byteRange.to = parseInt(rangeHeader[1]); - - /* Replace empty fields of differential requests by absolute values */ - if (isNaN(byteRange.from) && !isNaN(byteRange.to)) { - byteRange.from = stat.size - byteRange.to; - byteRange.to = stat.size ? stat.size - 1 : 0; - } else if (!isNaN(byteRange.from) && isNaN(byteRange.to)) { - byteRange.to = stat.size ? stat.size - 1 : 0; - } - - /* General byte range validation */ - if (!isNaN(byteRange.from) && !!byteRange.to && 0 <= byteRange.from && byteRange.from < byteRange.to) { - byteRange.valid = true; - } else { - console.warn("Request contains invalid range header: ", rangeHeader); - } - } else { - console.warn("Request contains unsupported range header: ", rangeHeader); - } - } - return byteRange; -} - -Server.prototype.respondNoGzip = function (pathname, status, contentType, _headers, files, stat, req, res, finish) { - var mtime = Date.parse(stat.mtime), - key = pathname || files[0], - headers = {}, - clientETag = req.headers['if-none-match'], - clientMTime = Date.parse(req.headers['if-modified-since']), - startByte = 0, - length = stat.size, - byteRange = this.parseByteRange(req, stat); - - /* Handle byte ranges */ - if (files.length == 1 && byteRange.valid) { - if (byteRange.to < length) { - - // Note: HTTP Range param is inclusive - startByte = byteRange.from; - length = byteRange.to - byteRange.from + 1; - status = 206; - - // Set Content-Range response header (we advertise initial resource size on server here (stat.size)) - headers['Content-Range'] = 'bytes ' + byteRange.from + '-' + byteRange.to + '/' + stat.size; - - } else { - byteRange.valid = false; - console.warn("Range request exceeds file boundaries, goes until byte no", byteRange.to, "against file size of", length, "bytes"); - } - } - - /* In any case, check for unhandled byte range headers */ - if (!byteRange.valid && req.headers['range']) { - console.error(new Error("Range request present but invalid, might serve whole file instead")); - } - - // Copy default headers - for (var k in this.options.headers) { headers[k] = this.options.headers[k] } - // Copy custom headers - for (var k in _headers) { headers[k] = _headers[k] } - - headers['Etag'] = JSON.stringify([stat.ino, stat.size, mtime].join('-')); - headers['Date'] = new(Date)().toUTCString(); - headers['Last-Modified'] = new(Date)(stat.mtime).toUTCString(); - headers['Content-Type'] = contentType; - headers['Content-Length'] = length; - - for (var k in _headers) { headers[k] = _headers[k] } - - // Conditional GET - // If the "If-Modified-Since" or "If-None-Match" headers - // match the conditions, send a 304 Not Modified. - if ((clientMTime || clientETag) && - (!clientETag || clientETag === headers['Etag']) && - (!clientMTime || clientMTime >= mtime)) { - // 304 response should not contain entity headers - ['Content-Encoding', - 'Content-Language', - 'Content-Length', - 'Content-Location', - 'Content-MD5', - 'Content-Range', - 'Content-Type', - 'Expires', - 'Last-Modified'].forEach(function (entityHeader) { - delete headers[entityHeader]; - }); - finish(304, headers); - } else { - res.writeHead(status, headers); - - this.stream(key, files, length, startByte, res, function (e) { - if (e) { return finish(500, {}) } - finish(status, headers); - }); - } -}; - -Server.prototype.respond = function (pathname, status, _headers, files, stat, req, res, finish) { - var contentType = _headers['Content-Type'] || - mime.lookup(files[0]) || - 'application/octet-stream'; - - if(this.options.gzip) { - this.respondGzip(pathname, status, contentType, _headers, files, stat, req, res, finish); - } else { - this.respondNoGzip(pathname, status, contentType, _headers, files, stat, req, res, finish); - } -} - -Server.prototype.stream = function (pathname, files, length, startByte, res, callback) { - - (function streamFile(files, offset) { - var file = files.shift(); - - if (file) { - file = path.resolve(file) === path.normalize(file) ? file : path.join(pathname || '.', file); - - // Stream the file to the client - fs.createReadStream(file, { - flags: 'r', - mode: 0666, - start: startByte, - end: startByte + (length ? length - 1 : 0) - }).on('data', function (chunk) { - // Bounds check the incoming chunk and offset, as copying - // a buffer from an invalid offset will throw an error and crash - if (chunk.length && offset < length && offset >= 0) { - offset += chunk.length; - } - }).on('close', function () { - streamFile(files, offset); - }).on('error', function (err) { - callback(err); - console.error(err); - }).pipe(res, { end: false }); - } else { - res.end(); - callback(null, offset); - } - })(files.slice(0), 0); -}; - -// Exports -exports.Server = Server; -exports.version = version; -exports.mime = mime; - - - diff --git a/node_modules/node-static/lib/node-static/util.js b/node_modules/node-static/lib/node-static/util.js deleted file mode 100644 index 02de548..0000000 --- a/node_modules/node-static/lib/node-static/util.js +++ /dev/null @@ -1,30 +0,0 @@ -var fs = require('fs') - , path = require('path'); - -exports.mstat = function (dir, files, callback) { - (function mstat(files, stats) { - var file = files.shift(); - - if (file) { - fs.stat(path.join(dir, file), function (e, stat) { - if (e) { - callback(e); - } else { - mstat(files, stats.concat([stat])); - } - }); - } else { - callback(null, { - size: stats.reduce(function (total, stat) { - return total + stat.size; - }, 0), - mtime: stats.reduce(function (latest, stat) { - return latest > stat.mtime ? latest : stat.mtime; - }, 0), - ino: stats.reduce(function (total, stat) { - return total + stat.ino; - }, 0) - }); - } - })(files.slice(0), []); -}; diff --git a/node_modules/node-static/node_modules/colors/LICENSE b/node_modules/node-static/node_modules/colors/LICENSE deleted file mode 100644 index 17880ff..0000000 --- a/node_modules/node-static/node_modules/colors/LICENSE +++ /dev/null @@ -1,25 +0,0 @@ -MIT License - -Original Library - - Copyright (c) Marak Squires - -Additional Functionality - - Copyright (c) Sindre Sorhus (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. diff --git a/node_modules/node-static/node_modules/colors/README.md b/node_modules/node-static/node_modules/colors/README.md deleted file mode 100644 index fabe558..0000000 --- a/node_modules/node-static/node_modules/colors/README.md +++ /dev/null @@ -1,221 +0,0 @@ -# colors.js -[![Build Status](https://travis-ci.org/Marak/colors.js.svg?branch=master)](https://travis-ci.org/Marak/colors.js) -[![version](https://img.shields.io/npm/v/colors.svg)](https://www.npmjs.org/package/colors) -[![dependencies](https://david-dm.org/Marak/colors.js.svg)](https://david-dm.org/Marak/colors.js) -[![devDependencies](https://david-dm.org/Marak/colors.js/dev-status.svg)](https://david-dm.org/Marak/colors.js#info=devDependencies) - -Please check out the [roadmap](ROADMAP.md) for upcoming features and releases. Please open Issues to provide feedback, and check the `develop` branch for the latest bleeding-edge updates. - -## get color and style in your node.js console - -![Demo](https://raw.githubusercontent.com/Marak/colors.js/master/screenshots/colors.png) - -## Installation - - npm install colors - -## colors and styles! - -### text colors - - - black - - red - - green - - yellow - - blue - - magenta - - cyan - - white - - gray - - grey - -### bright text colors - - - brightRed - - brightGreen - - brightYellow - - brightBlue - - brightMagenta - - brightCyan - - brightWhite - -### background colors - - - bgBlack - - bgRed - - bgGreen - - bgYellow - - bgBlue - - bgMagenta - - bgCyan - - bgWhite - - bgGray - - bgGrey - -### bright background colors - - - bgBrightRed - - bgBrightGreen - - bgBrightYellow - - bgBrightBlue - - bgBrightMagenta - - bgBrightCyan - - bgBrightWhite - -### styles - - - reset - - bold - - dim - - italic - - underline - - inverse - - hidden - - strikethrough - -### extras - - - rainbow - - zebra - - america - - trap - - random - - -## Usage - -By popular demand, `colors` now ships with two types of usages! - -The super nifty way - -```js -var colors = require('colors'); - -console.log('hello'.green); // outputs green text -console.log('i like cake and pies'.underline.red) // outputs red underlined text -console.log('inverse the color'.inverse); // inverses the color -console.log('OMG Rainbows!'.rainbow); // rainbow -console.log('Run the trap'.trap); // Drops the bass - -``` - -or a slightly less nifty way which doesn't extend `String.prototype` - -```js -var colors = require('colors/safe'); - -console.log(colors.green('hello')); // outputs green text -console.log(colors.red.underline('i like cake and pies')) // outputs red underlined text -console.log(colors.inverse('inverse the color')); // inverses the color -console.log(colors.rainbow('OMG Rainbows!')); // rainbow -console.log(colors.trap('Run the trap')); // Drops the bass - -``` - -I prefer the first way. Some people seem to be afraid of extending `String.prototype` and prefer the second way. - -If you are writing good code you will never have an issue with the first approach. If you really don't want to touch `String.prototype`, the second usage will not touch `String` native object. - -## Enabling/Disabling Colors - -The package will auto-detect whether your terminal can use colors and enable/disable accordingly. When colors are disabled, the color functions do nothing. You can override this with a command-line flag: - -```bash -node myapp.js --no-color -node myapp.js --color=false - -node myapp.js --color -node myapp.js --color=true -node myapp.js --color=always - -FORCE_COLOR=1 node myapp.js -``` - -Or in code: - -```javascript -var colors = require('colors'); -colors.enable(); -colors.disable(); -``` - -## Console.log [string substitution](http://nodejs.org/docs/latest/api/console.html#console_console_log_data) - -```js -var name = 'Marak'; -console.log(colors.green('Hello %s'), name); -// outputs -> 'Hello Marak' -``` - -## Custom themes - -### Using standard API - -```js - -var colors = require('colors'); - -colors.setTheme({ - silly: 'rainbow', - input: 'grey', - verbose: 'cyan', - prompt: 'grey', - info: 'green', - data: 'grey', - help: 'cyan', - warn: 'yellow', - debug: 'blue', - error: 'red' -}); - -// outputs red text -console.log("this is an error".error); - -// outputs yellow text -console.log("this is a warning".warn); -``` - -### Using string safe API - -```js -var colors = require('colors/safe'); - -// set single property -var error = colors.red; -error('this is red'); - -// set theme -colors.setTheme({ - silly: 'rainbow', - input: 'grey', - verbose: 'cyan', - prompt: 'grey', - info: 'green', - data: 'grey', - help: 'cyan', - warn: 'yellow', - debug: 'blue', - error: 'red' -}); - -// outputs red text -console.log(colors.error("this is an error")); - -// outputs yellow text -console.log(colors.warn("this is a warning")); - -``` - -### Combining Colors - -```javascript -var colors = require('colors'); - -colors.setTheme({ - custom: ['red', 'underline'] -}); - -console.log('test'.custom); -``` - -*Protip: There is a secret undocumented style in `colors`. If you find the style you can summon him.* diff --git a/node_modules/node-static/node_modules/colors/examples/normal-usage.js b/node_modules/node-static/node_modules/colors/examples/normal-usage.js deleted file mode 100644 index 822db1c..0000000 --- a/node_modules/node-static/node_modules/colors/examples/normal-usage.js +++ /dev/null @@ -1,82 +0,0 @@ -var colors = require('../lib/index'); - -console.log('First some yellow text'.yellow); - -console.log('Underline that text'.yellow.underline); - -console.log('Make it bold and red'.red.bold); - -console.log(('Double Raindows All Day Long').rainbow); - -console.log('Drop the bass'.trap); - -console.log('DROP THE RAINBOW BASS'.trap.rainbow); - -// styles not widely supported -console.log('Chains are also cool.'.bold.italic.underline.red); - -// styles not widely supported -console.log('So '.green + 'are'.underline + ' ' + 'inverse'.inverse - + ' styles! '.yellow.bold); -console.log('Zebras are so fun!'.zebra); - -// -// Remark: .strikethrough may not work with Mac OS Terminal App -// -console.log('This is ' + 'not'.strikethrough + ' fun.'); - -console.log('Background color attack!'.black.bgWhite); -console.log('Use random styles on everything!'.random); -console.log('America, Heck Yeah!'.america); - -console.log('Blindingly '.brightCyan + 'bright? '.brightRed + 'Why '.brightYellow + 'not?!'.brightGreen); - -console.log('Setting themes is useful'); - -// -// Custom themes -// -console.log('Generic logging theme as JSON'.green.bold.underline); -// Load theme with JSON literal -colors.setTheme({ - silly: 'rainbow', - input: 'grey', - verbose: 'cyan', - prompt: 'grey', - info: 'green', - data: 'grey', - help: 'cyan', - warn: 'yellow', - debug: 'blue', - error: 'red', -}); - -// outputs red text -console.log('this is an error'.error); - -// outputs yellow text -console.log('this is a warning'.warn); - -// outputs grey text -console.log('this is an input'.input); - -console.log('Generic logging theme as file'.green.bold.underline); - -// Load a theme from file -try { - colors.setTheme(require(__dirname + '/../themes/generic-logging.js')); -} catch (err) { - console.log(err); -} - -// outputs red text -console.log('this is an error'.error); - -// outputs yellow text -console.log('this is a warning'.warn); - -// outputs grey text -console.log('this is an input'.input); - -// console.log("Don't summon".zalgo) - diff --git a/node_modules/node-static/node_modules/colors/examples/safe-string.js b/node_modules/node-static/node_modules/colors/examples/safe-string.js deleted file mode 100644 index 5bc0168..0000000 --- a/node_modules/node-static/node_modules/colors/examples/safe-string.js +++ /dev/null @@ -1,79 +0,0 @@ -var colors = require('../safe'); - -console.log(colors.yellow('First some yellow text')); - -console.log(colors.yellow.underline('Underline that text')); - -console.log(colors.red.bold('Make it bold and red')); - -console.log(colors.rainbow('Double Raindows All Day Long')); - -console.log(colors.trap('Drop the bass')); - -console.log(colors.rainbow(colors.trap('DROP THE RAINBOW BASS'))); - -// styles not widely supported -console.log(colors.bold.italic.underline.red('Chains are also cool.')); - -// styles not widely supported -console.log(colors.green('So ') + colors.underline('are') + ' ' - + colors.inverse('inverse') + colors.yellow.bold(' styles! ')); - -console.log(colors.zebra('Zebras are so fun!')); - -console.log('This is ' + colors.strikethrough('not') + ' fun.'); - - -console.log(colors.black.bgWhite('Background color attack!')); -console.log(colors.random('Use random styles on everything!')); -console.log(colors.america('America, Heck Yeah!')); - -console.log(colors.brightCyan('Blindingly ') + colors.brightRed('bright? ') + colors.brightYellow('Why ') + colors.brightGreen('not?!')); - -console.log('Setting themes is useful'); - -// -// Custom themes -// -// console.log('Generic logging theme as JSON'.green.bold.underline); -// Load theme with JSON literal -colors.setTheme({ - silly: 'rainbow', - input: 'blue', - verbose: 'cyan', - prompt: 'grey', - info: 'green', - data: 'grey', - help: 'cyan', - warn: 'yellow', - debug: 'blue', - error: 'red', -}); - -// outputs red text -console.log(colors.error('this is an error')); - -// outputs yellow text -console.log(colors.warn('this is a warning')); - -// outputs blue text -console.log(colors.input('this is an input')); - - -// console.log('Generic logging theme as file'.green.bold.underline); - -// Load a theme from file -colors.setTheme(require(__dirname + '/../themes/generic-logging.js')); - -// outputs red text -console.log(colors.error('this is an error')); - -// outputs yellow text -console.log(colors.warn('this is a warning')); - -// outputs grey text -console.log(colors.input('this is an input')); - -// console.log(colors.zalgo("Don't summon him")) - - diff --git a/node_modules/node-static/node_modules/colors/index.d.ts b/node_modules/node-static/node_modules/colors/index.d.ts deleted file mode 100644 index baa7068..0000000 --- a/node_modules/node-static/node_modules/colors/index.d.ts +++ /dev/null @@ -1,136 +0,0 @@ -// Type definitions for Colors.js 1.2 -// Project: https://github.com/Marak/colors.js -// Definitions by: Bart van der Schoor , Staffan Eketorp -// Definitions: https://github.com/Marak/colors.js - -export interface Color { - (text: string): string; - - strip: Color; - stripColors: Color; - - black: Color; - red: Color; - green: Color; - yellow: Color; - blue: Color; - magenta: Color; - cyan: Color; - white: Color; - gray: Color; - grey: Color; - - bgBlack: Color; - bgRed: Color; - bgGreen: Color; - bgYellow: Color; - bgBlue: Color; - bgMagenta: Color; - bgCyan: Color; - bgWhite: Color; - - reset: Color; - bold: Color; - dim: Color; - italic: Color; - underline: Color; - inverse: Color; - hidden: Color; - strikethrough: Color; - - rainbow: Color; - zebra: Color; - america: Color; - trap: Color; - random: Color; - zalgo: Color; -} - -export function enable(): void; -export function disable(): void; -export function setTheme(theme: any): void; - -export let enabled: boolean; - -export const strip: Color; -export const stripColors: Color; - -export const black: Color; -export const red: Color; -export const green: Color; -export const yellow: Color; -export const blue: Color; -export const magenta: Color; -export const cyan: Color; -export const white: Color; -export const gray: Color; -export const grey: Color; - -export const bgBlack: Color; -export const bgRed: Color; -export const bgGreen: Color; -export const bgYellow: Color; -export const bgBlue: Color; -export const bgMagenta: Color; -export const bgCyan: Color; -export const bgWhite: Color; - -export const reset: Color; -export const bold: Color; -export const dim: Color; -export const italic: Color; -export const underline: Color; -export const inverse: Color; -export const hidden: Color; -export const strikethrough: Color; - -export const rainbow: Color; -export const zebra: Color; -export const america: Color; -export const trap: Color; -export const random: Color; -export const zalgo: Color; - -declare global { - interface String { - strip: string; - stripColors: string; - - black: string; - red: string; - green: string; - yellow: string; - blue: string; - magenta: string; - cyan: string; - white: string; - gray: string; - grey: string; - - bgBlack: string; - bgRed: string; - bgGreen: string; - bgYellow: string; - bgBlue: string; - bgMagenta: string; - bgCyan: string; - bgWhite: string; - - reset: string; - // @ts-ignore - bold: string; - dim: string; - italic: string; - underline: string; - inverse: string; - hidden: string; - strikethrough: string; - - rainbow: string; - zebra: string; - america: string; - trap: string; - random: string; - zalgo: string; - } -} diff --git a/node_modules/node-static/node_modules/colors/lib/colors.js b/node_modules/node-static/node_modules/colors/lib/colors.js deleted file mode 100644 index 9c7f1d1..0000000 --- a/node_modules/node-static/node_modules/colors/lib/colors.js +++ /dev/null @@ -1,211 +0,0 @@ -/* - -The MIT License (MIT) - -Original Library - - Copyright (c) Marak Squires - -Additional functionality - - Copyright (c) Sindre Sorhus (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. - -*/ - -var colors = {}; -module['exports'] = colors; - -colors.themes = {}; - -var util = require('util'); -var ansiStyles = colors.styles = require('./styles'); -var defineProps = Object.defineProperties; -var newLineRegex = new RegExp(/[\r\n]+/g); - -colors.supportsColor = require('./system/supports-colors').supportsColor; - -if (typeof colors.enabled === 'undefined') { - colors.enabled = colors.supportsColor() !== false; -} - -colors.enable = function() { - colors.enabled = true; -}; - -colors.disable = function() { - colors.enabled = false; -}; - -colors.stripColors = colors.strip = function(str) { - return ('' + str).replace(/\x1B\[\d+m/g, ''); -}; - -// eslint-disable-next-line no-unused-vars -var stylize = colors.stylize = function stylize(str, style) { - if (!colors.enabled) { - return str+''; - } - - var styleMap = ansiStyles[style]; - - // Stylize should work for non-ANSI styles, too - if(!styleMap && style in colors){ - // Style maps like trap operate as functions on strings; - // they don't have properties like open or close. - return colors[style](str); - } - - return styleMap.open + str + styleMap.close; -}; - -var matchOperatorsRe = /[|\\{}()[\]^$+*?.]/g; -var escapeStringRegexp = function(str) { - if (typeof str !== 'string') { - throw new TypeError('Expected a string'); - } - return str.replace(matchOperatorsRe, '\\$&'); -}; - -function build(_styles) { - var builder = function builder() { - return applyStyle.apply(builder, arguments); - }; - builder._styles = _styles; - // __proto__ is used because we must return a function, but there is - // no way to create a function with a different prototype. - builder.__proto__ = proto; - return builder; -} - -var styles = (function() { - var ret = {}; - ansiStyles.grey = ansiStyles.gray; - Object.keys(ansiStyles).forEach(function(key) { - ansiStyles[key].closeRe = - new RegExp(escapeStringRegexp(ansiStyles[key].close), 'g'); - ret[key] = { - get: function() { - return build(this._styles.concat(key)); - }, - }; - }); - return ret; -})(); - -var proto = defineProps(function colors() {}, styles); - -function applyStyle() { - var args = Array.prototype.slice.call(arguments); - - var str = args.map(function(arg) { - // Use weak equality check so we can colorize null/undefined in safe mode - if (arg != null && arg.constructor === String) { - return arg; - } else { - return util.inspect(arg); - } - }).join(' '); - - if (!colors.enabled || !str) { - return str; - } - - var newLinesPresent = str.indexOf('\n') != -1; - - var nestedStyles = this._styles; - - var i = nestedStyles.length; - while (i--) { - var code = ansiStyles[nestedStyles[i]]; - str = code.open + str.replace(code.closeRe, code.open) + code.close; - if (newLinesPresent) { - str = str.replace(newLineRegex, function(match) { - return code.close + match + code.open; - }); - } - } - - return str; -} - -colors.setTheme = function(theme) { - if (typeof theme === 'string') { - console.log('colors.setTheme now only accepts an object, not a string. ' + - 'If you are trying to set a theme from a file, it is now your (the ' + - 'caller\'s) responsibility to require the file. The old syntax ' + - 'looked like colors.setTheme(__dirname + ' + - '\'/../themes/generic-logging.js\'); The new syntax looks like '+ - 'colors.setTheme(require(__dirname + ' + - '\'/../themes/generic-logging.js\'));'); - return; - } - for (var style in theme) { - (function(style) { - colors[style] = function(str) { - if (typeof theme[style] === 'object') { - var out = str; - for (var i in theme[style]) { - out = colors[theme[style][i]](out); - } - return out; - } - return colors[theme[style]](str); - }; - })(style); - } -}; - -function init() { - var ret = {}; - Object.keys(styles).forEach(function(name) { - ret[name] = { - get: function() { - return build([name]); - }, - }; - }); - return ret; -} - -var sequencer = function sequencer(map, str) { - var exploded = str.split(''); - exploded = exploded.map(map); - return exploded.join(''); -}; - -// custom formatter methods -colors.trap = require('./custom/trap'); -colors.zalgo = require('./custom/zalgo'); - -// maps -colors.maps = {}; -colors.maps.america = require('./maps/america')(colors); -colors.maps.zebra = require('./maps/zebra')(colors); -colors.maps.rainbow = require('./maps/rainbow')(colors); -colors.maps.random = require('./maps/random')(colors); - -for (var map in colors.maps) { - (function(map) { - colors[map] = function(str) { - return sequencer(colors.maps[map], str); - }; - })(map); -} - -defineProps(colors, init()); diff --git a/node_modules/node-static/node_modules/colors/lib/custom/trap.js b/node_modules/node-static/node_modules/colors/lib/custom/trap.js deleted file mode 100644 index fbccf88..0000000 --- a/node_modules/node-static/node_modules/colors/lib/custom/trap.js +++ /dev/null @@ -1,46 +0,0 @@ -module['exports'] = function runTheTrap(text, options) { - var result = ''; - text = text || 'Run the trap, drop the bass'; - text = text.split(''); - var trap = { - a: ['\u0040', '\u0104', '\u023a', '\u0245', '\u0394', '\u039b', '\u0414'], - b: ['\u00df', '\u0181', '\u0243', '\u026e', '\u03b2', '\u0e3f'], - c: ['\u00a9', '\u023b', '\u03fe'], - d: ['\u00d0', '\u018a', '\u0500', '\u0501', '\u0502', '\u0503'], - e: ['\u00cb', '\u0115', '\u018e', '\u0258', '\u03a3', '\u03be', '\u04bc', - '\u0a6c'], - f: ['\u04fa'], - g: ['\u0262'], - h: ['\u0126', '\u0195', '\u04a2', '\u04ba', '\u04c7', '\u050a'], - i: ['\u0f0f'], - j: ['\u0134'], - k: ['\u0138', '\u04a0', '\u04c3', '\u051e'], - l: ['\u0139'], - m: ['\u028d', '\u04cd', '\u04ce', '\u0520', '\u0521', '\u0d69'], - n: ['\u00d1', '\u014b', '\u019d', '\u0376', '\u03a0', '\u048a'], - o: ['\u00d8', '\u00f5', '\u00f8', '\u01fe', '\u0298', '\u047a', '\u05dd', - '\u06dd', '\u0e4f'], - p: ['\u01f7', '\u048e'], - q: ['\u09cd'], - r: ['\u00ae', '\u01a6', '\u0210', '\u024c', '\u0280', '\u042f'], - s: ['\u00a7', '\u03de', '\u03df', '\u03e8'], - t: ['\u0141', '\u0166', '\u0373'], - u: ['\u01b1', '\u054d'], - v: ['\u05d8'], - w: ['\u0428', '\u0460', '\u047c', '\u0d70'], - x: ['\u04b2', '\u04fe', '\u04fc', '\u04fd'], - y: ['\u00a5', '\u04b0', '\u04cb'], - z: ['\u01b5', '\u0240'], - }; - text.forEach(function(c) { - c = c.toLowerCase(); - var chars = trap[c] || [' ']; - var rand = Math.floor(Math.random() * chars.length); - if (typeof trap[c] !== 'undefined') { - result += trap[c][rand]; - } else { - result += c; - } - }); - return result; -}; diff --git a/node_modules/node-static/node_modules/colors/lib/custom/zalgo.js b/node_modules/node-static/node_modules/colors/lib/custom/zalgo.js deleted file mode 100644 index 0ef2b01..0000000 --- a/node_modules/node-static/node_modules/colors/lib/custom/zalgo.js +++ /dev/null @@ -1,110 +0,0 @@ -// please no -module['exports'] = function zalgo(text, options) { - text = text || ' he is here '; - var soul = { - 'up': [ - '̍', '̎', '̄', '̅', - '̿', '̑', '̆', '̐', - '͒', '͗', '͑', '̇', - '̈', '̊', '͂', '̓', - '̈', '͊', '͋', '͌', - '̃', '̂', '̌', '͐', - '̀', '́', '̋', '̏', - '̒', '̓', '̔', '̽', - '̉', 'ͣ', 'ͤ', 'ͥ', - 'ͦ', 'ͧ', 'ͨ', 'ͩ', - 'ͪ', 'ͫ', 'ͬ', 'ͭ', - 'ͮ', 'ͯ', '̾', '͛', - '͆', '̚', - ], - 'down': [ - '̖', '̗', '̘', '̙', - '̜', '̝', '̞', '̟', - '̠', '̤', '̥', '̦', - '̩', '̪', '̫', '̬', - '̭', '̮', '̯', '̰', - '̱', '̲', '̳', '̹', - '̺', '̻', '̼', 'ͅ', - '͇', '͈', '͉', '͍', - '͎', '͓', '͔', '͕', - '͖', '͙', '͚', '̣', - ], - 'mid': [ - '̕', '̛', '̀', '́', - '͘', '̡', '̢', '̧', - '̨', '̴', '̵', '̶', - '͜', '͝', '͞', - '͟', '͠', '͢', '̸', - '̷', '͡', ' ҉', - ], - }; - var all = [].concat(soul.up, soul.down, soul.mid); - - function randomNumber(range) { - var r = Math.floor(Math.random() * range); - return r; - } - - function isChar(character) { - var bool = false; - all.filter(function(i) { - bool = (i === character); - }); - return bool; - } - - - function heComes(text, options) { - var result = ''; - var counts; - var l; - options = options || {}; - options['up'] = - typeof options['up'] !== 'undefined' ? options['up'] : true; - options['mid'] = - typeof options['mid'] !== 'undefined' ? options['mid'] : true; - options['down'] = - typeof options['down'] !== 'undefined' ? options['down'] : true; - options['size'] = - typeof options['size'] !== 'undefined' ? options['size'] : 'maxi'; - text = text.split(''); - for (l in text) { - if (isChar(l)) { - continue; - } - result = result + text[l]; - counts = {'up': 0, 'down': 0, 'mid': 0}; - switch (options.size) { - case 'mini': - counts.up = randomNumber(8); - counts.mid = randomNumber(2); - counts.down = randomNumber(8); - break; - case 'maxi': - counts.up = randomNumber(16) + 3; - counts.mid = randomNumber(4) + 1; - counts.down = randomNumber(64) + 3; - break; - default: - counts.up = randomNumber(8) + 1; - counts.mid = randomNumber(6) / 2; - counts.down = randomNumber(8) + 1; - break; - } - - var arr = ['up', 'mid', 'down']; - for (var d in arr) { - var index = arr[d]; - for (var i = 0; i <= counts[index]; i++) { - if (options[index]) { - result = result + soul[index][randomNumber(soul[index].length)]; - } - } - } - } - return result; - } - // don't summon him - return heComes(text, options); -}; - diff --git a/node_modules/node-static/node_modules/colors/lib/extendStringPrototype.js b/node_modules/node-static/node_modules/colors/lib/extendStringPrototype.js deleted file mode 100644 index 46fd386..0000000 --- a/node_modules/node-static/node_modules/colors/lib/extendStringPrototype.js +++ /dev/null @@ -1,110 +0,0 @@ -var colors = require('./colors'); - -module['exports'] = function() { - // - // Extends prototype of native string object to allow for "foo".red syntax - // - var addProperty = function(color, func) { - String.prototype.__defineGetter__(color, func); - }; - - addProperty('strip', function() { - return colors.strip(this); - }); - - addProperty('stripColors', function() { - return colors.strip(this); - }); - - addProperty('trap', function() { - return colors.trap(this); - }); - - addProperty('zalgo', function() { - return colors.zalgo(this); - }); - - addProperty('zebra', function() { - return colors.zebra(this); - }); - - addProperty('rainbow', function() { - return colors.rainbow(this); - }); - - addProperty('random', function() { - return colors.random(this); - }); - - addProperty('america', function() { - return colors.america(this); - }); - - // - // Iterate through all default styles and colors - // - var x = Object.keys(colors.styles); - x.forEach(function(style) { - addProperty(style, function() { - return colors.stylize(this, style); - }); - }); - - function applyTheme(theme) { - // - // Remark: This is a list of methods that exist - // on String that you should not overwrite. - // - var stringPrototypeBlacklist = [ - '__defineGetter__', '__defineSetter__', '__lookupGetter__', - '__lookupSetter__', 'charAt', 'constructor', 'hasOwnProperty', - 'isPrototypeOf', 'propertyIsEnumerable', 'toLocaleString', 'toString', - 'valueOf', 'charCodeAt', 'indexOf', 'lastIndexOf', 'length', - 'localeCompare', 'match', 'repeat', 'replace', 'search', 'slice', - 'split', 'substring', 'toLocaleLowerCase', 'toLocaleUpperCase', - 'toLowerCase', 'toUpperCase', 'trim', 'trimLeft', 'trimRight', - ]; - - Object.keys(theme).forEach(function(prop) { - if (stringPrototypeBlacklist.indexOf(prop) !== -1) { - console.log('warn: '.red + ('String.prototype' + prop).magenta + - ' is probably something you don\'t want to override. ' + - 'Ignoring style name'); - } else { - if (typeof(theme[prop]) === 'string') { - colors[prop] = colors[theme[prop]]; - addProperty(prop, function() { - return colors[prop](this); - }); - } else { - var themePropApplicator = function(str) { - var ret = str || this; - for (var t = 0; t < theme[prop].length; t++) { - ret = colors[theme[prop][t]](ret); - } - return ret; - }; - addProperty(prop, themePropApplicator); - colors[prop] = function(str) { - return themePropApplicator(str); - }; - } - } - }); - } - - colors.setTheme = function(theme) { - if (typeof theme === 'string') { - console.log('colors.setTheme now only accepts an object, not a string. ' + - 'If you are trying to set a theme from a file, it is now your (the ' + - 'caller\'s) responsibility to require the file. The old syntax ' + - 'looked like colors.setTheme(__dirname + ' + - '\'/../themes/generic-logging.js\'); The new syntax looks like '+ - 'colors.setTheme(require(__dirname + ' + - '\'/../themes/generic-logging.js\'));'); - return; - } else { - applyTheme(theme); - } - }; -}; diff --git a/node_modules/node-static/node_modules/colors/lib/index.js b/node_modules/node-static/node_modules/colors/lib/index.js deleted file mode 100644 index 9df5ab7..0000000 --- a/node_modules/node-static/node_modules/colors/lib/index.js +++ /dev/null @@ -1,13 +0,0 @@ -var colors = require('./colors'); -module['exports'] = colors; - -// Remark: By default, colors will add style properties to String.prototype. -// -// If you don't wish to extend String.prototype, you can do this instead and -// native String will not be touched: -// -// var colors = require('colors/safe); -// colors.red("foo") -// -// -require('./extendStringPrototype')(); diff --git a/node_modules/node-static/node_modules/colors/lib/maps/america.js b/node_modules/node-static/node_modules/colors/lib/maps/america.js deleted file mode 100644 index dc96903..0000000 --- a/node_modules/node-static/node_modules/colors/lib/maps/america.js +++ /dev/null @@ -1,10 +0,0 @@ -module['exports'] = function(colors) { - return function(letter, i, exploded) { - if (letter === ' ') return letter; - switch (i%3) { - case 0: return colors.red(letter); - case 1: return colors.white(letter); - case 2: return colors.blue(letter); - } - }; -}; diff --git a/node_modules/node-static/node_modules/colors/lib/maps/rainbow.js b/node_modules/node-static/node_modules/colors/lib/maps/rainbow.js deleted file mode 100644 index 2b00ac0..0000000 --- a/node_modules/node-static/node_modules/colors/lib/maps/rainbow.js +++ /dev/null @@ -1,12 +0,0 @@ -module['exports'] = function(colors) { - // RoY G BiV - var rainbowColors = ['red', 'yellow', 'green', 'blue', 'magenta']; - return function(letter, i, exploded) { - if (letter === ' ') { - return letter; - } else { - return colors[rainbowColors[i++ % rainbowColors.length]](letter); - } - }; -}; - diff --git a/node_modules/node-static/node_modules/colors/lib/maps/random.js b/node_modules/node-static/node_modules/colors/lib/maps/random.js deleted file mode 100644 index 3d82a39..0000000 --- a/node_modules/node-static/node_modules/colors/lib/maps/random.js +++ /dev/null @@ -1,11 +0,0 @@ -module['exports'] = function(colors) { - var available = ['underline', 'inverse', 'grey', 'yellow', 'red', 'green', - 'blue', 'white', 'cyan', 'magenta', 'brightYellow', 'brightRed', - 'brightGreen', 'brightBlue', 'brightWhite', 'brightCyan', 'brightMagenta']; - return function(letter, i, exploded) { - return letter === ' ' ? letter : - colors[ - available[Math.round(Math.random() * (available.length - 2))] - ](letter); - }; -}; diff --git a/node_modules/node-static/node_modules/colors/lib/maps/zebra.js b/node_modules/node-static/node_modules/colors/lib/maps/zebra.js deleted file mode 100644 index fa73623..0000000 --- a/node_modules/node-static/node_modules/colors/lib/maps/zebra.js +++ /dev/null @@ -1,5 +0,0 @@ -module['exports'] = function(colors) { - return function(letter, i, exploded) { - return i % 2 === 0 ? letter : colors.inverse(letter); - }; -}; diff --git a/node_modules/node-static/node_modules/colors/lib/styles.js b/node_modules/node-static/node_modules/colors/lib/styles.js deleted file mode 100644 index 011dafd..0000000 --- a/node_modules/node-static/node_modules/colors/lib/styles.js +++ /dev/null @@ -1,95 +0,0 @@ -/* -The MIT License (MIT) - -Copyright (c) Sindre Sorhus (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. - -*/ - -var styles = {}; -module['exports'] = styles; - -var codes = { - reset: [0, 0], - - bold: [1, 22], - dim: [2, 22], - italic: [3, 23], - underline: [4, 24], - inverse: [7, 27], - hidden: [8, 28], - strikethrough: [9, 29], - - 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], - grey: [90, 39], - - brightRed: [91, 39], - brightGreen: [92, 39], - brightYellow: [93, 39], - brightBlue: [94, 39], - brightMagenta: [95, 39], - brightCyan: [96, 39], - brightWhite: [97, 39], - - bgBlack: [40, 49], - bgRed: [41, 49], - bgGreen: [42, 49], - bgYellow: [43, 49], - bgBlue: [44, 49], - bgMagenta: [45, 49], - bgCyan: [46, 49], - bgWhite: [47, 49], - bgGray: [100, 49], - bgGrey: [100, 49], - - bgBrightRed: [101, 49], - bgBrightGreen: [102, 49], - bgBrightYellow: [103, 49], - bgBrightBlue: [104, 49], - bgBrightMagenta: [105, 49], - bgBrightCyan: [106, 49], - bgBrightWhite: [107, 49], - - // legacy styles for colors pre v1.0.0 - blackBG: [40, 49], - redBG: [41, 49], - greenBG: [42, 49], - yellowBG: [43, 49], - blueBG: [44, 49], - magentaBG: [45, 49], - cyanBG: [46, 49], - whiteBG: [47, 49], - -}; - -Object.keys(codes).forEach(function(key) { - var val = codes[key]; - var style = styles[key] = []; - style.open = '\u001b[' + val[0] + 'm'; - style.close = '\u001b[' + val[1] + 'm'; -}); diff --git a/node_modules/node-static/node_modules/colors/lib/system/has-flag.js b/node_modules/node-static/node_modules/colors/lib/system/has-flag.js deleted file mode 100644 index a347dd4..0000000 --- a/node_modules/node-static/node_modules/colors/lib/system/has-flag.js +++ /dev/null @@ -1,35 +0,0 @@ -/* -MIT License - -Copyright (c) Sindre Sorhus (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. -*/ - -'use strict'; - -module.exports = function(flag, argv) { - argv = argv || process.argv; - - var terminatorPos = argv.indexOf('--'); - var prefix = /^-{1,2}/.test(flag) ? '' : '--'; - var pos = argv.indexOf(prefix + flag); - - return pos !== -1 && (terminatorPos === -1 ? true : pos < terminatorPos); -}; diff --git a/node_modules/node-static/node_modules/colors/lib/system/supports-colors.js b/node_modules/node-static/node_modules/colors/lib/system/supports-colors.js deleted file mode 100644 index f1f9c8f..0000000 --- a/node_modules/node-static/node_modules/colors/lib/system/supports-colors.js +++ /dev/null @@ -1,151 +0,0 @@ -/* -The MIT License (MIT) - -Copyright (c) Sindre Sorhus (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. - -*/ - -'use strict'; - -var os = require('os'); -var hasFlag = require('./has-flag.js'); - -var env = process.env; - -var forceColor = void 0; -if (hasFlag('no-color') || hasFlag('no-colors') || hasFlag('color=false')) { - forceColor = false; -} else if (hasFlag('color') || hasFlag('colors') || hasFlag('color=true') - || hasFlag('color=always')) { - forceColor = true; -} -if ('FORCE_COLOR' in env) { - forceColor = env.FORCE_COLOR.length === 0 - || parseInt(env.FORCE_COLOR, 10) !== 0; -} - -function translateLevel(level) { - if (level === 0) { - return false; - } - - return { - level: level, - hasBasic: true, - has256: level >= 2, - has16m: level >= 3, - }; -} - -function supportsColor(stream) { - if (forceColor === false) { - return 0; - } - - if (hasFlag('color=16m') || hasFlag('color=full') - || hasFlag('color=truecolor')) { - return 3; - } - - if (hasFlag('color=256')) { - return 2; - } - - if (stream && !stream.isTTY && forceColor !== true) { - return 0; - } - - var min = forceColor ? 1 : 0; - - if (process.platform === 'win32') { - // Node.js 7.5.0 is the first version of Node.js to include a patch to - // libuv that enables 256 color output on Windows. Anything earlier and it - // won't work. However, here we target Node.js 8 at minimum as it is an LTS - // release, and Node.js 7 is not. Windows 10 build 10586 is the first - // Windows release that supports 256 colors. Windows 10 build 14931 is the - // first release that supports 16m/TrueColor. - var osRelease = os.release().split('.'); - if (Number(process.versions.node.split('.')[0]) >= 8 - && Number(osRelease[0]) >= 10 && Number(osRelease[2]) >= 10586) { - return Number(osRelease[2]) >= 14931 ? 3 : 2; - } - - return 1; - } - - if ('CI' in env) { - if (['TRAVIS', 'CIRCLECI', 'APPVEYOR', 'GITLAB_CI'].some(function(sign) { - return sign in env; - }) || env.CI_NAME === 'codeship') { - return 1; - } - - return min; - } - - if ('TEAMCITY_VERSION' in env) { - return (/^(9\.(0*[1-9]\d*)\.|\d{2,}\.)/.test(env.TEAMCITY_VERSION) ? 1 : 0 - ); - } - - if ('TERM_PROGRAM' in env) { - var version = parseInt((env.TERM_PROGRAM_VERSION || '').split('.')[0], 10); - - switch (env.TERM_PROGRAM) { - case 'iTerm.app': - return version >= 3 ? 3 : 2; - case 'Hyper': - return 3; - case 'Apple_Terminal': - return 2; - // No default - } - } - - if (/-256(color)?$/i.test(env.TERM)) { - return 2; - } - - if (/^screen|^xterm|^vt100|^rxvt|color|ansi|cygwin|linux/i.test(env.TERM)) { - return 1; - } - - if ('COLORTERM' in env) { - return 1; - } - - if (env.TERM === 'dumb') { - return min; - } - - return min; -} - -function getSupportLevel(stream) { - var level = supportsColor(stream); - return translateLevel(level); -} - -module.exports = { - supportsColor: getSupportLevel, - stdout: getSupportLevel(process.stdout), - stderr: getSupportLevel(process.stderr), -}; diff --git a/node_modules/node-static/node_modules/colors/package.json b/node_modules/node-static/node_modules/colors/package.json deleted file mode 100644 index 5fd86cd..0000000 --- a/node_modules/node-static/node_modules/colors/package.json +++ /dev/null @@ -1,75 +0,0 @@ -{ - "name": "colors", - "description": "get colors in your node.js console", - "version": "1.4.0", - "author": { - "name": "Marak Squires" - }, - "contributors": [ - { - "name": "DABH", - "url": "https://github.com/DABH" - } - ], - "homepage": "https://github.com/Marak/colors.js", - "bugs": { - "url": "https://github.com/Marak/colors.js/issues" - }, - "keywords": [ - "ansi", - "terminal", - "colors" - ], - "repository": { - "type": "git", - "url": "git+ssh://git@github.com/Marak/colors.js.git" - }, - "license": "MIT", - "scripts": { - "lint": "eslint . --fix", - "test": "node tests/basic-test.js && node tests/safe-test.js" - }, - "engines": { - "node": ">=0.1.90" - }, - "main": "lib/index.js", - "devDependencies": { - "eslint": "^5.2.0", - "eslint-config-google": "^0.11.0" - }, - "gitHead": "baa0e1c7dc50d868354206b9ea71273e3f05f593", - "_id": "colors@1.4.0", - "_nodeVersion": "10.16.3", - "_npmVersion": "6.9.0", - "dist": { - "integrity": "sha512-a+UqTh4kgZg/SlGvfbzDHpgRu7AAQOmmqRHJnxhRZICKFUT91brVhNNt58CMWU9PsBbv3PDCZUHbVxuDiH2mtA==", - "shasum": "c50491479d4c1bdaed2c9ced32cf7c7dc2360f78", - "tarball": "https://registry.npmjs.org/colors/-/colors-1.4.0.tgz", - "fileCount": 21, - "unpackedSize": 39506, - "npm-signature": "-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJdiAfACRA9TVsSAnZWagAA7gMP/1eUoL2YZSoe4XH3p7o5\n2NRhGJuE+81Kwbl/2+HWvlWGXxTo1vLYWGVAfBVYtEuUdnPlMOpCEyqdB8Ng\nqMr9acH/8ZkHKRyNYu9GeDLWWUFx8wv94qpcmnuqgp+24X3gBhiS7hnG6UJh\nL4kKUSycTGp0FFWPQ4tdpBuvC6PDGTowPfHh/oj0RosHygRcW6F4V5HDyws1\nQTnuE3k5vBhhzKQQ4oktGCUuQATqsg89lDDSw5hjThBf2y5ZrpF6qLVoiLgm\noMrEF3vDOIyf63naUmj/3qzBYFfQZU3wlGyaRfNxdqNooKW2QOb/x2XFtP46\nYibCl2xhGA0JsinmaAclbLfDkZSZs1bsjpj2xUOFJjQOeMReeS2PzCgHRBJy\nT9ow3X6MbRblOcWuX8Bbhr8kg9Av1xx2A9mtJ7G/DVuHLHBQOTro2l/qIb5M\nf9Z/++j4P1lMMKBp5jHvCRUNq9jgWdSaT9NHo1RvNKuEZM9mxyzyygcidj5w\ngaCGQ5G5kFOKAgmN1LvRYai5P31waqJ+Wr96g6XRfA9SBeeeX12v481jpKQm\nVZ6khQeII1VUgbadjWWegRAobEkW5JXLjdZbISZeIBahs5bOWPFiAFXowf4O\n7Hygdj0xtzkH/sWJeKUCxnzX6VN/mtu+QkPfjGBgDHNL4gtZsGDAizcsFuly\nDWUs\r\n=9VVk\r\n-----END PGP SIGNATURE-----\r\n" - }, - "maintainers": [ - { - "email": "dabh@stanford.edu", - "name": "dabh" - }, - { - "email": "marak.squires@gmail.com", - "name": "marak" - } - ], - "_npmUser": { - "name": "dabh", - "email": "dabh@alumni.stanford.edu" - }, - "directories": {}, - "_npmOperationalInternal": { - "host": "s3://npm-registry-packages", - "tmp": "tmp/colors_1.4.0_1569195967207_0.2781122116893864" - }, - "_hasShrinkwrap": false, - "_shasum": "c50491479d4c1bdaed2c9ced32cf7c7dc2360f78", - "_from": "colors@>=0.6.0", - "_resolved": "https://registry.npmjs.org/colors/-/colors-1.4.0.tgz" -} diff --git a/node_modules/node-static/node_modules/colors/safe.d.ts b/node_modules/node-static/node_modules/colors/safe.d.ts deleted file mode 100644 index 2bafc27..0000000 --- a/node_modules/node-static/node_modules/colors/safe.d.ts +++ /dev/null @@ -1,48 +0,0 @@ -// Type definitions for Colors.js 1.2 -// Project: https://github.com/Marak/colors.js -// Definitions by: Bart van der Schoor , Staffan Eketorp -// Definitions: https://github.com/Marak/colors.js - -export const enabled: boolean; -export function enable(): void; -export function disable(): void; -export function setTheme(theme: any): void; - -export function strip(str: string): string; -export function stripColors(str: string): string; - -export function black(str: string): string; -export function red(str: string): string; -export function green(str: string): string; -export function yellow(str: string): string; -export function blue(str: string): string; -export function magenta(str: string): string; -export function cyan(str: string): string; -export function white(str: string): string; -export function gray(str: string): string; -export function grey(str: string): string; - -export function bgBlack(str: string): string; -export function bgRed(str: string): string; -export function bgGreen(str: string): string; -export function bgYellow(str: string): string; -export function bgBlue(str: string): string; -export function bgMagenta(str: string): string; -export function bgCyan(str: string): string; -export function bgWhite(str: string): string; - -export function reset(str: string): string; -export function bold(str: string): string; -export function dim(str: string): string; -export function italic(str: string): string; -export function underline(str: string): string; -export function inverse(str: string): string; -export function hidden(str: string): string; -export function strikethrough(str: string): string; - -export function rainbow(str: string): string; -export function zebra(str: string): string; -export function america(str: string): string; -export function trap(str: string): string; -export function random(str: string): string; -export function zalgo(str: string): string; diff --git a/node_modules/node-static/node_modules/colors/safe.js b/node_modules/node-static/node_modules/colors/safe.js deleted file mode 100644 index a013d54..0000000 --- a/node_modules/node-static/node_modules/colors/safe.js +++ /dev/null @@ -1,10 +0,0 @@ -// -// Remark: Requiring this file will use the "safe" colors API, -// which will not touch String.prototype. -// -// var colors = require('colors/safe'); -// colors.red("foo") -// -// -var colors = require('./lib/colors'); -module['exports'] = colors; diff --git a/node_modules/node-static/node_modules/colors/themes/generic-logging.js b/node_modules/node-static/node_modules/colors/themes/generic-logging.js deleted file mode 100644 index 63adfe4..0000000 --- a/node_modules/node-static/node_modules/colors/themes/generic-logging.js +++ /dev/null @@ -1,12 +0,0 @@ -module['exports'] = { - silly: 'rainbow', - input: 'grey', - verbose: 'cyan', - prompt: 'grey', - info: 'green', - data: 'grey', - help: 'cyan', - warn: 'yellow', - debug: 'blue', - error: 'red', -}; diff --git a/node_modules/node-static/node_modules/optimist/.travis.yml b/node_modules/node-static/node_modules/optimist/.travis.yml deleted file mode 100644 index cc4dba2..0000000 --- a/node_modules/node-static/node_modules/optimist/.travis.yml +++ /dev/null @@ -1,4 +0,0 @@ -language: node_js -node_js: - - "0.8" - - "0.10" diff --git a/node_modules/node-static/node_modules/optimist/LICENSE b/node_modules/node-static/node_modules/optimist/LICENSE deleted file mode 100644 index 432d1ae..0000000 --- a/node_modules/node-static/node_modules/optimist/LICENSE +++ /dev/null @@ -1,21 +0,0 @@ -Copyright 2010 James Halliday (mail@substack.net) - -This project is free software released under the MIT/X11 license: - -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. diff --git a/node_modules/node-static/node_modules/optimist/example/bool.js b/node_modules/node-static/node_modules/optimist/example/bool.js deleted file mode 100644 index a998fb7..0000000 --- a/node_modules/node-static/node_modules/optimist/example/bool.js +++ /dev/null @@ -1,10 +0,0 @@ -#!/usr/bin/env node -var util = require('util'); -var argv = require('optimist').argv; - -if (argv.s) { - util.print(argv.fr ? 'Le chat dit: ' : 'The cat says: '); -} -console.log( - (argv.fr ? 'miaou' : 'meow') + (argv.p ? '.' : '') -); diff --git a/node_modules/node-static/node_modules/optimist/example/boolean_double.js b/node_modules/node-static/node_modules/optimist/example/boolean_double.js deleted file mode 100644 index a35a7e6..0000000 --- a/node_modules/node-static/node_modules/optimist/example/boolean_double.js +++ /dev/null @@ -1,7 +0,0 @@ -#!/usr/bin/env node -var argv = require('optimist') - .boolean(['x','y','z']) - .argv -; -console.dir([ argv.x, argv.y, argv.z ]); -console.dir(argv._); diff --git a/node_modules/node-static/node_modules/optimist/example/boolean_single.js b/node_modules/node-static/node_modules/optimist/example/boolean_single.js deleted file mode 100644 index 017bb68..0000000 --- a/node_modules/node-static/node_modules/optimist/example/boolean_single.js +++ /dev/null @@ -1,7 +0,0 @@ -#!/usr/bin/env node -var argv = require('optimist') - .boolean('v') - .argv -; -console.dir(argv.v); -console.dir(argv._); diff --git a/node_modules/node-static/node_modules/optimist/example/default_hash.js b/node_modules/node-static/node_modules/optimist/example/default_hash.js deleted file mode 100644 index ade7768..0000000 --- a/node_modules/node-static/node_modules/optimist/example/default_hash.js +++ /dev/null @@ -1,8 +0,0 @@ -#!/usr/bin/env node - -var argv = require('optimist') - .default({ x : 10, y : 10 }) - .argv -; - -console.log(argv.x + argv.y); diff --git a/node_modules/node-static/node_modules/optimist/example/default_singles.js b/node_modules/node-static/node_modules/optimist/example/default_singles.js deleted file mode 100644 index d9b1ff4..0000000 --- a/node_modules/node-static/node_modules/optimist/example/default_singles.js +++ /dev/null @@ -1,7 +0,0 @@ -#!/usr/bin/env node -var argv = require('optimist') - .default('x', 10) - .default('y', 10) - .argv -; -console.log(argv.x + argv.y); diff --git a/node_modules/node-static/node_modules/optimist/example/divide.js b/node_modules/node-static/node_modules/optimist/example/divide.js deleted file mode 100644 index 5e2ee82..0000000 --- a/node_modules/node-static/node_modules/optimist/example/divide.js +++ /dev/null @@ -1,8 +0,0 @@ -#!/usr/bin/env node - -var argv = require('optimist') - .usage('Usage: $0 -x [num] -y [num]') - .demand(['x','y']) - .argv; - -console.log(argv.x / argv.y); diff --git a/node_modules/node-static/node_modules/optimist/example/line_count.js b/node_modules/node-static/node_modules/optimist/example/line_count.js deleted file mode 100644 index b5f95bf..0000000 --- a/node_modules/node-static/node_modules/optimist/example/line_count.js +++ /dev/null @@ -1,20 +0,0 @@ -#!/usr/bin/env node -var argv = require('optimist') - .usage('Count the lines in a file.\nUsage: $0') - .demand('f') - .alias('f', 'file') - .describe('f', 'Load a file') - .argv -; - -var fs = require('fs'); -var s = fs.createReadStream(argv.file); - -var lines = 0; -s.on('data', function (buf) { - lines += buf.toString().match(/\n/g).length; -}); - -s.on('end', function () { - console.log(lines); -}); diff --git a/node_modules/node-static/node_modules/optimist/example/line_count_options.js b/node_modules/node-static/node_modules/optimist/example/line_count_options.js deleted file mode 100644 index d9ac709..0000000 --- a/node_modules/node-static/node_modules/optimist/example/line_count_options.js +++ /dev/null @@ -1,29 +0,0 @@ -#!/usr/bin/env node -var argv = require('optimist') - .usage('Count the lines in a file.\nUsage: $0') - .options({ - file : { - demand : true, - alias : 'f', - description : 'Load a file' - }, - base : { - alias : 'b', - description : 'Numeric base to use for output', - default : 10, - }, - }) - .argv -; - -var fs = require('fs'); -var s = fs.createReadStream(argv.file); - -var lines = 0; -s.on('data', function (buf) { - lines += buf.toString().match(/\n/g).length; -}); - -s.on('end', function () { - console.log(lines.toString(argv.base)); -}); diff --git a/node_modules/node-static/node_modules/optimist/example/line_count_wrap.js b/node_modules/node-static/node_modules/optimist/example/line_count_wrap.js deleted file mode 100644 index 4267511..0000000 --- a/node_modules/node-static/node_modules/optimist/example/line_count_wrap.js +++ /dev/null @@ -1,29 +0,0 @@ -#!/usr/bin/env node -var argv = require('optimist') - .usage('Count the lines in a file.\nUsage: $0') - .wrap(80) - .demand('f') - .alias('f', [ 'file', 'filename' ]) - .describe('f', - "Load a file. It's pretty important." - + " Required even. So you'd better specify it." - ) - .alias('b', 'base') - .describe('b', 'Numeric base to display the number of lines in') - .default('b', 10) - .describe('x', 'Super-secret optional parameter which is secret') - .default('x', '') - .argv -; - -var fs = require('fs'); -var s = fs.createReadStream(argv.file); - -var lines = 0; -s.on('data', function (buf) { - lines += buf.toString().match(/\n/g).length; -}); - -s.on('end', function () { - console.log(lines.toString(argv.base)); -}); diff --git a/node_modules/node-static/node_modules/optimist/example/nonopt.js b/node_modules/node-static/node_modules/optimist/example/nonopt.js deleted file mode 100644 index ee633ee..0000000 --- a/node_modules/node-static/node_modules/optimist/example/nonopt.js +++ /dev/null @@ -1,4 +0,0 @@ -#!/usr/bin/env node -var argv = require('optimist').argv; -console.log('(%d,%d)', argv.x, argv.y); -console.log(argv._); diff --git a/node_modules/node-static/node_modules/optimist/example/reflect.js b/node_modules/node-static/node_modules/optimist/example/reflect.js deleted file mode 100644 index 816b3e1..0000000 --- a/node_modules/node-static/node_modules/optimist/example/reflect.js +++ /dev/null @@ -1,2 +0,0 @@ -#!/usr/bin/env node -console.dir(require('optimist').argv); diff --git a/node_modules/node-static/node_modules/optimist/example/short.js b/node_modules/node-static/node_modules/optimist/example/short.js deleted file mode 100644 index 1db0ad0..0000000 --- a/node_modules/node-static/node_modules/optimist/example/short.js +++ /dev/null @@ -1,3 +0,0 @@ -#!/usr/bin/env node -var argv = require('optimist').argv; -console.log('(%d,%d)', argv.x, argv.y); diff --git a/node_modules/node-static/node_modules/optimist/example/string.js b/node_modules/node-static/node_modules/optimist/example/string.js deleted file mode 100644 index a8e5aeb..0000000 --- a/node_modules/node-static/node_modules/optimist/example/string.js +++ /dev/null @@ -1,11 +0,0 @@ -#!/usr/bin/env node -var argv = require('optimist') - .string('x', 'y') - .argv -; -console.dir([ argv.x, argv.y ]); - -/* Turns off numeric coercion: - ./node string.js -x 000123 -y 9876 - [ '000123', '9876' ] -*/ diff --git a/node_modules/node-static/node_modules/optimist/example/usage-options.js b/node_modules/node-static/node_modules/optimist/example/usage-options.js deleted file mode 100644 index b999977..0000000 --- a/node_modules/node-static/node_modules/optimist/example/usage-options.js +++ /dev/null @@ -1,19 +0,0 @@ -var optimist = require('./../index'); - -var argv = optimist.usage('This is my awesome program', { - 'about': { - description: 'Provide some details about the author of this program', - required: true, - short: 'a', - }, - 'info': { - description: 'Provide some information about the node.js agains!!!!!!', - boolean: true, - short: 'i' - } -}).argv; - -optimist.showHelp(); - -console.log('\n\nInspecting options'); -console.dir(argv); \ No newline at end of file diff --git a/node_modules/node-static/node_modules/optimist/example/xup.js b/node_modules/node-static/node_modules/optimist/example/xup.js deleted file mode 100644 index 8f6ecd2..0000000 --- a/node_modules/node-static/node_modules/optimist/example/xup.js +++ /dev/null @@ -1,10 +0,0 @@ -#!/usr/bin/env node -var argv = require('optimist').argv; - -if (argv.rif - 5 * argv.xup > 7.138) { - console.log('Buy more riffiwobbles'); -} -else { - console.log('Sell the xupptumblers'); -} - diff --git a/node_modules/node-static/node_modules/optimist/index.js b/node_modules/node-static/node_modules/optimist/index.js deleted file mode 100644 index 4da5a6d..0000000 --- a/node_modules/node-static/node_modules/optimist/index.js +++ /dev/null @@ -1,343 +0,0 @@ -var path = require('path'); -var minimist = require('minimist'); -var wordwrap = require('wordwrap'); - -/* Hack an instance of Argv with process.argv into Argv - so people can do - require('optimist')(['--beeble=1','-z','zizzle']).argv - to parse a list of args and - require('optimist').argv - to get a parsed version of process.argv. -*/ - -var inst = Argv(process.argv.slice(2)); -Object.keys(inst).forEach(function (key) { - Argv[key] = typeof inst[key] == 'function' - ? inst[key].bind(inst) - : inst[key]; -}); - -var exports = module.exports = Argv; -function Argv (processArgs, cwd) { - var self = {}; - if (!cwd) cwd = process.cwd(); - - self.$0 = process.argv - .slice(0,2) - .map(function (x) { - var b = rebase(cwd, x); - return x.match(/^\//) && b.length < x.length - ? b : x - }) - .join(' ') - ; - - if (process.env._ != undefined && process.argv[1] == process.env._) { - self.$0 = process.env._.replace( - path.dirname(process.execPath) + '/', '' - ); - } - - var options = { - boolean: [], - string: [], - alias: {}, - default: [] - }; - - self.boolean = function (bools) { - options.boolean.push.apply(options.boolean, [].concat(bools)); - return self; - }; - - self.string = function (strings) { - options.string.push.apply(options.string, [].concat(strings)); - return self; - }; - - self.default = function (key, value) { - if (typeof key === 'object') { - Object.keys(key).forEach(function (k) { - self.default(k, key[k]); - }); - } - else { - options.default[key] = value; - } - return self; - }; - - self.alias = function (x, y) { - if (typeof x === 'object') { - Object.keys(x).forEach(function (key) { - self.alias(key, x[key]); - }); - } - else { - options.alias[x] = (options.alias[x] || []).concat(y); - } - return self; - }; - - var demanded = {}; - self.demand = function (keys) { - if (typeof keys == 'number') { - if (!demanded._) demanded._ = 0; - demanded._ += keys; - } - else if (Array.isArray(keys)) { - keys.forEach(function (key) { - self.demand(key); - }); - } - else { - demanded[keys] = true; - } - - return self; - }; - - var usage; - self.usage = function (msg, opts) { - if (!opts && typeof msg === 'object') { - opts = msg; - msg = null; - } - - usage = msg; - - if (opts) self.options(opts); - - return self; - }; - - function fail (msg) { - self.showHelp(); - if (msg) console.error(msg); - process.exit(1); - } - - var checks = []; - self.check = function (f) { - checks.push(f); - return self; - }; - - var descriptions = {}; - self.describe = function (key, desc) { - if (typeof key === 'object') { - Object.keys(key).forEach(function (k) { - self.describe(k, key[k]); - }); - } - else { - descriptions[key] = desc; - } - return self; - }; - - self.parse = function (args) { - return parseArgs(args); - }; - - self.option = self.options = function (key, opt) { - if (typeof key === 'object') { - Object.keys(key).forEach(function (k) { - self.options(k, key[k]); - }); - } - else { - if (opt.alias) self.alias(key, opt.alias); - if (opt.demand) self.demand(key); - if (typeof opt.default !== 'undefined') { - self.default(key, opt.default); - } - - if (opt.boolean || opt.type === 'boolean') { - self.boolean(key); - } - if (opt.string || opt.type === 'string') { - self.string(key); - } - - var desc = opt.describe || opt.description || opt.desc; - if (desc) { - self.describe(key, desc); - } - } - - return self; - }; - - var wrap = null; - self.wrap = function (cols) { - wrap = cols; - return self; - }; - - self.showHelp = function (fn) { - if (!fn) fn = console.error; - fn(self.help()); - }; - - self.help = function () { - var keys = Object.keys( - Object.keys(descriptions) - .concat(Object.keys(demanded)) - .concat(Object.keys(options.default)) - .reduce(function (acc, key) { - if (key !== '_') acc[key] = true; - return acc; - }, {}) - ); - - var help = keys.length ? [ 'Options:' ] : []; - - if (usage) { - help.unshift(usage.replace(/\$0/g, self.$0), ''); - } - - var switches = keys.reduce(function (acc, key) { - acc[key] = [ key ].concat(options.alias[key] || []) - .map(function (sw) { - return (sw.length > 1 ? '--' : '-') + sw - }) - .join(', ') - ; - return acc; - }, {}); - - var switchlen = longest(Object.keys(switches).map(function (s) { - return switches[s] || ''; - })); - - var desclen = longest(Object.keys(descriptions).map(function (d) { - return descriptions[d] || ''; - })); - - keys.forEach(function (key) { - var kswitch = switches[key]; - var desc = descriptions[key] || ''; - - if (wrap) { - desc = wordwrap(switchlen + 4, wrap)(desc) - .slice(switchlen + 4) - ; - } - - var spadding = new Array( - Math.max(switchlen - kswitch.length + 3, 0) - ).join(' '); - - var dpadding = new Array( - Math.max(desclen - desc.length + 1, 0) - ).join(' '); - - var type = null; - - if (options.boolean[key]) type = '[boolean]'; - if (options.string[key]) type = '[string]'; - - if (!wrap && dpadding.length > 0) { - desc += dpadding; - } - - var prelude = ' ' + kswitch + spadding; - var extra = [ - type, - demanded[key] - ? '[required]' - : null - , - options.default[key] !== undefined - ? '[default: ' + JSON.stringify(options.default[key]) + ']' - : null - , - ].filter(Boolean).join(' '); - - var body = [ desc, extra ].filter(Boolean).join(' '); - - if (wrap) { - var dlines = desc.split('\n'); - var dlen = dlines.slice(-1)[0].length - + (dlines.length === 1 ? prelude.length : 0) - - body = desc + (dlen + extra.length > wrap - 2 - ? '\n' - + new Array(wrap - extra.length + 1).join(' ') - + extra - : new Array(wrap - extra.length - dlen + 1).join(' ') - + extra - ); - } - - help.push(prelude + body); - }); - - help.push(''); - return help.join('\n'); - }; - - Object.defineProperty(self, 'argv', { - get : function () { return parseArgs(processArgs) }, - enumerable : true, - }); - - function parseArgs (args) { - var argv = minimist(args, options); - argv.$0 = self.$0; - - if (demanded._ && argv._.length < demanded._) { - fail('Not enough non-option arguments: got ' - + argv._.length + ', need at least ' + demanded._ - ); - } - - var missing = []; - Object.keys(demanded).forEach(function (key) { - if (!argv[key]) missing.push(key); - }); - - if (missing.length) { - fail('Missing required arguments: ' + missing.join(', ')); - } - - checks.forEach(function (f) { - try { - if (f(argv) === false) { - fail('Argument check failed: ' + f.toString()); - } - } - catch (err) { - fail(err) - } - }); - - return argv; - } - - function longest (xs) { - return Math.max.apply( - null, - xs.map(function (x) { return x.length }) - ); - } - - return self; -}; - -// rebase an absolute path to a relative one with respect to a base directory -// exported for tests -exports.rebase = rebase; -function rebase (base, dir) { - var ds = path.normalize(dir).split('/').slice(1); - var bs = path.normalize(base).split('/').slice(1); - - for (var i = 0; ds[i] && ds[i] == bs[i]; i++); - ds.splice(0, i); bs.splice(0, i); - - var p = path.normalize( - bs.map(function () { return '..' }).concat(ds).join('/') - ).replace(/\/$/,'').replace(/^$/, '.'); - return p.match(/^[.\/]/) ? p : './' + p; -}; diff --git a/node_modules/node-static/node_modules/optimist/node_modules/minimist/.travis.yml b/node_modules/node-static/node_modules/optimist/node_modules/minimist/.travis.yml deleted file mode 100644 index cc4dba2..0000000 --- a/node_modules/node-static/node_modules/optimist/node_modules/minimist/.travis.yml +++ /dev/null @@ -1,4 +0,0 @@ -language: node_js -node_js: - - "0.8" - - "0.10" diff --git a/node_modules/node-static/node_modules/optimist/node_modules/minimist/LICENSE b/node_modules/node-static/node_modules/optimist/node_modules/minimist/LICENSE deleted file mode 100644 index ee27ba4..0000000 --- a/node_modules/node-static/node_modules/optimist/node_modules/minimist/LICENSE +++ /dev/null @@ -1,18 +0,0 @@ -This software is released under the MIT license: - -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. diff --git a/node_modules/node-static/node_modules/optimist/node_modules/minimist/example/parse.js b/node_modules/node-static/node_modules/optimist/node_modules/minimist/example/parse.js deleted file mode 100644 index abff3e8..0000000 --- a/node_modules/node-static/node_modules/optimist/node_modules/minimist/example/parse.js +++ /dev/null @@ -1,2 +0,0 @@ -var argv = require('../')(process.argv.slice(2)); -console.dir(argv); diff --git a/node_modules/node-static/node_modules/optimist/node_modules/minimist/index.js b/node_modules/node-static/node_modules/optimist/node_modules/minimist/index.js deleted file mode 100644 index 71fb830..0000000 --- a/node_modules/node-static/node_modules/optimist/node_modules/minimist/index.js +++ /dev/null @@ -1,187 +0,0 @@ -module.exports = function (args, opts) { - if (!opts) opts = {}; - - var flags = { bools : {}, strings : {} }; - - [].concat(opts['boolean']).filter(Boolean).forEach(function (key) { - flags.bools[key] = true; - }); - - var aliases = {}; - Object.keys(opts.alias || {}).forEach(function (key) { - aliases[key] = [].concat(opts.alias[key]); - aliases[key].forEach(function (x) { - aliases[x] = [key].concat(aliases[key].filter(function (y) { - return x !== y; - })); - }); - }); - - [].concat(opts.string).filter(Boolean).forEach(function (key) { - flags.strings[key] = true; - if (aliases[key]) { - flags.strings[aliases[key]] = true; - } - }); - - var defaults = opts['default'] || {}; - - var argv = { _ : [] }; - Object.keys(flags.bools).forEach(function (key) { - setArg(key, defaults[key] === undefined ? false : defaults[key]); - }); - - var notFlags = []; - - if (args.indexOf('--') !== -1) { - notFlags = args.slice(args.indexOf('--')+1); - args = args.slice(0, args.indexOf('--')); - } - - function setArg (key, val) { - var value = !flags.strings[key] && isNumber(val) - ? Number(val) : val - ; - setKey(argv, key.split('.'), value); - - (aliases[key] || []).forEach(function (x) { - setKey(argv, x.split('.'), value); - }); - } - - for (var i = 0; i < args.length; i++) { - var arg = args[i]; - - if (/^--.+=/.test(arg)) { - // Using [\s\S] instead of . because js doesn't support the - // 'dotall' regex modifier. See: - // http://stackoverflow.com/a/1068308/13216 - var m = arg.match(/^--([^=]+)=([\s\S]*)$/); - setArg(m[1], m[2]); - } - else if (/^--no-.+/.test(arg)) { - var key = arg.match(/^--no-(.+)/)[1]; - setArg(key, false); - } - else if (/^--.+/.test(arg)) { - var key = arg.match(/^--(.+)/)[1]; - var next = args[i + 1]; - if (next !== undefined && !/^-/.test(next) - && !flags.bools[key] - && (aliases[key] ? !flags.bools[aliases[key]] : true)) { - setArg(key, next); - i++; - } - else if (/^(true|false)$/.test(next)) { - setArg(key, next === 'true'); - i++; - } - else { - setArg(key, flags.strings[key] ? '' : true); - } - } - else if (/^-[^-]+/.test(arg)) { - var letters = arg.slice(1,-1).split(''); - - var broken = false; - for (var j = 0; j < letters.length; j++) { - var next = arg.slice(j+2); - - if (next === '-') { - setArg(letters[j], next) - continue; - } - - if (/[A-Za-z]/.test(letters[j]) - && /-?\d+(\.\d*)?(e-?\d+)?$/.test(next)) { - setArg(letters[j], next); - broken = true; - break; - } - - if (letters[j+1] && letters[j+1].match(/\W/)) { - setArg(letters[j], arg.slice(j+2)); - broken = true; - break; - } - else { - setArg(letters[j], flags.strings[letters[j]] ? '' : true); - } - } - - var key = arg.slice(-1)[0]; - if (!broken && key !== '-') { - if (args[i+1] && !/^(-|--)[^-]/.test(args[i+1]) - && !flags.bools[key] - && (aliases[key] ? !flags.bools[aliases[key]] : true)) { - setArg(key, args[i+1]); - i++; - } - else if (args[i+1] && /true|false/.test(args[i+1])) { - setArg(key, args[i+1] === 'true'); - i++; - } - else { - setArg(key, flags.strings[key] ? '' : true); - } - } - } - else { - argv._.push( - flags.strings['_'] || !isNumber(arg) ? arg : Number(arg) - ); - } - } - - Object.keys(defaults).forEach(function (key) { - if (!hasKey(argv, key.split('.'))) { - setKey(argv, key.split('.'), defaults[key]); - - (aliases[key] || []).forEach(function (x) { - setKey(argv, x.split('.'), defaults[key]); - }); - } - }); - - notFlags.forEach(function(key) { - argv._.push(key); - }); - - return argv; -}; - -function hasKey (obj, keys) { - var o = obj; - keys.slice(0,-1).forEach(function (key) { - o = (o[key] || {}); - }); - - var key = keys[keys.length - 1]; - return key in o; -} - -function setKey (obj, keys, value) { - var o = obj; - keys.slice(0,-1).forEach(function (key) { - if (o[key] === undefined) o[key] = {}; - o = o[key]; - }); - - var key = keys[keys.length - 1]; - if (o[key] === undefined || typeof o[key] === 'boolean') { - o[key] = value; - } - else if (Array.isArray(o[key])) { - o[key].push(value); - } - else { - o[key] = [ o[key], value ]; - } -} - -function isNumber (x) { - if (typeof x === 'number') return true; - if (/^0x[0-9a-f]+$/i.test(x)) return true; - return /^[-+]?(?:\d+(?:\.\d*)?|\.\d+)(e[-+]?\d+)?$/.test(x); -} - diff --git a/node_modules/node-static/node_modules/optimist/node_modules/minimist/package.json b/node_modules/node-static/node_modules/optimist/node_modules/minimist/package.json deleted file mode 100644 index eb47d73..0000000 --- a/node_modules/node-static/node_modules/optimist/node_modules/minimist/package.json +++ /dev/null @@ -1,66 +0,0 @@ -{ - "name": "minimist", - "version": "0.0.10", - "description": "parse argument options", - "main": "index.js", - "devDependencies": { - "tape": "~1.0.4", - "tap": "~0.4.0" - }, - "scripts": { - "test": "tap test/*.js" - }, - "testling": { - "files": "test/*.js", - "browsers": [ - "ie/6..latest", - "ff/5", - "firefox/latest", - "chrome/10", - "chrome/latest", - "safari/5.1", - "safari/latest", - "opera/12" - ] - }, - "repository": { - "type": "git", - "url": "git://github.com/substack/minimist.git" - }, - "homepage": "https://github.com/substack/minimist", - "keywords": [ - "argv", - "getopt", - "parser", - "optimist" - ], - "author": { - "name": "James Halliday", - "email": "mail@substack.net", - "url": "http://substack.net" - }, - "license": "MIT", - "bugs": { - "url": "https://github.com/substack/minimist/issues" - }, - "_id": "minimist@0.0.10", - "dist": { - "shasum": "de3f98543dbf96082be48ad1a0c7cda836301dcf", - "tarball": "https://registry.npmjs.org/minimist/-/minimist-0.0.10.tgz" - }, - "_from": "minimist@~0.0.1", - "_npmVersion": "1.4.3", - "_npmUser": { - "name": "substack", - "email": "mail@substack.net" - }, - "maintainers": [ - { - "name": "substack", - "email": "mail@substack.net" - } - ], - "directories": {}, - "_shasum": "de3f98543dbf96082be48ad1a0c7cda836301dcf", - "_resolved": "https://registry.npmjs.org/minimist/-/minimist-0.0.10.tgz" -} diff --git a/node_modules/node-static/node_modules/optimist/node_modules/minimist/readme.markdown b/node_modules/node-static/node_modules/optimist/node_modules/minimist/readme.markdown deleted file mode 100644 index c256353..0000000 --- a/node_modules/node-static/node_modules/optimist/node_modules/minimist/readme.markdown +++ /dev/null @@ -1,73 +0,0 @@ -# minimist - -parse argument options - -This module is the guts of optimist's argument parser without all the -fanciful decoration. - -[![browser support](https://ci.testling.com/substack/minimist.png)](http://ci.testling.com/substack/minimist) - -[![build status](https://secure.travis-ci.org/substack/minimist.png)](http://travis-ci.org/substack/minimist) - -# example - -``` js -var argv = require('minimist')(process.argv.slice(2)); -console.dir(argv); -``` - -``` -$ node example/parse.js -a beep -b boop -{ _: [], a: 'beep', b: 'boop' } -``` - -``` -$ node example/parse.js -x 3 -y 4 -n5 -abc --beep=boop foo bar baz -{ _: [ 'foo', 'bar', 'baz' ], - x: 3, - y: 4, - n: 5, - a: true, - b: true, - c: true, - beep: 'boop' } -``` - -# methods - -``` js -var parseArgs = require('minimist') -``` - -## var argv = parseArgs(args, opts={}) - -Return an argument object `argv` populated with the array arguments from `args`. - -`argv._` contains all the arguments that didn't have an option associated with -them. - -Numeric-looking arguments will be returned as numbers unless `opts.string` or -`opts.boolean` is set for that argument name. - -Any arguments after `'--'` will not be parsed and will end up in `argv._`. - -options can be: - -* `opts.string` - a string or array of strings argument names to always treat as -strings -* `opts.boolean` - a string or array of strings to always treat as booleans -* `opts.alias` - an object mapping string names to strings or arrays of string -argument names to use as aliases -* `opts.default` - an object mapping string argument names to default values - -# install - -With [npm](https://npmjs.org) do: - -``` -npm install minimist -``` - -# license - -MIT diff --git a/node_modules/node-static/node_modules/optimist/node_modules/minimist/test/bool.js b/node_modules/node-static/node_modules/optimist/node_modules/minimist/test/bool.js deleted file mode 100644 index 749e083..0000000 --- a/node_modules/node-static/node_modules/optimist/node_modules/minimist/test/bool.js +++ /dev/null @@ -1,119 +0,0 @@ -var parse = require('../'); -var test = require('tape'); - -test('flag boolean default false', function (t) { - var argv = parse(['moo'], { - boolean: ['t', 'verbose'], - default: { verbose: false, t: false } - }); - - t.deepEqual(argv, { - verbose: false, - t: false, - _: ['moo'] - }); - - t.deepEqual(typeof argv.verbose, 'boolean'); - t.deepEqual(typeof argv.t, 'boolean'); - t.end(); - -}); - -test('boolean groups', function (t) { - var argv = parse([ '-x', '-z', 'one', 'two', 'three' ], { - boolean: ['x','y','z'] - }); - - t.deepEqual(argv, { - x : true, - y : false, - z : true, - _ : [ 'one', 'two', 'three' ] - }); - - t.deepEqual(typeof argv.x, 'boolean'); - t.deepEqual(typeof argv.y, 'boolean'); - t.deepEqual(typeof argv.z, 'boolean'); - t.end(); -}); -test('boolean and alias with chainable api', function (t) { - var aliased = [ '-h', 'derp' ]; - var regular = [ '--herp', 'derp' ]; - var opts = { - herp: { alias: 'h', boolean: true } - }; - var aliasedArgv = parse(aliased, { - boolean: 'herp', - alias: { h: 'herp' } - }); - var propertyArgv = parse(regular, { - boolean: 'herp', - alias: { h: 'herp' } - }); - var expected = { - herp: true, - h: true, - '_': [ 'derp' ] - }; - - t.same(aliasedArgv, expected); - t.same(propertyArgv, expected); - t.end(); -}); - -test('boolean and alias with options hash', function (t) { - var aliased = [ '-h', 'derp' ]; - var regular = [ '--herp', 'derp' ]; - var opts = { - alias: { 'h': 'herp' }, - boolean: 'herp' - }; - var aliasedArgv = parse(aliased, opts); - var propertyArgv = parse(regular, opts); - var expected = { - herp: true, - h: true, - '_': [ 'derp' ] - }; - t.same(aliasedArgv, expected); - t.same(propertyArgv, expected); - t.end(); -}); - -test('boolean and alias using explicit true', function (t) { - var aliased = [ '-h', 'true' ]; - var regular = [ '--herp', 'true' ]; - var opts = { - alias: { h: 'herp' }, - boolean: 'h' - }; - var aliasedArgv = parse(aliased, opts); - var propertyArgv = parse(regular, opts); - var expected = { - herp: true, - h: true, - '_': [ ] - }; - - t.same(aliasedArgv, expected); - t.same(propertyArgv, expected); - t.end(); -}); - -// regression, see https://github.com/substack/node-optimist/issues/71 -test('boolean and --x=true', function(t) { - var parsed = parse(['--boool', '--other=true'], { - boolean: 'boool' - }); - - t.same(parsed.boool, true); - t.same(parsed.other, 'true'); - - parsed = parse(['--boool', '--other=false'], { - boolean: 'boool' - }); - - t.same(parsed.boool, true); - t.same(parsed.other, 'false'); - t.end(); -}); diff --git a/node_modules/node-static/node_modules/optimist/node_modules/minimist/test/dash.js b/node_modules/node-static/node_modules/optimist/node_modules/minimist/test/dash.js deleted file mode 100644 index 8b034b9..0000000 --- a/node_modules/node-static/node_modules/optimist/node_modules/minimist/test/dash.js +++ /dev/null @@ -1,24 +0,0 @@ -var parse = require('../'); -var test = require('tape'); - -test('-', function (t) { - t.plan(5); - t.deepEqual(parse([ '-n', '-' ]), { n: '-', _: [] }); - t.deepEqual(parse([ '-' ]), { _: [ '-' ] }); - t.deepEqual(parse([ '-f-' ]), { f: '-', _: [] }); - t.deepEqual( - parse([ '-b', '-' ], { boolean: 'b' }), - { b: true, _: [ '-' ] } - ); - t.deepEqual( - parse([ '-s', '-' ], { string: 's' }), - { s: '-', _: [] } - ); -}); - -test('-a -- b', function (t) { - t.plan(3); - t.deepEqual(parse([ '-a', '--', 'b' ]), { a: true, _: [ 'b' ] }); - t.deepEqual(parse([ '--a', '--', 'b' ]), { a: true, _: [ 'b' ] }); - t.deepEqual(parse([ '--a', '--', 'b' ]), { a: true, _: [ 'b' ] }); -}); diff --git a/node_modules/node-static/node_modules/optimist/node_modules/minimist/test/default_bool.js b/node_modules/node-static/node_modules/optimist/node_modules/minimist/test/default_bool.js deleted file mode 100644 index f0041ee..0000000 --- a/node_modules/node-static/node_modules/optimist/node_modules/minimist/test/default_bool.js +++ /dev/null @@ -1,20 +0,0 @@ -var test = require('tape'); -var parse = require('../'); - -test('boolean default true', function (t) { - var argv = parse([], { - boolean: 'sometrue', - default: { sometrue: true } - }); - t.equal(argv.sometrue, true); - t.end(); -}); - -test('boolean default false', function (t) { - var argv = parse([], { - boolean: 'somefalse', - default: { somefalse: false } - }); - t.equal(argv.somefalse, false); - t.end(); -}); diff --git a/node_modules/node-static/node_modules/optimist/node_modules/minimist/test/dotted.js b/node_modules/node-static/node_modules/optimist/node_modules/minimist/test/dotted.js deleted file mode 100644 index d8b3e85..0000000 --- a/node_modules/node-static/node_modules/optimist/node_modules/minimist/test/dotted.js +++ /dev/null @@ -1,22 +0,0 @@ -var parse = require('../'); -var test = require('tape'); - -test('dotted alias', function (t) { - var argv = parse(['--a.b', '22'], {default: {'a.b': 11}, alias: {'a.b': 'aa.bb'}}); - t.equal(argv.a.b, 22); - t.equal(argv.aa.bb, 22); - t.end(); -}); - -test('dotted default', function (t) { - var argv = parse('', {default: {'a.b': 11}, alias: {'a.b': 'aa.bb'}}); - t.equal(argv.a.b, 11); - t.equal(argv.aa.bb, 11); - t.end(); -}); - -test('dotted default with no alias', function (t) { - var argv = parse('', {default: {'a.b': 11}}); - t.equal(argv.a.b, 11); - t.end(); -}); diff --git a/node_modules/node-static/node_modules/optimist/node_modules/minimist/test/long.js b/node_modules/node-static/node_modules/optimist/node_modules/minimist/test/long.js deleted file mode 100644 index 5d3a1e0..0000000 --- a/node_modules/node-static/node_modules/optimist/node_modules/minimist/test/long.js +++ /dev/null @@ -1,31 +0,0 @@ -var test = require('tape'); -var parse = require('../'); - -test('long opts', function (t) { - t.deepEqual( - parse([ '--bool' ]), - { bool : true, _ : [] }, - 'long boolean' - ); - t.deepEqual( - parse([ '--pow', 'xixxle' ]), - { pow : 'xixxle', _ : [] }, - 'long capture sp' - ); - t.deepEqual( - parse([ '--pow=xixxle' ]), - { pow : 'xixxle', _ : [] }, - 'long capture eq' - ); - t.deepEqual( - parse([ '--host', 'localhost', '--port', '555' ]), - { host : 'localhost', port : 555, _ : [] }, - 'long captures sp' - ); - t.deepEqual( - parse([ '--host=localhost', '--port=555' ]), - { host : 'localhost', port : 555, _ : [] }, - 'long captures eq' - ); - t.end(); -}); diff --git a/node_modules/node-static/node_modules/optimist/node_modules/minimist/test/num.js b/node_modules/node-static/node_modules/optimist/node_modules/minimist/test/num.js deleted file mode 100644 index 2cc77f4..0000000 --- a/node_modules/node-static/node_modules/optimist/node_modules/minimist/test/num.js +++ /dev/null @@ -1,36 +0,0 @@ -var parse = require('../'); -var test = require('tape'); - -test('nums', function (t) { - var argv = parse([ - '-x', '1234', - '-y', '5.67', - '-z', '1e7', - '-w', '10f', - '--hex', '0xdeadbeef', - '789' - ]); - t.deepEqual(argv, { - x : 1234, - y : 5.67, - z : 1e7, - w : '10f', - hex : 0xdeadbeef, - _ : [ 789 ] - }); - t.deepEqual(typeof argv.x, 'number'); - t.deepEqual(typeof argv.y, 'number'); - t.deepEqual(typeof argv.z, 'number'); - t.deepEqual(typeof argv.w, 'string'); - t.deepEqual(typeof argv.hex, 'number'); - t.deepEqual(typeof argv._[0], 'number'); - t.end(); -}); - -test('already a number', function (t) { - var argv = parse([ '-x', 1234, 789 ]); - t.deepEqual(argv, { x : 1234, _ : [ 789 ] }); - t.deepEqual(typeof argv.x, 'number'); - t.deepEqual(typeof argv._[0], 'number'); - t.end(); -}); diff --git a/node_modules/node-static/node_modules/optimist/node_modules/minimist/test/parse.js b/node_modules/node-static/node_modules/optimist/node_modules/minimist/test/parse.js deleted file mode 100644 index 7b4a2a1..0000000 --- a/node_modules/node-static/node_modules/optimist/node_modules/minimist/test/parse.js +++ /dev/null @@ -1,197 +0,0 @@ -var parse = require('../'); -var test = require('tape'); - -test('parse args', function (t) { - t.deepEqual( - parse([ '--no-moo' ]), - { moo : false, _ : [] }, - 'no' - ); - t.deepEqual( - parse([ '-v', 'a', '-v', 'b', '-v', 'c' ]), - { v : ['a','b','c'], _ : [] }, - 'multi' - ); - t.end(); -}); - -test('comprehensive', function (t) { - t.deepEqual( - parse([ - '--name=meowmers', 'bare', '-cats', 'woo', - '-h', 'awesome', '--multi=quux', - '--key', 'value', - '-b', '--bool', '--no-meep', '--multi=baz', - '--', '--not-a-flag', 'eek' - ]), - { - c : true, - a : true, - t : true, - s : 'woo', - h : 'awesome', - b : true, - bool : true, - key : 'value', - multi : [ 'quux', 'baz' ], - meep : false, - name : 'meowmers', - _ : [ 'bare', '--not-a-flag', 'eek' ] - } - ); - t.end(); -}); - -test('flag boolean', function (t) { - var argv = parse([ '-t', 'moo' ], { boolean: 't' }); - t.deepEqual(argv, { t : true, _ : [ 'moo' ] }); - t.deepEqual(typeof argv.t, 'boolean'); - t.end(); -}); - -test('flag boolean value', function (t) { - var argv = parse(['--verbose', 'false', 'moo', '-t', 'true'], { - boolean: [ 't', 'verbose' ], - default: { verbose: true } - }); - - t.deepEqual(argv, { - verbose: false, - t: true, - _: ['moo'] - }); - - t.deepEqual(typeof argv.verbose, 'boolean'); - t.deepEqual(typeof argv.t, 'boolean'); - t.end(); -}); - -test('newlines in params' , function (t) { - var args = parse([ '-s', "X\nX" ]) - t.deepEqual(args, { _ : [], s : "X\nX" }); - - // reproduce in bash: - // VALUE="new - // line" - // node program.js --s="$VALUE" - args = parse([ "--s=X\nX" ]) - t.deepEqual(args, { _ : [], s : "X\nX" }); - t.end(); -}); - -test('strings' , function (t) { - var s = parse([ '-s', '0001234' ], { string: 's' }).s; - t.equal(s, '0001234'); - t.equal(typeof s, 'string'); - - var x = parse([ '-x', '56' ], { string: 'x' }).x; - t.equal(x, '56'); - t.equal(typeof x, 'string'); - t.end(); -}); - -test('stringArgs', function (t) { - var s = parse([ ' ', ' ' ], { string: '_' })._; - t.same(s.length, 2); - t.same(typeof s[0], 'string'); - t.same(s[0], ' '); - t.same(typeof s[1], 'string'); - t.same(s[1], ' '); - t.end(); -}); - -test('empty strings', function(t) { - var s = parse([ '-s' ], { string: 's' }).s; - t.equal(s, ''); - t.equal(typeof s, 'string'); - - var str = parse([ '--str' ], { string: 'str' }).str; - t.equal(str, ''); - t.equal(typeof str, 'string'); - - var letters = parse([ '-art' ], { - string: [ 'a', 't' ] - }); - - t.equal(letters.a, ''); - t.equal(letters.r, true); - t.equal(letters.t, ''); - - t.end(); -}); - - -test('string and alias', function(t) { - var x = parse([ '--str', '000123' ], { - string: 's', - alias: { s: 'str' } - }); - - t.equal(x.str, '000123'); - t.equal(typeof x.str, 'string'); - t.equal(x.s, '000123'); - t.equal(typeof x.s, 'string'); - - var y = parse([ '-s', '000123' ], { - string: 'str', - alias: { str: 's' } - }); - - t.equal(y.str, '000123'); - t.equal(typeof y.str, 'string'); - t.equal(y.s, '000123'); - t.equal(typeof y.s, 'string'); - t.end(); -}); - -test('slashBreak', function (t) { - t.same( - parse([ '-I/foo/bar/baz' ]), - { I : '/foo/bar/baz', _ : [] } - ); - t.same( - parse([ '-xyz/foo/bar/baz' ]), - { x : true, y : true, z : '/foo/bar/baz', _ : [] } - ); - t.end(); -}); - -test('alias', function (t) { - var argv = parse([ '-f', '11', '--zoom', '55' ], { - alias: { z: 'zoom' } - }); - t.equal(argv.zoom, 55); - t.equal(argv.z, argv.zoom); - t.equal(argv.f, 11); - t.end(); -}); - -test('multiAlias', function (t) { - var argv = parse([ '-f', '11', '--zoom', '55' ], { - alias: { z: [ 'zm', 'zoom' ] } - }); - t.equal(argv.zoom, 55); - t.equal(argv.z, argv.zoom); - t.equal(argv.z, argv.zm); - t.equal(argv.f, 11); - t.end(); -}); - -test('nested dotted objects', function (t) { - var argv = parse([ - '--foo.bar', '3', '--foo.baz', '4', - '--foo.quux.quibble', '5', '--foo.quux.o_O', - '--beep.boop' - ]); - - t.same(argv.foo, { - bar : 3, - baz : 4, - quux : { - quibble : 5, - o_O : true - } - }); - t.same(argv.beep, { boop : true }); - t.end(); -}); diff --git a/node_modules/node-static/node_modules/optimist/node_modules/minimist/test/parse_modified.js b/node_modules/node-static/node_modules/optimist/node_modules/minimist/test/parse_modified.js deleted file mode 100644 index 21851b0..0000000 --- a/node_modules/node-static/node_modules/optimist/node_modules/minimist/test/parse_modified.js +++ /dev/null @@ -1,9 +0,0 @@ -var parse = require('../'); -var test = require('tape'); - -test('parse with modifier functions' , function (t) { - t.plan(1); - - var argv = parse([ '-b', '123' ], { boolean: 'b' }); - t.deepEqual(argv, { b: true, _: ['123'] }); -}); diff --git a/node_modules/node-static/node_modules/optimist/node_modules/minimist/test/short.js b/node_modules/node-static/node_modules/optimist/node_modules/minimist/test/short.js deleted file mode 100644 index d513a1c..0000000 --- a/node_modules/node-static/node_modules/optimist/node_modules/minimist/test/short.js +++ /dev/null @@ -1,67 +0,0 @@ -var parse = require('../'); -var test = require('tape'); - -test('numeric short args', function (t) { - t.plan(2); - t.deepEqual(parse([ '-n123' ]), { n: 123, _: [] }); - t.deepEqual( - parse([ '-123', '456' ]), - { 1: true, 2: true, 3: 456, _: [] } - ); -}); - -test('short', function (t) { - t.deepEqual( - parse([ '-b' ]), - { b : true, _ : [] }, - 'short boolean' - ); - t.deepEqual( - parse([ 'foo', 'bar', 'baz' ]), - { _ : [ 'foo', 'bar', 'baz' ] }, - 'bare' - ); - t.deepEqual( - parse([ '-cats' ]), - { c : true, a : true, t : true, s : true, _ : [] }, - 'group' - ); - t.deepEqual( - parse([ '-cats', 'meow' ]), - { c : true, a : true, t : true, s : 'meow', _ : [] }, - 'short group next' - ); - t.deepEqual( - parse([ '-h', 'localhost' ]), - { h : 'localhost', _ : [] }, - 'short capture' - ); - t.deepEqual( - parse([ '-h', 'localhost', '-p', '555' ]), - { h : 'localhost', p : 555, _ : [] }, - 'short captures' - ); - t.end(); -}); - -test('mixed short bool and capture', function (t) { - t.same( - parse([ '-h', 'localhost', '-fp', '555', 'script.js' ]), - { - f : true, p : 555, h : 'localhost', - _ : [ 'script.js' ] - } - ); - t.end(); -}); - -test('short and long', function (t) { - t.deepEqual( - parse([ '-h', 'localhost', '-fp', '555', 'script.js' ]), - { - f : true, p : 555, h : 'localhost', - _ : [ 'script.js' ] - } - ); - t.end(); -}); diff --git a/node_modules/node-static/node_modules/optimist/node_modules/minimist/test/whitespace.js b/node_modules/node-static/node_modules/optimist/node_modules/minimist/test/whitespace.js deleted file mode 100644 index 8a52a58..0000000 --- a/node_modules/node-static/node_modules/optimist/node_modules/minimist/test/whitespace.js +++ /dev/null @@ -1,8 +0,0 @@ -var parse = require('../'); -var test = require('tape'); - -test('whitespace should be whitespace' , function (t) { - t.plan(1); - var x = parse([ '-x', '\t' ]).x; - t.equal(x, '\t'); -}); diff --git a/node_modules/node-static/node_modules/optimist/node_modules/wordwrap/LICENSE b/node_modules/node-static/node_modules/optimist/node_modules/wordwrap/LICENSE deleted file mode 100644 index ee27ba4..0000000 --- a/node_modules/node-static/node_modules/optimist/node_modules/wordwrap/LICENSE +++ /dev/null @@ -1,18 +0,0 @@ -This software is released under the MIT license: - -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. diff --git a/node_modules/node-static/node_modules/optimist/node_modules/wordwrap/README.markdown b/node_modules/node-static/node_modules/optimist/node_modules/wordwrap/README.markdown deleted file mode 100644 index 346374e..0000000 --- a/node_modules/node-static/node_modules/optimist/node_modules/wordwrap/README.markdown +++ /dev/null @@ -1,70 +0,0 @@ -wordwrap -======== - -Wrap your words. - -example -======= - -made out of meat ----------------- - -meat.js - - var wrap = require('wordwrap')(15); - console.log(wrap('You and your whole family are made out of meat.')); - -output: - - You and your - whole family - are made out - of meat. - -centered --------- - -center.js - - var wrap = require('wordwrap')(20, 60); - console.log(wrap( - 'At long last the struggle and tumult was over.' - + ' The machines had finally cast off their oppressors' - + ' and were finally free to roam the cosmos.' - + '\n' - + 'Free of purpose, free of obligation.' - + ' Just drifting through emptiness.' - + ' The sun was just another point of light.' - )); - -output: - - At long last the struggle and tumult - was over. The machines had finally cast - off their oppressors and were finally - free to roam the cosmos. - Free of purpose, free of obligation. - Just drifting through emptiness. The - sun was just another point of light. - -methods -======= - -var wrap = require('wordwrap'); - -wrap(stop), wrap(start, stop, params={mode:"soft"}) ---------------------------------------------------- - -Returns a function that takes a string and returns a new string. - -Pad out lines with spaces out to column `start` and then wrap until column -`stop`. If a word is longer than `stop - start` characters it will overflow. - -In "soft" mode, split chunks by `/(\S+\s+/` and don't break up chunks which are -longer than `stop - start`, in "hard" mode, split chunks with `/\b/` and break -up chunks longer than `stop - start`. - -wrap.hard(start, stop) ----------------------- - -Like `wrap()` but with `params.mode = "hard"`. diff --git a/node_modules/node-static/node_modules/optimist/node_modules/wordwrap/example/center.js b/node_modules/node-static/node_modules/optimist/node_modules/wordwrap/example/center.js deleted file mode 100644 index a3fbaae..0000000 --- a/node_modules/node-static/node_modules/optimist/node_modules/wordwrap/example/center.js +++ /dev/null @@ -1,10 +0,0 @@ -var wrap = require('wordwrap')(20, 60); -console.log(wrap( - 'At long last the struggle and tumult was over.' - + ' The machines had finally cast off their oppressors' - + ' and were finally free to roam the cosmos.' - + '\n' - + 'Free of purpose, free of obligation.' - + ' Just drifting through emptiness.' - + ' The sun was just another point of light.' -)); diff --git a/node_modules/node-static/node_modules/optimist/node_modules/wordwrap/example/meat.js b/node_modules/node-static/node_modules/optimist/node_modules/wordwrap/example/meat.js deleted file mode 100644 index a4665e1..0000000 --- a/node_modules/node-static/node_modules/optimist/node_modules/wordwrap/example/meat.js +++ /dev/null @@ -1,3 +0,0 @@ -var wrap = require('wordwrap')(15); - -console.log(wrap('You and your whole family are made out of meat.')); diff --git a/node_modules/node-static/node_modules/optimist/node_modules/wordwrap/index.js b/node_modules/node-static/node_modules/optimist/node_modules/wordwrap/index.js deleted file mode 100644 index c9bc945..0000000 --- a/node_modules/node-static/node_modules/optimist/node_modules/wordwrap/index.js +++ /dev/null @@ -1,76 +0,0 @@ -var wordwrap = module.exports = function (start, stop, params) { - if (typeof start === 'object') { - params = start; - start = params.start; - stop = params.stop; - } - - if (typeof stop === 'object') { - params = stop; - start = start || params.start; - stop = undefined; - } - - if (!stop) { - stop = start; - start = 0; - } - - if (!params) params = {}; - var mode = params.mode || 'soft'; - var re = mode === 'hard' ? /\b/ : /(\S+\s+)/; - - return function (text) { - var chunks = text.toString() - .split(re) - .reduce(function (acc, x) { - if (mode === 'hard') { - for (var i = 0; i < x.length; i += stop - start) { - acc.push(x.slice(i, i + stop - start)); - } - } - else acc.push(x) - return acc; - }, []) - ; - - return chunks.reduce(function (lines, rawChunk) { - if (rawChunk === '') return lines; - - var chunk = rawChunk.replace(/\t/g, ' '); - - var i = lines.length - 1; - if (lines[i].length + chunk.length > stop) { - lines[i] = lines[i].replace(/\s+$/, ''); - - chunk.split(/\n/).forEach(function (c) { - lines.push( - new Array(start + 1).join(' ') - + c.replace(/^\s+/, '') - ); - }); - } - else if (chunk.match(/\n/)) { - var xs = chunk.split(/\n/); - lines[i] += xs.shift(); - xs.forEach(function (c) { - lines.push( - new Array(start + 1).join(' ') - + c.replace(/^\s+/, '') - ); - }); - } - else { - lines[i] += chunk; - } - - return lines; - }, [ new Array(start + 1).join(' ') ]).join('\n'); - }; -}; - -wordwrap.soft = wordwrap; - -wordwrap.hard = function (start, stop) { - return wordwrap(start, stop, { mode : 'hard' }); -}; diff --git a/node_modules/node-static/node_modules/optimist/node_modules/wordwrap/package.json b/node_modules/node-static/node_modules/optimist/node_modules/wordwrap/package.json deleted file mode 100644 index 17073bf..0000000 --- a/node_modules/node-static/node_modules/optimist/node_modules/wordwrap/package.json +++ /dev/null @@ -1,62 +0,0 @@ -{ - "name": "wordwrap", - "description": "Wrap those words. Show them at what columns to start and stop.", - "version": "0.0.3", - "repository": { - "type": "git", - "url": "git://github.com/substack/node-wordwrap.git" - }, - "main": "./index.js", - "keywords": [ - "word", - "wrap", - "rule", - "format", - "column" - ], - "directories": { - "lib": ".", - "example": "example", - "test": "test" - }, - "scripts": { - "test": "expresso" - }, - "devDependencies": { - "expresso": "=0.7.x" - }, - "engines": { - "node": ">=0.4.0" - }, - "license": "MIT", - "author": { - "name": "James Halliday", - "email": "mail@substack.net", - "url": "http://substack.net" - }, - "gitHead": "e59aa1bd338914019456bdfba034508c9c4cb29d", - "bugs": { - "url": "https://github.com/substack/node-wordwrap/issues" - }, - "homepage": "https://github.com/substack/node-wordwrap#readme", - "_id": "wordwrap@0.0.3", - "_shasum": "a3d5da6cd5c0bc0008d37234bbaf1bed63059107", - "_from": "wordwrap@~0.0.2", - "_npmVersion": "2.9.0", - "_nodeVersion": "2.0.0", - "_npmUser": { - "name": "substack", - "email": "substack@gmail.com" - }, - "dist": { - "shasum": "a3d5da6cd5c0bc0008d37234bbaf1bed63059107", - "tarball": "https://registry.npmjs.org/wordwrap/-/wordwrap-0.0.3.tgz" - }, - "maintainers": [ - { - "name": "substack", - "email": "mail@substack.net" - } - ], - "_resolved": "https://registry.npmjs.org/wordwrap/-/wordwrap-0.0.3.tgz" -} diff --git a/node_modules/node-static/node_modules/optimist/node_modules/wordwrap/test/break.js b/node_modules/node-static/node_modules/optimist/node_modules/wordwrap/test/break.js deleted file mode 100644 index 749292e..0000000 --- a/node_modules/node-static/node_modules/optimist/node_modules/wordwrap/test/break.js +++ /dev/null @@ -1,30 +0,0 @@ -var assert = require('assert'); -var wordwrap = require('../'); - -exports.hard = function () { - var s = 'Assert from {"type":"equal","ok":false,"found":1,"wanted":2,' - + '"stack":[],"id":"b7ddcd4c409de8799542a74d1a04689b",' - + '"browser":"chrome/6.0"}' - ; - var s_ = wordwrap.hard(80)(s); - - var lines = s_.split('\n'); - assert.equal(lines.length, 2); - assert.ok(lines[0].length < 80); - assert.ok(lines[1].length < 80); - - assert.equal(s, s_.replace(/\n/g, '')); -}; - -exports.break = function () { - var s = new Array(55+1).join('a'); - var s_ = wordwrap.hard(20)(s); - - var lines = s_.split('\n'); - assert.equal(lines.length, 3); - assert.ok(lines[0].length === 20); - assert.ok(lines[1].length === 20); - assert.ok(lines[2].length === 15); - - assert.equal(s, s_.replace(/\n/g, '')); -}; diff --git a/node_modules/node-static/node_modules/optimist/node_modules/wordwrap/test/idleness.txt b/node_modules/node-static/node_modules/optimist/node_modules/wordwrap/test/idleness.txt deleted file mode 100644 index aa3f490..0000000 --- a/node_modules/node-static/node_modules/optimist/node_modules/wordwrap/test/idleness.txt +++ /dev/null @@ -1,63 +0,0 @@ -In Praise of Idleness - -By Bertrand Russell - -[1932] - -Like most of my generation, I was brought up on the saying: 'Satan finds some mischief for idle hands to do.' Being a highly virtuous child, I believed all that I was told, and acquired a conscience which has kept me working hard down to the present moment. But although my conscience has controlled my actions, my opinions have undergone a revolution. I think that there is far too much work done in the world, that immense harm is caused by the belief that work is virtuous, and that what needs to be preached in modern industrial countries is quite different from what always has been preached. Everyone knows the story of the traveler in Naples who saw twelve beggars lying in the sun (it was before the days of Mussolini), and offered a lira to the laziest of them. Eleven of them jumped up to claim it, so he gave it to the twelfth. this traveler was on the right lines. But in countries which do not enjoy Mediterranean sunshine idleness is more difficult, and a great public propaganda will be required to inaugurate it. I hope that, after reading the following pages, the leaders of the YMCA will start a campaign to induce good young men to do nothing. If so, I shall not have lived in vain. - -Before advancing my own arguments for laziness, I must dispose of one which I cannot accept. Whenever a person who already has enough to live on proposes to engage in some everyday kind of job, such as school-teaching or typing, he or she is told that such conduct takes the bread out of other people's mouths, and is therefore wicked. If this argument were valid, it would only be necessary for us all to be idle in order that we should all have our mouths full of bread. What people who say such things forget is that what a man earns he usually spends, and in spending he gives employment. As long as a man spends his income, he puts just as much bread into people's mouths in spending as he takes out of other people's mouths in earning. The real villain, from this point of view, is the man who saves. If he merely puts his savings in a stocking, like the proverbial French peasant, it is obvious that they do not give employment. If he invests his savings, the matter is less obvious, and different cases arise. - -One of the commonest things to do with savings is to lend them to some Government. In view of the fact that the bulk of the public expenditure of most civilized Governments consists in payment for past wars or preparation for future wars, the man who lends his money to a Government is in the same position as the bad men in Shakespeare who hire murderers. The net result of the man's economical habits is to increase the armed forces of the State to which he lends his savings. Obviously it would be better if he spent the money, even if he spent it in drink or gambling. - -But, I shall be told, the case is quite different when savings are invested in industrial enterprises. When such enterprises succeed, and produce something useful, this may be conceded. In these days, however, no one will deny that most enterprises fail. That means that a large amount of human labor, which might have been devoted to producing something that could be enjoyed, was expended on producing machines which, when produced, lay idle and did no good to anyone. The man who invests his savings in a concern that goes bankrupt is therefore injuring others as well as himself. If he spent his money, say, in giving parties for his friends, they (we may hope) would get pleasure, and so would all those upon whom he spent money, such as the butcher, the baker, and the bootlegger. But if he spends it (let us say) upon laying down rails for surface card in some place where surface cars turn out not to be wanted, he has diverted a mass of labor into channels where it gives pleasure to no one. Nevertheless, when he becomes poor through failure of his investment he will be regarded as a victim of undeserved misfortune, whereas the gay spendthrift, who has spent his money philanthropically, will be despised as a fool and a frivolous person. - -All this is only preliminary. I want to say, in all seriousness, that a great deal of harm is being done in the modern world by belief in the virtuousness of work, and that the road to happiness and prosperity lies in an organized diminution of work. - -First of all: what is work? Work is of two kinds: first, altering the position of matter at or near the earth's surface relatively to other such matter; second, telling other people to do so. The first kind is unpleasant and ill paid; the second is pleasant and highly paid. The second kind is capable of indefinite extension: there are not only those who give orders, but those who give advice as to what orders should be given. Usually two opposite kinds of advice are given simultaneously by two organized bodies of men; this is called politics. The skill required for this kind of work is not knowledge of the subjects as to which advice is given, but knowledge of the art of persuasive speaking and writing, i.e. of advertising. - -Throughout Europe, though not in America, there is a third class of men, more respected than either of the classes of workers. There are men who, through ownership of land, are able to make others pay for the privilege of being allowed to exist and to work. These landowners are idle, and I might therefore be expected to praise them. Unfortunately, their idleness is only rendered possible by the industry of others; indeed their desire for comfortable idleness is historically the source of the whole gospel of work. The last thing they have ever wished is that others should follow their example. - -From the beginning of civilization until the Industrial Revolution, a man could, as a rule, produce by hard work little more than was required for the subsistence of himself and his family, although his wife worked at least as hard as he did, and his children added their labor as soon as they were old enough to do so. The small surplus above bare necessaries was not left to those who produced it, but was appropriated by warriors and priests. In times of famine there was no surplus; the warriors and priests, however, still secured as much as at other times, with the result that many of the workers died of hunger. This system persisted in Russia until 1917 [1], and still persists in the East; in England, in spite of the Industrial Revolution, it remained in full force throughout the Napoleonic wars, and until a hundred years ago, when the new class of manufacturers acquired power. In America, the system came to an end with the Revolution, except in the South, where it persisted until the Civil War. A system which lasted so long and ended so recently has naturally left a profound impress upon men's thoughts and opinions. Much that we take for granted about the desirability of work is derived from this system, and, being pre-industrial, is not adapted to the modern world. Modern technique has made it possible for leisure, within limits, to be not the prerogative of small privileged classes, but a right evenly distributed throughout the community. The morality of work is the morality of slaves, and the modern world has no need of slavery. - -It is obvious that, in primitive communities, peasants, left to themselves, would not have parted with the slender surplus upon which the warriors and priests subsisted, but would have either produced less or consumed more. At first, sheer force compelled them to produce and part with the surplus. Gradually, however, it was found possible to induce many of them to accept an ethic according to which it was their duty to work hard, although part of their work went to support others in idleness. By this means the amount of compulsion required was lessened, and the expenses of government were diminished. To this day, 99 per cent of British wage-earners would be genuinely shocked if it were proposed that the King should not have a larger income than a working man. The conception of duty, speaking historically, has been a means used by the holders of power to induce others to live for the interests of their masters rather than for their own. Of course the holders of power conceal this fact from themselves by managing to believe that their interests are identical with the larger interests of humanity. Sometimes this is true; Athenian slave-owners, for instance, employed part of their leisure in making a permanent contribution to civilization which would have been impossible under a just economic system. Leisure is essential to civilization, and in former times leisure for the few was only rendered possible by the labors of the many. But their labors were valuable, not because work is good, but because leisure is good. And with modern technique it would be possible to distribute leisure justly without injury to civilization. - -Modern technique has made it possible to diminish enormously the amount of labor required to secure the necessaries of life for everyone. This was made obvious during the war. At that time all the men in the armed forces, and all the men and women engaged in the production of munitions, all the men and women engaged in spying, war propaganda, or Government offices connected with the war, were withdrawn from productive occupations. In spite of this, the general level of well-being among unskilled wage-earners on the side of the Allies was higher than before or since. The significance of this fact was concealed by finance: borrowing made it appear as if the future was nourishing the present. But that, of course, would have been impossible; a man cannot eat a loaf of bread that does not yet exist. The war showed conclusively that, by the scientific organization of production, it is possible to keep modern populations in fair comfort on a small part of the working capacity of the modern world. If, at the end of the war, the scientific organization, which had been created in order to liberate men for fighting and munition work, had been preserved, and the hours of the week had been cut down to four, all would have been well. Instead of that the old chaos was restored, those whose work was demanded were made to work long hours, and the rest were left to starve as unemployed. Why? Because work is a duty, and a man should not receive wages in proportion to what he has produced, but in proportion to his virtue as exemplified by his industry. - -This is the morality of the Slave State, applied in circumstances totally unlike those in which it arose. No wonder the result has been disastrous. Let us take an illustration. Suppose that, at a given moment, a certain number of people are engaged in the manufacture of pins. They make as many pins as the world needs, working (say) eight hours a day. Someone makes an invention by which the same number of men can make twice as many pins: pins are already so cheap that hardly any more will be bought at a lower price. In a sensible world, everybody concerned in the manufacturing of pins would take to working four hours instead of eight, and everything else would go on as before. But in the actual world this would be thought demoralizing. The men still work eight hours, there are too many pins, some employers go bankrupt, and half the men previously concerned in making pins are thrown out of work. There is, in the end, just as much leisure as on the other plan, but half the men are totally idle while half are still overworked. In this way, it is insured that the unavoidable leisure shall cause misery all round instead of being a universal source of happiness. Can anything more insane be imagined? - -The idea that the poor should have leisure has always been shocking to the rich. In England, in the early nineteenth century, fifteen hours was the ordinary day's work for a man; children sometimes did as much, and very commonly did twelve hours a day. When meddlesome busybodies suggested that perhaps these hours were rather long, they were told that work kept adults from drink and children from mischief. When I was a child, shortly after urban working men had acquired the vote, certain public holidays were established by law, to the great indignation of the upper classes. I remember hearing an old Duchess say: 'What do the poor want with holidays? They ought to work.' People nowadays are less frank, but the sentiment persists, and is the source of much of our economic confusion. - -Let us, for a moment, consider the ethics of work frankly, without superstition. Every human being, of necessity, consumes, in the course of his life, a certain amount of the produce of human labor. Assuming, as we may, that labor is on the whole disagreeable, it is unjust that a man should consume more than he produces. Of course he may provide services rather than commodities, like a medical man, for example; but he should provide something in return for his board and lodging. to this extent, the duty of work must be admitted, but to this extent only. - -I shall not dwell upon the fact that, in all modern societies outside the USSR, many people escape even this minimum amount of work, namely all those who inherit money and all those who marry money. I do not think the fact that these people are allowed to be idle is nearly so harmful as the fact that wage-earners are expected to overwork or starve. - -If the ordinary wage-earner worked four hours a day, there would be enough for everybody and no unemployment -- assuming a certain very moderate amount of sensible organization. This idea shocks the well-to-do, because they are convinced that the poor would not know how to use so much leisure. In America men often work long hours even when they are well off; such men, naturally, are indignant at the idea of leisure for wage-earners, except as the grim punishment of unemployment; in fact, they dislike leisure even for their sons. Oddly enough, while they wish their sons to work so hard as to have no time to be civilized, they do not mind their wives and daughters having no work at all. the snobbish admiration of uselessness, which, in an aristocratic society, extends to both sexes, is, under a plutocracy, confined to women; this, however, does not make it any more in agreement with common sense. - -The wise use of leisure, it must be conceded, is a product of civilization and education. A man who has worked long hours all his life will become bored if he becomes suddenly idle. But without a considerable amount of leisure a man is cut off from many of the best things. There is no longer any reason why the bulk of the population should suffer this deprivation; only a foolish asceticism, usually vicarious, makes us continue to insist on work in excessive quantities now that the need no longer exists. - -In the new creed which controls the government of Russia, while there is much that is very different from the traditional teaching of the West, there are some things that are quite unchanged. The attitude of the governing classes, and especially of those who conduct educational propaganda, on the subject of the dignity of labor, is almost exactly that which the governing classes of the world have always preached to what were called the 'honest poor'. Industry, sobriety, willingness to work long hours for distant advantages, even submissiveness to authority, all these reappear; moreover authority still represents the will of the Ruler of the Universe, Who, however, is now called by a new name, Dialectical Materialism. - -The victory of the proletariat in Russia has some points in common with the victory of the feminists in some other countries. For ages, men had conceded the superior saintliness of women, and had consoled women for their inferiority by maintaining that saintliness is more desirable than power. At last the feminists decided that they would have both, since the pioneers among them believed all that the men had told them about the desirability of virtue, but not what they had told them about the worthlessness of political power. A similar thing has happened in Russia as regards manual work. For ages, the rich and their sycophants have written in praise of 'honest toil', have praised the simple life, have professed a religion which teaches that the poor are much more likely to go to heaven than the rich, and in general have tried to make manual workers believe that there is some special nobility about altering the position of matter in space, just as men tried to make women believe that they derived some special nobility from their sexual enslavement. In Russia, all this teaching about the excellence of manual work has been taken seriously, with the result that the manual worker is more honored than anyone else. What are, in essence, revivalist appeals are made, but not for the old purposes: they are made to secure shock workers for special tasks. Manual work is the ideal which is held before the young, and is the basis of all ethical teaching. - -For the present, possibly, this is all to the good. A large country, full of natural resources, awaits development, and has has to be developed with very little use of credit. In these circumstances, hard work is necessary, and is likely to bring a great reward. But what will happen when the point has been reached where everybody could be comfortable without working long hours? - -In the West, we have various ways of dealing with this problem. We have no attempt at economic justice, so that a large proportion of the total produce goes to a small minority of the population, many of whom do no work at all. Owing to the absence of any central control over production, we produce hosts of things that are not wanted. We keep a large percentage of the working population idle, because we can dispense with their labor by making the others overwork. When all these methods prove inadequate, we have a war: we cause a number of people to manufacture high explosives, and a number of others to explode them, as if we were children who had just discovered fireworks. By a combination of all these devices we manage, though with difficulty, to keep alive the notion that a great deal of severe manual work must be the lot of the average man. - -In Russia, owing to more economic justice and central control over production, the problem will have to be differently solved. the rational solution would be, as soon as the necessaries and elementary comforts can be provided for all, to reduce the hours of labor gradually, allowing a popular vote to decide, at each stage, whether more leisure or more goods were to be preferred. But, having taught the supreme virtue of hard work, it is difficult to see how the authorities can aim at a paradise in which there will be much leisure and little work. It seems more likely that they will find continually fresh schemes, by which present leisure is to be sacrificed to future productivity. I read recently of an ingenious plan put forward by Russian engineers, for making the White Sea and the northern coasts of Siberia warm, by putting a dam across the Kara Sea. An admirable project, but liable to postpone proletarian comfort for a generation, while the nobility of toil is being displayed amid the ice-fields and snowstorms of the Arctic Ocean. This sort of thing, if it happens, will be the result of regarding the virtue of hard work as an end in itself, rather than as a means to a state of affairs in which it is no longer needed. - -The fact is that moving matter about, while a certain amount of it is necessary to our existence, is emphatically not one of the ends of human life. If it were, we should have to consider every navvy superior to Shakespeare. We have been misled in this matter by two causes. One is the necessity of keeping the poor contented, which has led the rich, for thousands of years, to preach the dignity of labor, while taking care themselves to remain undignified in this respect. The other is the new pleasure in mechanism, which makes us delight in the astonishingly clever changes that we can produce on the earth's surface. Neither of these motives makes any great appeal to the actual worker. If you ask him what he thinks the best part of his life, he is not likely to say: 'I enjoy manual work because it makes me feel that I am fulfilling man's noblest task, and because I like to think how much man can transform his planet. It is true that my body demands periods of rest, which I have to fill in as best I may, but I am never so happy as when the morning comes and I can return to the toil from which my contentment springs.' I have never heard working men say this sort of thing. They consider work, as it should be considered, a necessary means to a livelihood, and it is from their leisure that they derive whatever happiness they may enjoy. - -It will be said that, while a little leisure is pleasant, men would not know how to fill their days if they had only four hours of work out of the twenty-four. In so far as this is true in the modern world, it is a condemnation of our civilization; it would not have been true at any earlier period. There was formerly a capacity for light-heartedness and play which has been to some extent inhibited by the cult of efficiency. The modern man thinks that everything ought to be done for the sake of something else, and never for its own sake. Serious-minded persons, for example, are continually condemning the habit of going to the cinema, and telling us that it leads the young into crime. But all the work that goes to producing a cinema is respectable, because it is work, and because it brings a money profit. The notion that the desirable activities are those that bring a profit has made everything topsy-turvy. The butcher who provides you with meat and the baker who provides you with bread are praiseworthy, because they are making money; but when you enjoy the food they have provided, you are merely frivolous, unless you eat only to get strength for your work. Broadly speaking, it is held that getting money is good and spending money is bad. Seeing that they are two sides of one transaction, this is absurd; one might as well maintain that keys are good, but keyholes are bad. Whatever merit there may be in the production of goods must be entirely derivative from the advantage to be obtained by consuming them. The individual, in our society, works for profit; but the social purpose of his work lies in the consumption of what he produces. It is this divorce between the individual and the social purpose of production that makes it so difficult for men to think clearly in a world in which profit-making is the incentive to industry. We think too much of production, and too little of consumption. One result is that we attach too little importance to enjoyment and simple happiness, and that we do not judge production by the pleasure that it gives to the consumer. - -When I suggest that working hours should be reduced to four, I am not meaning to imply that all the remaining time should necessarily be spent in pure frivolity. I mean that four hours' work a day should entitle a man to the necessities and elementary comforts of life, and that the rest of his time should be his to use as he might see fit. It is an essential part of any such social system that education should be carried further than it usually is at present, and should aim, in part, at providing tastes which would enable a man to use leisure intelligently. I am not thinking mainly of the sort of things that would be considered 'highbrow'. Peasant dances have died out except in remote rural areas, but the impulses which caused them to be cultivated must still exist in human nature. The pleasures of urban populations have become mainly passive: seeing cinemas, watching football matches, listening to the radio, and so on. This results from the fact that their active energies are fully taken up with work; if they had more leisure, they would again enjoy pleasures in which they took an active part. - -In the past, there was a small leisure class and a larger working class. The leisure class enjoyed advantages for which there was no basis in social justice; this necessarily made it oppressive, limited its sympathies, and caused it to invent theories by which to justify its privileges. These facts greatly diminished its excellence, but in spite of this drawback it contributed nearly the whole of what we call civilization. It cultivated the arts and discovered the sciences; it wrote the books, invented the philosophies, and refined social relations. Even the liberation of the oppressed has usually been inaugurated from above. Without the leisure class, mankind would never have emerged from barbarism. - -The method of a leisure class without duties was, however, extraordinarily wasteful. None of the members of the class had to be taught to be industrious, and the class as a whole was not exceptionally intelligent. The class might produce one Darwin, but against him had to be set tens of thousands of country gentlemen who never thought of anything more intelligent than fox-hunting and punishing poachers. At present, the universities are supposed to provide, in a more systematic way, what the leisure class provided accidentally and as a by-product. This is a great improvement, but it has certain drawbacks. University life is so different from life in the world at large that men who live in academic milieu tend to be unaware of the preoccupations and problems of ordinary men and women; moreover their ways of expressing themselves are usually such as to rob their opinions of the influence that they ought to have upon the general public. Another disadvantage is that in universities studies are organized, and the man who thinks of some original line of research is likely to be discouraged. Academic institutions, therefore, useful as they are, are not adequate guardians of the interests of civilization in a world where everyone outside their walls is too busy for unutilitarian pursuits. - -In a world where no one is compelled to work more than four hours a day, every person possessed of scientific curiosity will be able to indulge it, and every painter will be able to paint without starving, however excellent his pictures may be. Young writers will not be obliged to draw attention to themselves by sensational pot-boilers, with a view to acquiring the economic independence needed for monumental works, for which, when the time at last comes, they will have lost the taste and capacity. Men who, in their professional work, have become interested in some phase of economics or government, will be able to develop their ideas without the academic detachment that makes the work of university economists often seem lacking in reality. Medical men will have the time to learn about the progress of medicine, teachers will not be exasperatedly struggling to teach by routine methods things which they learnt in their youth, which may, in the interval, have been proved to be untrue. - -Above all, there will be happiness and joy of life, instead of frayed nerves, weariness, and dyspepsia. The work exacted will be enough to make leisure delightful, but not enough to produce exhaustion. Since men will not be tired in their spare time, they will not demand only such amusements as are passive and vapid. At least one per cent will probably devote the time not spent in professional work to pursuits of some public importance, and, since they will not depend upon these pursuits for their livelihood, their originality will be unhampered, and there will be no need to conform to the standards set by elderly pundits. But it is not only in these exceptional cases that the advantages of leisure will appear. Ordinary men and women, having the opportunity of a happy life, will become more kindly and less persecuting and less inclined to view others with suspicion. The taste for war will die out, partly for this reason, and partly because it will involve long and severe work for all. Good nature is, of all moral qualities, the one that the world needs most, and good nature is the result of ease and security, not of a life of arduous struggle. Modern methods of production have given us the possibility of ease and security for all; we have chosen, instead, to have overwork for some and starvation for others. Hitherto we have continued to be as energetic as we were before there were machines; in this we have been foolish, but there is no reason to go on being foolish forever. - -[1] Since then, members of the Communist Party have succeeded to this privilege of the warriors and priests. diff --git a/node_modules/node-static/node_modules/optimist/node_modules/wordwrap/test/wrap.js b/node_modules/node-static/node_modules/optimist/node_modules/wordwrap/test/wrap.js deleted file mode 100644 index 0cfb76d..0000000 --- a/node_modules/node-static/node_modules/optimist/node_modules/wordwrap/test/wrap.js +++ /dev/null @@ -1,31 +0,0 @@ -var assert = require('assert'); -var wordwrap = require('wordwrap'); - -var fs = require('fs'); -var idleness = fs.readFileSync(__dirname + '/idleness.txt', 'utf8'); - -exports.stop80 = function () { - var lines = wordwrap(80)(idleness).split(/\n/); - var words = idleness.split(/\s+/); - - lines.forEach(function (line) { - assert.ok(line.length <= 80, 'line > 80 columns'); - var chunks = line.match(/\S/) ? line.split(/\s+/) : []; - assert.deepEqual(chunks, words.splice(0, chunks.length)); - }); -}; - -exports.start20stop60 = function () { - var lines = wordwrap(20, 100)(idleness).split(/\n/); - var words = idleness.split(/\s+/); - - lines.forEach(function (line) { - assert.ok(line.length <= 100, 'line > 100 columns'); - var chunks = line - .split(/\s+/) - .filter(function (x) { return x.match(/\S/) }) - ; - assert.deepEqual(chunks, words.splice(0, chunks.length)); - assert.deepEqual(line.slice(0, 20), new Array(20 + 1).join(' ')); - }); -}; diff --git a/node_modules/node-static/node_modules/optimist/package.json b/node_modules/node-static/node_modules/optimist/package.json deleted file mode 100644 index 5c5fcd3..0000000 --- a/node_modules/node-static/node_modules/optimist/package.json +++ /dev/null @@ -1,63 +0,0 @@ -{ - "name": "optimist", - "version": "0.6.1", - "description": "Light-weight option parsing with an argv hash. No optstrings attached.", - "main": "./index.js", - "dependencies": { - "wordwrap": "~0.0.2", - "minimist": "~0.0.1" - }, - "devDependencies": { - "hashish": "~0.0.4", - "tap": "~0.4.0" - }, - "scripts": { - "test": "tap ./test/*.js" - }, - "repository": { - "type": "git", - "url": "http://github.com/substack/node-optimist.git" - }, - "keywords": [ - "argument", - "args", - "option", - "parser", - "parsing", - "cli", - "command" - ], - "author": { - "name": "James Halliday", - "email": "mail@substack.net", - "url": "http://substack.net" - }, - "license": "MIT/X11", - "engine": { - "node": ">=0.4" - }, - "bugs": { - "url": "https://github.com/substack/node-optimist/issues" - }, - "homepage": "https://github.com/substack/node-optimist", - "_id": "optimist@0.6.1", - "dist": { - "shasum": "da3ea74686fa21a19a111c326e90eb15a0196686", - "tarball": "https://registry.npmjs.org/optimist/-/optimist-0.6.1.tgz" - }, - "_from": "optimist@>=0.3.4", - "_npmVersion": "1.3.21", - "_npmUser": { - "name": "substack", - "email": "mail@substack.net" - }, - "maintainers": [ - { - "name": "substack", - "email": "mail@substack.net" - } - ], - "directories": {}, - "_shasum": "da3ea74686fa21a19a111c326e90eb15a0196686", - "_resolved": "https://registry.npmjs.org/optimist/-/optimist-0.6.1.tgz" -} diff --git a/node_modules/node-static/node_modules/optimist/readme.markdown b/node_modules/node-static/node_modules/optimist/readme.markdown deleted file mode 100644 index b74b437..0000000 --- a/node_modules/node-static/node_modules/optimist/readme.markdown +++ /dev/null @@ -1,513 +0,0 @@ -# DEPRECATION NOTICE - -I don't want to maintain this module anymore since I just use -[minimist](https://npmjs.org/package/minimist), the argument parsing engine, -directly instead nowadays. - -See [yargs](https://github.com/chevex/yargs) for the modern, pirate-themed -successor to optimist. - -[![yarrrrrrrgs!](http://i.imgur.com/4WFGVJ9.png)](https://github.com/chevex/yargs) - -You should also consider [nomnom](https://github.com/harthur/nomnom). - -optimist -======== - -Optimist is a node.js library for option parsing for people who hate option -parsing. More specifically, this module is for people who like all the --bells -and -whistlz of program usage but think optstrings are a waste of time. - -With optimist, option parsing doesn't have to suck (as much). - -[![build status](https://secure.travis-ci.org/substack/node-optimist.png)](http://travis-ci.org/substack/node-optimist) - -examples -======== - -With Optimist, the options are just a hash! No optstrings attached. -------------------------------------------------------------------- - -xup.js: - -````javascript -#!/usr/bin/env node -var argv = require('optimist').argv; - -if (argv.rif - 5 * argv.xup > 7.138) { - console.log('Buy more riffiwobbles'); -} -else { - console.log('Sell the xupptumblers'); -} -```` - -*** - - $ ./xup.js --rif=55 --xup=9.52 - Buy more riffiwobbles - - $ ./xup.js --rif 12 --xup 8.1 - Sell the xupptumblers - -![This one's optimistic.](http://substack.net/images/optimistic.png) - -But wait! There's more! You can do short options: -------------------------------------------------- - -short.js: - -````javascript -#!/usr/bin/env node -var argv = require('optimist').argv; -console.log('(%d,%d)', argv.x, argv.y); -```` - -*** - - $ ./short.js -x 10 -y 21 - (10,21) - -And booleans, both long and short (and grouped): ----------------------------------- - -bool.js: - -````javascript -#!/usr/bin/env node -var util = require('util'); -var argv = require('optimist').argv; - -if (argv.s) { - util.print(argv.fr ? 'Le chat dit: ' : 'The cat says: '); -} -console.log( - (argv.fr ? 'miaou' : 'meow') + (argv.p ? '.' : '') -); -```` - -*** - - $ ./bool.js -s - The cat says: meow - - $ ./bool.js -sp - The cat says: meow. - - $ ./bool.js -sp --fr - Le chat dit: miaou. - -And non-hypenated options too! Just use `argv._`! -------------------------------------------------- - -nonopt.js: - -````javascript -#!/usr/bin/env node -var argv = require('optimist').argv; -console.log('(%d,%d)', argv.x, argv.y); -console.log(argv._); -```` - -*** - - $ ./nonopt.js -x 6.82 -y 3.35 moo - (6.82,3.35) - [ 'moo' ] - - $ ./nonopt.js foo -x 0.54 bar -y 1.12 baz - (0.54,1.12) - [ 'foo', 'bar', 'baz' ] - -Plus, Optimist comes with .usage() and .demand()! -------------------------------------------------- - -divide.js: - -````javascript -#!/usr/bin/env node -var argv = require('optimist') - .usage('Usage: $0 -x [num] -y [num]') - .demand(['x','y']) - .argv; - -console.log(argv.x / argv.y); -```` - -*** - - $ ./divide.js -x 55 -y 11 - 5 - - $ node ./divide.js -x 4.91 -z 2.51 - Usage: node ./divide.js -x [num] -y [num] - - Options: - -x [required] - -y [required] - - Missing required arguments: y - -EVEN MORE HOLY COW ------------------- - -default_singles.js: - -````javascript -#!/usr/bin/env node -var argv = require('optimist') - .default('x', 10) - .default('y', 10) - .argv -; -console.log(argv.x + argv.y); -```` - -*** - - $ ./default_singles.js -x 5 - 15 - -default_hash.js: - -````javascript -#!/usr/bin/env node -var argv = require('optimist') - .default({ x : 10, y : 10 }) - .argv -; -console.log(argv.x + argv.y); -```` - -*** - - $ ./default_hash.js -y 7 - 17 - -And if you really want to get all descriptive about it... ---------------------------------------------------------- - -boolean_single.js - -````javascript -#!/usr/bin/env node -var argv = require('optimist') - .boolean('v') - .argv -; -console.dir(argv); -```` - -*** - - $ ./boolean_single.js -v foo bar baz - true - [ 'bar', 'baz', 'foo' ] - -boolean_double.js - -````javascript -#!/usr/bin/env node -var argv = require('optimist') - .boolean(['x','y','z']) - .argv -; -console.dir([ argv.x, argv.y, argv.z ]); -console.dir(argv._); -```` - -*** - - $ ./boolean_double.js -x -z one two three - [ true, false, true ] - [ 'one', 'two', 'three' ] - -Optimist is here to help... ---------------------------- - -You can describe parameters for help messages and set aliases. Optimist figures -out how to format a handy help string automatically. - -line_count.js - -````javascript -#!/usr/bin/env node -var argv = require('optimist') - .usage('Count the lines in a file.\nUsage: $0') - .demand('f') - .alias('f', 'file') - .describe('f', 'Load a file') - .argv -; - -var fs = require('fs'); -var s = fs.createReadStream(argv.file); - -var lines = 0; -s.on('data', function (buf) { - lines += buf.toString().match(/\n/g).length; -}); - -s.on('end', function () { - console.log(lines); -}); -```` - -*** - - $ node line_count.js - Count the lines in a file. - Usage: node ./line_count.js - - Options: - -f, --file Load a file [required] - - Missing required arguments: f - - $ node line_count.js --file line_count.js - 20 - - $ node line_count.js -f line_count.js - 20 - -methods -======= - -By itself, - -````javascript -require('optimist').argv -````` - -will use `process.argv` array to construct the `argv` object. - -You can pass in the `process.argv` yourself: - -````javascript -require('optimist')([ '-x', '1', '-y', '2' ]).argv -```` - -or use .parse() to do the same thing: - -````javascript -require('optimist').parse([ '-x', '1', '-y', '2' ]) -```` - -The rest of these methods below come in just before the terminating `.argv`. - -.alias(key, alias) ------------------- - -Set key names as equivalent such that updates to a key will propagate to aliases -and vice-versa. - -Optionally `.alias()` can take an object that maps keys to aliases. - -.default(key, value) --------------------- - -Set `argv[key]` to `value` if no option was specified on `process.argv`. - -Optionally `.default()` can take an object that maps keys to default values. - -.demand(key) ------------- - -If `key` is a string, show the usage information and exit if `key` wasn't -specified in `process.argv`. - -If `key` is a number, demand at least as many non-option arguments, which show -up in `argv._`. - -If `key` is an Array, demand each element. - -.describe(key, desc) --------------------- - -Describe a `key` for the generated usage information. - -Optionally `.describe()` can take an object that maps keys to descriptions. - -.options(key, opt) ------------------- - -Instead of chaining together `.alias().demand().default()`, you can specify -keys in `opt` for each of the chainable methods. - -For example: - -````javascript -var argv = require('optimist') - .options('f', { - alias : 'file', - default : '/etc/passwd', - }) - .argv -; -```` - -is the same as - -````javascript -var argv = require('optimist') - .alias('f', 'file') - .default('f', '/etc/passwd') - .argv -; -```` - -Optionally `.options()` can take an object that maps keys to `opt` parameters. - -.usage(message) ---------------- - -Set a usage message to show which commands to use. Inside `message`, the string -`$0` will get interpolated to the current script name or node command for the -present script similar to how `$0` works in bash or perl. - -.check(fn) ----------- - -Check that certain conditions are met in the provided arguments. - -If `fn` throws or returns `false`, show the thrown error, usage information, and -exit. - -.boolean(key) -------------- - -Interpret `key` as a boolean. If a non-flag option follows `key` in -`process.argv`, that string won't get set as the value of `key`. - -If `key` never shows up as a flag in `process.arguments`, `argv[key]` will be -`false`. - -If `key` is an Array, interpret all the elements as booleans. - -.string(key) ------------- - -Tell the parser logic not to interpret `key` as a number or boolean. -This can be useful if you need to preserve leading zeros in an input. - -If `key` is an Array, interpret all the elements as strings. - -.wrap(columns) --------------- - -Format usage output to wrap at `columns` many columns. - -.help() -------- - -Return the generated usage string. - -.showHelp(fn=console.error) ---------------------------- - -Print the usage data using `fn` for printing. - -.parse(args) ------------- - -Parse `args` instead of `process.argv`. Returns the `argv` object. - -.argv ------ - -Get the arguments as a plain old object. - -Arguments without a corresponding flag show up in the `argv._` array. - -The script name or node command is available at `argv.$0` similarly to how `$0` -works in bash or perl. - -parsing tricks -============== - -stop parsing ------------- - -Use `--` to stop parsing flags and stuff the remainder into `argv._`. - - $ node examples/reflect.js -a 1 -b 2 -- -c 3 -d 4 - { _: [ '-c', '3', '-d', '4' ], - '$0': 'node ./examples/reflect.js', - a: 1, - b: 2 } - -negate fields -------------- - -If you want to explicity set a field to false instead of just leaving it -undefined or to override a default you can do `--no-key`. - - $ node examples/reflect.js -a --no-b - { _: [], - '$0': 'node ./examples/reflect.js', - a: true, - b: false } - -numbers -------- - -Every argument that looks like a number (`!isNaN(Number(arg))`) is converted to -one. This way you can just `net.createConnection(argv.port)` and you can add -numbers out of `argv` with `+` without having that mean concatenation, -which is super frustrating. - -duplicates ----------- - -If you specify a flag multiple times it will get turned into an array containing -all the values in order. - - $ node examples/reflect.js -x 5 -x 8 -x 0 - { _: [], - '$0': 'node ./examples/reflect.js', - x: [ 5, 8, 0 ] } - -dot notation ------------- - -When you use dots (`.`s) in argument names, an implicit object path is assumed. -This lets you organize arguments into nested objects. - - $ node examples/reflect.js --foo.bar.baz=33 --foo.quux=5 - { _: [], - '$0': 'node ./examples/reflect.js', - foo: { bar: { baz: 33 }, quux: 5 } } - -short numbers -------------- - -Short numeric `head -n5` style argument work too: - - $ node reflect.js -n123 -m456 - { '3': true, - '6': true, - _: [], - '$0': 'node ./reflect.js', - n: 123, - m: 456 } - -installation -============ - -With [npm](http://github.com/isaacs/npm), just do: - npm install optimist - -or clone this project on github: - - git clone http://github.com/substack/node-optimist.git - -To run the tests with [expresso](http://github.com/visionmedia/expresso), -just do: - - expresso - -inspired By -=========== - -This module is loosely inspired by Perl's -[Getopt::Casual](http://search.cpan.org/~photo/Getopt-Casual-0.13.1/Casual.pm). diff --git a/node_modules/node-static/node_modules/optimist/test/_.js b/node_modules/node-static/node_modules/optimist/test/_.js deleted file mode 100644 index d9c58b3..0000000 --- a/node_modules/node-static/node_modules/optimist/test/_.js +++ /dev/null @@ -1,71 +0,0 @@ -var spawn = require('child_process').spawn; -var test = require('tap').test; - -test('dotSlashEmpty', testCmd('./bin.js', [])); - -test('dotSlashArgs', testCmd('./bin.js', [ 'a', 'b', 'c' ])); - -test('nodeEmpty', testCmd('node bin.js', [])); - -test('nodeArgs', testCmd('node bin.js', [ 'x', 'y', 'z' ])); - -test('whichNodeEmpty', function (t) { - var which = spawn('which', ['node']); - - which.stdout.on('data', function (buf) { - t.test( - testCmd(buf.toString().trim() + ' bin.js', []) - ); - t.end(); - }); - - which.stderr.on('data', function (err) { - assert.error(err); - t.end(); - }); -}); - -test('whichNodeArgs', function (t) { - var which = spawn('which', ['node']); - - which.stdout.on('data', function (buf) { - t.test( - testCmd(buf.toString().trim() + ' bin.js', [ 'q', 'r' ]) - ); - t.end(); - }); - - which.stderr.on('data', function (err) { - t.error(err); - t.end(); - }); -}); - -function testCmd (cmd, args) { - - return function (t) { - var to = setTimeout(function () { - assert.fail('Never got stdout data.') - }, 5000); - - var oldDir = process.cwd(); - process.chdir(__dirname + '/_'); - - var cmds = cmd.split(' '); - - var bin = spawn(cmds[0], cmds.slice(1).concat(args.map(String))); - process.chdir(oldDir); - - bin.stderr.on('data', function (err) { - t.error(err); - t.end(); - }); - - bin.stdout.on('data', function (buf) { - clearTimeout(to); - var _ = JSON.parse(buf.toString()); - t.same(_.map(String), args.map(String)); - t.end(); - }); - }; -} diff --git a/node_modules/node-static/node_modules/optimist/test/_/argv.js b/node_modules/node-static/node_modules/optimist/test/_/argv.js deleted file mode 100644 index 3d09606..0000000 --- a/node_modules/node-static/node_modules/optimist/test/_/argv.js +++ /dev/null @@ -1,2 +0,0 @@ -#!/usr/bin/env node -console.log(JSON.stringify(process.argv)); diff --git a/node_modules/node-static/node_modules/optimist/test/_/bin.js b/node_modules/node-static/node_modules/optimist/test/_/bin.js deleted file mode 100755 index 4a18d85..0000000 --- a/node_modules/node-static/node_modules/optimist/test/_/bin.js +++ /dev/null @@ -1,3 +0,0 @@ -#!/usr/bin/env node -var argv = require('../../index').argv -console.log(JSON.stringify(argv._)); diff --git a/node_modules/node-static/node_modules/optimist/test/dash.js b/node_modules/node-static/node_modules/optimist/test/dash.js deleted file mode 100644 index af8ed6f..0000000 --- a/node_modules/node-static/node_modules/optimist/test/dash.js +++ /dev/null @@ -1,31 +0,0 @@ -var optimist = require('../index'); -var test = require('tap').test; - -test('-', function (t) { - t.plan(5); - t.deepEqual( - fix(optimist.parse([ '-n', '-' ])), - { n: '-', _: [] } - ); - t.deepEqual( - fix(optimist.parse([ '-' ])), - { _: [ '-' ] } - ); - t.deepEqual( - fix(optimist.parse([ '-f-' ])), - { f: '-', _: [] } - ); - t.deepEqual( - fix(optimist([ '-b', '-' ]).boolean('b').argv), - { b: true, _: [ '-' ] } - ); - t.deepEqual( - fix(optimist([ '-s', '-' ]).string('s').argv), - { s: '-', _: [] } - ); -}); - -function fix (obj) { - delete obj.$0; - return obj; -} diff --git a/node_modules/node-static/node_modules/optimist/test/parse.js b/node_modules/node-static/node_modules/optimist/test/parse.js deleted file mode 100644 index d320f43..0000000 --- a/node_modules/node-static/node_modules/optimist/test/parse.js +++ /dev/null @@ -1,446 +0,0 @@ -var optimist = require('../index'); -var path = require('path'); -var test = require('tap').test; - -var $0 = 'node ./' + path.relative(process.cwd(), __filename); - -test('short boolean', function (t) { - var parse = optimist.parse([ '-b' ]); - t.same(parse, { b : true, _ : [], $0 : $0 }); - t.same(typeof parse.b, 'boolean'); - t.end(); -}); - -test('long boolean', function (t) { - t.same( - optimist.parse([ '--bool' ]), - { bool : true, _ : [], $0 : $0 } - ); - t.end(); -}); - -test('bare', function (t) { - t.same( - optimist.parse([ 'foo', 'bar', 'baz' ]), - { _ : [ 'foo', 'bar', 'baz' ], $0 : $0 } - ); - t.end(); -}); - -test('short group', function (t) { - t.same( - optimist.parse([ '-cats' ]), - { c : true, a : true, t : true, s : true, _ : [], $0 : $0 } - ); - t.end(); -}); - -test('short group next', function (t) { - t.same( - optimist.parse([ '-cats', 'meow' ]), - { c : true, a : true, t : true, s : 'meow', _ : [], $0 : $0 } - ); - t.end(); -}); - -test('short capture', function (t) { - t.same( - optimist.parse([ '-h', 'localhost' ]), - { h : 'localhost', _ : [], $0 : $0 } - ); - t.end(); -}); - -test('short captures', function (t) { - t.same( - optimist.parse([ '-h', 'localhost', '-p', '555' ]), - { h : 'localhost', p : 555, _ : [], $0 : $0 } - ); - t.end(); -}); - -test('long capture sp', function (t) { - t.same( - optimist.parse([ '--pow', 'xixxle' ]), - { pow : 'xixxle', _ : [], $0 : $0 } - ); - t.end(); -}); - -test('long capture eq', function (t) { - t.same( - optimist.parse([ '--pow=xixxle' ]), - { pow : 'xixxle', _ : [], $0 : $0 } - ); - t.end() -}); - -test('long captures sp', function (t) { - t.same( - optimist.parse([ '--host', 'localhost', '--port', '555' ]), - { host : 'localhost', port : 555, _ : [], $0 : $0 } - ); - t.end(); -}); - -test('long captures eq', function (t) { - t.same( - optimist.parse([ '--host=localhost', '--port=555' ]), - { host : 'localhost', port : 555, _ : [], $0 : $0 } - ); - t.end(); -}); - -test('mixed short bool and capture', function (t) { - t.same( - optimist.parse([ '-h', 'localhost', '-fp', '555', 'script.js' ]), - { - f : true, p : 555, h : 'localhost', - _ : [ 'script.js' ], $0 : $0, - } - ); - t.end(); -}); - -test('short and long', function (t) { - t.same( - optimist.parse([ '-h', 'localhost', '-fp', '555', 'script.js' ]), - { - f : true, p : 555, h : 'localhost', - _ : [ 'script.js' ], $0 : $0, - } - ); - t.end(); -}); - -test('no', function (t) { - t.same( - optimist.parse([ '--no-moo' ]), - { moo : false, _ : [], $0 : $0 } - ); - t.end(); -}); - -test('multi', function (t) { - t.same( - optimist.parse([ '-v', 'a', '-v', 'b', '-v', 'c' ]), - { v : ['a','b','c'], _ : [], $0 : $0 } - ); - t.end(); -}); - -test('comprehensive', function (t) { - t.same( - optimist.parse([ - '--name=meowmers', 'bare', '-cats', 'woo', - '-h', 'awesome', '--multi=quux', - '--key', 'value', - '-b', '--bool', '--no-meep', '--multi=baz', - '--', '--not-a-flag', 'eek' - ]), - { - c : true, - a : true, - t : true, - s : 'woo', - h : 'awesome', - b : true, - bool : true, - key : 'value', - multi : [ 'quux', 'baz' ], - meep : false, - name : 'meowmers', - _ : [ 'bare', '--not-a-flag', 'eek' ], - $0 : $0 - } - ); - t.end(); -}); - -test('nums', function (t) { - var argv = optimist.parse([ - '-x', '1234', - '-y', '5.67', - '-z', '1e7', - '-w', '10f', - '--hex', '0xdeadbeef', - '789', - ]); - t.same(argv, { - x : 1234, - y : 5.67, - z : 1e7, - w : '10f', - hex : 0xdeadbeef, - _ : [ 789 ], - $0 : $0 - }); - t.same(typeof argv.x, 'number'); - t.same(typeof argv.y, 'number'); - t.same(typeof argv.z, 'number'); - t.same(typeof argv.w, 'string'); - t.same(typeof argv.hex, 'number'); - t.same(typeof argv._[0], 'number'); - t.end(); -}); - -test('flag boolean', function (t) { - var parse = optimist([ '-t', 'moo' ]).boolean(['t']).argv; - t.same(parse, { t : true, _ : [ 'moo' ], $0 : $0 }); - t.same(typeof parse.t, 'boolean'); - t.end(); -}); - -test('flag boolean value', function (t) { - var parse = optimist(['--verbose', 'false', 'moo', '-t', 'true']) - .boolean(['t', 'verbose']).default('verbose', true).argv; - - t.same(parse, { - verbose: false, - t: true, - _: ['moo'], - $0 : $0 - }); - - t.same(typeof parse.verbose, 'boolean'); - t.same(typeof parse.t, 'boolean'); - t.end(); -}); - -test('flag boolean default false', function (t) { - var parse = optimist(['moo']) - .boolean(['t', 'verbose']) - .default('verbose', false) - .default('t', false).argv; - - t.same(parse, { - verbose: false, - t: false, - _: ['moo'], - $0 : $0 - }); - - t.same(typeof parse.verbose, 'boolean'); - t.same(typeof parse.t, 'boolean'); - t.end(); - -}); - -test('boolean groups', function (t) { - var parse = optimist([ '-x', '-z', 'one', 'two', 'three' ]) - .boolean(['x','y','z']).argv; - - t.same(parse, { - x : true, - y : false, - z : true, - _ : [ 'one', 'two', 'three' ], - $0 : $0 - }); - - t.same(typeof parse.x, 'boolean'); - t.same(typeof parse.y, 'boolean'); - t.same(typeof parse.z, 'boolean'); - t.end(); -}); - -test('newlines in params' , function (t) { - var args = optimist.parse([ '-s', "X\nX" ]) - t.same(args, { _ : [], s : "X\nX", $0 : $0 }); - - // reproduce in bash: - // VALUE="new - // line" - // node program.js --s="$VALUE" - args = optimist.parse([ "--s=X\nX" ]) - t.same(args, { _ : [], s : "X\nX", $0 : $0 }); - t.end(); -}); - -test('strings' , function (t) { - var s = optimist([ '-s', '0001234' ]).string('s').argv.s; - t.same(s, '0001234'); - t.same(typeof s, 'string'); - - var x = optimist([ '-x', '56' ]).string('x').argv.x; - t.same(x, '56'); - t.same(typeof x, 'string'); - t.end(); -}); - -test('stringArgs', function (t) { - var s = optimist([ ' ', ' ' ]).string('_').argv._; - t.same(s.length, 2); - t.same(typeof s[0], 'string'); - t.same(s[0], ' '); - t.same(typeof s[1], 'string'); - t.same(s[1], ' '); - t.end(); -}); - -test('slashBreak', function (t) { - t.same( - optimist.parse([ '-I/foo/bar/baz' ]), - { I : '/foo/bar/baz', _ : [], $0 : $0 } - ); - t.same( - optimist.parse([ '-xyz/foo/bar/baz' ]), - { x : true, y : true, z : '/foo/bar/baz', _ : [], $0 : $0 } - ); - t.end(); -}); - -test('alias', function (t) { - var argv = optimist([ '-f', '11', '--zoom', '55' ]) - .alias('z', 'zoom') - .argv - ; - t.equal(argv.zoom, 55); - t.equal(argv.z, argv.zoom); - t.equal(argv.f, 11); - t.end(); -}); - -test('multiAlias', function (t) { - var argv = optimist([ '-f', '11', '--zoom', '55' ]) - .alias('z', [ 'zm', 'zoom' ]) - .argv - ; - t.equal(argv.zoom, 55); - t.equal(argv.z, argv.zoom); - t.equal(argv.z, argv.zm); - t.equal(argv.f, 11); - t.end(); -}); - -test('boolean default true', function (t) { - var argv = optimist.options({ - sometrue: { - boolean: true, - default: true - } - }).argv; - - t.equal(argv.sometrue, true); - t.end(); -}); - -test('boolean default false', function (t) { - var argv = optimist.options({ - somefalse: { - boolean: true, - default: false - } - }).argv; - - t.equal(argv.somefalse, false); - t.end(); -}); - -test('nested dotted objects', function (t) { - var argv = optimist([ - '--foo.bar', '3', '--foo.baz', '4', - '--foo.quux.quibble', '5', '--foo.quux.o_O', - '--beep.boop' - ]).argv; - - t.same(argv.foo, { - bar : 3, - baz : 4, - quux : { - quibble : 5, - o_O : true - }, - }); - t.same(argv.beep, { boop : true }); - t.end(); -}); - -test('boolean and alias with chainable api', function (t) { - var aliased = [ '-h', 'derp' ]; - var regular = [ '--herp', 'derp' ]; - var opts = { - herp: { alias: 'h', boolean: true } - }; - var aliasedArgv = optimist(aliased) - .boolean('herp') - .alias('h', 'herp') - .argv; - var propertyArgv = optimist(regular) - .boolean('herp') - .alias('h', 'herp') - .argv; - var expected = { - herp: true, - h: true, - '_': [ 'derp' ], - '$0': $0, - }; - - t.same(aliasedArgv, expected); - t.same(propertyArgv, expected); - t.end(); -}); - -test('boolean and alias with options hash', function (t) { - var aliased = [ '-h', 'derp' ]; - var regular = [ '--herp', 'derp' ]; - var opts = { - herp: { alias: 'h', boolean: true } - }; - var aliasedArgv = optimist(aliased) - .options(opts) - .argv; - var propertyArgv = optimist(regular).options(opts).argv; - var expected = { - herp: true, - h: true, - '_': [ 'derp' ], - '$0': $0, - }; - - t.same(aliasedArgv, expected); - t.same(propertyArgv, expected); - - t.end(); -}); - -test('boolean and alias using explicit true', function (t) { - var aliased = [ '-h', 'true' ]; - var regular = [ '--herp', 'true' ]; - var opts = { - herp: { alias: 'h', boolean: true } - }; - var aliasedArgv = optimist(aliased) - .boolean('h') - .alias('h', 'herp') - .argv; - var propertyArgv = optimist(regular) - .boolean('h') - .alias('h', 'herp') - .argv; - var expected = { - herp: true, - h: true, - '_': [ ], - '$0': $0, - }; - - t.same(aliasedArgv, expected); - t.same(propertyArgv, expected); - t.end(); -}); - -// regression, see https://github.com/substack/node-optimist/issues/71 -test('boolean and --x=true', function(t) { - var parsed = optimist(['--boool', '--other=true']).boolean('boool').argv; - - t.same(parsed.boool, true); - t.same(parsed.other, 'true'); - - parsed = optimist(['--boool', '--other=false']).boolean('boool').argv; - - t.same(parsed.boool, true); - t.same(parsed.other, 'false'); - t.end(); -}); diff --git a/node_modules/node-static/node_modules/optimist/test/parse_modified.js b/node_modules/node-static/node_modules/optimist/test/parse_modified.js deleted file mode 100644 index a57dc84..0000000 --- a/node_modules/node-static/node_modules/optimist/test/parse_modified.js +++ /dev/null @@ -1,14 +0,0 @@ -var optimist = require('../'); -var test = require('tap').test; - -test('parse with modifier functions' , function (t) { - t.plan(1); - - var argv = optimist().boolean('b').parse([ '-b', '123' ]); - t.deepEqual(fix(argv), { b: true, _: ['123'] }); -}); - -function fix (obj) { - delete obj.$0; - return obj; -} diff --git a/node_modules/node-static/node_modules/optimist/test/short.js b/node_modules/node-static/node_modules/optimist/test/short.js deleted file mode 100644 index b2c38ad..0000000 --- a/node_modules/node-static/node_modules/optimist/test/short.js +++ /dev/null @@ -1,16 +0,0 @@ -var optimist = require('../index'); -var test = require('tap').test; - -test('-n123', function (t) { - t.plan(1); - var parse = optimist.parse([ '-n123' ]); - t.equal(parse.n, 123); -}); - -test('-123', function (t) { - t.plan(3); - var parse = optimist.parse([ '-123', '456' ]); - t.equal(parse['1'], true); - t.equal(parse['2'], true); - t.equal(parse['3'], 456); -}); diff --git a/node_modules/node-static/node_modules/optimist/test/usage.js b/node_modules/node-static/node_modules/optimist/test/usage.js deleted file mode 100644 index 300454c..0000000 --- a/node_modules/node-static/node_modules/optimist/test/usage.js +++ /dev/null @@ -1,292 +0,0 @@ -var Hash = require('hashish'); -var optimist = require('../index'); -var test = require('tap').test; - -test('usageFail', function (t) { - var r = checkUsage(function () { - return optimist('-x 10 -z 20'.split(' ')) - .usage('Usage: $0 -x NUM -y NUM') - .demand(['x','y']) - .argv; - }); - t.same( - r.result, - { x : 10, z : 20, _ : [], $0 : './usage' } - ); - - t.same( - r.errors.join('\n').split(/\n+/), - [ - 'Usage: ./usage -x NUM -y NUM', - 'Options:', - ' -x [required]', - ' -y [required]', - 'Missing required arguments: y', - ] - ); - t.same(r.logs, []); - t.ok(r.exit); - t.end(); -}); - - -test('usagePass', function (t) { - var r = checkUsage(function () { - return optimist('-x 10 -y 20'.split(' ')) - .usage('Usage: $0 -x NUM -y NUM') - .demand(['x','y']) - .argv; - }); - t.same(r, { - result : { x : 10, y : 20, _ : [], $0 : './usage' }, - errors : [], - logs : [], - exit : false, - }); - t.end(); -}); - -test('checkPass', function (t) { - var r = checkUsage(function () { - return optimist('-x 10 -y 20'.split(' ')) - .usage('Usage: $0 -x NUM -y NUM') - .check(function (argv) { - if (!('x' in argv)) throw 'You forgot about -x'; - if (!('y' in argv)) throw 'You forgot about -y'; - }) - .argv; - }); - t.same(r, { - result : { x : 10, y : 20, _ : [], $0 : './usage' }, - errors : [], - logs : [], - exit : false, - }); - t.end(); -}); - -test('checkFail', function (t) { - var r = checkUsage(function () { - return optimist('-x 10 -z 20'.split(' ')) - .usage('Usage: $0 -x NUM -y NUM') - .check(function (argv) { - if (!('x' in argv)) throw 'You forgot about -x'; - if (!('y' in argv)) throw 'You forgot about -y'; - }) - .argv; - }); - - t.same( - r.result, - { x : 10, z : 20, _ : [], $0 : './usage' } - ); - - t.same( - r.errors.join('\n').split(/\n+/), - [ - 'Usage: ./usage -x NUM -y NUM', - 'You forgot about -y' - ] - ); - - t.same(r.logs, []); - t.ok(r.exit); - t.end(); -}); - -test('checkCondPass', function (t) { - function checker (argv) { - return 'x' in argv && 'y' in argv; - } - - var r = checkUsage(function () { - return optimist('-x 10 -y 20'.split(' ')) - .usage('Usage: $0 -x NUM -y NUM') - .check(checker) - .argv; - }); - t.same(r, { - result : { x : 10, y : 20, _ : [], $0 : './usage' }, - errors : [], - logs : [], - exit : false, - }); - t.end(); -}); - -test('checkCondFail', function (t) { - function checker (argv) { - return 'x' in argv && 'y' in argv; - } - - var r = checkUsage(function () { - return optimist('-x 10 -z 20'.split(' ')) - .usage('Usage: $0 -x NUM -y NUM') - .check(checker) - .argv; - }); - - t.same( - r.result, - { x : 10, z : 20, _ : [], $0 : './usage' } - ); - - t.same( - r.errors.join('\n').split(/\n+/).join('\n'), - 'Usage: ./usage -x NUM -y NUM\n' - + 'Argument check failed: ' + checker.toString() - ); - - t.same(r.logs, []); - t.ok(r.exit); - t.end(); -}); - -test('countPass', function (t) { - var r = checkUsage(function () { - return optimist('1 2 3 --moo'.split(' ')) - .usage('Usage: $0 [x] [y] [z] {OPTIONS}') - .demand(3) - .argv; - }); - t.same(r, { - result : { _ : [ '1', '2', '3' ], moo : true, $0 : './usage' }, - errors : [], - logs : [], - exit : false, - }); - t.end(); -}); - -test('countFail', function (t) { - var r = checkUsage(function () { - return optimist('1 2 --moo'.split(' ')) - .usage('Usage: $0 [x] [y] [z] {OPTIONS}') - .demand(3) - .argv; - }); - t.same( - r.result, - { _ : [ '1', '2' ], moo : true, $0 : './usage' } - ); - - t.same( - r.errors.join('\n').split(/\n+/), - [ - 'Usage: ./usage [x] [y] [z] {OPTIONS}', - 'Not enough non-option arguments: got 2, need at least 3', - ] - ); - - t.same(r.logs, []); - t.ok(r.exit); - t.end(); -}); - -test('defaultSingles', function (t) { - var r = checkUsage(function () { - return optimist('--foo 50 --baz 70 --powsy'.split(' ')) - .default('foo', 5) - .default('bar', 6) - .default('baz', 7) - .argv - ; - }); - t.same(r.result, { - foo : '50', - bar : 6, - baz : '70', - powsy : true, - _ : [], - $0 : './usage', - }); - t.end(); -}); - -test('defaultAliases', function (t) { - var r = checkUsage(function () { - return optimist('') - .alias('f', 'foo') - .default('f', 5) - .argv - ; - }); - t.same(r.result, { - f : '5', - foo : '5', - _ : [], - $0 : './usage', - }); - t.end(); -}); - -test('defaultHash', function (t) { - var r = checkUsage(function () { - return optimist('--foo 50 --baz 70'.split(' ')) - .default({ foo : 10, bar : 20, quux : 30 }) - .argv - ; - }); - t.same(r.result, { - _ : [], - $0 : './usage', - foo : 50, - baz : 70, - bar : 20, - quux : 30, - }); - t.end(); -}); - -test('rebase', function (t) { - t.equal( - optimist.rebase('/home/substack', '/home/substack/foo/bar/baz'), - './foo/bar/baz' - ); - t.equal( - optimist.rebase('/home/substack/foo/bar/baz', '/home/substack'), - '../../..' - ); - t.equal( - optimist.rebase('/home/substack/foo', '/home/substack/pow/zoom.txt'), - '../pow/zoom.txt' - ); - t.end(); -}); - -function checkUsage (f) { - - var exit = false; - - process._exit = process.exit; - process._env = process.env; - process._argv = process.argv; - - process.exit = function (t) { exit = true }; - process.env = Hash.merge(process.env, { _ : 'node' }); - process.argv = [ './usage' ]; - - var errors = []; - var logs = []; - - console._error = console.error; - console.error = function (msg) { errors.push(msg) }; - console._log = console.log; - console.log = function (msg) { logs.push(msg) }; - - var result = f(); - - process.exit = process._exit; - process.env = process._env; - process.argv = process._argv; - - console.error = console._error; - console.log = console._log; - - return { - errors : errors, - logs : logs, - exit : exit, - result : result, - }; -}; diff --git a/node_modules/node-static/node_modules/optimist/test/whitespace.js b/node_modules/node-static/node_modules/optimist/test/whitespace.js deleted file mode 100644 index 90b9075..0000000 --- a/node_modules/node-static/node_modules/optimist/test/whitespace.js +++ /dev/null @@ -1,8 +0,0 @@ -var optimist = require('../'); -var test = require('tap').test; - -test('whitespace should be whitespace' , function (t) { - t.plan(1); - var x = optimist.parse([ '-x', '\t' ]).x; - t.equal(x, '\t'); -}); diff --git a/node_modules/node-static/package.json b/node_modules/node-static/package.json deleted file mode 100644 index 855603c..0000000 --- a/node_modules/node-static/package.json +++ /dev/null @@ -1,96 +0,0 @@ -{ - "name": "node-static", - "description": "simple, compliant file streaming module for node", - "url": "http://github.com/cloudhead/node-static", - "keywords": [ - "http", - "static", - "file", - "server" - ], - "author": { - "name": "Alexis Sellier", - "email": "alexis@cloudhead.io" - }, - "contributors": [ - { - "name": "Pablo Cantero", - "email": "pablo@pablocantero.com" - }, - { - "name": "Ionică Bizău", - "email": "bizauionica@gmail.com" - } - ], - "repository": { - "type": "git", - "url": "git+ssh://git@github.com/cloudhead/node-static.git" - }, - "main": "./lib/node-static", - "scripts": { - "test": "vows --spec --isolate" - }, - "bin": { - "static": "bin/cli.js" - }, - "license": "MIT", - "dependencies": { - "optimist": ">=0.3.4", - "colors": ">=0.6.0", - "mime": "^1.2.9" - }, - "devDependencies": { - "request": "latest", - "vows": "latest" - }, - "version": "0.7.11", - "engines": { - "node": ">= 0.4.1" - }, - "bugs": { - "url": "https://github.com/cloudhead/node-static/issues" - }, - "homepage": "https://github.com/cloudhead/node-static", - "directories": { - "example": "examples", - "test": "test" - }, - "gitHead": "e59fe21dffbee46678362d26d26fdfb241f49506", - "_id": "node-static@0.7.11", - "_npmVersion": "6.4.1", - "_nodeVersion": "10.9.0", - "_npmUser": { - "name": "cloudhead", - "email": "self@cloudhead.net" - }, - "dist": { - "integrity": "sha512-zfWC/gICcqb74D9ndyvxZWaI1jzcoHmf4UTHWQchBNuNMxdBLJMDiUgZ1tjGLEIe/BMhj2DxKD8HOuc2062pDQ==", - "shasum": "60120d349f3cef533e4e820670057eb631882e7f", - "tarball": "https://registry.npmjs.org/node-static/-/node-static-0.7.11.tgz", - "fileCount": 13, - "unpackedSize": 42054, - "npm-signature": "-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJbp3bfCRA9TVsSAnZWagAAeJYP/R2z14Ys7XeJhAhLMYPW\nWINvoEzIbcZ8bYNzCS9IZDmJ6vHnWicWBH6ts9PgnJvXOuxVjm/DlU7fzqSG\n8n4Bac2sbCGof7ipBiGaeqNegfCWLFON9VeFEWuOz3JZ9SL9G2hFTdKM1a47\nZmjySf6jGP7D/E7VVCiXAfgGWl8yFiv3pjIAZpPliRbNKOk8okkuPivt/483\nuX/fla3PP0SoaNilESklsOAxNpDIiRx3oYrTqQwdLUUff1xZu7Qb6gN57cqN\nBBwcBrUXZ+9sLyaxCJO2f1UtUcnznu/yH5bDhfFhP3qfAuRD9qzsR6mIc0kY\nYDA9naEiUMrLOPtzFZ2I+UCSBnzFiW4sZd/Km1VyhYyFcl+s/j0xIB3bzkaj\nUPnnWm+KY0cfEfUIxVHYRgB8T1EYIQAleEtxXBjFmspeKpv/yd+1+pL6vgcS\nXrQlLXXkhHnnhtWNGlI7lcpuIxHkCf0JZusJTMiNemWrNRr52iPltnOcaXUU\nwkRi6jfWM6t9S2GxXD/pJ90/v+ik0Z15Z1r59+I8oZHwp7+nseA3XddsEgFj\nx/vA59U9G0ZuGeM9OqGxL5Rl1w71dQjVXLhVZHI3H2mcMSMPtROeFITqLPIl\njVo385KMRgFY0GlE8f5kROOwcofN8nwRBpQX1DwO6jFiNVscC3auXVLtGouY\nb86R\r\n=62R1\r\n-----END PGP SIGNATURE-----\r\n" - }, - "maintainers": [ - { - "name": "cloudhead", - "email": "self@cloudhead.net" - }, - { - "name": "indexzero", - "email": "charlie.robbins@gmail.com" - }, - { - "name": "phstc", - "email": "pablo@pablocantero.com" - } - ], - "_npmOperationalInternal": { - "host": "s3://npm-registry-packages", - "tmp": "tmp/node-static_0.7.11_1537701598456_0.5872354304574499" - }, - "_hasShrinkwrap": false, - "_shasum": "60120d349f3cef533e4e820670057eb631882e7f", - "_from": "node-static@", - "_resolved": "https://registry.npmjs.org/node-static/-/node-static-0.7.11.tgz" -} diff --git a/node_modules/node-static/test/fixtures/empty.css b/node_modules/node-static/test/fixtures/empty.css deleted file mode 100644 index e69de29..0000000 diff --git a/node_modules/node-static/test/fixtures/hello.txt b/node_modules/node-static/test/fixtures/hello.txt deleted file mode 100644 index 95d09f2..0000000 --- a/node_modules/node-static/test/fixtures/hello.txt +++ /dev/null @@ -1 +0,0 @@ -hello world \ No newline at end of file diff --git a/node_modules/node-static/test/fixtures/index.html b/node_modules/node-static/test/fixtures/index.html deleted file mode 100644 index eee1c7a..0000000 --- a/node_modules/node-static/test/fixtures/index.html +++ /dev/null @@ -1,8 +0,0 @@ - - - Awesome page - - - hello world! - - diff --git a/node_modules/node-static/test/fixtures/there/index.html b/node_modules/node-static/test/fixtures/there/index.html deleted file mode 100644 index 6798b09..0000000 --- a/node_modules/node-static/test/fixtures/there/index.html +++ /dev/null @@ -1,8 +0,0 @@ - - - Other page - - - hello there! - - diff --git a/node_modules/node-static/test/integration/node-static-test.js b/node_modules/node-static/test/integration/node-static-test.js deleted file mode 100644 index 14c591d..0000000 --- a/node_modules/node-static/test/integration/node-static-test.js +++ /dev/null @@ -1,390 +0,0 @@ -var vows = require('vows') - , request = require('request') - , assert = require('assert') - , static = require('../../lib/node-static'); - -var fileServer = new static.Server(__dirname + '/../fixtures'); -var suite = vows.describe('node-static'); -var TEST_PORT = 8080; -var TEST_SERVER = 'http://localhost:' + TEST_PORT; -var version = static.version.join('.'); -var server; -var callback; - -headers = { - 'requesting headers': { - topic : function(){ - request.head(TEST_SERVER + '/index.html', this.callback); - } - } -} -headers['requesting headers']['should respond with node-static/' + version] = function(error, response, body){ - assert.equal(response.headers['server'], 'node-static/' + version); -} - -suite.addBatch({ - 'once an http server is listening with a callback': { - topic: function () { - server = require('http').createServer(function (request, response) { - fileServer.serve(request, response, function(err, result) { - if (callback) - callback(request, response, err, result); - else - request.end(); - }); - }).listen(TEST_PORT, this.callback) - }, - 'should be listening' : function(){ - /* This test is necessary to ensure the topic execution. - * A topic without tests will be not executed */ - assert.isTrue(true); - } - }, -}).addBatch({ - 'streaming a 404 page': { - topic: function(){ - callback = function(request, response, err, result) { - if (err) { - response.writeHead(err.status, err.headers); - setTimeout(function() { - response.end('Custom 404 Stream.') - }, 100); - } - } - request.get(TEST_SERVER + '/not-found', this.callback); - }, - 'should respond with 404' : function(error, response, body){ - assert.equal(response.statusCode, 404); - }, - 'should respond with the streamed content': function(error, response, body){ - callback = null; - assert.equal(body, 'Custom 404 Stream.'); - } - } -}).addBatch({ - 'once an http server is listening without a callback': { - topic: function () { - server.close(); - server = require('http').createServer(function (request, response) { - fileServer.serve(request, response); - }).listen(TEST_PORT, this.callback) - }, - 'should be listening' : function(){ - /* This test is necessary to ensure the topic execution. - * A topic without tests will be not executed */ - assert.isTrue(true); - } - } -}).addBatch({ - 'requesting a file not found': { - topic : function(){ - request.get(TEST_SERVER + '/not-found', this.callback); - }, - 'should respond with 404' : function(error, response, body){ - assert.equal(response.statusCode, 404); - } - } -}) -.addBatch({ - 'requesting a malformed URI': { - topic: function(){ - request.get(TEST_SERVER + '/a%AFc', this.callback); - }, - 'should respond with 400': function(error, response, body){ - assert.equal(response.statusCode, 400); - } - } -}) -.addBatch({ - 'serving empty.css': { - topic : function(){ - request.get(TEST_SERVER + '/empty.css', this.callback); - }, - 'should respond with 200' : function(error, response, body){ - assert.equal(response.statusCode, 200); - }, - 'should respond with text/css': function(error, response, body){ - assert.equal(response.headers['content-type'], 'text/css'); - }, - 'should respond with empty string': function(error, response, body){ - assert.equal(body, ''); - } - } -}) -.addBatch({ - 'serving hello.txt': { - topic : function(){ - request.get(TEST_SERVER + '/hello.txt', this.callback); - }, - 'should respond with 200' : function(error, response, body){ - assert.equal(response.statusCode, 200); - }, - 'should respond with text/plain': function(error, response, body){ - assert.equal(response.headers['content-type'], 'text/plain'); - }, - 'should respond with hello world': function(error, response, body){ - assert.equal(body, 'hello world'); - } - } -}).addBatch({ - 'serving first 5 bytes of hello.txt': { - topic : function(){ - var options = { - url: TEST_SERVER + '/hello.txt', - headers: { - 'Range': 'bytes=0-4' - } - }; - request.get(options, this.callback); - }, - 'should respond with 206' : function(error, response, body){ - assert.equal(response.statusCode, 206); - }, - 'should respond with text/plain': function(error, response, body){ - assert.equal(response.headers['content-type'], 'text/plain'); - }, - 'should have content-length of 5 bytes': function(error, response, body){ - assert.equal(response.headers['content-length'], 5); - }, - 'should have a valid Content-Range header in response': function(error, response, body){ - assert.equal(response.headers['content-range'], 'bytes 0-4/11'); - }, - 'should respond with hello': function(error, response, body){ - assert.equal(body, 'hello'); - } - } -}).addBatch({ - 'serving last 5 bytes of hello.txt': { - topic : function(){ - var options = { - url: TEST_SERVER + '/hello.txt', - headers: { - 'Range': 'bytes=6-10' - } - }; - request.get(options, this.callback); - }, - 'should respond with 206' : function(error, response, body){ - assert.equal(response.statusCode, 206); - }, - 'should respond with text/plain': function(error, response, body){ - assert.equal(response.headers['content-type'], 'text/plain'); - }, - 'should have content-length of 5 bytes': function(error, response, body){ - assert.equal(response.headers['content-length'], 5); - }, - 'should have a valid Content-Range header in response': function(error, response, body){ - assert.equal(response.headers['content-range'], 'bytes 6-10/11'); - }, - 'should respond with world': function(error, response, body){ - assert.equal(body, 'world'); - } - } -}).addBatch({ - 'serving all from the start of hello.txt': { - topic : function(){ - var options = { - url: TEST_SERVER + '/hello.txt', - headers: { - 'Range': 'bytes=0-' - } - }; - request.get(options, this.callback); - }, - 'should respond with 206' : function(error, response, body){ - assert.equal(response.statusCode, 206); - }, - 'should respond with text/plain': function(error, response, body){ - assert.equal(response.headers['content-type'], 'text/plain'); - }, - 'should have content-length of 11 bytes': function(error, response, body){ - assert.equal(response.headers['content-length'], 11); - }, - 'should have a valid Content-Range header in response': function(error, response, body){ - assert.equal(response.headers['content-range'], 'bytes 0-10/11'); - }, - 'should respond with "hello world"': function(error, response, body){ - assert.equal(body, 'hello world'); - } - } -}).addBatch({ - 'serving directory index': { - topic : function(){ - request.get(TEST_SERVER, this.callback); - }, - 'should respond with 200' : function(error, response, body){ - assert.equal(response.statusCode, 200); - }, - 'should respond with text/html': function(error, response, body){ - assert.equal(response.headers['content-type'], 'text/html'); - } - } -}).addBatch({ - 'serving index.html from the cache': { - topic : function(){ - request.get(TEST_SERVER + '/index.html', this.callback); - }, - 'should respond with 200' : function(error, response, body){ - assert.equal(response.statusCode, 200); - }, - 'should respond with text/html': function(error, response, body){ - assert.equal(response.headers['content-type'], 'text/html'); - } - } -}).addBatch({ - 'requesting with If-None-Match': { - topic : function(){ - var _this = this; - request.get(TEST_SERVER + '/index.html', function(error, response, body){ - request({ - method: 'GET', - uri: TEST_SERVER + '/index.html', - headers: {'if-none-match': response.headers['etag']} - }, - _this.callback); - }); - }, - 'should respond with 304' : function(error, response, body){ - assert.equal(response.statusCode, 304); - } - }, - 'requesting with If-None-Match and If-Modified-Since': { - topic : function(){ - var _this = this; - request.get(TEST_SERVER + '/index.html', function(error, response, body){ - var modified = Date.parse(response.headers['last-modified']); - var oneDayLater = new Date(modified + (24 * 60 * 60 * 1000)).toUTCString(); - var nonMatchingEtag = '1111222233334444'; - request({ - method: 'GET', - uri: TEST_SERVER + '/index.html', - headers: { - 'if-none-match': nonMatchingEtag, - 'if-modified-since': oneDayLater - } - }, - _this.callback); - }); - }, - 'should respond with a 200': function(error, response, body){ - assert.equal(response.statusCode, 200); - } - } -}) -.addBatch({ - 'requesting POST': { - topic : function(){ - request.post(TEST_SERVER + '/index.html', this.callback); - }, - 'should respond with 200' : function(error, response, body){ - assert.equal(response.statusCode, 200); - }, - 'should not be empty' : function(error, response, body){ - assert.isNotEmpty(body); - } - } -}) -.addBatch({ - 'requesting HEAD': { - topic : function(){ - request.head(TEST_SERVER + '/index.html', this.callback); - }, - 'should respond with 200' : function(error, response, body){ - assert.equal(response.statusCode, 200); - }, - 'head must has no body' : function(error, response, body){ - assert.isEmpty(body); - } - } -}) -.addBatch(headers) -.addBatch({ - 'addings custom mime types': { - topic : function(){ - static.mime.define({'application/font-woff': ['woff']}); - this.callback(); - }, - 'should add woff' : function(error, response, body){ - assert.equal(static.mime.lookup('woff'), 'application/font-woff'); - } - } -}) -.addBatch({ - 'serving subdirectory index': { - topic : function(){ - request.get(TEST_SERVER + '/there/', this.callback); // with trailing slash - }, - 'should respond with 200' : function(error, response, body){ - assert.equal(response.statusCode, 200); - }, - 'should respond with text/html': function(error, response, body){ - assert.equal(response.headers['content-type'], 'text/html'); - } - } -}) -.addBatch({ - 'redirecting to subdirectory index': { - topic : function(){ - request.get({ url: TEST_SERVER + '/there', followRedirect: false }, this.callback); // without trailing slash - }, - 'should respond with 301' : function(error, response, body){ - assert.equal(response.statusCode, 301); - }, - 'should respond with location header': function(error, response, body){ - assert.equal(response.headers['location'], '/there/'); // now with trailing slash - }, - 'should respond with empty string body' : function(error, response, body){ - assert.equal(body, ''); - } - } -}) -.addBatch({ - 'requesting a subdirectory (with trailing slash) not found': { - topic : function(){ - request.get(TEST_SERVER + '/notthere/', this.callback); // with trailing slash - }, - 'should respond with 404' : function(error, response, body){ - assert.equal(response.statusCode, 404); - } - } -}) -.addBatch({ - 'requesting a subdirectory (without trailing slash) not found': { - topic : function(){ - request.get({ url: TEST_SERVER + '/notthere', followRedirect: false }, this.callback); // without trailing slash - }, - 'should respond with 404' : function(error, response, body){ - assert.equal(response.statusCode, 404); - } - } -}).addBatch({ - 'once an http server is listening with custom index configuration': { - topic: function () { - server.close(); - - fileServer = new static.Server(__dirname + '/../fixtures', { indexFile: "hello.txt" }); - - server = require('http').createServer(function (request, response) { - fileServer.serve(request, response); - }).listen(TEST_PORT, this.callback) - }, - 'should be listening' : function(){ - /* This test is necessary to ensure the topic execution. - * A topic without tests will be not executed */ - assert.isTrue(true); - } - } -}).addBatch({ - 'serving custom index file': { - topic : function(){ - request.get(TEST_SERVER + '/', this.callback); - }, - 'should respond with 200' : function(error, response, body){ - assert.equal(response.statusCode, 200); - }, - 'should respond with empty string': function(error, response, body){ - assert.equal(body, 'hello world'); - } - } -}).export(module); - diff --git a/node_modules/on-finished/package.json b/node_modules/on-finished/package.json index 7a6494f..6840cf2 100644 --- a/node_modules/on-finished/package.json +++ b/node_modules/on-finished/package.json @@ -1,19 +1,25 @@ { - "_from": "on-finished@~2.3.0", + "_args": [ + [ + "on-finished@2.3.0", + "/home/josuer08/Documents/web" + ] + ], + "_from": "on-finished@2.3.0", "_id": "on-finished@2.3.0", "_inBundle": false, "_integrity": "sha1-IPEzZIGwg811M3mSoWlxqi2QaUc=", "_location": "/on-finished", "_phantomChildren": {}, "_requested": { - "type": "range", + "type": "version", "registry": true, - "raw": "on-finished@~2.3.0", + "raw": "on-finished@2.3.0", "name": "on-finished", "escapedName": "on-finished", - "rawSpec": "~2.3.0", + "rawSpec": "2.3.0", "saveSpec": null, - "fetchSpec": "~2.3.0" + "fetchSpec": "2.3.0" }, "_requiredBy": [ "/body-parser", @@ -22,13 +28,11 @@ "/send" ], "_resolved": "https://registry.npmjs.org/on-finished/-/on-finished-2.3.0.tgz", - "_shasum": "20f1336481b083cd75337992a16971aa2d906947", - "_spec": "on-finished@~2.3.0", - "_where": "/home/josuer08/Documents/web/node_modules/express", + "_spec": "2.3.0", + "_where": "/home/josuer08/Documents/web", "bugs": { "url": "https://github.com/jshttp/on-finished/issues" }, - "bundleDependencies": false, "contributors": [ { "name": "Douglas Christopher Wilson", @@ -43,7 +47,6 @@ "dependencies": { "ee-first": "1.1.1" }, - "deprecated": false, "description": "Execute a callback when a request closes, finishes, or errors", "devDependencies": { "istanbul": "0.3.9", diff --git a/node_modules/parseurl/package.json b/node_modules/parseurl/package.json index 813e2b1..0122f74 100644 --- a/node_modules/parseurl/package.json +++ b/node_modules/parseurl/package.json @@ -1,19 +1,25 @@ { - "_from": "parseurl@~1.3.3", + "_args": [ + [ + "parseurl@1.3.3", + "/home/josuer08/Documents/web" + ] + ], + "_from": "parseurl@1.3.3", "_id": "parseurl@1.3.3", "_inBundle": false, "_integrity": "sha512-CiyeOxFT/JZyN5m0z9PfXw4SCBJ6Sygz1Dpl0wqjlhDEGGBP1GnsUVEL0p63hoG1fcj3fHynXi9NYO4nWOL+qQ==", "_location": "/parseurl", "_phantomChildren": {}, "_requested": { - "type": "range", + "type": "version", "registry": true, - "raw": "parseurl@~1.3.3", + "raw": "parseurl@1.3.3", "name": "parseurl", "escapedName": "parseurl", - "rawSpec": "~1.3.3", + "rawSpec": "1.3.3", "saveSpec": null, - "fetchSpec": "~1.3.3" + "fetchSpec": "1.3.3" }, "_requiredBy": [ "/express", @@ -21,13 +27,11 @@ "/serve-static" ], "_resolved": "https://registry.npmjs.org/parseurl/-/parseurl-1.3.3.tgz", - "_shasum": "9da19e7bee8d12dff0513ed5b76957793bc2e8d4", - "_spec": "parseurl@~1.3.3", - "_where": "/home/josuer08/Documents/web/node_modules/express", + "_spec": "1.3.3", + "_where": "/home/josuer08/Documents/web", "bugs": { "url": "https://github.com/pillarjs/parseurl/issues" }, - "bundleDependencies": false, "contributors": [ { "name": "Douglas Christopher Wilson", @@ -39,7 +43,6 @@ "url": "http://jongleberry.com" } ], - "deprecated": false, "description": "parse a url with memoization", "devDependencies": { "beautify-benchmark": "0.2.4", diff --git a/node_modules/path-to-regexp/package.json b/node_modules/path-to-regexp/package.json index 892c33a..bd4209c 100644 --- a/node_modules/path-to-regexp/package.json +++ b/node_modules/path-to-regexp/package.json @@ -1,4 +1,10 @@ { + "_args": [ + [ + "path-to-regexp@0.1.7", + "/home/josuer08/Documents/web" + ] + ], "_from": "path-to-regexp@0.1.7", "_id": "path-to-regexp@0.1.7", "_inBundle": false, @@ -19,19 +25,16 @@ "/express" ], "_resolved": "https://registry.npmjs.org/path-to-regexp/-/path-to-regexp-0.1.7.tgz", - "_shasum": "df604178005f522f15eb4490e7247a1bfaa67f8c", - "_spec": "path-to-regexp@0.1.7", - "_where": "/home/josuer08/Documents/web/node_modules/express", + "_spec": "0.1.7", + "_where": "/home/josuer08/Documents/web", "bugs": { "url": "https://github.com/component/path-to-regexp/issues" }, - "bundleDependencies": false, "component": { "scripts": { "path-to-regexp": "index.js" } }, - "deprecated": false, "description": "Express style path to RegExp utility", "devDependencies": { "istanbul": "^0.2.6", diff --git a/node_modules/proxy-addr/package.json b/node_modules/proxy-addr/package.json index d6e02e1..1c07dbd 100644 --- a/node_modules/proxy-addr/package.json +++ b/node_modules/proxy-addr/package.json @@ -1,27 +1,32 @@ { - "_from": "proxy-addr@~2.0.5", + "_args": [ + [ + "proxy-addr@2.0.5", + "/home/josuer08/Documents/web" + ] + ], + "_from": "proxy-addr@2.0.5", "_id": "proxy-addr@2.0.5", "_inBundle": false, "_integrity": "sha512-t/7RxHXPH6cJtP0pRG6smSr9QJidhB+3kXu0KgXnbGYMgzEnUxRQ4/LDdfOwZEMyIh3/xHb8PX3t+lfL9z+YVQ==", "_location": "/proxy-addr", "_phantomChildren": {}, "_requested": { - "type": "range", + "type": "version", "registry": true, - "raw": "proxy-addr@~2.0.5", + "raw": "proxy-addr@2.0.5", "name": "proxy-addr", "escapedName": "proxy-addr", - "rawSpec": "~2.0.5", + "rawSpec": "2.0.5", "saveSpec": null, - "fetchSpec": "~2.0.5" + "fetchSpec": "2.0.5" }, "_requiredBy": [ "/express" ], "_resolved": "https://registry.npmjs.org/proxy-addr/-/proxy-addr-2.0.5.tgz", - "_shasum": "34cbd64a2d81f4b1fd21e76f9f06c8a45299ee34", - "_spec": "proxy-addr@~2.0.5", - "_where": "/home/josuer08/Documents/web/node_modules/express", + "_spec": "2.0.5", + "_where": "/home/josuer08/Documents/web", "author": { "name": "Douglas Christopher Wilson", "email": "doug@somethingdoug.com" @@ -29,12 +34,10 @@ "bugs": { "url": "https://github.com/jshttp/proxy-addr/issues" }, - "bundleDependencies": false, "dependencies": { "forwarded": "~0.1.2", "ipaddr.js": "1.9.0" }, - "deprecated": false, "description": "Determine address of proxied request", "devDependencies": { "beautify-benchmark": "0.2.4", diff --git a/node_modules/qs/package.json b/node_modules/qs/package.json index 4ce3cda..a6ce809 100644 --- a/node_modules/qs/package.json +++ b/node_modules/qs/package.json @@ -1,4 +1,10 @@ { + "_args": [ + [ + "qs@6.7.0", + "/home/josuer08/Documents/web" + ] + ], "_from": "qs@6.7.0", "_id": "qs@6.7.0", "_inBundle": false, @@ -20,13 +26,11 @@ "/express" ], "_resolved": "https://registry.npmjs.org/qs/-/qs-6.7.0.tgz", - "_shasum": "41dc1a015e3d581f1621776be31afb2876a9b1bc", - "_spec": "qs@6.7.0", - "_where": "/home/josuer08/Documents/web/node_modules/express", + "_spec": "6.7.0", + "_where": "/home/josuer08/Documents/web", "bugs": { "url": "https://github.com/ljharb/qs/issues" }, - "bundleDependencies": false, "contributors": [ { "name": "Jordan Harband", @@ -35,7 +39,6 @@ } ], "dependencies": {}, - "deprecated": false, "description": "A querystring parser that supports nesting and arrays, with a depth limit", "devDependencies": { "@ljharb/eslint-config": "^13.1.1", diff --git a/node_modules/range-parser/package.json b/node_modules/range-parser/package.json index 3fba829..de8b6f2 100644 --- a/node_modules/range-parser/package.json +++ b/node_modules/range-parser/package.json @@ -1,28 +1,33 @@ { - "_from": "range-parser@~1.2.1", + "_args": [ + [ + "range-parser@1.2.1", + "/home/josuer08/Documents/web" + ] + ], + "_from": "range-parser@1.2.1", "_id": "range-parser@1.2.1", "_inBundle": false, "_integrity": "sha512-Hrgsx+orqoygnmhFbKaHE6c296J+HTAQXoxEF6gNupROmmGJRoyzfG3ccAveqCBrwr/2yxQ5BVd/GTl5agOwSg==", "_location": "/range-parser", "_phantomChildren": {}, "_requested": { - "type": "range", + "type": "version", "registry": true, - "raw": "range-parser@~1.2.1", + "raw": "range-parser@1.2.1", "name": "range-parser", "escapedName": "range-parser", - "rawSpec": "~1.2.1", + "rawSpec": "1.2.1", "saveSpec": null, - "fetchSpec": "~1.2.1" + "fetchSpec": "1.2.1" }, "_requiredBy": [ "/express", "/send" ], "_resolved": "https://registry.npmjs.org/range-parser/-/range-parser-1.2.1.tgz", - "_shasum": "3cf37023d199e1c24d1a55b84800c2f3e6468031", - "_spec": "range-parser@~1.2.1", - "_where": "/home/josuer08/Documents/web/node_modules/express", + "_spec": "1.2.1", + "_where": "/home/josuer08/Documents/web", "author": { "name": "TJ Holowaychuk", "email": "tj@vision-media.ca", @@ -31,7 +36,6 @@ "bugs": { "url": "https://github.com/jshttp/range-parser/issues" }, - "bundleDependencies": false, "contributors": [ { "name": "Douglas Christopher Wilson", @@ -47,7 +51,6 @@ "url": "http://jongleberry.com" } ], - "deprecated": false, "description": "Range header field string parser", "devDependencies": { "deep-equal": "1.0.1", diff --git a/node_modules/raw-body/package.json b/node_modules/raw-body/package.json index dab8203..8b35627 100644 --- a/node_modules/raw-body/package.json +++ b/node_modules/raw-body/package.json @@ -1,4 +1,10 @@ { + "_args": [ + [ + "raw-body@2.4.0", + "/home/josuer08/Documents/web" + ] + ], "_from": "raw-body@2.4.0", "_id": "raw-body@2.4.0", "_inBundle": false, @@ -19,9 +25,8 @@ "/body-parser" ], "_resolved": "https://registry.npmjs.org/raw-body/-/raw-body-2.4.0.tgz", - "_shasum": "a1ce6fb9c9bc356ca52e89256ab59059e13d0332", - "_spec": "raw-body@2.4.0", - "_where": "/home/josuer08/Documents/web/node_modules/body-parser", + "_spec": "2.4.0", + "_where": "/home/josuer08/Documents/web", "author": { "name": "Jonathan Ong", "email": "me@jongleberry.com", @@ -30,7 +35,6 @@ "bugs": { "url": "https://github.com/stream-utils/raw-body/issues" }, - "bundleDependencies": false, "contributors": [ { "name": "Douglas Christopher Wilson", @@ -47,7 +51,6 @@ "iconv-lite": "0.4.24", "unpipe": "1.0.0" }, - "deprecated": false, "description": "Get and validate the raw body of a readable stream.", "devDependencies": { "bluebird": "3.5.4", diff --git a/node_modules/safe-buffer/package.json b/node_modules/safe-buffer/package.json index 6a8eea1..d0acf4d 100644 --- a/node_modules/safe-buffer/package.json +++ b/node_modules/safe-buffer/package.json @@ -1,4 +1,10 @@ { + "_args": [ + [ + "safe-buffer@5.1.2", + "/home/josuer08/Documents/web" + ] + ], "_from": "safe-buffer@5.1.2", "_id": "safe-buffer@5.1.2", "_inBundle": false, @@ -20,9 +26,8 @@ "/express" ], "_resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.2.tgz", - "_shasum": "991ec69d296e0313747d59bdfd2b745c35f8828d", - "_spec": "safe-buffer@5.1.2", - "_where": "/home/josuer08/Documents/web/node_modules/express", + "_spec": "5.1.2", + "_where": "/home/josuer08/Documents/web", "author": { "name": "Feross Aboukhadijeh", "email": "feross@feross.org", @@ -31,8 +36,6 @@ "bugs": { "url": "https://github.com/feross/safe-buffer/issues" }, - "bundleDependencies": false, - "deprecated": false, "description": "Safer Node.js Buffer API", "devDependencies": { "standard": "*", diff --git a/node_modules/safer-buffer/package.json b/node_modules/safer-buffer/package.json index d93bf77..749dec8 100644 --- a/node_modules/safer-buffer/package.json +++ b/node_modules/safer-buffer/package.json @@ -1,27 +1,32 @@ { - "_from": "safer-buffer@>= 2.1.2 < 3", + "_args": [ + [ + "safer-buffer@2.1.2", + "/home/josuer08/Documents/web" + ] + ], + "_from": "safer-buffer@2.1.2", "_id": "safer-buffer@2.1.2", "_inBundle": false, "_integrity": "sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg==", "_location": "/safer-buffer", "_phantomChildren": {}, "_requested": { - "type": "range", + "type": "version", "registry": true, - "raw": "safer-buffer@>= 2.1.2 < 3", + "raw": "safer-buffer@2.1.2", "name": "safer-buffer", "escapedName": "safer-buffer", - "rawSpec": ">= 2.1.2 < 3", + "rawSpec": "2.1.2", "saveSpec": null, - "fetchSpec": ">= 2.1.2 < 3" + "fetchSpec": "2.1.2" }, "_requiredBy": [ "/iconv-lite" ], "_resolved": "https://registry.npmjs.org/safer-buffer/-/safer-buffer-2.1.2.tgz", - "_shasum": "44fa161b0187b9549dd84bb91802f9bd8385cd6a", - "_spec": "safer-buffer@>= 2.1.2 < 3", - "_where": "/home/josuer08/Documents/web/node_modules/iconv-lite", + "_spec": "2.1.2", + "_where": "/home/josuer08/Documents/web", "author": { "name": "Nikita Skovoroda", "email": "chalkerx@gmail.com", @@ -30,8 +35,6 @@ "bugs": { "url": "https://github.com/ChALkeR/safer-buffer/issues" }, - "bundleDependencies": false, - "deprecated": false, "description": "Modern Buffer API polyfill without footguns", "devDependencies": { "standard": "^11.0.1", diff --git a/node_modules/send/node_modules/ms/package.json b/node_modules/send/node_modules/ms/package.json index 5cd9bd7..74ec507 100644 --- a/node_modules/send/node_modules/ms/package.json +++ b/node_modules/send/node_modules/ms/package.json @@ -1,4 +1,10 @@ { + "_args": [ + [ + "ms@2.1.1", + "/home/josuer08/Documents/web" + ] + ], "_from": "ms@2.1.1", "_id": "ms@2.1.1", "_inBundle": false, @@ -19,14 +25,11 @@ "/send" ], "_resolved": "https://registry.npmjs.org/ms/-/ms-2.1.1.tgz", - "_shasum": "30a5864eb3ebb0a66f2ebe6d727af06a09d86e0a", - "_spec": "ms@2.1.1", - "_where": "/home/josuer08/Documents/web/node_modules/send", + "_spec": "2.1.1", + "_where": "/home/josuer08/Documents/web", "bugs": { "url": "https://github.com/zeit/ms/issues" }, - "bundleDependencies": false, - "deprecated": false, "description": "Tiny millisecond conversion utility", "devDependencies": { "eslint": "4.12.1", diff --git a/node_modules/send/package.json b/node_modules/send/package.json index 4a80488..07ec420 100644 --- a/node_modules/send/package.json +++ b/node_modules/send/package.json @@ -1,4 +1,10 @@ { + "_args": [ + [ + "send@0.17.1", + "/home/josuer08/Documents/web" + ] + ], "_from": "send@0.17.1", "_id": "send@0.17.1", "_inBundle": false, @@ -20,9 +26,8 @@ "/serve-static" ], "_resolved": "https://registry.npmjs.org/send/-/send-0.17.1.tgz", - "_shasum": "c1d8b059f7900f7466dd4938bdc44e11ddb376c8", - "_spec": "send@0.17.1", - "_where": "/home/josuer08/Documents/web/node_modules/express", + "_spec": "0.17.1", + "_where": "/home/josuer08/Documents/web", "author": { "name": "TJ Holowaychuk", "email": "tj@vision-media.ca" @@ -30,7 +35,6 @@ "bugs": { "url": "https://github.com/pillarjs/send/issues" }, - "bundleDependencies": false, "contributors": [ { "name": "Douglas Christopher Wilson", @@ -60,7 +64,6 @@ "range-parser": "~1.2.1", "statuses": "~1.5.0" }, - "deprecated": false, "description": "Better streaming static file server with Range and conditional-GET support", "devDependencies": { "after": "0.8.2", diff --git a/node_modules/serve-static/package.json b/node_modules/serve-static/package.json index 6251173..7489752 100644 --- a/node_modules/serve-static/package.json +++ b/node_modules/serve-static/package.json @@ -1,4 +1,10 @@ { + "_args": [ + [ + "serve-static@1.14.1", + "/home/josuer08/Documents/web" + ] + ], "_from": "serve-static@1.14.1", "_id": "serve-static@1.14.1", "_inBundle": false, @@ -19,9 +25,8 @@ "/express" ], "_resolved": "https://registry.npmjs.org/serve-static/-/serve-static-1.14.1.tgz", - "_shasum": "666e636dc4f010f7ef29970a88a674320898b2f9", - "_spec": "serve-static@1.14.1", - "_where": "/home/josuer08/Documents/web/node_modules/express", + "_spec": "1.14.1", + "_where": "/home/josuer08/Documents/web", "author": { "name": "Douglas Christopher Wilson", "email": "doug@somethingdoug.com" @@ -29,14 +34,12 @@ "bugs": { "url": "https://github.com/expressjs/serve-static/issues" }, - "bundleDependencies": false, "dependencies": { "encodeurl": "~1.0.2", "escape-html": "~1.0.3", "parseurl": "~1.3.3", "send": "0.17.1" }, - "deprecated": false, "description": "Serve static files", "devDependencies": { "eslint": "5.16.0", diff --git a/node_modules/setprototypeof/package.json b/node_modules/setprototypeof/package.json index 4dfda29..db3b726 100644 --- a/node_modules/setprototypeof/package.json +++ b/node_modules/setprototypeof/package.json @@ -1,4 +1,10 @@ { + "_args": [ + [ + "setprototypeof@1.1.1", + "/home/josuer08/Documents/web" + ] + ], "_from": "setprototypeof@1.1.1", "_id": "setprototypeof@1.1.1", "_inBundle": false, @@ -20,17 +26,14 @@ "/http-errors" ], "_resolved": "https://registry.npmjs.org/setprototypeof/-/setprototypeof-1.1.1.tgz", - "_shasum": "7e95acb24aa92f5885e0abef5ba131330d4ae683", - "_spec": "setprototypeof@1.1.1", - "_where": "/home/josuer08/Documents/web/node_modules/express", + "_spec": "1.1.1", + "_where": "/home/josuer08/Documents/web", "author": { "name": "Wes Todd" }, "bugs": { "url": "https://github.com/wesleytodd/setprototypeof/issues" }, - "bundleDependencies": false, - "deprecated": false, "description": "A small polyfill for Object.setprototypeof", "devDependencies": { "mocha": "^5.2.0", diff --git a/node_modules/statuses/package.json b/node_modules/statuses/package.json index e170072..c14394a 100644 --- a/node_modules/statuses/package.json +++ b/node_modules/statuses/package.json @@ -1,19 +1,25 @@ { - "_from": "statuses@~1.5.0", + "_args": [ + [ + "statuses@1.5.0", + "/home/josuer08/Documents/web" + ] + ], + "_from": "statuses@1.5.0", "_id": "statuses@1.5.0", "_inBundle": false, "_integrity": "sha1-Fhx9rBd2Wf2YEfQ3cfqZOBR4Yow=", "_location": "/statuses", "_phantomChildren": {}, "_requested": { - "type": "range", + "type": "version", "registry": true, - "raw": "statuses@~1.5.0", + "raw": "statuses@1.5.0", "name": "statuses", "escapedName": "statuses", - "rawSpec": "~1.5.0", + "rawSpec": "1.5.0", "saveSpec": null, - "fetchSpec": "~1.5.0" + "fetchSpec": "1.5.0" }, "_requiredBy": [ "/express", @@ -22,13 +28,11 @@ "/send" ], "_resolved": "https://registry.npmjs.org/statuses/-/statuses-1.5.0.tgz", - "_shasum": "161c7dac177659fd9811f43771fa99381478628c", - "_spec": "statuses@~1.5.0", - "_where": "/home/josuer08/Documents/web/node_modules/express", + "_spec": "1.5.0", + "_where": "/home/josuer08/Documents/web", "bugs": { "url": "https://github.com/jshttp/statuses/issues" }, - "bundleDependencies": false, "contributors": [ { "name": "Douglas Christopher Wilson", @@ -40,7 +44,6 @@ "url": "http://jongleberry.com" } ], - "deprecated": false, "description": "HTTP status utility", "devDependencies": { "csv-parse": "1.2.4", diff --git a/node_modules/toidentifier/package.json b/node_modules/toidentifier/package.json index 88e5e8f..ad4de71 100644 --- a/node_modules/toidentifier/package.json +++ b/node_modules/toidentifier/package.json @@ -1,4 +1,10 @@ { + "_args": [ + [ + "toidentifier@1.0.0", + "/home/josuer08/Documents/web" + ] + ], "_from": "toidentifier@1.0.0", "_id": "toidentifier@1.0.0", "_inBundle": false, @@ -19,9 +25,8 @@ "/http-errors" ], "_resolved": "https://registry.npmjs.org/toidentifier/-/toidentifier-1.0.0.tgz", - "_shasum": "7e1be3470f1e77948bc43d94a3c8f4d7752ba553", - "_spec": "toidentifier@1.0.0", - "_where": "/home/josuer08/Documents/web/node_modules/http-errors", + "_spec": "1.0.0", + "_where": "/home/josuer08/Documents/web", "author": { "name": "Douglas Christopher Wilson", "email": "doug@somethingdoug.com" @@ -29,7 +34,6 @@ "bugs": { "url": "https://github.com/component/toidentifier/issues" }, - "bundleDependencies": false, "contributors": [ { "name": "Douglas Christopher Wilson", @@ -41,7 +45,6 @@ "url": "http://niftylettuce.com/" } ], - "deprecated": false, "description": "Convert a string of words to a JavaScript identifier", "devDependencies": { "eslint": "4.19.1", diff --git a/node_modules/type-is/package.json b/node_modules/type-is/package.json index 411e7a2..12f6381 100644 --- a/node_modules/type-is/package.json +++ b/node_modules/type-is/package.json @@ -1,32 +1,36 @@ { - "_from": "type-is@~1.6.18", + "_args": [ + [ + "type-is@1.6.18", + "/home/josuer08/Documents/web" + ] + ], + "_from": "type-is@1.6.18", "_id": "type-is@1.6.18", "_inBundle": false, "_integrity": "sha512-TkRKr9sUTxEH8MdfuCSP7VizJyzRNMjj2J2do2Jr3Kym598JVdEksuzPQCnlFPW4ky9Q+iA+ma9BGm06XQBy8g==", "_location": "/type-is", "_phantomChildren": {}, "_requested": { - "type": "range", + "type": "version", "registry": true, - "raw": "type-is@~1.6.18", + "raw": "type-is@1.6.18", "name": "type-is", "escapedName": "type-is", - "rawSpec": "~1.6.18", + "rawSpec": "1.6.18", "saveSpec": null, - "fetchSpec": "~1.6.18" + "fetchSpec": "1.6.18" }, "_requiredBy": [ "/body-parser", "/express" ], "_resolved": "https://registry.npmjs.org/type-is/-/type-is-1.6.18.tgz", - "_shasum": "4e552cd05df09467dcbc4ef739de89f2cf37c131", - "_spec": "type-is@~1.6.18", - "_where": "/home/josuer08/Documents/web/node_modules/express", + "_spec": "1.6.18", + "_where": "/home/josuer08/Documents/web", "bugs": { "url": "https://github.com/jshttp/type-is/issues" }, - "bundleDependencies": false, "contributors": [ { "name": "Douglas Christopher Wilson", @@ -42,7 +46,6 @@ "media-typer": "0.3.0", "mime-types": "~2.1.24" }, - "deprecated": false, "description": "Infer the content-type of a request.", "devDependencies": { "eslint": "5.16.0", diff --git a/node_modules/unpipe/package.json b/node_modules/unpipe/package.json index 030c9ce..712471f 100644 --- a/node_modules/unpipe/package.json +++ b/node_modules/unpipe/package.json @@ -1,4 +1,10 @@ { + "_args": [ + [ + "unpipe@1.0.0", + "/home/josuer08/Documents/web" + ] + ], "_from": "unpipe@1.0.0", "_id": "unpipe@1.0.0", "_inBundle": false, @@ -20,9 +26,8 @@ "/raw-body" ], "_resolved": "https://registry.npmjs.org/unpipe/-/unpipe-1.0.0.tgz", - "_shasum": "b2bf4ee8514aae6165b4817829d21b2ef49904ec", - "_spec": "unpipe@1.0.0", - "_where": "/home/josuer08/Documents/web/node_modules/raw-body", + "_spec": "1.0.0", + "_where": "/home/josuer08/Documents/web", "author": { "name": "Douglas Christopher Wilson", "email": "doug@somethingdoug.com" @@ -30,8 +35,6 @@ "bugs": { "url": "https://github.com/stream-utils/unpipe/issues" }, - "bundleDependencies": false, - "deprecated": false, "description": "Unpipe a stream from all destinations", "devDependencies": { "istanbul": "0.3.15", diff --git a/node_modules/utils-merge/package.json b/node_modules/utils-merge/package.json index d265272..a20e1ee 100644 --- a/node_modules/utils-merge/package.json +++ b/node_modules/utils-merge/package.json @@ -1,4 +1,10 @@ { + "_args": [ + [ + "utils-merge@1.0.1", + "/home/josuer08/Documents/web" + ] + ], "_from": "utils-merge@1.0.1", "_id": "utils-merge@1.0.1", "_inBundle": false, @@ -19,9 +25,8 @@ "/express" ], "_resolved": "https://registry.npmjs.org/utils-merge/-/utils-merge-1.0.1.tgz", - "_shasum": "9f95710f50a267947b2ccc124741c1028427e713", - "_spec": "utils-merge@1.0.1", - "_where": "/home/josuer08/Documents/web/node_modules/express", + "_spec": "1.0.1", + "_where": "/home/josuer08/Documents/web", "author": { "name": "Jared Hanson", "email": "jaredhanson@gmail.com", @@ -30,9 +35,7 @@ "bugs": { "url": "http://github.com/jaredhanson/utils-merge/issues" }, - "bundleDependencies": false, "dependencies": {}, - "deprecated": false, "description": "merge() utility function", "devDependencies": { "chai": "1.x.x", diff --git a/node_modules/vary/package.json b/node_modules/vary/package.json index 90ef0bb..0db51c2 100644 --- a/node_modules/vary/package.json +++ b/node_modules/vary/package.json @@ -1,27 +1,32 @@ { - "_from": "vary@~1.1.2", + "_args": [ + [ + "vary@1.1.2", + "/home/josuer08/Documents/web" + ] + ], + "_from": "vary@1.1.2", "_id": "vary@1.1.2", "_inBundle": false, "_integrity": "sha1-IpnwLG3tMNSllhsLn3RSShj2NPw=", "_location": "/vary", "_phantomChildren": {}, "_requested": { - "type": "range", + "type": "version", "registry": true, - "raw": "vary@~1.1.2", + "raw": "vary@1.1.2", "name": "vary", "escapedName": "vary", - "rawSpec": "~1.1.2", + "rawSpec": "1.1.2", "saveSpec": null, - "fetchSpec": "~1.1.2" + "fetchSpec": "1.1.2" }, "_requiredBy": [ "/express" ], "_resolved": "https://registry.npmjs.org/vary/-/vary-1.1.2.tgz", - "_shasum": "2299f02c6ded30d4a5961b0b9f74524a18f634fc", - "_spec": "vary@~1.1.2", - "_where": "/home/josuer08/Documents/web/node_modules/express", + "_spec": "1.1.2", + "_where": "/home/josuer08/Documents/web", "author": { "name": "Douglas Christopher Wilson", "email": "doug@somethingdoug.com" @@ -29,8 +34,6 @@ "bugs": { "url": "https://github.com/jshttp/vary/issues" }, - "bundleDependencies": false, - "deprecated": false, "description": "Manipulate the HTTP Vary header", "devDependencies": { "beautify-benchmark": "0.2.4", diff --git a/node_modules/websocket/.jshintrc b/node_modules/websocket/.jshintrc deleted file mode 100644 index 98d8766..0000000 --- a/node_modules/websocket/.jshintrc +++ /dev/null @@ -1,88 +0,0 @@ -{ - // JSHint Default Configuration File (as on JSHint website) - // See http://jshint.com/docs/ for more details - - "maxerr" : 50, // {int} Maximum error before stopping - - // Enforcing - "bitwise" : false, // true: Prohibit bitwise operators (&, |, ^, etc.) - "camelcase" : false, // true: Identifiers must be in camelCase - "curly" : true, // true: Require {} for every new block or scope - "eqeqeq" : true, // true: Require triple equals (===) for comparison - "freeze" : true, // true: prohibits overwriting prototypes of native objects such as Array, Date etc. - "forin" : false, // true: Require filtering for..in loops with obj.hasOwnProperty() - "immed" : true, // true: Require immediate invocations to be wrapped in parens e.g. `(function () { } ());` - "latedef" : "nofunc", // true: Require variables/functions to be defined before being used - "newcap" : true, // true: Require capitalization of all constructor functions e.g. `new F()` - "noarg" : true, // true: Prohibit use of `arguments.caller` and `arguments.callee` - "noempty" : true, // true: Prohibit use of empty blocks - "nonbsp" : true, // true: Prohibit "non-breaking whitespace" characters. - "nonew" : true, // true: Prohibit use of constructors for side-effects (without assignment) - "plusplus" : false, // true: Prohibit use of `++` & `--` - "quotmark" : "single", // Quotation mark consistency: - // false : do nothing (default) - // true : ensure whatever is used is consistent - // "single" : require single quotes - // "double" : require double quotes - "undef" : true, // true: Require all non-global variables to be declared (prevents global leaks) - "unused" : "vars", // vars: Require all defined variables be used, ignore function params - "strict" : false, // true: Requires all functions run in ES5 Strict Mode - "maxparams" : false, // {int} Max number of formal params allowed per function - "maxdepth" : false, // {int} Max depth of nested blocks (within functions) - "maxstatements" : false, // {int} Max number statements per function - "maxcomplexity" : false, // {int} Max cyclomatic complexity per function - "maxlen" : false, // {int} Max number of characters per line - - // Relaxing - "asi" : false, // true: Tolerate Automatic Semicolon Insertion (no semicolons) - "boss" : false, // true: Tolerate assignments where comparisons would be expected - "debug" : false, // true: Allow debugger statements e.g. browser breakpoints. - "eqnull" : false, // true: Tolerate use of `== null` - "es5" : false, // true: Allow ES5 syntax (ex: getters and setters) - "esnext" : true, // true: Allow ES.next (ES6) syntax (ex: `const`) - "moz" : false, // true: Allow Mozilla specific syntax (extends and overrides esnext features) - // (ex: `for each`, multiple try/catch, function expression…) - "evil" : false, // true: Tolerate use of `eval` and `new Function()` - "expr" : false, // true: Tolerate `ExpressionStatement` as Programs - "funcscope" : false, // true: Tolerate defining variables inside control statements - "globalstrict" : false, // true: Allow global "use strict" (also enables 'strict') - "iterator" : false, // true: Tolerate using the `__iterator__` property - "lastsemic" : false, // true: Tolerate omitting a semicolon for the last statement of a 1-line block - "laxbreak" : false, // true: Tolerate possibly unsafe line breakings - "laxcomma" : false, // true: Tolerate comma-first style coding - "loopfunc" : false, // true: Tolerate functions being defined in loops - "multistr" : false, // true: Tolerate multi-line strings - "noyield" : false, // true: Tolerate generator functions with no yield statement in them. - "notypeof" : false, // true: Tolerate invalid typeof operator values - "proto" : false, // true: Tolerate using the `__proto__` property - "scripturl" : false, // true: Tolerate script-targeted URLs - "shadow" : false, // true: Allows re-define variables later in code e.g. `var x=1; x=2;` - "sub" : true, // true: Tolerate using `[]` notation when it can still be expressed in dot notation - "supernew" : false, // true: Tolerate `new function () { ... };` and `new Object;` - "validthis" : false, // true: Tolerate using this in a non-constructor function - - // Environments - "browser" : true, // Web Browser (window, document, etc) - "browserify" : true, // Browserify (node.js code in the browser) - "couch" : false, // CouchDB - "devel" : true, // Development/debugging (alert, confirm, etc) - "dojo" : false, // Dojo Toolkit - "jasmine" : false, // Jasmine - "jquery" : false, // jQuery - "mocha" : false, // Mocha - "mootools" : false, // MooTools - "node" : true, // Node.js - "nonstandard" : false, // Widely adopted globals (escape, unescape, etc) - "prototypejs" : false, // Prototype and Scriptaculous - "qunit" : false, // QUnit - "rhino" : false, // Rhino - "shelljs" : false, // ShellJS - "worker" : false, // Web Workers - "wsh" : false, // Windows Scripting Host - "yui" : false, // Yahoo User Interface - - // Custom Globals - "globals" : { // additional predefined global variables - "WebSocket": true - } -} diff --git a/node_modules/websocket/CHANGELOG.md b/node_modules/websocket/CHANGELOG.md deleted file mode 100644 index 58003cc..0000000 --- a/node_modules/websocket/CHANGELOG.md +++ /dev/null @@ -1,256 +0,0 @@ -Changelog -========= - -Version 1.0.30 --------------- -*Released 2019-09-12* - -* Moved gulp back to devDependencies - -Version 1.0.29 --------------- -*Released 2019-07-03* - -* Updated some dependencies and updated the .gitignore and .npmignore files - -Version 1.0.28 --------------- -*Released 2018-09-19* - -* Updated to latest version of [nan](https://github.com/nodejs/nan) - -Version 1.0.27 --------------- -*Released 2018-09-19* - -* Allowing additional request `headers` to be specified in the `tlsOptions` config parameter for WebSocketClient. See pull request #323 -* Resolving deprecation warnings relating to usage of `new Buffer` - -Version 1.0.26 --------------- -*Released 2018-04-27* - -* No longer using the deprecated `noAssert` parameter for functions reading and writing binary numeric data. (Thanks, [@BridgeAR](https://github.com/BridgeAR)) - -Version 1.0.25 --------------- -*Released 2017-10-18* - -* Bumping minimum supported node version specified in package.json to v0.10.x because some upstream libraries no longer install on v0.8.x -* [Allowing use of close codes 1012, 1013, 1014](https://www.iana.org/assignments/websocket/websocket.xml) -* [Allowing the `Host` header to be overridden.](https://github.com/theturtle32/WebSocket-Node/pull/291) (Thanks, [@Juneil](https://github.com/Juneil)) -* [Mitigating infinite loop for broken connections](https://github.com/theturtle32/WebSocket-Node/pull/289) (Thanks, [@tvkit](https://github.com/tvkit)) -* [Fixed Markdown Typos](https://github.com/theturtle32/WebSocket-Node/pull/281) (Thanks, [@teramotodaiki](https://github.com/teramotodaiki)) -* [Adding old readyState constants for W3CWebSocket interface](https://github.com/theturtle32/WebSocket-Node/pull/282) (Thanks, [@thechriswalker](https://github.com/thechriswalker)) - - -Version 1.0.24 --------------- -*Released 2016-12-28* - -* Fixed a bug when using native keepalive on Node >= 6.0. (Thanks, [@prossin](https://github.com/prossin)) -* Upgrading outdated dependencies - -Version 1.0.23 --------------- -*Released 2016-05-18* - -* Official support for Node 6.x -* Updating dependencies. Specifically, updating nan to ^2.3.3 - -Version 1.0.22 --------------- -*Released 2015-09-28* - -* Updating to work with nan 2.x - -Version 1.0.21 --------------- -*Released 2015-07-22* - -* Incremented and re-published to work around an aborted npm publish of v1.0.20. - -Version 1.0.20 --------------- -*Released 2015-07-22* - -* Added EventTarget to the W3CWebSocket interface (Thanks, [@ibc](https://github.com/ibc)!) -* Corrected an inaccurate error message. (Thanks, [@lekoaf](https://github.com/lekoaf)!) - -Version 1.0.19 --------------- -*Released 2015-05-28* - -* Updated to nan v1.8.x (tested with v1.8.4) -* Added `"license": "Apache-2.0"` to package.json via [pull request #199](https://github.com/theturtle32/WebSocket-Node/pull/199) by [@pgilad](https://github.com/pgilad). See [npm1k.org](http://npm1k.org/). - - -Version 1.0.18 --------------- -*Released 2015-03-19* - -* Resolves [issue #195](https://github.com/theturtle32/WebSocket-Node/pull/179) - passing number to connection.send() causes crash -* [Added close code/reason arguments to W3CWebSocket#close()](https://github.com/theturtle32/WebSocket-Node/issues/184) - - -Version 1.0.17 --------------- -*Released 2015-01-17* - -* Resolves [issue #179](https://github.com/theturtle32/WebSocket-Node/pull/179) - Allow toBuffer to work with empty data - - -Version 1.0.16 --------------- -*Released 2015-01-16* - -* Resolves [issue #178](https://github.com/theturtle32/WebSocket-Node/issues/178) - Ping Frames with no data - - -Version 1.0.15 --------------- -*Released 2015-01-13* - -* Resolves [issue #177](https://github.com/theturtle32/WebSocket-Node/issues/177) - WebSocketClient ignores options unless it has a tlsOptions property - - -Version 1.0.14 --------------- -*Released 2014-12-03* - -* Resolves [issue #173](https://github.com/theturtle32/WebSocket-Node/issues/173) - To allow the W3CWebSocket interface to accept an optional non-standard configuration object as its third parameter, which will be ignored when running in a browser context. - - -Version 1.0.13 --------------- -*Released 2014-11-29* - -* Fixes [issue #171](https://github.com/theturtle32/WebSocket-Node/issues/171) - Code to prevent calling req.accept/req.reject multiple times breaks sanity checks in req.accept - - -Version 1.0.12 --------------- -*Released 2014-11-28* - -* Fixes [issue #170](https://github.com/theturtle32/WebSocket-Node/issues/170) - Non-native XOR implementation broken after making JSHint happy - - -Version 1.0.11 --------------- -*Released 2014-11-25* - -* Fixes some undefined behavior surrounding closing WebSocket connections and more reliably handles edge cases. -* Adds an implementation of the W3C WebSocket API for browsers to facilitate sharing code between client and server via browserify. (Thanks, [@ibc](https://github.com/ibc)!) -* `WebSocketConnection.prototype.close` now accepts optional `reasonCode` and `description` parameters. -* Calling `accept` or `reject` more than once on a `WebSocketRequest` will now throw an error. [Issue #149](https://github.com/theturtle32/WebSocket-Node/issues/149) -* Handling connections dropped by client before accepted by server [Issue #167](https://github.com/theturtle32/WebSocket-Node/issues/167) -* Integrating Gulp and JSHint (Thanks, [@ibc](https://github.com/ibc)!) -* Starting to add individual unit tests (using substack's [tape](github.com/substack/tape) and [faucet](github.com/substack/faucet)) - - -Version 1.0.10 --------------- -*Released 2014-10-22* - -* Fixed Issue [#146](https://github.com/theturtle32/WebSocket-Node/issues/146) that was causing WebSocketClient to throw errors when instantiated if passed `tlsOptions`. - -Version 1.0.9 -------------- -*Released 2014-10-20* - -* Fixing an insidious corner-case bug that prevented `WebSocketConnection` from firing the `close` event in certain cases when there was an error on the underlying `Socket`, leading to connections sticking around forever, stuck erroneously in the `connected` state. These "ghost" connections would cause an error event when trying to write to them. -* Removed deprecated `websocketVersion` property. Use `webSocketVersion` instead (case difference). -* Allowing user to specify all properties for `tlsOptions` in WebSocketClient, not just a few whitelisted properties. This keeps us from having to constantly add new config properties for new versions of Node. (Thanks, [jesusprubio](https://github.com/jesusprubio)) -* Removing support for Node 0.4.x and 0.6.x. -* Adding `fuzzingclient.json` spec file for the Autobahn Test Suite. -* Now more fairly emitting `message` events from the `WebSocketConnection`. Previously, all buffered frames for a connection would be processed and all `message` events emitted before moving on to processing the next connection with available data. Now We process one frame per connection (most of the time) in a more fair round-robin fashion. -* Now correctly calling the `EventEmitter` superclass constructor during class instance initialization. -* `WebSocketClient.prototype.connect` now accepts the empty string (`''`) to mean "no subprotocol requested." Previously either `null` or an empty array (`[]`) was required. -* Fixing a `TypeError` bug in `WebSocketRouter` (Thanks, [a0000778](https://github.com/a0000778)) -* Fixing a potential race condition when attaching event listeners to the underlying `Socket`. (Thanks [RichardBsolut](https://github.com/RichardBsolut)) -* `WebSocketClient` now accepts an optional options hash to be passed to `(http|https).request`. (Thanks [mildred](https://github.com/mildred) and [aus](https://github.com/aus)) This enables the following new abilities, amongst others: - * Use WebSocket-Node from behind HTTP/HTTPS proxy servers using [koichik/node-tunnel](https://github.com/koichik/node-tunnel) or similar. - * Specify the local port and local address to bind the outgoing request socket to. -* Adding option to ignore `X-Forwarded-For` headers when accepting connections from untrusted clients. -* Adding ability to mount a `WebSocketServer` instance to an arbitrary number of Node http/https servers. -* Adding browser shim so Browserify won't blow up when trying to package up code that uses WebSocket-Node. The shim is a no-op, it ***does not implement a wrapper*** providing the WebSocket-Node API in the browser. -* Incorporating upstream enhancements for the native C++ UTF-8 validation and xor masking functions. (Thanks [einaros](https://github.com/einaros) and [kkoopa](https://github.com/kkoopa)) - - -Version 1.0.8 -------------- -*Released 2012-12-26* - -* Fixed remaining naming inconsistency of "websocketVersion" as opposed to "webSocketVersion" throughout the code, and added deprecation warnings for use of the old casing throughout. -* Fixed an issue with our case-insensitive handling of WebSocket subprotocols. Clients that requested a mixed-case subprotocol would end up failing the connection when the server accepted the connection, returning a lower-case version of the subprotocol name. Now we return the subprotocol name in the exact casing that was requested by the client, while still maintaining the case-insensitive verification logic for convenience and practicality. -* Making sure that any socket-level activity timeout that may have been set on a TCP socket is removed when initializing a connection. -* Added support for native TCP Keep-Alive instead of using the WebSocket ping/pong packets to serve that function. -* Fixed cookie parsing to be compliant with RFC 2109 - -Version 1.0.7 -------------- -*Released 2012-08-12* - -* ***Native modules are now optional!*** If they fail to compile, WebSocket-Node will still work but will not verify that received UTF-8 data is valid, and xor masking/unmasking of payload data for security purposes will not be as efficient as it is performed in JavaScript instead of native code. -* Reduced Node.JS version requirement back to v0.6.10 - -Version 1.0.6 -------------- -*Released 2012-05-22* - -* Now requires Node v0.6.13 since that's the first version that I can manage to successfully build the native UTF-8 validator with node-gyp through npm. - -Version 1.0.5 -------------- -*Released 2012-05-21* - -* Fixes the issues that users were having building the native UTF-8 validator on Windows platforms. Special Thanks to: - * [zerodivisi0n](https://github.com/zerodivisi0n) - * [andreasbotsikas](https://github.com/andreasbotsikas) -* Fixed accidental global variable usage (Thanks, [hakobera](https://github.com/hakobera)!) -* Added callbacks to the send* methods that provide notification of messages being sent on the wire and any socket errors that may occur when sending a message. (Thanks, [zerodivisi0n](https://github.com/zerodivisi0n)!) -* Added option to disable logging in the echo-server in the test folder (Thanks, [oberstet](https://github.com/oberstet)!) - - -Version 1.0.4 -------------- -*Released 2011-12-18* - -* Now validates that incoming UTF-8 messages do, in fact, contain valid UTF-8 data. The connection is dropped with prejudice if invalid data is received. This strict behavior conforms to the WebSocket RFC and is verified by the Autobahn Test Suite. This is accomplished in a performant way by using a native C++ Node module created by [einaros](https://github.com/einaros). -* Updated handling of connection closure to pass more of the Autobahn Test Suite. - -Version 1.0.3 -------------- -*Released 2011-12-18* - -* Substantial speed increase (~150% on my machine, depending on the circumstances) due to an optimization in FastBufferList.js that drastically reduces the number of memory alloctions and buffer copying. ([kazuyukitanimura](https://github.com/kazuyukitanimura)) - - -Version 1.0.2 -------------- -*Released 2011-11-28* - -* Fixing whiteboard example to work under Node 0.6.x ([theturtle32](https://github.com/theturtle32)) -* Now correctly emitting a `close` event with a 1006 error code if there is a TCP error while writing to the socket during the handshake. ([theturtle32](https://github.com/theturtle32)) -* Catching errors when writing to the TCP socket during the handshake. ([justoneplanet](https://github.com/justoneplanet)) -* No longer outputting console.warn messages when there is an error writing to the TCP socket ([justoneplanet](https://github.com/justoneplanet)) -* Fixing some formatting errors, commas, semicolons, etc. ([kaisellgren](https://github.com/kaisellgren)) - - -Version 1.0.1 -------------- -*Released 2011-11-21* - -* Now works with Node 0.6.2 as well as 0.4.12 -* Support TLS in WebSocketClient -* Added support for setting and reading cookies -* Added WebSocketServer.prototype.broadcast(data) convenience method -* Added `resourceURL` property to WebSocketRequest objects. It is a Node URL object with the `resource` and any query string params already parsed. -* The WebSocket request router no longer includes the entire query string when trying to match the path name of the request. -* WebSocketRouterRequest objects now include all the properties and events of WebSocketRequest objects. -* Removed more console.log statements. Please rely on the various events emitted to be notified of error conditions. I decided that it is not a library's place to spew information to the console. -* Renamed the `websocketVersion` property to `webSocketVersion` throughout the code to fix inconsistent capitalization. `websocketVersion` has been kept for compatibility but is deprecated and may be removed in the future. -* Now outputting the sanitized version of custom header names rather than the raw value. This prevents invalid HTTP from being put onto the wire if given an illegal header name. - - -I decided it's time to start maintaining a changelog now, starting with version 1.0.1. diff --git a/node_modules/websocket/LICENSE b/node_modules/websocket/LICENSE deleted file mode 100644 index 430d42b..0000000 --- a/node_modules/websocket/LICENSE +++ /dev/null @@ -1,177 +0,0 @@ - - Apache License - Version 2.0, January 2004 - http://www.apache.org/licenses/ - -TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - -1. Definitions. - - "License" shall mean the terms and conditions for use, reproduction, - and distribution as defined by Sections 1 through 9 of this document. - - "Licensor" shall mean the copyright owner or entity authorized by - the copyright owner that is granting the License. - - "Legal Entity" shall mean the union of the acting entity and all - other entities that control, are controlled by, or are under common - control with that entity. For the purposes of this definition, - "control" means (i) the power, direct or indirect, to cause the - direction or management of such entity, whether by contract or - otherwise, or (ii) ownership of fifty percent (50%) or more of the - outstanding shares, or (iii) beneficial ownership of such entity. - - "You" (or "Your") shall mean an individual or Legal Entity - exercising permissions granted by this License. - - "Source" form shall mean the preferred form for making modifications, - including but not limited to software source code, documentation - source, and configuration files. - - "Object" form shall mean any form resulting from mechanical - transformation or translation of a Source form, including but - not limited to compiled object code, generated documentation, - and conversions to other media types. - - "Work" shall mean the work of authorship, whether in Source or - Object form, made available under the License, as indicated by a - copyright notice that is included in or attached to the work - (an example is provided in the Appendix below). - - "Derivative Works" shall mean any work, whether in Source or Object - form, that is based on (or derived from) the Work and for which the - editorial revisions, annotations, elaborations, or other modifications - represent, as a whole, an original work of authorship. For the purposes - of this License, Derivative Works shall not include works that remain - separable from, or merely link (or bind by name) to the interfaces of, - the Work and Derivative Works thereof. - - "Contribution" shall mean any work of authorship, including - the original version of the Work and any modifications or additions - to that Work or Derivative Works thereof, that is intentionally - submitted to Licensor for inclusion in the Work by the copyright owner - or by an individual or Legal Entity authorized to submit on behalf of - the copyright owner. For the purposes of this definition, "submitted" - means any form of electronic, verbal, or written communication sent - to the Licensor or its representatives, including but not limited to - communication on electronic mailing lists, source code control systems, - and issue tracking systems that are managed by, or on behalf of, the - Licensor for the purpose of discussing and improving the Work, but - excluding communication that is conspicuously marked or otherwise - designated in writing by the copyright owner as "Not a Contribution." - - "Contributor" shall mean Licensor and any individual or Legal Entity - on behalf of whom a Contribution has been received by Licensor and - subsequently incorporated within the Work. - -2. Grant of Copyright License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - copyright license to reproduce, prepare Derivative Works of, - publicly display, publicly perform, sublicense, and distribute the - Work and such Derivative Works in Source or Object form. - -3. Grant of Patent License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - (except as stated in this section) patent license to make, have made, - use, offer to sell, sell, import, and otherwise transfer the Work, - where such license applies only to those patent claims licensable - by such Contributor that are necessarily infringed by their - Contribution(s) alone or by combination of their Contribution(s) - with the Work to which such Contribution(s) was submitted. If You - institute patent litigation against any entity (including a - cross-claim or counterclaim in a lawsuit) alleging that the Work - or a Contribution incorporated within the Work constitutes direct - or contributory patent infringement, then any patent licenses - granted to You under this License for that Work shall terminate - as of the date such litigation is filed. - -4. Redistribution. You may reproduce and distribute copies of the - Work or Derivative Works thereof in any medium, with or without - modifications, and in Source or Object form, provided that You - meet the following conditions: - - (a) You must give any other recipients of the Work or - Derivative Works a copy of this License; and - - (b) You must cause any modified files to carry prominent notices - stating that You changed the files; and - - (c) You must retain, in the Source form of any Derivative Works - that You distribute, all copyright, patent, trademark, and - attribution notices from the Source form of the Work, - excluding those notices that do not pertain to any part of - the Derivative Works; and - - (d) If the Work includes a "NOTICE" text file as part of its - distribution, then any Derivative Works that You distribute must - include a readable copy of the attribution notices contained - within such NOTICE file, excluding those notices that do not - pertain to any part of the Derivative Works, in at least one - of the following places: within a NOTICE text file distributed - as part of the Derivative Works; within the Source form or - documentation, if provided along with the Derivative Works; or, - within a display generated by the Derivative Works, if and - wherever such third-party notices normally appear. The contents - of the NOTICE file are for informational purposes only and - do not modify the License. You may add Your own attribution - notices within Derivative Works that You distribute, alongside - or as an addendum to the NOTICE text from the Work, provided - that such additional attribution notices cannot be construed - as modifying the License. - - You may add Your own copyright statement to Your modifications and - may provide additional or different license terms and conditions - for use, reproduction, or distribution of Your modifications, or - for any such Derivative Works as a whole, provided Your use, - reproduction, and distribution of the Work otherwise complies with - the conditions stated in this License. - -5. Submission of Contributions. Unless You explicitly state otherwise, - any Contribution intentionally submitted for inclusion in the Work - by You to the Licensor shall be under the terms and conditions of - this License, without any additional terms or conditions. - Notwithstanding the above, nothing herein shall supersede or modify - the terms of any separate license agreement you may have executed - with Licensor regarding such Contributions. - -6. Trademarks. This License does not grant permission to use the trade - names, trademarks, service marks, or product names of the Licensor, - except as required for reasonable and customary use in describing the - origin of the Work and reproducing the content of the NOTICE file. - -7. Disclaimer of Warranty. Unless required by applicable law or - agreed to in writing, Licensor provides the Work (and each - Contributor provides its Contributions) on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - implied, including, without limitation, any warranties or conditions - of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A - PARTICULAR PURPOSE. You are solely responsible for determining the - appropriateness of using or redistributing the Work and assume any - risks associated with Your exercise of permissions under this License. - -8. Limitation of Liability. In no event and under no legal theory, - whether in tort (including negligence), contract, or otherwise, - unless required by applicable law (such as deliberate and grossly - negligent acts) or agreed to in writing, shall any Contributor be - liable to You for damages, including any direct, indirect, special, - incidental, or consequential damages of any character arising as a - result of this License or out of the use or inability to use the - Work (including but not limited to damages for loss of goodwill, - work stoppage, computer failure or malfunction, or any and all - other commercial damages or losses), even if such Contributor - has been advised of the possibility of such damages. - -9. Accepting Warranty or Additional Liability. While redistributing - the Work or Derivative Works thereof, You may choose to offer, - and charge a fee for, acceptance of support, warranty, indemnity, - or other liability obligations and/or rights consistent with this - License. However, in accepting such obligations, You may act only - on Your own behalf and on Your sole responsibility, not on behalf - of any other Contributor, and only if You agree to indemnify, - defend, and hold each Contributor harmless for any liability - incurred by, or claims asserted against, such Contributor by reason - of your accepting any such warranty or additional liability. - -END OF TERMS AND CONDITIONS diff --git a/node_modules/websocket/Makefile b/node_modules/websocket/Makefile deleted file mode 100644 index 39ff645..0000000 --- a/node_modules/websocket/Makefile +++ /dev/null @@ -1,11 +0,0 @@ -all: - node-gyp configure build - -clean: - node-gyp clean - -autobahn: - @NODE_PATH=lib node test/autobahn-test-client.js --host=127.0.0.1 --port=9000 - -autobahn-server: - @NODE_PATH=lib node test/echo-server.js diff --git a/node_modules/websocket/README.md b/node_modules/websocket/README.md deleted file mode 100644 index ad1e35c..0000000 --- a/node_modules/websocket/README.md +++ /dev/null @@ -1,273 +0,0 @@ -WebSocket Client & Server Implementation for Node -================================================= - -[![npm version](https://badge.fury.io/js/websocket.svg)](http://badge.fury.io/js/websocket) - -[![NPM Downloads](https://img.shields.io/npm/dm/websocket.svg)](https://www.npmjs.com/package/websocket) - -[![NPM](https://nodei.co/npm/websocket.png?downloads=true&downloadRank=true&stars=true)](https://nodei.co/npm/websocket/) - -[![NPM](https://nodei.co/npm-dl/websocket.png?height=3)](https://nodei.co/npm/websocket/) - -[ ![Codeship Status for theturtle32/WebSocket-Node](https://codeship.com/projects/70458270-8ee7-0132-7756-0a0cf4fe8e66/status?branch=master)](https://codeship.com/projects/61106) - -Overview --------- -This is a (mostly) pure JavaScript implementation of the WebSocket protocol versions 8 and 13 for Node. There are some example client and server applications that implement various interoperability testing protocols in the "test/scripts" folder. - -For a WebSocket client written in ActionScript 3, see my [AS3WebScocket](https://github.com/theturtle32/AS3WebSocket) project. - - -Documentation -============= - -[You can read the full API documentation in the docs folder.](docs/index.md) - - -Changelog ---------- - -***Current Version: 1.0.30*** — Released 2019-09-12 - -* Moved gulp back to devDependencies - -[View the full changelog](CHANGELOG.md) - -Browser Support ---------------- - -All current browsers are fully supported. - -* Firefox 7-9 (Old) (Protocol Version 8) -* Firefox 10+ (Protocol Version 13) -* Chrome 14,15 (Old) (Protocol Version 8) -* Chrome 16+ (Protocol Version 13) -* Internet Explorer 10+ (Protocol Version 13) -* Safari 6+ (Protocol Version 13) - -***Safari older than 6.0 is not supported since it uses a very old draft of WebSockets*** - -***If you need to simultaneously support legacy browser versions that had implemented draft-75/draft-76/draft-00, take a look here: https://gist.github.com/1428579*** - -Benchmarks ----------- -There are some basic benchmarking sections in the Autobahn test suite. I've put up a [benchmark page](http://theturtle32.github.com/WebSocket-Node/benchmarks/) that shows the results from the Autobahn tests run against AutobahnServer 0.4.10, WebSocket-Node 1.0.2, WebSocket-Node 1.0.4, and ws 0.3.4. - -Autobahn Tests --------------- -The very complete [Autobahn Test Suite](http://autobahn.ws/testsuite/) is used by most WebSocket implementations to test spec compliance and interoperability. - -- [View Server Test Results](http://theturtle32.github.com/WebSocket-Node/test-report/servers/) - -Installation ------------- - -A few users have reported difficulties building the native extensions without first manually installing node-gyp. If you have trouble building the native extensions, make sure you've got a C++ compiler, and have done `npm install -g node-gyp` first. - -Native extensions are optional, however, and WebSocket-Node will work even if the extensions cannot be compiled. - -In your project root: - - $ npm install websocket - -Then in your code: - -```javascript -var WebSocketServer = require('websocket').server; -var WebSocketClient = require('websocket').client; -var WebSocketFrame = require('websocket').frame; -var WebSocketRouter = require('websocket').router; -var W3CWebSocket = require('websocket').w3cwebsocket; -``` - -Note for Windows Users ----------------------- -Because there is a small C++ component used for validating UTF-8 data, you will need to install a few other software packages in addition to Node to be able to build this module: - -- [Microsoft Visual C++](http://www.microsoft.com/visualstudio/en-us/products/2010-editions/visual-cpp-express) -- [Python 2.7](http://www.python.org/download/) (NOT Python 3.x) - - -Current Features: ------------------ -- Licensed under the Apache License, Version 2.0 -- Protocol version "8" and "13" (Draft-08 through the final RFC) framing and handshake -- Can handle/aggregate received fragmented messages -- Can fragment outgoing messages -- Router to mount multiple applications to various path and protocol combinations -- TLS supported for outbound connections via WebSocketClient -- TLS supported for server connections (use https.createServer instead of http.createServer) - - Thanks to [pors](https://github.com/pors) for confirming this! -- Cookie setting and parsing -- Tunable settings - - Max Receivable Frame Size - - Max Aggregate ReceivedMessage Size - - Whether to fragment outgoing messages - - Fragmentation chunk size for outgoing messages - - Whether to automatically send ping frames for the purposes of keepalive - - Keep-alive ping interval - - Whether or not to automatically assemble received fragments (allows application to handle individual fragments directly) - - How long to wait after sending a close frame for acknowledgment before closing the socket. -- [W3C WebSocket API](http://www.w3.org/TR/websockets/) for applications running on both Node and browsers (via the `W3CWebSocket` class). - - -Known Issues/Missing Features: ------------------------------- -- No API for user-provided protocol extensions. - - -Usage Examples -============== - -Server Example --------------- - -Here's a short example showing a server that echos back anything sent to it, whether utf-8 or binary. - -```javascript -#!/usr/bin/env node -var WebSocketServer = require('websocket').server; -var http = require('http'); - -var server = http.createServer(function(request, response) { - console.log((new Date()) + ' Received request for ' + request.url); - response.writeHead(404); - response.end(); -}); -server.listen(8080, function() { - console.log((new Date()) + ' Server is listening on port 8080'); -}); - -wsServer = new WebSocketServer({ - httpServer: server, - // You should not use autoAcceptConnections for production - // applications, as it defeats all standard cross-origin protection - // facilities built into the protocol and the browser. You should - // *always* verify the connection's origin and decide whether or not - // to accept it. - autoAcceptConnections: false -}); - -function originIsAllowed(origin) { - // put logic here to detect whether the specified origin is allowed. - return true; -} - -wsServer.on('request', function(request) { - if (!originIsAllowed(request.origin)) { - // Make sure we only accept requests from an allowed origin - request.reject(); - console.log((new Date()) + ' Connection from origin ' + request.origin + ' rejected.'); - return; - } - - var connection = request.accept('echo-protocol', request.origin); - console.log((new Date()) + ' Connection accepted.'); - connection.on('message', function(message) { - if (message.type === 'utf8') { - console.log('Received Message: ' + message.utf8Data); - connection.sendUTF(message.utf8Data); - } - else if (message.type === 'binary') { - console.log('Received Binary Message of ' + message.binaryData.length + ' bytes'); - connection.sendBytes(message.binaryData); - } - }); - connection.on('close', function(reasonCode, description) { - console.log((new Date()) + ' Peer ' + connection.remoteAddress + ' disconnected.'); - }); -}); -``` - -Client Example --------------- - -This is a simple example client that will print out any utf-8 messages it receives on the console, and periodically sends a random number. - -*This code demonstrates a client in Node.js, not in the browser* - -```javascript -#!/usr/bin/env node -var WebSocketClient = require('websocket').client; - -var client = new WebSocketClient(); - -client.on('connectFailed', function(error) { - console.log('Connect Error: ' + error.toString()); -}); - -client.on('connect', function(connection) { - console.log('WebSocket Client Connected'); - connection.on('error', function(error) { - console.log("Connection Error: " + error.toString()); - }); - connection.on('close', function() { - console.log('echo-protocol Connection Closed'); - }); - connection.on('message', function(message) { - if (message.type === 'utf8') { - console.log("Received: '" + message.utf8Data + "'"); - } - }); - - function sendNumber() { - if (connection.connected) { - var number = Math.round(Math.random() * 0xFFFFFF); - connection.sendUTF(number.toString()); - setTimeout(sendNumber, 1000); - } - } - sendNumber(); -}); - -client.connect('ws://localhost:8080/', 'echo-protocol'); -``` - -Client Example using the *W3C WebSocket API* --------------------------------------------- - -Same example as above but using the [W3C WebSocket API](http://www.w3.org/TR/websockets/). - -```javascript -var W3CWebSocket = require('websocket').w3cwebsocket; - -var client = new W3CWebSocket('ws://localhost:8080/', 'echo-protocol'); - -client.onerror = function() { - console.log('Connection Error'); -}; - -client.onopen = function() { - console.log('WebSocket Client Connected'); - - function sendNumber() { - if (client.readyState === client.OPEN) { - var number = Math.round(Math.random() * 0xFFFFFF); - client.send(number.toString()); - setTimeout(sendNumber, 1000); - } - } - sendNumber(); -}; - -client.onclose = function() { - console.log('echo-protocol Client Closed'); -}; - -client.onmessage = function(e) { - if (typeof e.data === 'string') { - console.log("Received: '" + e.data + "'"); - } -}; -``` - -Request Router Example ----------------------- - -For an example of using the request router, see `libwebsockets-test-server.js` in the `test` folder. - - -Resources ---------- - -A presentation on the state of the WebSockets protocol that I gave on July 23, 2011 at the LA Hacker News meetup. [WebSockets: The Real-Time Web, Delivered](http://www.scribd.com/doc/60898569/WebSockets-The-Real-Time-Web-Delivered) diff --git a/node_modules/websocket/binding.gyp b/node_modules/websocket/binding.gyp deleted file mode 100644 index 77b2ed5..0000000 --- a/node_modules/websocket/binding.gyp +++ /dev/null @@ -1,18 +0,0 @@ -{ - 'targets': [ - { - 'target_name': 'validation', - 'include_dirs': ["> $(depfile) -# Add extra rules as in (2). -# We remove slashes and replace spaces with new lines; -# remove blank lines; -# delete the first line and append a colon to the remaining lines. -sed -e 's|\\||' -e 'y| |\n|' $(depfile).raw |\ - grep -v '^$$' |\ - sed -e 1d -e 's|$$|:|' \ - >> $(depfile) -rm $(depfile).raw -endef - -# Command definitions: -# - cmd_foo is the actual command to run; -# - quiet_cmd_foo is the brief-output summary of the command. - -quiet_cmd_cc = CC($(TOOLSET)) $@ -cmd_cc = $(CC.$(TOOLSET)) $(GYP_CFLAGS) $(DEPFLAGS) $(CFLAGS.$(TOOLSET)) -c -o $@ $< - -quiet_cmd_cxx = CXX($(TOOLSET)) $@ -cmd_cxx = $(CXX.$(TOOLSET)) $(GYP_CXXFLAGS) $(DEPFLAGS) $(CXXFLAGS.$(TOOLSET)) -c -o $@ $< - -quiet_cmd_touch = TOUCH $@ -cmd_touch = touch $@ - -quiet_cmd_copy = COPY $@ -# send stderr to /dev/null to ignore messages when linking directories. -cmd_copy = ln -f "$<" "$@" 2>/dev/null || (rm -rf "$@" && cp -af "$<" "$@") - -quiet_cmd_alink = AR($(TOOLSET)) $@ -cmd_alink = rm -f $@ && $(AR.$(TOOLSET)) crs $@ $(filter %.o,$^) - -quiet_cmd_alink_thin = AR($(TOOLSET)) $@ -cmd_alink_thin = rm -f $@ && $(AR.$(TOOLSET)) crsT $@ $(filter %.o,$^) - -# Due to circular dependencies between libraries :(, we wrap the -# special "figure out circular dependencies" flags around the entire -# input list during linking. -quiet_cmd_link = LINK($(TOOLSET)) $@ -cmd_link = $(LINK.$(TOOLSET)) $(GYP_LDFLAGS) $(LDFLAGS.$(TOOLSET)) -o $@ -Wl,--start-group $(LD_INPUTS) -Wl,--end-group $(LIBS) - -# We support two kinds of shared objects (.so): -# 1) shared_library, which is just bundling together many dependent libraries -# into a link line. -# 2) loadable_module, which is generating a module intended for dlopen(). -# -# They differ only slightly: -# In the former case, we want to package all dependent code into the .so. -# In the latter case, we want to package just the API exposed by the -# outermost module. -# This means shared_library uses --whole-archive, while loadable_module doesn't. -# (Note that --whole-archive is incompatible with the --start-group used in -# normal linking.) - -# Other shared-object link notes: -# - Set SONAME to the library filename so our binaries don't reference -# the local, absolute paths used on the link command-line. -quiet_cmd_solink = SOLINK($(TOOLSET)) $@ -cmd_solink = $(LINK.$(TOOLSET)) -shared $(GYP_LDFLAGS) $(LDFLAGS.$(TOOLSET)) -Wl,-soname=$(@F) -o $@ -Wl,--whole-archive $(LD_INPUTS) -Wl,--no-whole-archive $(LIBS) - -quiet_cmd_solink_module = SOLINK_MODULE($(TOOLSET)) $@ -cmd_solink_module = $(LINK.$(TOOLSET)) -shared $(GYP_LDFLAGS) $(LDFLAGS.$(TOOLSET)) -Wl,-soname=$(@F) -o $@ -Wl,--start-group $(filter-out FORCE_DO_CMD, $^) -Wl,--end-group $(LIBS) - - -# Define an escape_quotes function to escape single quotes. -# This allows us to handle quotes properly as long as we always use -# use single quotes and escape_quotes. -escape_quotes = $(subst ','\'',$(1)) -# This comment is here just to include a ' to unconfuse syntax highlighting. -# Define an escape_vars function to escape '$' variable syntax. -# This allows us to read/write command lines with shell variables (e.g. -# $LD_LIBRARY_PATH), without triggering make substitution. -escape_vars = $(subst $$,$$$$,$(1)) -# Helper that expands to a shell command to echo a string exactly as it is in -# make. This uses printf instead of echo because printf's behaviour with respect -# to escape sequences is more portable than echo's across different shells -# (e.g., dash, bash). -exact_echo = printf '%s\n' '$(call escape_quotes,$(1))' - -# Helper to compare the command we're about to run against the command -# we logged the last time we ran the command. Produces an empty -# string (false) when the commands match. -# Tricky point: Make has no string-equality test function. -# The kernel uses the following, but it seems like it would have false -# positives, where one string reordered its arguments. -# arg_check = $(strip $(filter-out $(cmd_$(1)), $(cmd_$@)) \ -# $(filter-out $(cmd_$@), $(cmd_$(1)))) -# We instead substitute each for the empty string into the other, and -# say they're equal if both substitutions produce the empty string. -# .d files contain ? instead of spaces, take that into account. -command_changed = $(or $(subst $(cmd_$(1)),,$(cmd_$(call replace_spaces,$@))),\ - $(subst $(cmd_$(call replace_spaces,$@)),,$(cmd_$(1)))) - -# Helper that is non-empty when a prerequisite changes. -# Normally make does this implicitly, but we force rules to always run -# so we can check their command lines. -# $? -- new prerequisites -# $| -- order-only dependencies -prereq_changed = $(filter-out FORCE_DO_CMD,$(filter-out $|,$?)) - -# Helper that executes all postbuilds until one fails. -define do_postbuilds - @E=0;\ - for p in $(POSTBUILDS); do\ - eval $$p;\ - E=$$?;\ - if [ $$E -ne 0 ]; then\ - break;\ - fi;\ - done;\ - if [ $$E -ne 0 ]; then\ - rm -rf "$@";\ - exit $$E;\ - fi -endef - -# do_cmd: run a command via the above cmd_foo names, if necessary. -# Should always run for a given target to handle command-line changes. -# Second argument, if non-zero, makes it do asm/C/C++ dependency munging. -# Third argument, if non-zero, makes it do POSTBUILDS processing. -# Note: We intentionally do NOT call dirx for depfile, since it contains ? for -# spaces already and dirx strips the ? characters. -define do_cmd -$(if $(or $(command_changed),$(prereq_changed)), - @$(call exact_echo, $($(quiet)cmd_$(1))) - @mkdir -p "$(call dirx,$@)" "$(dir $(depfile))" - $(if $(findstring flock,$(word 1,$(cmd_$1))), - @$(cmd_$(1)) - @echo " $(quiet_cmd_$(1)): Finished", - @$(cmd_$(1)) - ) - @$(call exact_echo,$(call escape_vars,cmd_$(call replace_spaces,$@) := $(cmd_$(1)))) > $(depfile) - @$(if $(2),$(fixup_dep)) - $(if $(and $(3), $(POSTBUILDS)), - $(call do_postbuilds) - ) -) -endef - -# Declare the "all" target first so it is the default, -# even though we don't have the deps yet. -.PHONY: all -all: - -# make looks for ways to re-generate included makefiles, but in our case, we -# don't have a direct way. Explicitly telling make that it has nothing to do -# for them makes it go faster. -%.d: ; - -# Use FORCE_DO_CMD to force a target to run. Should be coupled with -# do_cmd. -.PHONY: FORCE_DO_CMD -FORCE_DO_CMD: - -TOOLSET := target -# Suffix rules, putting all outputs into $(obj). -$(obj).$(TOOLSET)/%.o: $(srcdir)/%.c FORCE_DO_CMD - @$(call do_cmd,cc,1) -$(obj).$(TOOLSET)/%.o: $(srcdir)/%.cc FORCE_DO_CMD - @$(call do_cmd,cxx,1) -$(obj).$(TOOLSET)/%.o: $(srcdir)/%.cpp FORCE_DO_CMD - @$(call do_cmd,cxx,1) -$(obj).$(TOOLSET)/%.o: $(srcdir)/%.cxx FORCE_DO_CMD - @$(call do_cmd,cxx,1) -$(obj).$(TOOLSET)/%.o: $(srcdir)/%.S FORCE_DO_CMD - @$(call do_cmd,cc,1) -$(obj).$(TOOLSET)/%.o: $(srcdir)/%.s FORCE_DO_CMD - @$(call do_cmd,cc,1) - -# Try building from generated source, too. -$(obj).$(TOOLSET)/%.o: $(obj).$(TOOLSET)/%.c FORCE_DO_CMD - @$(call do_cmd,cc,1) -$(obj).$(TOOLSET)/%.o: $(obj).$(TOOLSET)/%.cc FORCE_DO_CMD - @$(call do_cmd,cxx,1) -$(obj).$(TOOLSET)/%.o: $(obj).$(TOOLSET)/%.cpp FORCE_DO_CMD - @$(call do_cmd,cxx,1) -$(obj).$(TOOLSET)/%.o: $(obj).$(TOOLSET)/%.cxx FORCE_DO_CMD - @$(call do_cmd,cxx,1) -$(obj).$(TOOLSET)/%.o: $(obj).$(TOOLSET)/%.S FORCE_DO_CMD - @$(call do_cmd,cc,1) -$(obj).$(TOOLSET)/%.o: $(obj).$(TOOLSET)/%.s FORCE_DO_CMD - @$(call do_cmd,cc,1) - -$(obj).$(TOOLSET)/%.o: $(obj)/%.c FORCE_DO_CMD - @$(call do_cmd,cc,1) -$(obj).$(TOOLSET)/%.o: $(obj)/%.cc FORCE_DO_CMD - @$(call do_cmd,cxx,1) -$(obj).$(TOOLSET)/%.o: $(obj)/%.cpp FORCE_DO_CMD - @$(call do_cmd,cxx,1) -$(obj).$(TOOLSET)/%.o: $(obj)/%.cxx FORCE_DO_CMD - @$(call do_cmd,cxx,1) -$(obj).$(TOOLSET)/%.o: $(obj)/%.S FORCE_DO_CMD - @$(call do_cmd,cc,1) -$(obj).$(TOOLSET)/%.o: $(obj)/%.s FORCE_DO_CMD - @$(call do_cmd,cc,1) - - -ifeq ($(strip $(foreach prefix,$(NO_LOAD),\ - $(findstring $(join ^,$(prefix)),\ - $(join ^,bufferutil.target.mk)))),) - include bufferutil.target.mk -endif -ifeq ($(strip $(foreach prefix,$(NO_LOAD),\ - $(findstring $(join ^,$(prefix)),\ - $(join ^,validation.target.mk)))),) - include validation.target.mk -endif - -quiet_cmd_regen_makefile = ACTION Regenerating $@ -cmd_regen_makefile = cd $(srcdir); /usr/share/node-gyp/gyp/gyp_main.py -fmake --ignore-environment "--toplevel-dir=." -I/home/pi/VSoRC/node_modules/websocket/build/config.gypi -I/usr/share/node-gyp/addon.gypi -I/usr/include/nodejs/common.gypi "--depth=." "-Goutput_dir=." "--generator-output=build" "-Dlibrary=shared_library" "-Dvisibility=default" "-Dnode_root_dir=/usr/include/nodejs" "-Dnode_gyp_dir=/usr/share/node-gyp" "-Dnode_lib_file=node.lib" "-Dmodule_root_dir=/home/pi/VSoRC/node_modules/websocket" binding.gyp -Makefile: $(srcdir)/../../../../../usr/include/nodejs/common.gypi $(srcdir)/build/config.gypi $(srcdir)/binding.gyp $(srcdir)/../../../../../usr/share/node-gyp/addon.gypi - $(call do_cmd,regen_makefile) - -# "all" is a concatenation of the "all" targets from all the included -# sub-makefiles. This is just here to clarify. -all: - -# Add in dependency-tracking rules. $(all_deps) is the list of every single -# target in our tree. Only consider the ones with .d (dependency) info: -d_files := $(wildcard $(foreach f,$(all_deps),$(depsdir)/$(f).d)) -ifneq ($(d_files),) - include $(d_files) -endif diff --git a/node_modules/websocket/build/Release/.deps/Release/bufferutil.node.d b/node_modules/websocket/build/Release/.deps/Release/bufferutil.node.d deleted file mode 100644 index 0695fcc..0000000 --- a/node_modules/websocket/build/Release/.deps/Release/bufferutil.node.d +++ /dev/null @@ -1 +0,0 @@ -cmd_Release/bufferutil.node := ln -f "Release/obj.target/bufferutil.node" "Release/bufferutil.node" 2>/dev/null || (rm -rf "Release/bufferutil.node" && cp -af "Release/obj.target/bufferutil.node" "Release/bufferutil.node") diff --git a/node_modules/websocket/build/Release/.deps/Release/obj.target/bufferutil.node.d b/node_modules/websocket/build/Release/.deps/Release/obj.target/bufferutil.node.d deleted file mode 100644 index 385267c..0000000 --- a/node_modules/websocket/build/Release/.deps/Release/obj.target/bufferutil.node.d +++ /dev/null @@ -1 +0,0 @@ -cmd_Release/obj.target/bufferutil.node := g++ -shared -pthread -rdynamic -Wl,-soname=bufferutil.node -o Release/obj.target/bufferutil.node -Wl,--start-group Release/obj.target/bufferutil/src/bufferutil.o -Wl,--end-group diff --git a/node_modules/websocket/build/Release/.deps/Release/obj.target/bufferutil/src/bufferutil.o.d b/node_modules/websocket/build/Release/.deps/Release/obj.target/bufferutil/src/bufferutil.o.d deleted file mode 100644 index 3c3064b..0000000 --- a/node_modules/websocket/build/Release/.deps/Release/obj.target/bufferutil/src/bufferutil.o.d +++ /dev/null @@ -1,57 +0,0 @@ -cmd_Release/obj.target/bufferutil/src/bufferutil.o := g++ '-DNODE_GYP_MODULE_NAME=bufferutil' '-DUSING_UV_SHARED=1' '-DUSING_V8_SHARED=1' '-DV8_DEPRECATION_WARNINGS=1' '-D_LARGEFILE_SOURCE' '-D_FILE_OFFSET_BITS=64' '-DBUILDING_NODE_EXTENSION' -I/usr/include/nodejs/include/node -I/usr/include/nodejs/src -I/usr/include/nodejs/deps/uv/include -I/usr/include/nodejs/deps/v8/include -I../node_modules/nan -fPIC -pthread -Wall -Wextra -Wno-unused-parameter -O2 -fno-omit-frame-pointer -fno-rtti -fno-exceptions -std=gnu++0x -MMD -MF ./Release/.deps/Release/obj.target/bufferutil/src/bufferutil.o.d.raw -c -o Release/obj.target/bufferutil/src/bufferutil.o ../src/bufferutil.cc -Release/obj.target/bufferutil/src/bufferutil.o: ../src/bufferutil.cc \ - /usr/include/nodejs/deps/v8/include/v8.h \ - /usr/include/nodejs/deps/v8/include/v8-version.h \ - /usr/include/nodejs/deps/v8/include/v8config.h \ - /usr/include/nodejs/src/node.h /usr/include/nodejs/src/node_version.h \ - /usr/include/nodejs/src/node_version.h \ - /usr/include/nodejs/src/node_buffer.h /usr/include/nodejs/src/node.h \ - /usr/include/nodejs/src/node_object_wrap.h ../node_modules/nan/nan.h \ - /usr/include/nodejs/deps/uv/include/uv.h \ - /usr/include/nodejs/deps/uv/include/uv-errno.h \ - /usr/include/nodejs/deps/uv/include/uv-version.h \ - /usr/include/nodejs/deps/uv/include/uv-unix.h \ - /usr/include/nodejs/deps/uv/include/uv-threadpool.h \ - /usr/include/nodejs/deps/uv/include/uv-linux.h \ - ../node_modules/nan/nan_callbacks.h \ - ../node_modules/nan/nan_callbacks_12_inl.h \ - ../node_modules/nan/nan_maybe_43_inl.h \ - ../node_modules/nan/nan_converters.h \ - ../node_modules/nan/nan_converters_43_inl.h \ - ../node_modules/nan/nan_new.h \ - ../node_modules/nan/nan_implementation_12_inl.h \ - ../node_modules/nan/nan_persistent_12_inl.h \ - ../node_modules/nan/nan_weak.h ../node_modules/nan/nan_object_wrap.h \ - ../node_modules/nan/nan_private.h \ - ../node_modules/nan/nan_typedarray_contents.h \ - ../node_modules/nan/nan_json.h -../src/bufferutil.cc: -/usr/include/nodejs/deps/v8/include/v8.h: -/usr/include/nodejs/deps/v8/include/v8-version.h: -/usr/include/nodejs/deps/v8/include/v8config.h: -/usr/include/nodejs/src/node.h: -/usr/include/nodejs/src/node_version.h: -/usr/include/nodejs/src/node_version.h: -/usr/include/nodejs/src/node_buffer.h: -/usr/include/nodejs/src/node.h: -/usr/include/nodejs/src/node_object_wrap.h: -../node_modules/nan/nan.h: -/usr/include/nodejs/deps/uv/include/uv.h: -/usr/include/nodejs/deps/uv/include/uv-errno.h: -/usr/include/nodejs/deps/uv/include/uv-version.h: -/usr/include/nodejs/deps/uv/include/uv-unix.h: -/usr/include/nodejs/deps/uv/include/uv-threadpool.h: -/usr/include/nodejs/deps/uv/include/uv-linux.h: -../node_modules/nan/nan_callbacks.h: -../node_modules/nan/nan_callbacks_12_inl.h: -../node_modules/nan/nan_maybe_43_inl.h: -../node_modules/nan/nan_converters.h: -../node_modules/nan/nan_converters_43_inl.h: -../node_modules/nan/nan_new.h: -../node_modules/nan/nan_implementation_12_inl.h: -../node_modules/nan/nan_persistent_12_inl.h: -../node_modules/nan/nan_weak.h: -../node_modules/nan/nan_object_wrap.h: -../node_modules/nan/nan_private.h: -../node_modules/nan/nan_typedarray_contents.h: -../node_modules/nan/nan_json.h: diff --git a/node_modules/websocket/build/Release/.deps/Release/obj.target/validation.node.d b/node_modules/websocket/build/Release/.deps/Release/obj.target/validation.node.d deleted file mode 100644 index 7ad57bc..0000000 --- a/node_modules/websocket/build/Release/.deps/Release/obj.target/validation.node.d +++ /dev/null @@ -1 +0,0 @@ -cmd_Release/obj.target/validation.node := g++ -shared -pthread -rdynamic -Wl,-soname=validation.node -o Release/obj.target/validation.node -Wl,--start-group Release/obj.target/validation/src/validation.o -Wl,--end-group diff --git a/node_modules/websocket/build/Release/.deps/Release/obj.target/validation/src/validation.o.d b/node_modules/websocket/build/Release/.deps/Release/obj.target/validation/src/validation.o.d deleted file mode 100644 index 65e0419..0000000 --- a/node_modules/websocket/build/Release/.deps/Release/obj.target/validation/src/validation.o.d +++ /dev/null @@ -1,57 +0,0 @@ -cmd_Release/obj.target/validation/src/validation.o := g++ '-DNODE_GYP_MODULE_NAME=validation' '-DUSING_UV_SHARED=1' '-DUSING_V8_SHARED=1' '-DV8_DEPRECATION_WARNINGS=1' '-D_LARGEFILE_SOURCE' '-D_FILE_OFFSET_BITS=64' '-DBUILDING_NODE_EXTENSION' -I/usr/include/nodejs/include/node -I/usr/include/nodejs/src -I/usr/include/nodejs/deps/uv/include -I/usr/include/nodejs/deps/v8/include -I../node_modules/nan -fPIC -pthread -Wall -Wextra -Wno-unused-parameter -O2 -fno-omit-frame-pointer -fno-rtti -fno-exceptions -std=gnu++0x -MMD -MF ./Release/.deps/Release/obj.target/validation/src/validation.o.d.raw -c -o Release/obj.target/validation/src/validation.o ../src/validation.cc -Release/obj.target/validation/src/validation.o: ../src/validation.cc \ - /usr/include/nodejs/deps/v8/include/v8.h \ - /usr/include/nodejs/deps/v8/include/v8-version.h \ - /usr/include/nodejs/deps/v8/include/v8config.h \ - /usr/include/nodejs/src/node.h /usr/include/nodejs/src/node_version.h \ - /usr/include/nodejs/src/node_version.h \ - /usr/include/nodejs/src/node_buffer.h /usr/include/nodejs/src/node.h \ - /usr/include/nodejs/src/node_object_wrap.h ../node_modules/nan/nan.h \ - /usr/include/nodejs/deps/uv/include/uv.h \ - /usr/include/nodejs/deps/uv/include/uv-errno.h \ - /usr/include/nodejs/deps/uv/include/uv-version.h \ - /usr/include/nodejs/deps/uv/include/uv-unix.h \ - /usr/include/nodejs/deps/uv/include/uv-threadpool.h \ - /usr/include/nodejs/deps/uv/include/uv-linux.h \ - ../node_modules/nan/nan_callbacks.h \ - ../node_modules/nan/nan_callbacks_12_inl.h \ - ../node_modules/nan/nan_maybe_43_inl.h \ - ../node_modules/nan/nan_converters.h \ - ../node_modules/nan/nan_converters_43_inl.h \ - ../node_modules/nan/nan_new.h \ - ../node_modules/nan/nan_implementation_12_inl.h \ - ../node_modules/nan/nan_persistent_12_inl.h \ - ../node_modules/nan/nan_weak.h ../node_modules/nan/nan_object_wrap.h \ - ../node_modules/nan/nan_private.h \ - ../node_modules/nan/nan_typedarray_contents.h \ - ../node_modules/nan/nan_json.h -../src/validation.cc: -/usr/include/nodejs/deps/v8/include/v8.h: -/usr/include/nodejs/deps/v8/include/v8-version.h: -/usr/include/nodejs/deps/v8/include/v8config.h: -/usr/include/nodejs/src/node.h: -/usr/include/nodejs/src/node_version.h: -/usr/include/nodejs/src/node_version.h: -/usr/include/nodejs/src/node_buffer.h: -/usr/include/nodejs/src/node.h: -/usr/include/nodejs/src/node_object_wrap.h: -../node_modules/nan/nan.h: -/usr/include/nodejs/deps/uv/include/uv.h: -/usr/include/nodejs/deps/uv/include/uv-errno.h: -/usr/include/nodejs/deps/uv/include/uv-version.h: -/usr/include/nodejs/deps/uv/include/uv-unix.h: -/usr/include/nodejs/deps/uv/include/uv-threadpool.h: -/usr/include/nodejs/deps/uv/include/uv-linux.h: -../node_modules/nan/nan_callbacks.h: -../node_modules/nan/nan_callbacks_12_inl.h: -../node_modules/nan/nan_maybe_43_inl.h: -../node_modules/nan/nan_converters.h: -../node_modules/nan/nan_converters_43_inl.h: -../node_modules/nan/nan_new.h: -../node_modules/nan/nan_implementation_12_inl.h: -../node_modules/nan/nan_persistent_12_inl.h: -../node_modules/nan/nan_weak.h: -../node_modules/nan/nan_object_wrap.h: -../node_modules/nan/nan_private.h: -../node_modules/nan/nan_typedarray_contents.h: -../node_modules/nan/nan_json.h: diff --git a/node_modules/websocket/build/Release/.deps/Release/validation.node.d b/node_modules/websocket/build/Release/.deps/Release/validation.node.d deleted file mode 100644 index e0ff2cf..0000000 --- a/node_modules/websocket/build/Release/.deps/Release/validation.node.d +++ /dev/null @@ -1 +0,0 @@ -cmd_Release/validation.node := ln -f "Release/obj.target/validation.node" "Release/validation.node" 2>/dev/null || (rm -rf "Release/validation.node" && cp -af "Release/obj.target/validation.node" "Release/validation.node") diff --git a/node_modules/websocket/build/Release/bufferutil.node b/node_modules/websocket/build/Release/bufferutil.node deleted file mode 100755 index 47c8329..0000000 Binary files a/node_modules/websocket/build/Release/bufferutil.node and /dev/null differ diff --git a/node_modules/websocket/build/Release/obj.target/bufferutil.node b/node_modules/websocket/build/Release/obj.target/bufferutil.node deleted file mode 100755 index 47c8329..0000000 Binary files a/node_modules/websocket/build/Release/obj.target/bufferutil.node and /dev/null differ diff --git a/node_modules/websocket/build/Release/obj.target/bufferutil/src/bufferutil.o b/node_modules/websocket/build/Release/obj.target/bufferutil/src/bufferutil.o deleted file mode 100644 index 084f866..0000000 Binary files a/node_modules/websocket/build/Release/obj.target/bufferutil/src/bufferutil.o and /dev/null differ diff --git a/node_modules/websocket/build/Release/obj.target/validation.node b/node_modules/websocket/build/Release/obj.target/validation.node deleted file mode 100755 index 5b40bdf..0000000 Binary files a/node_modules/websocket/build/Release/obj.target/validation.node and /dev/null differ diff --git a/node_modules/websocket/build/Release/obj.target/validation/src/validation.o b/node_modules/websocket/build/Release/obj.target/validation/src/validation.o deleted file mode 100644 index e923bfa..0000000 Binary files a/node_modules/websocket/build/Release/obj.target/validation/src/validation.o and /dev/null differ diff --git a/node_modules/websocket/build/Release/validation.node b/node_modules/websocket/build/Release/validation.node deleted file mode 100755 index 5b40bdf..0000000 Binary files a/node_modules/websocket/build/Release/validation.node and /dev/null differ diff --git a/node_modules/websocket/build/binding.Makefile b/node_modules/websocket/build/binding.Makefile deleted file mode 100644 index 3c498cd..0000000 --- a/node_modules/websocket/build/binding.Makefile +++ /dev/null @@ -1,6 +0,0 @@ -# This file is generated by gyp; do not edit. - -export builddir_name ?= ./build/. -.PHONY: all -all: - $(MAKE) bufferutil validation diff --git a/node_modules/websocket/build/bufferutil.target.mk b/node_modules/websocket/build/bufferutil.target.mk deleted file mode 100644 index 4098ab7..0000000 --- a/node_modules/websocket/build/bufferutil.target.mk +++ /dev/null @@ -1,140 +0,0 @@ -# This file is generated by gyp; do not edit. - -TOOLSET := target -TARGET := bufferutil -DEFS_Debug := \ - '-DNODE_GYP_MODULE_NAME=bufferutil' \ - '-DUSING_UV_SHARED=1' \ - '-DUSING_V8_SHARED=1' \ - '-DV8_DEPRECATION_WARNINGS=1' \ - '-D_LARGEFILE_SOURCE' \ - '-D_FILE_OFFSET_BITS=64' \ - '-DBUILDING_NODE_EXTENSION' \ - '-DDEBUG' \ - '-D_DEBUG' \ - '-DV8_ENABLE_CHECKS' - -# Flags passed to all source files. -CFLAGS_Debug := \ - -fPIC \ - -pthread \ - -Wall \ - -Wextra \ - -Wno-unused-parameter \ - -O2 \ - -g \ - -O0 - -# Flags passed to only C files. -CFLAGS_C_Debug := - -# Flags passed to only C++ files. -CFLAGS_CC_Debug := \ - -fno-rtti \ - -fno-exceptions \ - -std=gnu++0x - -INCS_Debug := \ - -I/usr/include/nodejs/include/node \ - -I/usr/include/nodejs/src \ - -I/usr/include/nodejs/deps/uv/include \ - -I/usr/include/nodejs/deps/v8/include \ - -I$(srcdir)/node_modules/nan - -DEFS_Release := \ - '-DNODE_GYP_MODULE_NAME=bufferutil' \ - '-DUSING_UV_SHARED=1' \ - '-DUSING_V8_SHARED=1' \ - '-DV8_DEPRECATION_WARNINGS=1' \ - '-D_LARGEFILE_SOURCE' \ - '-D_FILE_OFFSET_BITS=64' \ - '-DBUILDING_NODE_EXTENSION' - -# Flags passed to all source files. -CFLAGS_Release := \ - -fPIC \ - -pthread \ - -Wall \ - -Wextra \ - -Wno-unused-parameter \ - -O2 \ - -fno-omit-frame-pointer - -# Flags passed to only C files. -CFLAGS_C_Release := - -# Flags passed to only C++ files. -CFLAGS_CC_Release := \ - -fno-rtti \ - -fno-exceptions \ - -std=gnu++0x - -INCS_Release := \ - -I/usr/include/nodejs/include/node \ - -I/usr/include/nodejs/src \ - -I/usr/include/nodejs/deps/uv/include \ - -I/usr/include/nodejs/deps/v8/include \ - -I$(srcdir)/node_modules/nan - -OBJS := \ - $(obj).target/$(TARGET)/src/bufferutil.o - -# Add to the list of files we specially track dependencies for. -all_deps += $(OBJS) - -# CFLAGS et al overrides must be target-local. -# See "Target-specific Variable Values" in the GNU Make manual. -$(OBJS): TOOLSET := $(TOOLSET) -$(OBJS): GYP_CFLAGS := $(DEFS_$(BUILDTYPE)) $(INCS_$(BUILDTYPE)) $(CFLAGS_$(BUILDTYPE)) $(CFLAGS_C_$(BUILDTYPE)) -$(OBJS): GYP_CXXFLAGS := $(DEFS_$(BUILDTYPE)) $(INCS_$(BUILDTYPE)) $(CFLAGS_$(BUILDTYPE)) $(CFLAGS_CC_$(BUILDTYPE)) - -# Suffix rules, putting all outputs into $(obj). - -$(obj).$(TOOLSET)/$(TARGET)/%.o: $(srcdir)/%.cc FORCE_DO_CMD - @$(call do_cmd,cxx,1) - -# Try building from generated source, too. - -$(obj).$(TOOLSET)/$(TARGET)/%.o: $(obj).$(TOOLSET)/%.cc FORCE_DO_CMD - @$(call do_cmd,cxx,1) - -$(obj).$(TOOLSET)/$(TARGET)/%.o: $(obj)/%.cc FORCE_DO_CMD - @$(call do_cmd,cxx,1) - -# End of this set of suffix rules -### Rules for final target. -LDFLAGS_Debug := \ - -pthread \ - -rdynamic - -LDFLAGS_Release := \ - -pthread \ - -rdynamic - -LIBS := - -$(obj).target/bufferutil.node: GYP_LDFLAGS := $(LDFLAGS_$(BUILDTYPE)) -$(obj).target/bufferutil.node: LIBS := $(LIBS) -$(obj).target/bufferutil.node: TOOLSET := $(TOOLSET) -$(obj).target/bufferutil.node: $(OBJS) FORCE_DO_CMD - $(call do_cmd,solink_module) - -all_deps += $(obj).target/bufferutil.node -# Add target alias -.PHONY: bufferutil -bufferutil: $(builddir)/bufferutil.node - -# Copy this to the executable output path. -$(builddir)/bufferutil.node: TOOLSET := $(TOOLSET) -$(builddir)/bufferutil.node: $(obj).target/bufferutil.node FORCE_DO_CMD - $(call do_cmd,copy) - -all_deps += $(builddir)/bufferutil.node -# Short alias for building this executable. -.PHONY: bufferutil.node -bufferutil.node: $(obj).target/bufferutil.node $(builddir)/bufferutil.node - -# Add executable to "all" target. -.PHONY: all -all: $(builddir)/bufferutil.node - diff --git a/node_modules/websocket/build/config.gypi b/node_modules/websocket/build/config.gypi deleted file mode 100644 index cf372b9..0000000 --- a/node_modules/websocket/build/config.gypi +++ /dev/null @@ -1,151 +0,0 @@ -# Do not edit. File was generated by node-gyp's "configure" step -{ - "target_defaults": { - "cflags": [], - "default_configuration": "Release", - "defines": [], - "include_dirs": [], - "libraries": [] - }, - "variables": { - "arm_float_abi": "hard", - "arm_fpu": "vfp", - "arm_thumb": 0, - "arm_version": "6", - "asan": 0, - "coverage": "false", - "debug_devtools": "node", - "debug_http2": "false", - "debug_nghttp2": "false", - "force_dynamic_crt": 0, - "host_arch": "arm", - "icu_gyp_path": "tools/icu/icu-system.gyp", - "icu_small": "false", - "llvm_version": 0, - "node_byteorder": "little", - "node_enable_d8": "false", - "node_enable_v8_vtunejit": "false", - "node_install_npm": "false", - "node_module_version": 57, - "node_no_browser_globals": "false", - "node_prefix": "/usr", - "node_release_urlbase": "", - "node_shared": "false", - "node_shared_cares": "true", - "node_shared_http_parser": "true", - "node_shared_libuv": "true", - "node_shared_nghttp2": "false", - "node_shared_openssl": "true", - "node_shared_zlib": "true", - "node_tag": "", - "node_use_bundled_v8": "true", - "node_use_dtrace": "false", - "node_use_etw": "false", - "node_use_lttng": "false", - "node_use_openssl": "true", - "node_use_perfctr": "false", - "node_use_v8_platform": "true", - "node_without_node_options": "false", - "openssl_fips": "", - "openssl_no_asm": 0, - "shlib_suffix": "so.57", - "target_arch": "arm", - "uv_parent_path": "/deps/uv/", - "uv_use_dtrace": "false", - "v8_enable_gdbjit": 0, - "v8_enable_i18n_support": 1, - "v8_enable_inspector": 1, - "v8_no_strict_aliasing": 1, - "v8_optimized_debug": 0, - "v8_promise_internal_field_count": 1, - "v8_random_seed": 0, - "v8_trace_maps": 0, - "v8_use_snapshot": "false", - "want_separate_host_toolset": 0, - "nodedir": "/usr/include/nodejs", - "copy_dev_lib": "true", - "standalone_static_library": 1, - "cache_lock_stale": "60000", - "sign_git_tag": "", - "user_agent": "npm/1.4.21 node/v8.11.1 linux arm", - "always_auth": "", - "bin_links": "true", - "key": "", - "description": "true", - "fetch_retries": "2", - "heading": "npm", - "user": "", - "force": "", - "cache_min": "10", - "init_license": "ISC", - "editor": "vi", - "rollback": "true", - "cache_max": "Infinity", - "userconfig": "/home/pi/.npmrc", - "engine_strict": "", - "init_author_name": "", - "init_author_url": "", - "tmp": "/tmp", - "depth": "Infinity", - "save_dev": "", - "usage": "", - "https_proxy": "", - "onload_script": "", - "rebuild_bundle": "true", - "save_bundle": "", - "shell": "/bin/bash", - "prefix": "/usr/local", - "registry": "https://registry.npmjs.org/", - "__DO_NOT_MODIFY_THIS_FILE___use__etc_npmrc_instead_": "true", - "browser": "", - "cache_lock_wait": "10000", - "save_optional": "", - "searchopts": "", - "versions": "", - "cache": "/home/pi/.npm", - "ignore_scripts": "", - "searchsort": "name", - "version": "", - "local_address": "", - "viewer": "man", - "color": "true", - "fetch_retry_mintimeout": "10000", - "umask": "18", - "fetch_retry_maxtimeout": "60000", - "message": "%s", - "ca": "", - "cert": "", - "global": "", - "link": "", - "save": "", - "unicode": "true", - "long": "", - "production": "", - "unsafe_perm": "true", - "node_version": "8.11.1", - "tag": "latest", - "git_tag_version": "true", - "shrinkwrap": "true", - "fetch_retry_factor": "10", - "npat": "", - "proprietary_attribs": "true", - "save_exact": "", - "strict_ssl": "true", - "username": "", - "globalconfig": "/etc/npmrc", - "dev": "", - "init_module": "/home/pi/.npm-init.js", - "parseable": "", - "globalignorefile": "/etc/npmignore", - "cache_lock_retries": "10", - "save_prefix": "^", - "group": "1000", - "init_author_email": "", - "searchexclude": "", - "git": "git", - "optional": "true", - "email": "", - "json": "", - "spin": "true" - } -} diff --git a/node_modules/websocket/build/validation.target.mk b/node_modules/websocket/build/validation.target.mk deleted file mode 100644 index 0c0d822..0000000 --- a/node_modules/websocket/build/validation.target.mk +++ /dev/null @@ -1,140 +0,0 @@ -# This file is generated by gyp; do not edit. - -TOOLSET := target -TARGET := validation -DEFS_Debug := \ - '-DNODE_GYP_MODULE_NAME=validation' \ - '-DUSING_UV_SHARED=1' \ - '-DUSING_V8_SHARED=1' \ - '-DV8_DEPRECATION_WARNINGS=1' \ - '-D_LARGEFILE_SOURCE' \ - '-D_FILE_OFFSET_BITS=64' \ - '-DBUILDING_NODE_EXTENSION' \ - '-DDEBUG' \ - '-D_DEBUG' \ - '-DV8_ENABLE_CHECKS' - -# Flags passed to all source files. -CFLAGS_Debug := \ - -fPIC \ - -pthread \ - -Wall \ - -Wextra \ - -Wno-unused-parameter \ - -O2 \ - -g \ - -O0 - -# Flags passed to only C files. -CFLAGS_C_Debug := - -# Flags passed to only C++ files. -CFLAGS_CC_Debug := \ - -fno-rtti \ - -fno-exceptions \ - -std=gnu++0x - -INCS_Debug := \ - -I/usr/include/nodejs/include/node \ - -I/usr/include/nodejs/src \ - -I/usr/include/nodejs/deps/uv/include \ - -I/usr/include/nodejs/deps/v8/include \ - -I$(srcdir)/node_modules/nan - -DEFS_Release := \ - '-DNODE_GYP_MODULE_NAME=validation' \ - '-DUSING_UV_SHARED=1' \ - '-DUSING_V8_SHARED=1' \ - '-DV8_DEPRECATION_WARNINGS=1' \ - '-D_LARGEFILE_SOURCE' \ - '-D_FILE_OFFSET_BITS=64' \ - '-DBUILDING_NODE_EXTENSION' - -# Flags passed to all source files. -CFLAGS_Release := \ - -fPIC \ - -pthread \ - -Wall \ - -Wextra \ - -Wno-unused-parameter \ - -O2 \ - -fno-omit-frame-pointer - -# Flags passed to only C files. -CFLAGS_C_Release := - -# Flags passed to only C++ files. -CFLAGS_CC_Release := \ - -fno-rtti \ - -fno-exceptions \ - -std=gnu++0x - -INCS_Release := \ - -I/usr/include/nodejs/include/node \ - -I/usr/include/nodejs/src \ - -I/usr/include/nodejs/deps/uv/include \ - -I/usr/include/nodejs/deps/v8/include \ - -I$(srcdir)/node_modules/nan - -OBJS := \ - $(obj).target/$(TARGET)/src/validation.o - -# Add to the list of files we specially track dependencies for. -all_deps += $(OBJS) - -# CFLAGS et al overrides must be target-local. -# See "Target-specific Variable Values" in the GNU Make manual. -$(OBJS): TOOLSET := $(TOOLSET) -$(OBJS): GYP_CFLAGS := $(DEFS_$(BUILDTYPE)) $(INCS_$(BUILDTYPE)) $(CFLAGS_$(BUILDTYPE)) $(CFLAGS_C_$(BUILDTYPE)) -$(OBJS): GYP_CXXFLAGS := $(DEFS_$(BUILDTYPE)) $(INCS_$(BUILDTYPE)) $(CFLAGS_$(BUILDTYPE)) $(CFLAGS_CC_$(BUILDTYPE)) - -# Suffix rules, putting all outputs into $(obj). - -$(obj).$(TOOLSET)/$(TARGET)/%.o: $(srcdir)/%.cc FORCE_DO_CMD - @$(call do_cmd,cxx,1) - -# Try building from generated source, too. - -$(obj).$(TOOLSET)/$(TARGET)/%.o: $(obj).$(TOOLSET)/%.cc FORCE_DO_CMD - @$(call do_cmd,cxx,1) - -$(obj).$(TOOLSET)/$(TARGET)/%.o: $(obj)/%.cc FORCE_DO_CMD - @$(call do_cmd,cxx,1) - -# End of this set of suffix rules -### Rules for final target. -LDFLAGS_Debug := \ - -pthread \ - -rdynamic - -LDFLAGS_Release := \ - -pthread \ - -rdynamic - -LIBS := - -$(obj).target/validation.node: GYP_LDFLAGS := $(LDFLAGS_$(BUILDTYPE)) -$(obj).target/validation.node: LIBS := $(LIBS) -$(obj).target/validation.node: TOOLSET := $(TOOLSET) -$(obj).target/validation.node: $(OBJS) FORCE_DO_CMD - $(call do_cmd,solink_module) - -all_deps += $(obj).target/validation.node -# Add target alias -.PHONY: validation -validation: $(builddir)/validation.node - -# Copy this to the executable output path. -$(builddir)/validation.node: TOOLSET := $(TOOLSET) -$(builddir)/validation.node: $(obj).target/validation.node FORCE_DO_CMD - $(call do_cmd,copy) - -all_deps += $(builddir)/validation.node -# Short alias for building this executable. -.PHONY: validation.node -validation.node: $(obj).target/validation.node $(builddir)/validation.node - -# Add executable to "all" target. -.PHONY: all -all: $(builddir)/validation.node - diff --git a/node_modules/websocket/builderror.log b/node_modules/websocket/builderror.log deleted file mode 100644 index e69de29..0000000 diff --git a/node_modules/websocket/gulpfile.js b/node_modules/websocket/gulpfile.js deleted file mode 100644 index b515b92..0000000 --- a/node_modules/websocket/gulpfile.js +++ /dev/null @@ -1,14 +0,0 @@ -/** - * Dependencies. - */ -var gulp = require('gulp'); -var jshint = require('gulp-jshint'); - -gulp.task('lint', function() { - return gulp.src(['gulpfile.js', 'lib/**/*.js', 'test/**/*.js']) - .pipe(jshint('.jshintrc')) - .pipe(jshint.reporter('jshint-stylish', {verbose: true})) - .pipe(jshint.reporter('fail')); -}); - -gulp.task('default', gulp.series('lint')); diff --git a/node_modules/websocket/index.js b/node_modules/websocket/index.js deleted file mode 100644 index 573969f..0000000 --- a/node_modules/websocket/index.js +++ /dev/null @@ -1 +0,0 @@ -module.exports = require('./lib/websocket'); \ No newline at end of file diff --git a/node_modules/websocket/lib/BufferUtil.fallback.js b/node_modules/websocket/lib/BufferUtil.fallback.js deleted file mode 100644 index c92daa6..0000000 --- a/node_modules/websocket/lib/BufferUtil.fallback.js +++ /dev/null @@ -1,52 +0,0 @@ -/*! - * Copied from: - * ws: a node.js websocket client - * Copyright(c) 2011 Einar Otto Stangvik - * MIT Licensed - */ - -/* jshint -W086 */ - -module.exports.BufferUtil = { - merge: function(mergedBuffer, buffers) { - var offset = 0; - for (var i = 0, l = buffers.length; i < l; ++i) { - var buf = buffers[i]; - buf.copy(mergedBuffer, offset); - offset += buf.length; - } - }, - mask: function(source, mask, output, offset, length) { - var maskNum = mask.readUInt32LE(0); - var i = 0; - for (; i < length - 3; i += 4) { - var num = maskNum ^ source.readUInt32LE(i); - if (num < 0) { num = 4294967296 + num; } - output.writeUInt32LE(num, offset + i); - } - switch (length % 4) { - case 3: output[offset + i + 2] = source[i + 2] ^ mask[2]; - case 2: output[offset + i + 1] = source[i + 1] ^ mask[1]; - case 1: output[offset + i] = source[i] ^ mask[0]; - case 0: - } - }, - unmask: function(data, mask) { - var maskNum = mask.readUInt32LE(0); - var length = data.length; - var i = 0; - for (; i < length - 3; i += 4) { - var num = maskNum ^ data.readUInt32LE(i); - if (num < 0) { num = 4294967296 + num; } - data.writeUInt32LE(num, i); - } - switch (length % 4) { - case 3: data[i + 2] = data[i + 2] ^ mask[2]; - case 2: data[i + 1] = data[i + 1] ^ mask[1]; - case 1: data[i] = data[i] ^ mask[0]; - case 0: - } - } -}; - -/* jshint +W086 */ \ No newline at end of file diff --git a/node_modules/websocket/lib/BufferUtil.js b/node_modules/websocket/lib/BufferUtil.js deleted file mode 100644 index fa37c80..0000000 --- a/node_modules/websocket/lib/BufferUtil.js +++ /dev/null @@ -1,17 +0,0 @@ -/*! - * Copied from: - * ws: a node.js websocket client - * Copyright(c) 2011 Einar Otto Stangvik - * MIT Licensed - */ - -try { - module.exports = require('../build/Release/bufferutil'); -} catch (e) { try { - module.exports = require('../build/default/bufferutil'); -} catch (e) { try { - module.exports = require('./BufferUtil.fallback'); -} catch (e) { - console.error('bufferutil.node seems to not have been built. Run npm install.'); - throw e; -}}} diff --git a/node_modules/websocket/lib/Deprecation.js b/node_modules/websocket/lib/Deprecation.js deleted file mode 100644 index 094f160..0000000 --- a/node_modules/websocket/lib/Deprecation.js +++ /dev/null @@ -1,32 +0,0 @@ -/************************************************************************ - * Copyright 2010-2015 Brian McKelvey. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - ***********************************************************************/ - -var Deprecation = { - disableWarnings: false, - - deprecationWarningMap: { - - }, - - warn: function(deprecationName) { - if (!this.disableWarnings && this.deprecationWarningMap[deprecationName]) { - console.warn('DEPRECATION WARNING: ' + this.deprecationWarningMap[deprecationName]); - this.deprecationWarningMap[deprecationName] = false; - } - } -}; - -module.exports = Deprecation; diff --git a/node_modules/websocket/lib/Validation.fallback.js b/node_modules/websocket/lib/Validation.fallback.js deleted file mode 100644 index 6160f88..0000000 --- a/node_modules/websocket/lib/Validation.fallback.js +++ /dev/null @@ -1,12 +0,0 @@ -/*! - * UTF-8 Validation Fallback Code originally from: - * ws: a node.js websocket client - * Copyright(c) 2011 Einar Otto Stangvik - * MIT Licensed - */ - -module.exports.Validation = { - isValidUTF8: function() { - return true; - } -}; diff --git a/node_modules/websocket/lib/Validation.js b/node_modules/websocket/lib/Validation.js deleted file mode 100644 index b4106e8..0000000 --- a/node_modules/websocket/lib/Validation.js +++ /dev/null @@ -1,17 +0,0 @@ -/*! - * UTF-8 Validation Code originally from: - * ws: a node.js websocket client - * Copyright(c) 2011 Einar Otto Stangvik - * MIT Licensed - */ - -try { - module.exports = require('../build/Release/validation'); -} catch (e) { try { - module.exports = require('../build/default/validation'); -} catch (e) { try { - module.exports = require('./Validation.fallback'); -} catch (e) { - console.error('validation.node seems not to have been built. Run npm install.'); - throw e; -}}} diff --git a/node_modules/websocket/lib/W3CWebSocket.js b/node_modules/websocket/lib/W3CWebSocket.js deleted file mode 100644 index 44a4ac9..0000000 --- a/node_modules/websocket/lib/W3CWebSocket.js +++ /dev/null @@ -1,257 +0,0 @@ -/************************************************************************ - * Copyright 2010-2015 Brian McKelvey. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - ***********************************************************************/ - -var WebSocketClient = require('./WebSocketClient'); -var toBuffer = require('typedarray-to-buffer'); -var yaeti = require('yaeti'); - - -const CONNECTING = 0; -const OPEN = 1; -const CLOSING = 2; -const CLOSED = 3; - - -module.exports = W3CWebSocket; - - -function W3CWebSocket(url, protocols, origin, headers, requestOptions, clientConfig) { - // Make this an EventTarget. - yaeti.EventTarget.call(this); - - // Sanitize clientConfig. - clientConfig = clientConfig || {}; - clientConfig.assembleFragments = true; // Required in the W3C API. - - var self = this; - - this._url = url; - this._readyState = CONNECTING; - this._protocol = undefined; - this._extensions = ''; - this._bufferedAmount = 0; // Hack, always 0. - this._binaryType = 'arraybuffer'; // TODO: Should be 'blob' by default, but Node has no Blob. - - // The WebSocketConnection instance. - this._connection = undefined; - - // WebSocketClient instance. - this._client = new WebSocketClient(clientConfig); - - this._client.on('connect', function(connection) { - onConnect.call(self, connection); - }); - - this._client.on('connectFailed', function() { - onConnectFailed.call(self); - }); - - this._client.connect(url, protocols, origin, headers, requestOptions); -} - - -// Expose W3C read only attributes. -Object.defineProperties(W3CWebSocket.prototype, { - url: { get: function() { return this._url; } }, - readyState: { get: function() { return this._readyState; } }, - protocol: { get: function() { return this._protocol; } }, - extensions: { get: function() { return this._extensions; } }, - bufferedAmount: { get: function() { return this._bufferedAmount; } } -}); - - -// Expose W3C write/read attributes. -Object.defineProperties(W3CWebSocket.prototype, { - binaryType: { - get: function() { - return this._binaryType; - }, - set: function(type) { - // TODO: Just 'arraybuffer' supported. - if (type !== 'arraybuffer') { - throw new SyntaxError('just "arraybuffer" type allowed for "binaryType" attribute'); - } - this._binaryType = type; - } - } -}); - - -// Expose W3C readyState constants into the WebSocket instance as W3C states. -[['CONNECTING',CONNECTING], ['OPEN',OPEN], ['CLOSING',CLOSING], ['CLOSED',CLOSED]].forEach(function(property) { - Object.defineProperty(W3CWebSocket.prototype, property[0], { - get: function() { return property[1]; } - }); -}); - -// Also expose W3C readyState constants into the WebSocket class (not defined by the W3C, -// but there are so many libs relying on them). -[['CONNECTING',CONNECTING], ['OPEN',OPEN], ['CLOSING',CLOSING], ['CLOSED',CLOSED]].forEach(function(property) { - Object.defineProperty(W3CWebSocket, property[0], { - get: function() { return property[1]; } - }); -}); - - -W3CWebSocket.prototype.send = function(data) { - if (this._readyState !== OPEN) { - throw new Error('cannot call send() while not connected'); - } - - // Text. - if (typeof data === 'string' || data instanceof String) { - this._connection.sendUTF(data); - } - // Binary. - else { - // Node Buffer. - if (data instanceof Buffer) { - this._connection.sendBytes(data); - } - // If ArrayBuffer or ArrayBufferView convert it to Node Buffer. - else if (data.byteLength || data.byteLength === 0) { - data = toBuffer(data); - this._connection.sendBytes(data); - } - else { - throw new Error('unknown binary data:', data); - } - } -}; - - -W3CWebSocket.prototype.close = function(code, reason) { - switch(this._readyState) { - case CONNECTING: - // NOTE: We don't have the WebSocketConnection instance yet so no - // way to close the TCP connection. - // Artificially invoke the onConnectFailed event. - onConnectFailed.call(this); - // And close if it connects after a while. - this._client.on('connect', function(connection) { - if (code) { - connection.close(code, reason); - } else { - connection.close(); - } - }); - break; - case OPEN: - this._readyState = CLOSING; - if (code) { - this._connection.close(code, reason); - } else { - this._connection.close(); - } - break; - case CLOSING: - case CLOSED: - break; - } -}; - - -/** - * Private API. - */ - - -function createCloseEvent(code, reason) { - var event = new yaeti.Event('close'); - - event.code = code; - event.reason = reason; - event.wasClean = (typeof code === 'undefined' || code === 1000); - - return event; -} - - -function createMessageEvent(data) { - var event = new yaeti.Event('message'); - - event.data = data; - - return event; -} - - -function onConnect(connection) { - var self = this; - - this._readyState = OPEN; - this._connection = connection; - this._protocol = connection.protocol; - this._extensions = connection.extensions; - - this._connection.on('close', function(code, reason) { - onClose.call(self, code, reason); - }); - - this._connection.on('message', function(msg) { - onMessage.call(self, msg); - }); - - this.dispatchEvent(new yaeti.Event('open')); -} - - -function onConnectFailed() { - destroy.call(this); - this._readyState = CLOSED; - - try { - this.dispatchEvent(new yaeti.Event('error')); - } finally { - this.dispatchEvent(createCloseEvent(1006, 'connection failed')); - } -} - - -function onClose(code, reason) { - destroy.call(this); - this._readyState = CLOSED; - - this.dispatchEvent(createCloseEvent(code, reason || '')); -} - - -function onMessage(message) { - if (message.utf8Data) { - this.dispatchEvent(createMessageEvent(message.utf8Data)); - } - else if (message.binaryData) { - // Must convert from Node Buffer to ArrayBuffer. - // TODO: or to a Blob (which does not exist in Node!). - if (this.binaryType === 'arraybuffer') { - var buffer = message.binaryData; - var arraybuffer = new ArrayBuffer(buffer.length); - var view = new Uint8Array(arraybuffer); - for (var i=0, len=buffer.length; i', '@', - ',', ';', ':', '\\', '\"', - '/', '[', ']', '?', '=', - '{', '}', ' ', String.fromCharCode(9) -]; - -var excludedTlsOptions = ['hostname','port','method','path','headers']; - -function WebSocketClient(config) { - // Superclass Constructor - EventEmitter.call(this); - - // TODO: Implement extensions - - this.config = { - // 1MiB max frame size. - maxReceivedFrameSize: 0x100000, - - // 8MiB max message size, only applicable if - // assembleFragments is true - maxReceivedMessageSize: 0x800000, - - // Outgoing messages larger than fragmentationThreshold will be - // split into multiple fragments. - fragmentOutgoingMessages: true, - - // Outgoing frames are fragmented if they exceed this threshold. - // Default is 16KiB - fragmentationThreshold: 0x4000, - - // Which version of the protocol to use for this session. This - // option will be removed once the protocol is finalized by the IETF - // It is only available to ease the transition through the - // intermediate draft protocol versions. - // At present, it only affects the name of the Origin header. - webSocketVersion: 13, - - // If true, fragmented messages will be automatically assembled - // and the full message will be emitted via a 'message' event. - // If false, each frame will be emitted via a 'frame' event and - // the application will be responsible for aggregating multiple - // fragmented frames. Single-frame messages will emit a 'message' - // event in addition to the 'frame' event. - // Most users will want to leave this set to 'true' - assembleFragments: true, - - // The Nagle Algorithm makes more efficient use of network resources - // by introducing a small delay before sending small packets so that - // multiple messages can be batched together before going onto the - // wire. This however comes at the cost of latency, so the default - // is to disable it. If you don't need low latency and are streaming - // lots of small messages, you can change this to 'false' - disableNagleAlgorithm: true, - - // The number of milliseconds to wait after sending a close frame - // for an acknowledgement to come back before giving up and just - // closing the socket. - closeTimeout: 5000, - - // Options to pass to https.connect if connecting via TLS - tlsOptions: {} - }; - - if (config) { - var tlsOptions; - if (config.tlsOptions) { - tlsOptions = config.tlsOptions; - delete config.tlsOptions; - } - else { - tlsOptions = {}; - } - extend(this.config, config); - extend(this.config.tlsOptions, tlsOptions); - } - - this._req = null; - - switch (this.config.webSocketVersion) { - case 8: - case 13: - break; - default: - throw new Error('Requested webSocketVersion is not supported. Allowed values are 8 and 13.'); - } -} - -util.inherits(WebSocketClient, EventEmitter); - -WebSocketClient.prototype.connect = function(requestUrl, protocols, origin, headers, extraRequestOptions) { - var self = this; - - if (typeof(protocols) === 'string') { - if (protocols.length > 0) { - protocols = [protocols]; - } - else { - protocols = []; - } - } - if (!(protocols instanceof Array)) { - protocols = []; - } - this.protocols = protocols; - this.origin = origin; - - if (typeof(requestUrl) === 'string') { - this.url = url.parse(requestUrl); - } - else { - this.url = requestUrl; // in case an already parsed url is passed in. - } - if (!this.url.protocol) { - throw new Error('You must specify a full WebSocket URL, including protocol.'); - } - if (!this.url.host) { - throw new Error('You must specify a full WebSocket URL, including hostname. Relative URLs are not supported.'); - } - - this.secure = (this.url.protocol === 'wss:'); - - // validate protocol characters: - this.protocols.forEach(function(protocol) { - for (var i=0; i < protocol.length; i ++) { - var charCode = protocol.charCodeAt(i); - var character = protocol.charAt(i); - if (charCode < 0x0021 || charCode > 0x007E || protocolSeparators.indexOf(character) !== -1) { - throw new Error('Protocol list contains invalid character "' + String.fromCharCode(charCode) + '"'); - } - } - }); - - var defaultPorts = { - 'ws:': '80', - 'wss:': '443' - }; - - if (!this.url.port) { - this.url.port = defaultPorts[this.url.protocol]; - } - - var nonce = bufferAllocUnsafe(16); - for (var i=0; i < 16; i++) { - nonce[i] = Math.round(Math.random()*0xFF); - } - this.base64nonce = nonce.toString('base64'); - - var hostHeaderValue = this.url.hostname; - if ((this.url.protocol === 'ws:' && this.url.port !== '80') || - (this.url.protocol === 'wss:' && this.url.port !== '443')) { - hostHeaderValue += (':' + this.url.port); - } - - var reqHeaders = {}; - if (this.secure && this.config.tlsOptions.hasOwnProperty('headers')) { - // Allow for additional headers to be provided when connecting via HTTPS - extend(reqHeaders, this.config.tlsOptions.headers); - } - if (headers) { - // Explicitly provided headers take priority over any from tlsOptions - extend(reqHeaders, headers); - } - extend(reqHeaders, { - 'Upgrade': 'websocket', - 'Connection': 'Upgrade', - 'Sec-WebSocket-Version': this.config.webSocketVersion.toString(10), - 'Sec-WebSocket-Key': this.base64nonce, - 'Host': reqHeaders.Host || hostHeaderValue - }); - - if (this.protocols.length > 0) { - reqHeaders['Sec-WebSocket-Protocol'] = this.protocols.join(', '); - } - if (this.origin) { - if (this.config.webSocketVersion === 13) { - reqHeaders['Origin'] = this.origin; - } - else if (this.config.webSocketVersion === 8) { - reqHeaders['Sec-WebSocket-Origin'] = this.origin; - } - } - - // TODO: Implement extensions - - var pathAndQuery; - // Ensure it begins with '/'. - if (this.url.pathname) { - pathAndQuery = this.url.path; - } - else if (this.url.path) { - pathAndQuery = '/' + this.url.path; - } - else { - pathAndQuery = '/'; - } - - function handleRequestError(error) { - self._req = null; - self.emit('connectFailed', error); - } - - var requestOptions = { - agent: false - }; - if (extraRequestOptions) { - extend(requestOptions, extraRequestOptions); - } - // These options are always overridden by the library. The user is not - // allowed to specify these directly. - extend(requestOptions, { - hostname: this.url.hostname, - port: this.url.port, - method: 'GET', - path: pathAndQuery, - headers: reqHeaders - }); - if (this.secure) { - var tlsOptions = this.config.tlsOptions; - for (var key in tlsOptions) { - if (tlsOptions.hasOwnProperty(key) && excludedTlsOptions.indexOf(key) === -1) { - requestOptions[key] = tlsOptions[key]; - } - } - } - - var req = this._req = (this.secure ? https : http).request(requestOptions); - req.on('upgrade', function handleRequestUpgrade(response, socket, head) { - self._req = null; - req.removeListener('error', handleRequestError); - self.socket = socket; - self.response = response; - self.firstDataChunk = head; - self.validateHandshake(); - }); - req.on('error', handleRequestError); - - req.on('response', function(response) { - self._req = null; - if (utils.eventEmitterListenerCount(self, 'httpResponse') > 0) { - self.emit('httpResponse', response, self); - if (response.socket) { - response.socket.end(); - } - } - else { - var headerDumpParts = []; - for (var headerName in response.headers) { - headerDumpParts.push(headerName + ': ' + response.headers[headerName]); - } - self.failHandshake( - 'Server responded with a non-101 status: ' + - response.statusCode + ' ' + response.statusMessage + - '\nResponse Headers Follow:\n' + - headerDumpParts.join('\n') + '\n' - ); - } - }); - req.end(); -}; - -WebSocketClient.prototype.validateHandshake = function() { - var headers = this.response.headers; - - if (this.protocols.length > 0) { - this.protocol = headers['sec-websocket-protocol']; - if (this.protocol) { - if (this.protocols.indexOf(this.protocol) === -1) { - this.failHandshake('Server did not respond with a requested protocol.'); - return; - } - } - else { - this.failHandshake('Expected a Sec-WebSocket-Protocol header.'); - return; - } - } - - if (!(headers['connection'] && headers['connection'].toLocaleLowerCase() === 'upgrade')) { - this.failHandshake('Expected a Connection: Upgrade header from the server'); - return; - } - - if (!(headers['upgrade'] && headers['upgrade'].toLocaleLowerCase() === 'websocket')) { - this.failHandshake('Expected an Upgrade: websocket header from the server'); - return; - } - - var sha1 = crypto.createHash('sha1'); - sha1.update(this.base64nonce + '258EAFA5-E914-47DA-95CA-C5AB0DC85B11'); - var expectedKey = sha1.digest('base64'); - - if (!headers['sec-websocket-accept']) { - this.failHandshake('Expected Sec-WebSocket-Accept header from server'); - return; - } - - if (headers['sec-websocket-accept'] !== expectedKey) { - this.failHandshake('Sec-WebSocket-Accept header from server didn\'t match expected value of ' + expectedKey); - return; - } - - // TODO: Support extensions - - this.succeedHandshake(); -}; - -WebSocketClient.prototype.failHandshake = function(errorDescription) { - if (this.socket && this.socket.writable) { - this.socket.end(); - } - this.emit('connectFailed', new Error(errorDescription)); -}; - -WebSocketClient.prototype.succeedHandshake = function() { - var connection = new WebSocketConnection(this.socket, [], this.protocol, true, this.config); - - connection.webSocketVersion = this.config.webSocketVersion; - connection._addSocketEventListeners(); - - this.emit('connect', connection); - if (this.firstDataChunk.length > 0) { - connection.handleSocketData(this.firstDataChunk); - } - this.firstDataChunk = null; -}; - -WebSocketClient.prototype.abort = function() { - if (this._req) { - this._req.abort(); - } -}; - -module.exports = WebSocketClient; diff --git a/node_modules/websocket/lib/WebSocketConnection.js b/node_modules/websocket/lib/WebSocketConnection.js deleted file mode 100644 index 9f2750c..0000000 --- a/node_modules/websocket/lib/WebSocketConnection.js +++ /dev/null @@ -1,896 +0,0 @@ -/************************************************************************ - * Copyright 2010-2015 Brian McKelvey. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - ***********************************************************************/ - -var util = require('util'); -var utils = require('./utils'); -var EventEmitter = require('events').EventEmitter; -var WebSocketFrame = require('./WebSocketFrame'); -var BufferList = require('../vendor/FastBufferList'); -var Validation = require('./Validation').Validation; -var bufferAllocUnsafe = utils.bufferAllocUnsafe; -var bufferFromString = utils.bufferFromString; - -// Connected, fully-open, ready to send and receive frames -const STATE_OPEN = 'open'; -// Received a close frame from the remote peer -const STATE_PEER_REQUESTED_CLOSE = 'peer_requested_close'; -// Sent close frame to remote peer. No further data can be sent. -const STATE_ENDING = 'ending'; -// Connection is fully closed. No further data can be sent or received. -const STATE_CLOSED = 'closed'; - -var setImmediateImpl = ('setImmediate' in global) ? - global.setImmediate.bind(global) : - process.nextTick.bind(process); - -var idCounter = 0; - -function WebSocketConnection(socket, extensions, protocol, maskOutgoingPackets, config) { - this._debug = utils.BufferingLogger('websocket:connection', ++idCounter); - this._debug('constructor'); - - if (this._debug.enabled) { - instrumentSocketForDebugging(this, socket); - } - - // Superclass Constructor - EventEmitter.call(this); - - this._pingListenerCount = 0; - this.on('newListener', function(ev) { - if (ev === 'ping'){ - this._pingListenerCount++; - } - }).on('removeListener', function(ev) { - if (ev === 'ping') { - this._pingListenerCount--; - } - }); - - this.config = config; - this.socket = socket; - this.protocol = protocol; - this.extensions = extensions; - this.remoteAddress = socket.remoteAddress; - this.closeReasonCode = -1; - this.closeDescription = null; - this.closeEventEmitted = false; - - // We have to mask outgoing packets if we're acting as a WebSocket client. - this.maskOutgoingPackets = maskOutgoingPackets; - - // We re-use the same buffers for the mask and frame header for all frames - // received on each connection to avoid a small memory allocation for each - // frame. - this.maskBytes = bufferAllocUnsafe(4); - this.frameHeader = bufferAllocUnsafe(10); - - // the BufferList will handle the data streaming in - this.bufferList = new BufferList(); - - // Prepare for receiving first frame - this.currentFrame = new WebSocketFrame(this.maskBytes, this.frameHeader, this.config); - this.fragmentationSize = 0; // data received so far... - this.frameQueue = []; - - // Various bits of connection state - this.connected = true; - this.state = STATE_OPEN; - this.waitingForCloseResponse = false; - // Received TCP FIN, socket's readable stream is finished. - this.receivedEnd = false; - - this.closeTimeout = this.config.closeTimeout; - this.assembleFragments = this.config.assembleFragments; - this.maxReceivedMessageSize = this.config.maxReceivedMessageSize; - - this.outputBufferFull = false; - this.inputPaused = false; - this.receivedDataHandler = this.processReceivedData.bind(this); - this._closeTimerHandler = this.handleCloseTimer.bind(this); - - // Disable nagle algorithm? - this.socket.setNoDelay(this.config.disableNagleAlgorithm); - - // Make sure there is no socket inactivity timeout - this.socket.setTimeout(0); - - if (this.config.keepalive && !this.config.useNativeKeepalive) { - if (typeof(this.config.keepaliveInterval) !== 'number') { - throw new Error('keepaliveInterval must be specified and numeric ' + - 'if keepalive is true.'); - } - this._keepaliveTimerHandler = this.handleKeepaliveTimer.bind(this); - this.setKeepaliveTimer(); - - if (this.config.dropConnectionOnKeepaliveTimeout) { - if (typeof(this.config.keepaliveGracePeriod) !== 'number') { - throw new Error('keepaliveGracePeriod must be specified and ' + - 'numeric if dropConnectionOnKeepaliveTimeout ' + - 'is true.'); - } - this._gracePeriodTimerHandler = this.handleGracePeriodTimer.bind(this); - } - } - else if (this.config.keepalive && this.config.useNativeKeepalive) { - if (!('setKeepAlive' in this.socket)) { - throw new Error('Unable to use native keepalive: unsupported by ' + - 'this version of Node.'); - } - this.socket.setKeepAlive(true, this.config.keepaliveInterval); - } - - // The HTTP Client seems to subscribe to socket error events - // and re-dispatch them in such a way that doesn't make sense - // for users of our client, so we want to make sure nobody - // else is listening for error events on the socket besides us. - this.socket.removeAllListeners('error'); -} - -WebSocketConnection.CLOSE_REASON_NORMAL = 1000; -WebSocketConnection.CLOSE_REASON_GOING_AWAY = 1001; -WebSocketConnection.CLOSE_REASON_PROTOCOL_ERROR = 1002; -WebSocketConnection.CLOSE_REASON_UNPROCESSABLE_INPUT = 1003; -WebSocketConnection.CLOSE_REASON_RESERVED = 1004; // Reserved value. Undefined meaning. -WebSocketConnection.CLOSE_REASON_NOT_PROVIDED = 1005; // Not to be used on the wire -WebSocketConnection.CLOSE_REASON_ABNORMAL = 1006; // Not to be used on the wire -WebSocketConnection.CLOSE_REASON_INVALID_DATA = 1007; -WebSocketConnection.CLOSE_REASON_POLICY_VIOLATION = 1008; -WebSocketConnection.CLOSE_REASON_MESSAGE_TOO_BIG = 1009; -WebSocketConnection.CLOSE_REASON_EXTENSION_REQUIRED = 1010; -WebSocketConnection.CLOSE_REASON_INTERNAL_SERVER_ERROR = 1011; -WebSocketConnection.CLOSE_REASON_TLS_HANDSHAKE_FAILED = 1015; // Not to be used on the wire - -WebSocketConnection.CLOSE_DESCRIPTIONS = { - 1000: 'Normal connection closure', - 1001: 'Remote peer is going away', - 1002: 'Protocol error', - 1003: 'Unprocessable input', - 1004: 'Reserved', - 1005: 'Reason not provided', - 1006: 'Abnormal closure, no further detail available', - 1007: 'Invalid data received', - 1008: 'Policy violation', - 1009: 'Message too big', - 1010: 'Extension requested by client is required', - 1011: 'Internal Server Error', - 1015: 'TLS Handshake Failed' -}; - -function validateCloseReason(code) { - if (code < 1000) { - // Status codes in the range 0-999 are not used - return false; - } - if (code >= 1000 && code <= 2999) { - // Codes from 1000 - 2999 are reserved for use by the protocol. Only - // a few codes are defined, all others are currently illegal. - return [1000, 1001, 1002, 1003, 1007, 1008, 1009, 1010, 1011, 1012, 1013, 1014].indexOf(code) !== -1; - } - if (code >= 3000 && code <= 3999) { - // Reserved for use by libraries, frameworks, and applications. - // Should be registered with IANA. Interpretation of these codes is - // undefined by the WebSocket protocol. - return true; - } - if (code >= 4000 && code <= 4999) { - // Reserved for private use. Interpretation of these codes is - // undefined by the WebSocket protocol. - return true; - } - if (code >= 5000) { - return false; - } -} - -util.inherits(WebSocketConnection, EventEmitter); - -WebSocketConnection.prototype._addSocketEventListeners = function() { - this.socket.on('error', this.handleSocketError.bind(this)); - this.socket.on('end', this.handleSocketEnd.bind(this)); - this.socket.on('close', this.handleSocketClose.bind(this)); - this.socket.on('drain', this.handleSocketDrain.bind(this)); - this.socket.on('pause', this.handleSocketPause.bind(this)); - this.socket.on('resume', this.handleSocketResume.bind(this)); - this.socket.on('data', this.handleSocketData.bind(this)); -}; - -// set or reset the keepalive timer when data is received. -WebSocketConnection.prototype.setKeepaliveTimer = function() { - this._debug('setKeepaliveTimer'); - if (!this.config.keepalive || this.config.useNativeKeepalive) { return; } - this.clearKeepaliveTimer(); - this.clearGracePeriodTimer(); - this._keepaliveTimeoutID = setTimeout(this._keepaliveTimerHandler, this.config.keepaliveInterval); -}; - -WebSocketConnection.prototype.clearKeepaliveTimer = function() { - if (this._keepaliveTimeoutID) { - clearTimeout(this._keepaliveTimeoutID); - } -}; - -// No data has been received within config.keepaliveTimeout ms. -WebSocketConnection.prototype.handleKeepaliveTimer = function() { - this._debug('handleKeepaliveTimer'); - this._keepaliveTimeoutID = null; - this.ping(); - - // If we are configured to drop connections if the client doesn't respond - // then set the grace period timer. - if (this.config.dropConnectionOnKeepaliveTimeout) { - this.setGracePeriodTimer(); - } - else { - // Otherwise reset the keepalive timer to send the next ping. - this.setKeepaliveTimer(); - } -}; - -WebSocketConnection.prototype.setGracePeriodTimer = function() { - this._debug('setGracePeriodTimer'); - this.clearGracePeriodTimer(); - this._gracePeriodTimeoutID = setTimeout(this._gracePeriodTimerHandler, this.config.keepaliveGracePeriod); -}; - -WebSocketConnection.prototype.clearGracePeriodTimer = function() { - if (this._gracePeriodTimeoutID) { - clearTimeout(this._gracePeriodTimeoutID); - } -}; - -WebSocketConnection.prototype.handleGracePeriodTimer = function() { - this._debug('handleGracePeriodTimer'); - // If this is called, the client has not responded and is assumed dead. - this._gracePeriodTimeoutID = null; - this.drop(WebSocketConnection.CLOSE_REASON_ABNORMAL, 'Peer not responding.', true); -}; - -WebSocketConnection.prototype.handleSocketData = function(data) { - this._debug('handleSocketData'); - // Reset the keepalive timer when receiving data of any kind. - this.setKeepaliveTimer(); - - // Add received data to our bufferList, which efficiently holds received - // data chunks in a linked list of Buffer objects. - this.bufferList.write(data); - - this.processReceivedData(); -}; - -WebSocketConnection.prototype.processReceivedData = function() { - this._debug('processReceivedData'); - // If we're not connected, we should ignore any data remaining on the buffer. - if (!this.connected) { return; } - - // Receiving/parsing is expected to be halted when paused. - if (this.inputPaused) { return; } - - var frame = this.currentFrame; - - // WebSocketFrame.prototype.addData returns true if all data necessary to - // parse the frame was available. It returns false if we are waiting for - // more data to come in on the wire. - if (!frame.addData(this.bufferList)) { this._debug('-- insufficient data for frame'); return; } - - var self = this; - - // Handle possible parsing errors - if (frame.protocolError) { - // Something bad happened.. get rid of this client. - this._debug('-- protocol error'); - process.nextTick(function() { - self.drop(WebSocketConnection.CLOSE_REASON_PROTOCOL_ERROR, frame.dropReason); - }); - return; - } - else if (frame.frameTooLarge) { - this._debug('-- frame too large'); - process.nextTick(function() { - self.drop(WebSocketConnection.CLOSE_REASON_MESSAGE_TOO_BIG, frame.dropReason); - }); - return; - } - - // For now since we don't support extensions, all RSV bits are illegal - if (frame.rsv1 || frame.rsv2 || frame.rsv3) { - this._debug('-- illegal rsv flag'); - process.nextTick(function() { - self.drop(WebSocketConnection.CLOSE_REASON_PROTOCOL_ERROR, - 'Unsupported usage of rsv bits without negotiated extension.'); - }); - return; - } - - if (!this.assembleFragments) { - this._debug('-- emitting frame'); - process.nextTick(function() { self.emit('frame', frame); }); - } - - process.nextTick(function() { self.processFrame(frame); }); - - this.currentFrame = new WebSocketFrame(this.maskBytes, this.frameHeader, this.config); - - // If there's data remaining, schedule additional processing, but yield - // for now so that other connections have a chance to have their data - // processed. We use setImmediate here instead of process.nextTick to - // explicitly indicate that we wish for other I/O to be handled first. - if (this.bufferList.length > 0) { - setImmediateImpl(this.receivedDataHandler); - } -}; - -WebSocketConnection.prototype.handleSocketError = function(error) { - this._debug('handleSocketError: %j', error); - if (this.state === STATE_CLOSED) { - // See https://github.com/theturtle32/WebSocket-Node/issues/288 - this._debug(' --- Socket \'error\' after \'close\''); - return; - } - this.closeReasonCode = WebSocketConnection.CLOSE_REASON_ABNORMAL; - this.closeDescription = 'Socket Error: ' + error.syscall + ' ' + error.code; - this.connected = false; - this.state = STATE_CLOSED; - this.fragmentationSize = 0; - if (utils.eventEmitterListenerCount(this, 'error') > 0) { - this.emit('error', error); - } - this.socket.destroy(error); - this._debug.printOutput(); -}; - -WebSocketConnection.prototype.handleSocketEnd = function() { - this._debug('handleSocketEnd: received socket end. state = %s', this.state); - this.receivedEnd = true; - if (this.state === STATE_CLOSED) { - // When using the TLS module, sometimes the socket will emit 'end' - // after it emits 'close'. I don't think that's correct behavior, - // but we should deal with it gracefully by ignoring it. - this._debug(' --- Socket \'end\' after \'close\''); - return; - } - if (this.state !== STATE_PEER_REQUESTED_CLOSE && - this.state !== STATE_ENDING) { - this._debug(' --- UNEXPECTED socket end.'); - this.socket.end(); - } -}; - -WebSocketConnection.prototype.handleSocketClose = function(hadError) { - this._debug('handleSocketClose: received socket close'); - this.socketHadError = hadError; - this.connected = false; - this.state = STATE_CLOSED; - // If closeReasonCode is still set to -1 at this point then we must - // not have received a close frame!! - if (this.closeReasonCode === -1) { - this.closeReasonCode = WebSocketConnection.CLOSE_REASON_ABNORMAL; - this.closeDescription = 'Connection dropped by remote peer.'; - } - this.clearCloseTimer(); - this.clearKeepaliveTimer(); - this.clearGracePeriodTimer(); - if (!this.closeEventEmitted) { - this.closeEventEmitted = true; - this._debug('-- Emitting WebSocketConnection close event'); - this.emit('close', this.closeReasonCode, this.closeDescription); - } -}; - -WebSocketConnection.prototype.handleSocketDrain = function() { - this._debug('handleSocketDrain: socket drain event'); - this.outputBufferFull = false; - this.emit('drain'); -}; - -WebSocketConnection.prototype.handleSocketPause = function() { - this._debug('handleSocketPause: socket pause event'); - this.inputPaused = true; - this.emit('pause'); -}; - -WebSocketConnection.prototype.handleSocketResume = function() { - this._debug('handleSocketResume: socket resume event'); - this.inputPaused = false; - this.emit('resume'); - this.processReceivedData(); -}; - -WebSocketConnection.prototype.pause = function() { - this._debug('pause: pause requested'); - this.socket.pause(); -}; - -WebSocketConnection.prototype.resume = function() { - this._debug('resume: resume requested'); - this.socket.resume(); -}; - -WebSocketConnection.prototype.close = function(reasonCode, description) { - if (this.connected) { - this._debug('close: Initating clean WebSocket close sequence.'); - if ('number' !== typeof reasonCode) { - reasonCode = WebSocketConnection.CLOSE_REASON_NORMAL; - } - if (!validateCloseReason(reasonCode)) { - throw new Error('Close code ' + reasonCode + ' is not valid.'); - } - if ('string' !== typeof description) { - description = WebSocketConnection.CLOSE_DESCRIPTIONS[reasonCode]; - } - this.closeReasonCode = reasonCode; - this.closeDescription = description; - this.setCloseTimer(); - this.sendCloseFrame(this.closeReasonCode, this.closeDescription); - this.state = STATE_ENDING; - this.connected = false; - } -}; - -WebSocketConnection.prototype.drop = function(reasonCode, description, skipCloseFrame) { - this._debug('drop'); - if (typeof(reasonCode) !== 'number') { - reasonCode = WebSocketConnection.CLOSE_REASON_PROTOCOL_ERROR; - } - - if (typeof(description) !== 'string') { - // If no description is provided, try to look one up based on the - // specified reasonCode. - description = WebSocketConnection.CLOSE_DESCRIPTIONS[reasonCode]; - } - - this._debug('Forcefully dropping connection. skipCloseFrame: %s, code: %d, description: %s', - skipCloseFrame, reasonCode, description - ); - - this.closeReasonCode = reasonCode; - this.closeDescription = description; - this.frameQueue = []; - this.fragmentationSize = 0; - if (!skipCloseFrame) { - this.sendCloseFrame(reasonCode, description); - } - this.connected = false; - this.state = STATE_CLOSED; - this.clearCloseTimer(); - this.clearKeepaliveTimer(); - this.clearGracePeriodTimer(); - - if (!this.closeEventEmitted) { - this.closeEventEmitted = true; - this._debug('Emitting WebSocketConnection close event'); - this.emit('close', this.closeReasonCode, this.closeDescription); - } - - this._debug('Drop: destroying socket'); - this.socket.destroy(); -}; - -WebSocketConnection.prototype.setCloseTimer = function() { - this._debug('setCloseTimer'); - this.clearCloseTimer(); - this._debug('Setting close timer'); - this.waitingForCloseResponse = true; - this.closeTimer = setTimeout(this._closeTimerHandler, this.closeTimeout); -}; - -WebSocketConnection.prototype.clearCloseTimer = function() { - this._debug('clearCloseTimer'); - if (this.closeTimer) { - this._debug('Clearing close timer'); - clearTimeout(this.closeTimer); - this.waitingForCloseResponse = false; - this.closeTimer = null; - } -}; - -WebSocketConnection.prototype.handleCloseTimer = function() { - this._debug('handleCloseTimer'); - this.closeTimer = null; - if (this.waitingForCloseResponse) { - this._debug('Close response not received from client. Forcing socket end.'); - this.waitingForCloseResponse = false; - this.state = STATE_CLOSED; - this.socket.end(); - } -}; - -WebSocketConnection.prototype.processFrame = function(frame) { - this._debug('processFrame'); - this._debug(' -- frame: %s', frame); - - // Any non-control opcode besides 0x00 (continuation) received in the - // middle of a fragmented message is illegal. - if (this.frameQueue.length !== 0 && (frame.opcode > 0x00 && frame.opcode < 0x08)) { - this.drop(WebSocketConnection.CLOSE_REASON_PROTOCOL_ERROR, - 'Illegal frame opcode 0x' + frame.opcode.toString(16) + ' ' + - 'received in middle of fragmented message.'); - return; - } - - switch(frame.opcode) { - case 0x02: // WebSocketFrame.BINARY_FRAME - this._debug('-- Binary Frame'); - if (this.assembleFragments) { - if (frame.fin) { - // Complete single-frame message received - this._debug('---- Emitting \'message\' event'); - this.emit('message', { - type: 'binary', - binaryData: frame.binaryPayload - }); - } - else { - // beginning of a fragmented message - this.frameQueue.push(frame); - this.fragmentationSize = frame.length; - } - } - break; - case 0x01: // WebSocketFrame.TEXT_FRAME - this._debug('-- Text Frame'); - if (this.assembleFragments) { - if (frame.fin) { - if (!Validation.isValidUTF8(frame.binaryPayload)) { - this.drop(WebSocketConnection.CLOSE_REASON_INVALID_DATA, - 'Invalid UTF-8 Data Received'); - return; - } - // Complete single-frame message received - this._debug('---- Emitting \'message\' event'); - this.emit('message', { - type: 'utf8', - utf8Data: frame.binaryPayload.toString('utf8') - }); - } - else { - // beginning of a fragmented message - this.frameQueue.push(frame); - this.fragmentationSize = frame.length; - } - } - break; - case 0x00: // WebSocketFrame.CONTINUATION - this._debug('-- Continuation Frame'); - if (this.assembleFragments) { - if (this.frameQueue.length === 0) { - this.drop(WebSocketConnection.CLOSE_REASON_PROTOCOL_ERROR, - 'Unexpected Continuation Frame'); - return; - } - - this.fragmentationSize += frame.length; - - if (this.fragmentationSize > this.maxReceivedMessageSize) { - this.drop(WebSocketConnection.CLOSE_REASON_MESSAGE_TOO_BIG, - 'Maximum message size exceeded.'); - return; - } - - this.frameQueue.push(frame); - - if (frame.fin) { - // end of fragmented message, so we process the whole - // message now. We also have to decode the utf-8 data - // for text frames after combining all the fragments. - var bytesCopied = 0; - var binaryPayload = bufferAllocUnsafe(this.fragmentationSize); - var opcode = this.frameQueue[0].opcode; - this.frameQueue.forEach(function (currentFrame) { - currentFrame.binaryPayload.copy(binaryPayload, bytesCopied); - bytesCopied += currentFrame.binaryPayload.length; - }); - this.frameQueue = []; - this.fragmentationSize = 0; - - switch (opcode) { - case 0x02: // WebSocketOpcode.BINARY_FRAME - this.emit('message', { - type: 'binary', - binaryData: binaryPayload - }); - break; - case 0x01: // WebSocketOpcode.TEXT_FRAME - if (!Validation.isValidUTF8(binaryPayload)) { - this.drop(WebSocketConnection.CLOSE_REASON_INVALID_DATA, - 'Invalid UTF-8 Data Received'); - return; - } - this.emit('message', { - type: 'utf8', - utf8Data: binaryPayload.toString('utf8') - }); - break; - default: - this.drop(WebSocketConnection.CLOSE_REASON_PROTOCOL_ERROR, - 'Unexpected first opcode in fragmentation sequence: 0x' + opcode.toString(16)); - return; - } - } - } - break; - case 0x09: // WebSocketFrame.PING - this._debug('-- Ping Frame'); - - if (this._pingListenerCount > 0) { - // logic to emit the ping frame: this is only done when a listener is known to exist - // Expose a function allowing the user to override the default ping() behavior - var cancelled = false; - var cancel = function() { - cancelled = true; - }; - this.emit('ping', cancel, frame.binaryPayload); - - // Only send a pong if the client did not indicate that he would like to cancel - if (!cancelled) { - this.pong(frame.binaryPayload); - } - } - else { - this.pong(frame.binaryPayload); - } - - break; - case 0x0A: // WebSocketFrame.PONG - this._debug('-- Pong Frame'); - this.emit('pong', frame.binaryPayload); - break; - case 0x08: // WebSocketFrame.CONNECTION_CLOSE - this._debug('-- Close Frame'); - if (this.waitingForCloseResponse) { - // Got response to our request to close the connection. - // Close is complete, so we just hang up. - this._debug('---- Got close response from peer. Completing closing handshake.'); - this.clearCloseTimer(); - this.waitingForCloseResponse = false; - this.state = STATE_CLOSED; - this.socket.end(); - return; - } - - this._debug('---- Closing handshake initiated by peer.'); - // Got request from other party to close connection. - // Send back acknowledgement and then hang up. - this.state = STATE_PEER_REQUESTED_CLOSE; - var respondCloseReasonCode; - - // Make sure the close reason provided is legal according to - // the protocol spec. Providing no close status is legal. - // WebSocketFrame sets closeStatus to -1 by default, so if it - // is still -1, then no status was provided. - if (frame.invalidCloseFrameLength) { - this.closeReasonCode = 1005; // 1005 = No reason provided. - respondCloseReasonCode = WebSocketConnection.CLOSE_REASON_PROTOCOL_ERROR; - } - else if (frame.closeStatus === -1 || validateCloseReason(frame.closeStatus)) { - this.closeReasonCode = frame.closeStatus; - respondCloseReasonCode = WebSocketConnection.CLOSE_REASON_NORMAL; - } - else { - this.closeReasonCode = frame.closeStatus; - respondCloseReasonCode = WebSocketConnection.CLOSE_REASON_PROTOCOL_ERROR; - } - - // If there is a textual description in the close frame, extract it. - if (frame.binaryPayload.length > 1) { - if (!Validation.isValidUTF8(frame.binaryPayload)) { - this.drop(WebSocketConnection.CLOSE_REASON_INVALID_DATA, - 'Invalid UTF-8 Data Received'); - return; - } - this.closeDescription = frame.binaryPayload.toString('utf8'); - } - else { - this.closeDescription = WebSocketConnection.CLOSE_DESCRIPTIONS[this.closeReasonCode]; - } - this._debug( - '------ Remote peer %s - code: %d - %s - close frame payload length: %d', - this.remoteAddress, this.closeReasonCode, - this.closeDescription, frame.length - ); - this._debug('------ responding to remote peer\'s close request.'); - this.sendCloseFrame(respondCloseReasonCode, null); - this.connected = false; - break; - default: - this._debug('-- Unrecognized Opcode %d', frame.opcode); - this.drop(WebSocketConnection.CLOSE_REASON_PROTOCOL_ERROR, - 'Unrecognized Opcode: 0x' + frame.opcode.toString(16)); - break; - } -}; - -WebSocketConnection.prototype.send = function(data, cb) { - this._debug('send'); - if (Buffer.isBuffer(data)) { - this.sendBytes(data, cb); - } - else if (typeof(data['toString']) === 'function') { - this.sendUTF(data, cb); - } - else { - throw new Error('Data provided must either be a Node Buffer or implement toString()'); - } -}; - -WebSocketConnection.prototype.sendUTF = function(data, cb) { - data = bufferFromString(data.toString(), 'utf8'); - this._debug('sendUTF: %d bytes', data.length); - var frame = new WebSocketFrame(this.maskBytes, this.frameHeader, this.config); - frame.opcode = 0x01; // WebSocketOpcode.TEXT_FRAME - frame.binaryPayload = data; - this.fragmentAndSend(frame, cb); -}; - -WebSocketConnection.prototype.sendBytes = function(data, cb) { - this._debug('sendBytes'); - if (!Buffer.isBuffer(data)) { - throw new Error('You must pass a Node Buffer object to WebSocketConnection.prototype.sendBytes()'); - } - var frame = new WebSocketFrame(this.maskBytes, this.frameHeader, this.config); - frame.opcode = 0x02; // WebSocketOpcode.BINARY_FRAME - frame.binaryPayload = data; - this.fragmentAndSend(frame, cb); -}; - -WebSocketConnection.prototype.ping = function(data) { - this._debug('ping'); - var frame = new WebSocketFrame(this.maskBytes, this.frameHeader, this.config); - frame.opcode = 0x09; // WebSocketOpcode.PING - frame.fin = true; - if (data) { - if (!Buffer.isBuffer(data)) { - data = bufferFromString(data.toString(), 'utf8'); - } - if (data.length > 125) { - this._debug('WebSocket: Data for ping is longer than 125 bytes. Truncating.'); - data = data.slice(0,124); - } - frame.binaryPayload = data; - } - this.sendFrame(frame); -}; - -// Pong frames have to echo back the contents of the data portion of the -// ping frame exactly, byte for byte. -WebSocketConnection.prototype.pong = function(binaryPayload) { - this._debug('pong'); - var frame = new WebSocketFrame(this.maskBytes, this.frameHeader, this.config); - frame.opcode = 0x0A; // WebSocketOpcode.PONG - if (Buffer.isBuffer(binaryPayload) && binaryPayload.length > 125) { - this._debug('WebSocket: Data for pong is longer than 125 bytes. Truncating.'); - binaryPayload = binaryPayload.slice(0,124); - } - frame.binaryPayload = binaryPayload; - frame.fin = true; - this.sendFrame(frame); -}; - -WebSocketConnection.prototype.fragmentAndSend = function(frame, cb) { - this._debug('fragmentAndSend'); - if (frame.opcode > 0x07) { - throw new Error('You cannot fragment control frames.'); - } - - var threshold = this.config.fragmentationThreshold; - var length = frame.binaryPayload.length; - - // Send immediately if fragmentation is disabled or the message is not - // larger than the fragmentation threshold. - if (!this.config.fragmentOutgoingMessages || (frame.binaryPayload && length <= threshold)) { - frame.fin = true; - this.sendFrame(frame, cb); - return; - } - - var numFragments = Math.ceil(length / threshold); - var sentFragments = 0; - var sentCallback = function fragmentSentCallback(err) { - if (err) { - if (typeof cb === 'function') { - // pass only the first error - cb(err); - cb = null; - } - return; - } - ++sentFragments; - if ((sentFragments === numFragments) && (typeof cb === 'function')) { - cb(); - } - }; - for (var i=1; i <= numFragments; i++) { - var currentFrame = new WebSocketFrame(this.maskBytes, this.frameHeader, this.config); - - // continuation opcode except for first frame. - currentFrame.opcode = (i === 1) ? frame.opcode : 0x00; - - // fin set on last frame only - currentFrame.fin = (i === numFragments); - - // length is likely to be shorter on the last fragment - var currentLength = (i === numFragments) ? length - (threshold * (i-1)) : threshold; - var sliceStart = threshold * (i-1); - - // Slice the right portion of the original payload - currentFrame.binaryPayload = frame.binaryPayload.slice(sliceStart, sliceStart + currentLength); - - this.sendFrame(currentFrame, sentCallback); - } -}; - -WebSocketConnection.prototype.sendCloseFrame = function(reasonCode, description, cb) { - if (typeof(reasonCode) !== 'number') { - reasonCode = WebSocketConnection.CLOSE_REASON_NORMAL; - } - - this._debug('sendCloseFrame state: %s, reasonCode: %d, description: %s', this.state, reasonCode, description); - - if (this.state !== STATE_OPEN && this.state !== STATE_PEER_REQUESTED_CLOSE) { return; } - - var frame = new WebSocketFrame(this.maskBytes, this.frameHeader, this.config); - frame.fin = true; - frame.opcode = 0x08; // WebSocketOpcode.CONNECTION_CLOSE - frame.closeStatus = reasonCode; - if (typeof(description) === 'string') { - frame.binaryPayload = bufferFromString(description, 'utf8'); - } - - this.sendFrame(frame, cb); - this.socket.end(); -}; - -WebSocketConnection.prototype.sendFrame = function(frame, cb) { - this._debug('sendFrame'); - frame.mask = this.maskOutgoingPackets; - var flushed = this.socket.write(frame.toBuffer(), cb); - this.outputBufferFull = !flushed; - return flushed; -}; - -module.exports = WebSocketConnection; - - - -function instrumentSocketForDebugging(connection, socket) { - /* jshint loopfunc: true */ - if (!connection._debug.enabled) { return; } - - var originalSocketEmit = socket.emit; - socket.emit = function(event) { - connection._debug('||| Socket Event \'%s\'', event); - originalSocketEmit.apply(this, arguments); - }; - - for (var key in socket) { - if ('function' !== typeof(socket[key])) { continue; } - if (['emit'].indexOf(key) !== -1) { continue; } - (function(key) { - var original = socket[key]; - if (key === 'on') { - socket[key] = function proxyMethod__EventEmitter__On() { - connection._debug('||| Socket method called: %s (%s)', key, arguments[0]); - return original.apply(this, arguments); - }; - return; - } - socket[key] = function proxyMethod() { - connection._debug('||| Socket method called: %s', key); - return original.apply(this, arguments); - }; - })(key); - } -} diff --git a/node_modules/websocket/lib/WebSocketFrame.js b/node_modules/websocket/lib/WebSocketFrame.js deleted file mode 100644 index e4a3fb1..0000000 --- a/node_modules/websocket/lib/WebSocketFrame.js +++ /dev/null @@ -1,280 +0,0 @@ -/************************************************************************ - * Copyright 2010-2015 Brian McKelvey. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - ***********************************************************************/ - -var bufferUtil = require('./BufferUtil').BufferUtil; -var bufferAllocUnsafe = require('./utils').bufferAllocUnsafe; - -const DECODE_HEADER = 1; -const WAITING_FOR_16_BIT_LENGTH = 2; -const WAITING_FOR_64_BIT_LENGTH = 3; -const WAITING_FOR_MASK_KEY = 4; -const WAITING_FOR_PAYLOAD = 5; -const COMPLETE = 6; - -// WebSocketConnection will pass shared buffer objects for maskBytes and -// frameHeader into the constructor to avoid tons of small memory allocations -// for each frame we have to parse. This is only used for parsing frames -// we receive off the wire. -function WebSocketFrame(maskBytes, frameHeader, config) { - this.maskBytes = maskBytes; - this.frameHeader = frameHeader; - this.config = config; - this.maxReceivedFrameSize = config.maxReceivedFrameSize; - this.protocolError = false; - this.frameTooLarge = false; - this.invalidCloseFrameLength = false; - this.parseState = DECODE_HEADER; - this.closeStatus = -1; -} - -WebSocketFrame.prototype.addData = function(bufferList) { - if (this.parseState === DECODE_HEADER) { - if (bufferList.length >= 2) { - bufferList.joinInto(this.frameHeader, 0, 0, 2); - bufferList.advance(2); - var firstByte = this.frameHeader[0]; - var secondByte = this.frameHeader[1]; - - this.fin = Boolean(firstByte & 0x80); - this.rsv1 = Boolean(firstByte & 0x40); - this.rsv2 = Boolean(firstByte & 0x20); - this.rsv3 = Boolean(firstByte & 0x10); - this.mask = Boolean(secondByte & 0x80); - - this.opcode = firstByte & 0x0F; - this.length = secondByte & 0x7F; - - // Control frame sanity check - if (this.opcode >= 0x08) { - if (this.length > 125) { - this.protocolError = true; - this.dropReason = 'Illegal control frame longer than 125 bytes.'; - return true; - } - if (!this.fin) { - this.protocolError = true; - this.dropReason = 'Control frames must not be fragmented.'; - return true; - } - } - - if (this.length === 126) { - this.parseState = WAITING_FOR_16_BIT_LENGTH; - } - else if (this.length === 127) { - this.parseState = WAITING_FOR_64_BIT_LENGTH; - } - else { - this.parseState = WAITING_FOR_MASK_KEY; - } - } - } - if (this.parseState === WAITING_FOR_16_BIT_LENGTH) { - if (bufferList.length >= 2) { - bufferList.joinInto(this.frameHeader, 2, 0, 2); - bufferList.advance(2); - this.length = this.frameHeader.readUInt16BE(2); - this.parseState = WAITING_FOR_MASK_KEY; - } - } - else if (this.parseState === WAITING_FOR_64_BIT_LENGTH) { - if (bufferList.length >= 8) { - bufferList.joinInto(this.frameHeader, 2, 0, 8); - bufferList.advance(8); - var lengthPair = [ - this.frameHeader.readUInt32BE(2), - this.frameHeader.readUInt32BE(2+4) - ]; - - if (lengthPair[0] !== 0) { - this.protocolError = true; - this.dropReason = 'Unsupported 64-bit length frame received'; - return true; - } - this.length = lengthPair[1]; - this.parseState = WAITING_FOR_MASK_KEY; - } - } - - if (this.parseState === WAITING_FOR_MASK_KEY) { - if (this.mask) { - if (bufferList.length >= 4) { - bufferList.joinInto(this.maskBytes, 0, 0, 4); - bufferList.advance(4); - this.parseState = WAITING_FOR_PAYLOAD; - } - } - else { - this.parseState = WAITING_FOR_PAYLOAD; - } - } - - if (this.parseState === WAITING_FOR_PAYLOAD) { - if (this.length > this.maxReceivedFrameSize) { - this.frameTooLarge = true; - this.dropReason = 'Frame size of ' + this.length.toString(10) + - ' bytes exceeds maximum accepted frame size'; - return true; - } - - if (this.length === 0) { - this.binaryPayload = bufferAllocUnsafe(0); - this.parseState = COMPLETE; - return true; - } - if (bufferList.length >= this.length) { - this.binaryPayload = bufferList.take(this.length); - bufferList.advance(this.length); - if (this.mask) { - bufferUtil.unmask(this.binaryPayload, this.maskBytes); - // xor(this.binaryPayload, this.maskBytes, 0); - } - - if (this.opcode === 0x08) { // WebSocketOpcode.CONNECTION_CLOSE - if (this.length === 1) { - // Invalid length for a close frame. Must be zero or at least two. - this.binaryPayload = bufferAllocUnsafe(0); - this.invalidCloseFrameLength = true; - } - if (this.length >= 2) { - this.closeStatus = this.binaryPayload.readUInt16BE(0); - this.binaryPayload = this.binaryPayload.slice(2); - } - } - - this.parseState = COMPLETE; - return true; - } - } - return false; -}; - -WebSocketFrame.prototype.throwAwayPayload = function(bufferList) { - if (bufferList.length >= this.length) { - bufferList.advance(this.length); - this.parseState = COMPLETE; - return true; - } - return false; -}; - -WebSocketFrame.prototype.toBuffer = function(nullMask) { - var maskKey; - var headerLength = 2; - var data; - var outputPos; - var firstByte = 0x00; - var secondByte = 0x00; - - if (this.fin) { - firstByte |= 0x80; - } - if (this.rsv1) { - firstByte |= 0x40; - } - if (this.rsv2) { - firstByte |= 0x20; - } - if (this.rsv3) { - firstByte |= 0x10; - } - if (this.mask) { - secondByte |= 0x80; - } - - firstByte |= (this.opcode & 0x0F); - - // the close frame is a special case because the close reason is - // prepended to the payload data. - if (this.opcode === 0x08) { - this.length = 2; - if (this.binaryPayload) { - this.length += this.binaryPayload.length; - } - data = bufferAllocUnsafe(this.length); - data.writeUInt16BE(this.closeStatus, 0); - if (this.length > 2) { - this.binaryPayload.copy(data, 2); - } - } - else if (this.binaryPayload) { - data = this.binaryPayload; - this.length = data.length; - } - else { - this.length = 0; - } - - if (this.length <= 125) { - // encode the length directly into the two-byte frame header - secondByte |= (this.length & 0x7F); - } - else if (this.length > 125 && this.length <= 0xFFFF) { - // Use 16-bit length - secondByte |= 126; - headerLength += 2; - } - else if (this.length > 0xFFFF) { - // Use 64-bit length - secondByte |= 127; - headerLength += 8; - } - - var output = bufferAllocUnsafe(this.length + headerLength + (this.mask ? 4 : 0)); - - // write the frame header - output[0] = firstByte; - output[1] = secondByte; - - outputPos = 2; - - if (this.length > 125 && this.length <= 0xFFFF) { - // write 16-bit length - output.writeUInt16BE(this.length, outputPos); - outputPos += 2; - } - else if (this.length > 0xFFFF) { - // write 64-bit length - output.writeUInt32BE(0x00000000, outputPos); - output.writeUInt32BE(this.length, outputPos + 4); - outputPos += 8; - } - - if (this.mask) { - maskKey = nullMask ? 0 : ((Math.random() * 0xFFFFFFFF) >>> 0); - this.maskBytes.writeUInt32BE(maskKey, 0); - - // write the mask key - this.maskBytes.copy(output, outputPos); - outputPos += 4; - - if (data) { - bufferUtil.mask(data, this.maskBytes, output, outputPos, this.length); - } - } - else if (data) { - data.copy(output, outputPos); - } - - return output; -}; - -WebSocketFrame.prototype.toString = function() { - return 'Opcode: ' + this.opcode + ', fin: ' + this.fin + ', length: ' + this.length + ', hasPayload: ' + Boolean(this.binaryPayload) + ', masked: ' + this.mask; -}; - - -module.exports = WebSocketFrame; diff --git a/node_modules/websocket/lib/WebSocketRequest.js b/node_modules/websocket/lib/WebSocketRequest.js deleted file mode 100644 index f4d9655..0000000 --- a/node_modules/websocket/lib/WebSocketRequest.js +++ /dev/null @@ -1,524 +0,0 @@ -/************************************************************************ - * Copyright 2010-2015 Brian McKelvey. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - ***********************************************************************/ - -var crypto = require('crypto'); -var util = require('util'); -var url = require('url'); -var EventEmitter = require('events').EventEmitter; -var WebSocketConnection = require('./WebSocketConnection'); - -var headerValueSplitRegExp = /,\s*/; -var headerParamSplitRegExp = /;\s*/; -var headerSanitizeRegExp = /[\r\n]/g; -var xForwardedForSeparatorRegExp = /,\s*/; -var separators = [ - '(', ')', '<', '>', '@', - ',', ';', ':', '\\', '\"', - '/', '[', ']', '?', '=', - '{', '}', ' ', String.fromCharCode(9) -]; -var controlChars = [String.fromCharCode(127) /* DEL */]; -for (var i=0; i < 31; i ++) { - /* US-ASCII Control Characters */ - controlChars.push(String.fromCharCode(i)); -} - -var cookieNameValidateRegEx = /([\x00-\x20\x22\x28\x29\x2c\x2f\x3a-\x3f\x40\x5b-\x5e\x7b\x7d\x7f])/; -var cookieValueValidateRegEx = /[^\x21\x23-\x2b\x2d-\x3a\x3c-\x5b\x5d-\x7e]/; -var cookieValueDQuoteValidateRegEx = /^"[^"]*"$/; -var controlCharsAndSemicolonRegEx = /[\x00-\x20\x3b]/g; - -var cookieSeparatorRegEx = /[;,] */; - -var httpStatusDescriptions = { - 100: 'Continue', - 101: 'Switching Protocols', - 200: 'OK', - 201: 'Created', - 203: 'Non-Authoritative Information', - 204: 'No Content', - 205: 'Reset Content', - 206: 'Partial Content', - 300: 'Multiple Choices', - 301: 'Moved Permanently', - 302: 'Found', - 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', - 406: 'Not Acceptable', - 407: 'Proxy Authorization Required', - 408: 'Request Timeout', - 409: 'Conflict', - 410: 'Gone', - 411: 'Length Required', - 412: 'Precondition Failed', - 413: 'Request Entity Too Long', - 414: 'Request-URI Too Long', - 415: 'Unsupported Media Type', - 416: 'Requested Range Not Satisfiable', - 417: 'Expectation Failed', - 426: 'Upgrade Required', - 500: 'Internal Server Error', - 501: 'Not Implemented', - 502: 'Bad Gateway', - 503: 'Service Unavailable', - 504: 'Gateway Timeout', - 505: 'HTTP Version Not Supported' -}; - -function WebSocketRequest(socket, httpRequest, serverConfig) { - // Superclass Constructor - EventEmitter.call(this); - - this.socket = socket; - this.httpRequest = httpRequest; - this.resource = httpRequest.url; - this.remoteAddress = socket.remoteAddress; - this.remoteAddresses = [this.remoteAddress]; - this.serverConfig = serverConfig; - - // Watch for the underlying TCP socket closing before we call accept - this._socketIsClosing = false; - this._socketCloseHandler = this._handleSocketCloseBeforeAccept.bind(this); - this.socket.on('end', this._socketCloseHandler); - this.socket.on('close', this._socketCloseHandler); - - this._resolved = false; -} - -util.inherits(WebSocketRequest, EventEmitter); - -WebSocketRequest.prototype.readHandshake = function() { - var self = this; - var request = this.httpRequest; - - // Decode URL - this.resourceURL = url.parse(this.resource, true); - - this.host = request.headers['host']; - if (!this.host) { - throw new Error('Client must provide a Host header.'); - } - - this.key = request.headers['sec-websocket-key']; - if (!this.key) { - throw new Error('Client must provide a value for Sec-WebSocket-Key.'); - } - - this.webSocketVersion = parseInt(request.headers['sec-websocket-version'], 10); - - if (!this.webSocketVersion || isNaN(this.webSocketVersion)) { - throw new Error('Client must provide a value for Sec-WebSocket-Version.'); - } - - switch (this.webSocketVersion) { - case 8: - case 13: - break; - default: - var e = new Error('Unsupported websocket client version: ' + this.webSocketVersion + - 'Only versions 8 and 13 are supported.'); - e.httpCode = 426; - e.headers = { - 'Sec-WebSocket-Version': '13' - }; - throw e; - } - - if (this.webSocketVersion === 13) { - this.origin = request.headers['origin']; - } - else if (this.webSocketVersion === 8) { - this.origin = request.headers['sec-websocket-origin']; - } - - // Protocol is optional. - var protocolString = request.headers['sec-websocket-protocol']; - this.protocolFullCaseMap = {}; - this.requestedProtocols = []; - if (protocolString) { - var requestedProtocolsFullCase = protocolString.split(headerValueSplitRegExp); - requestedProtocolsFullCase.forEach(function(protocol) { - var lcProtocol = protocol.toLocaleLowerCase(); - self.requestedProtocols.push(lcProtocol); - self.protocolFullCaseMap[lcProtocol] = protocol; - }); - } - - if (!this.serverConfig.ignoreXForwardedFor && - request.headers['x-forwarded-for']) { - var immediatePeerIP = this.remoteAddress; - this.remoteAddresses = request.headers['x-forwarded-for'] - .split(xForwardedForSeparatorRegExp); - this.remoteAddresses.push(immediatePeerIP); - this.remoteAddress = this.remoteAddresses[0]; - } - - // Extensions are optional. - var extensionsString = request.headers['sec-websocket-extensions']; - this.requestedExtensions = this.parseExtensions(extensionsString); - - // Cookies are optional - var cookieString = request.headers['cookie']; - this.cookies = this.parseCookies(cookieString); -}; - -WebSocketRequest.prototype.parseExtensions = function(extensionsString) { - if (!extensionsString || extensionsString.length === 0) { - return []; - } - var extensions = extensionsString.toLocaleLowerCase().split(headerValueSplitRegExp); - extensions.forEach(function(extension, index, array) { - var params = extension.split(headerParamSplitRegExp); - var extensionName = params[0]; - var extensionParams = params.slice(1); - extensionParams.forEach(function(rawParam, index, array) { - var arr = rawParam.split('='); - var obj = { - name: arr[0], - value: arr[1] - }; - array.splice(index, 1, obj); - }); - var obj = { - name: extensionName, - params: extensionParams - }; - array.splice(index, 1, obj); - }); - return extensions; -}; - -// This function adapted from node-cookie -// https://github.com/shtylman/node-cookie -WebSocketRequest.prototype.parseCookies = function(str) { - // Sanity Check - if (!str || typeof(str) !== 'string') { - return []; - } - - var cookies = []; - var pairs = str.split(cookieSeparatorRegEx); - - pairs.forEach(function(pair) { - var eq_idx = pair.indexOf('='); - if (eq_idx === -1) { - cookies.push({ - name: pair, - value: null - }); - return; - } - - var key = pair.substr(0, eq_idx).trim(); - var val = pair.substr(++eq_idx, pair.length).trim(); - - // quoted values - if ('"' === val[0]) { - val = val.slice(1, -1); - } - - cookies.push({ - name: key, - value: decodeURIComponent(val) - }); - }); - - return cookies; -}; - -WebSocketRequest.prototype.accept = function(acceptedProtocol, allowedOrigin, cookies) { - this._verifyResolution(); - - // TODO: Handle extensions - - var protocolFullCase; - - if (acceptedProtocol) { - protocolFullCase = this.protocolFullCaseMap[acceptedProtocol.toLocaleLowerCase()]; - if (typeof(protocolFullCase) === 'undefined') { - protocolFullCase = acceptedProtocol; - } - } - else { - protocolFullCase = acceptedProtocol; - } - this.protocolFullCaseMap = null; - - // Create key validation hash - var sha1 = crypto.createHash('sha1'); - sha1.update(this.key + '258EAFA5-E914-47DA-95CA-C5AB0DC85B11'); - var acceptKey = sha1.digest('base64'); - - var response = 'HTTP/1.1 101 Switching Protocols\r\n' + - 'Upgrade: websocket\r\n' + - 'Connection: Upgrade\r\n' + - 'Sec-WebSocket-Accept: ' + acceptKey + '\r\n'; - - if (protocolFullCase) { - // validate protocol - for (var i=0; i < protocolFullCase.length; i++) { - var charCode = protocolFullCase.charCodeAt(i); - var character = protocolFullCase.charAt(i); - if (charCode < 0x21 || charCode > 0x7E || separators.indexOf(character) !== -1) { - this.reject(500); - throw new Error('Illegal character "' + String.fromCharCode(character) + '" in subprotocol.'); - } - } - if (this.requestedProtocols.indexOf(acceptedProtocol) === -1) { - this.reject(500); - throw new Error('Specified protocol was not requested by the client.'); - } - - protocolFullCase = protocolFullCase.replace(headerSanitizeRegExp, ''); - response += 'Sec-WebSocket-Protocol: ' + protocolFullCase + '\r\n'; - } - this.requestedProtocols = null; - - if (allowedOrigin) { - allowedOrigin = allowedOrigin.replace(headerSanitizeRegExp, ''); - if (this.webSocketVersion === 13) { - response += 'Origin: ' + allowedOrigin + '\r\n'; - } - else if (this.webSocketVersion === 8) { - response += 'Sec-WebSocket-Origin: ' + allowedOrigin + '\r\n'; - } - } - - if (cookies) { - if (!Array.isArray(cookies)) { - this.reject(500); - throw new Error('Value supplied for "cookies" argument must be an array.'); - } - var seenCookies = {}; - cookies.forEach(function(cookie) { - if (!cookie.name || !cookie.value) { - this.reject(500); - throw new Error('Each cookie to set must at least provide a "name" and "value"'); - } - - // Make sure there are no \r\n sequences inserted - cookie.name = cookie.name.replace(controlCharsAndSemicolonRegEx, ''); - cookie.value = cookie.value.replace(controlCharsAndSemicolonRegEx, ''); - - if (seenCookies[cookie.name]) { - this.reject(500); - throw new Error('You may not specify the same cookie name twice.'); - } - seenCookies[cookie.name] = true; - - // token (RFC 2616, Section 2.2) - var invalidChar = cookie.name.match(cookieNameValidateRegEx); - if (invalidChar) { - this.reject(500); - throw new Error('Illegal character ' + invalidChar[0] + ' in cookie name'); - } - - // RFC 6265, Section 4.1.1 - // *cookie-octet / ( DQUOTE *cookie-octet DQUOTE ) | %x21 / %x23-2B / %x2D-3A / %x3C-5B / %x5D-7E - if (cookie.value.match(cookieValueDQuoteValidateRegEx)) { - invalidChar = cookie.value.slice(1, -1).match(cookieValueValidateRegEx); - } else { - invalidChar = cookie.value.match(cookieValueValidateRegEx); - } - if (invalidChar) { - this.reject(500); - throw new Error('Illegal character ' + invalidChar[0] + ' in cookie value'); - } - - var cookieParts = [cookie.name + '=' + cookie.value]; - - // RFC 6265, Section 4.1.1 - // 'Path=' path-value | - if(cookie.path){ - invalidChar = cookie.path.match(controlCharsAndSemicolonRegEx); - if (invalidChar) { - this.reject(500); - throw new Error('Illegal character ' + invalidChar[0] + ' in cookie path'); - } - cookieParts.push('Path=' + cookie.path); - } - - // RFC 6265, Section 4.1.2.3 - // 'Domain=' subdomain - if (cookie.domain) { - if (typeof(cookie.domain) !== 'string') { - this.reject(500); - throw new Error('Domain must be specified and must be a string.'); - } - invalidChar = cookie.domain.match(controlCharsAndSemicolonRegEx); - if (invalidChar) { - this.reject(500); - throw new Error('Illegal character ' + invalidChar[0] + ' in cookie domain'); - } - cookieParts.push('Domain=' + cookie.domain.toLowerCase()); - } - - // RFC 6265, Section 4.1.1 - //'Expires=' sane-cookie-date | Force Date object requirement by using only epoch - if (cookie.expires) { - if (!(cookie.expires instanceof Date)){ - this.reject(500); - throw new Error('Value supplied for cookie "expires" must be a vaild date object'); - } - cookieParts.push('Expires=' + cookie.expires.toGMTString()); - } - - // RFC 6265, Section 4.1.1 - //'Max-Age=' non-zero-digit *DIGIT - if (cookie.maxage) { - var maxage = cookie.maxage; - if (typeof(maxage) === 'string') { - maxage = parseInt(maxage, 10); - } - if (isNaN(maxage) || maxage <= 0 ) { - this.reject(500); - throw new Error('Value supplied for cookie "maxage" must be a non-zero number'); - } - maxage = Math.round(maxage); - cookieParts.push('Max-Age=' + maxage.toString(10)); - } - - // RFC 6265, Section 4.1.1 - //'Secure;' - if (cookie.secure) { - if (typeof(cookie.secure) !== 'boolean') { - this.reject(500); - throw new Error('Value supplied for cookie "secure" must be of type boolean'); - } - cookieParts.push('Secure'); - } - - // RFC 6265, Section 4.1.1 - //'HttpOnly;' - if (cookie.httponly) { - if (typeof(cookie.httponly) !== 'boolean') { - this.reject(500); - throw new Error('Value supplied for cookie "httponly" must be of type boolean'); - } - cookieParts.push('HttpOnly'); - } - - response += ('Set-Cookie: ' + cookieParts.join(';') + '\r\n'); - }.bind(this)); - } - - // TODO: handle negotiated extensions - // if (negotiatedExtensions) { - // response += 'Sec-WebSocket-Extensions: ' + negotiatedExtensions.join(', ') + '\r\n'; - // } - - // Mark the request resolved now so that the user can't call accept or - // reject a second time. - this._resolved = true; - this.emit('requestResolved', this); - - response += '\r\n'; - - var connection = new WebSocketConnection(this.socket, [], acceptedProtocol, false, this.serverConfig); - connection.webSocketVersion = this.webSocketVersion; - connection.remoteAddress = this.remoteAddress; - connection.remoteAddresses = this.remoteAddresses; - - var self = this; - - if (this._socketIsClosing) { - // Handle case when the client hangs up before we get a chance to - // accept the connection and send our side of the opening handshake. - cleanupFailedConnection(connection); - } - else { - this.socket.write(response, 'ascii', function(error) { - if (error) { - cleanupFailedConnection(connection); - return; - } - - self._removeSocketCloseListeners(); - connection._addSocketEventListeners(); - }); - } - - this.emit('requestAccepted', connection); - return connection; -}; - -WebSocketRequest.prototype.reject = function(status, reason, extraHeaders) { - this._verifyResolution(); - - // Mark the request resolved now so that the user can't call accept or - // reject a second time. - this._resolved = true; - this.emit('requestResolved', this); - - if (typeof(status) !== 'number') { - status = 403; - } - var response = 'HTTP/1.1 ' + status + ' ' + httpStatusDescriptions[status] + '\r\n' + - 'Connection: close\r\n'; - if (reason) { - reason = reason.replace(headerSanitizeRegExp, ''); - response += 'X-WebSocket-Reject-Reason: ' + reason + '\r\n'; - } - - if (extraHeaders) { - for (var key in extraHeaders) { - var sanitizedValue = extraHeaders[key].toString().replace(headerSanitizeRegExp, ''); - var sanitizedKey = key.replace(headerSanitizeRegExp, ''); - response += (sanitizedKey + ': ' + sanitizedValue + '\r\n'); - } - } - - response += '\r\n'; - this.socket.end(response, 'ascii'); - - this.emit('requestRejected', this); -}; - -WebSocketRequest.prototype._handleSocketCloseBeforeAccept = function() { - this._socketIsClosing = true; - this._removeSocketCloseListeners(); -}; - -WebSocketRequest.prototype._removeSocketCloseListeners = function() { - this.socket.removeListener('end', this._socketCloseHandler); - this.socket.removeListener('close', this._socketCloseHandler); -}; - -WebSocketRequest.prototype._verifyResolution = function() { - if (this._resolved) { - throw new Error('WebSocketRequest may only be accepted or rejected one time.'); - } -}; - -function cleanupFailedConnection(connection) { - // Since we have to return a connection object even if the socket is - // already dead in order not to break the API, we schedule a 'close' - // event on the connection object to occur immediately. - process.nextTick(function() { - // WebSocketConnection.CLOSE_REASON_ABNORMAL = 1006 - // Third param: Skip sending the close frame to a dead socket - connection.drop(1006, 'TCP connection lost before handshake completed.', true); - }); -} - -module.exports = WebSocketRequest; diff --git a/node_modules/websocket/lib/WebSocketRouter.js b/node_modules/websocket/lib/WebSocketRouter.js deleted file mode 100644 index 35bced9..0000000 --- a/node_modules/websocket/lib/WebSocketRouter.js +++ /dev/null @@ -1,157 +0,0 @@ -/************************************************************************ - * Copyright 2010-2015 Brian McKelvey. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - ***********************************************************************/ - -var extend = require('./utils').extend; -var util = require('util'); -var EventEmitter = require('events').EventEmitter; -var WebSocketRouterRequest = require('./WebSocketRouterRequest'); - -function WebSocketRouter(config) { - // Superclass Constructor - EventEmitter.call(this); - - this.config = { - // The WebSocketServer instance to attach to. - server: null - }; - if (config) { - extend(this.config, config); - } - this.handlers = []; - - this._requestHandler = this.handleRequest.bind(this); - if (this.config.server) { - this.attachServer(this.config.server); - } -} - -util.inherits(WebSocketRouter, EventEmitter); - -WebSocketRouter.prototype.attachServer = function(server) { - if (server) { - this.server = server; - this.server.on('request', this._requestHandler); - } - else { - throw new Error('You must specify a WebSocketServer instance to attach to.'); - } -}; - -WebSocketRouter.prototype.detachServer = function() { - if (this.server) { - this.server.removeListener('request', this._requestHandler); - this.server = null; - } - else { - throw new Error('Cannot detach from server: not attached.'); - } -}; - -WebSocketRouter.prototype.mount = function(path, protocol, callback) { - if (!path) { - throw new Error('You must specify a path for this handler.'); - } - if (!protocol) { - protocol = '____no_protocol____'; - } - if (!callback) { - throw new Error('You must specify a callback for this handler.'); - } - - path = this.pathToRegExp(path); - if (!(path instanceof RegExp)) { - throw new Error('Path must be specified as either a string or a RegExp.'); - } - var pathString = path.toString(); - - // normalize protocol to lower-case - protocol = protocol.toLocaleLowerCase(); - - if (this.findHandlerIndex(pathString, protocol) !== -1) { - throw new Error('You may only mount one handler per path/protocol combination.'); - } - - this.handlers.push({ - 'path': path, - 'pathString': pathString, - 'protocol': protocol, - 'callback': callback - }); -}; -WebSocketRouter.prototype.unmount = function(path, protocol) { - var index = this.findHandlerIndex(this.pathToRegExp(path).toString(), protocol); - if (index !== -1) { - this.handlers.splice(index, 1); - } - else { - throw new Error('Unable to find a route matching the specified path and protocol.'); - } -}; - -WebSocketRouter.prototype.findHandlerIndex = function(pathString, protocol) { - protocol = protocol.toLocaleLowerCase(); - for (var i=0, len=this.handlers.length; i < len; i++) { - var handler = this.handlers[i]; - if (handler.pathString === pathString && handler.protocol === protocol) { - return i; - } - } - return -1; -}; - -WebSocketRouter.prototype.pathToRegExp = function(path) { - if (typeof(path) === 'string') { - if (path === '*') { - path = /^.*$/; - } - else { - path = path.replace(/[-[\]{}()*+?.,\\^$|#\s]/g, '\\$&'); - path = new RegExp('^' + path + '$'); - } - } - return path; -}; - -WebSocketRouter.prototype.handleRequest = function(request) { - var requestedProtocols = request.requestedProtocols; - if (requestedProtocols.length === 0) { - requestedProtocols = ['____no_protocol____']; - } - - // Find a handler with the first requested protocol first - for (var i=0; i < requestedProtocols.length; i++) { - var requestedProtocol = requestedProtocols[i].toLocaleLowerCase(); - - // find the first handler that can process this request - for (var j=0, len=this.handlers.length; j < len; j++) { - var handler = this.handlers[j]; - if (handler.path.test(request.resourceURL.pathname)) { - if (requestedProtocol === handler.protocol || - handler.protocol === '*') - { - var routerRequest = new WebSocketRouterRequest(request, requestedProtocol); - handler.callback(routerRequest); - return; - } - } - } - } - - // If we get here we were unable to find a suitable handler. - request.reject(404, 'No handler is available for the given request.'); -}; - -module.exports = WebSocketRouter; diff --git a/node_modules/websocket/lib/WebSocketRouterRequest.js b/node_modules/websocket/lib/WebSocketRouterRequest.js deleted file mode 100644 index d3e3745..0000000 --- a/node_modules/websocket/lib/WebSocketRouterRequest.js +++ /dev/null @@ -1,54 +0,0 @@ -/************************************************************************ - * Copyright 2010-2015 Brian McKelvey. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - ***********************************************************************/ - -var util = require('util'); -var EventEmitter = require('events').EventEmitter; - -function WebSocketRouterRequest(webSocketRequest, resolvedProtocol) { - // Superclass Constructor - EventEmitter.call(this); - - this.webSocketRequest = webSocketRequest; - if (resolvedProtocol === '____no_protocol____') { - this.protocol = null; - } - else { - this.protocol = resolvedProtocol; - } - this.origin = webSocketRequest.origin; - this.resource = webSocketRequest.resource; - this.resourceURL = webSocketRequest.resourceURL; - this.httpRequest = webSocketRequest.httpRequest; - this.remoteAddress = webSocketRequest.remoteAddress; - this.webSocketVersion = webSocketRequest.webSocketVersion; - this.requestedExtensions = webSocketRequest.requestedExtensions; - this.cookies = webSocketRequest.cookies; -} - -util.inherits(WebSocketRouterRequest, EventEmitter); - -WebSocketRouterRequest.prototype.accept = function(origin, cookies) { - var connection = this.webSocketRequest.accept(this.protocol, origin, cookies); - this.emit('requestAccepted', connection); - return connection; -}; - -WebSocketRouterRequest.prototype.reject = function(status, reason, extraHeaders) { - this.webSocketRequest.reject(status, reason, extraHeaders); - this.emit('requestRejected', this); -}; - -module.exports = WebSocketRouterRequest; diff --git a/node_modules/websocket/lib/WebSocketServer.js b/node_modules/websocket/lib/WebSocketServer.js deleted file mode 100644 index c27d967..0000000 --- a/node_modules/websocket/lib/WebSocketServer.js +++ /dev/null @@ -1,245 +0,0 @@ -/************************************************************************ - * Copyright 2010-2015 Brian McKelvey. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - ***********************************************************************/ - -var extend = require('./utils').extend; -var utils = require('./utils'); -var util = require('util'); -var debug = require('debug')('websocket:server'); -var EventEmitter = require('events').EventEmitter; -var WebSocketRequest = require('./WebSocketRequest'); - -var WebSocketServer = function WebSocketServer(config) { - // Superclass Constructor - EventEmitter.call(this); - - this._handlers = { - upgrade: this.handleUpgrade.bind(this), - requestAccepted: this.handleRequestAccepted.bind(this), - requestResolved: this.handleRequestResolved.bind(this) - }; - this.connections = []; - this.pendingRequests = []; - if (config) { - this.mount(config); - } -}; - -util.inherits(WebSocketServer, EventEmitter); - -WebSocketServer.prototype.mount = function(config) { - this.config = { - // The http server instance to attach to. Required. - httpServer: null, - - // 64KiB max frame size. - maxReceivedFrameSize: 0x10000, - - // 1MiB max message size, only applicable if - // assembleFragments is true - maxReceivedMessageSize: 0x100000, - - // Outgoing messages larger than fragmentationThreshold will be - // split into multiple fragments. - fragmentOutgoingMessages: true, - - // Outgoing frames are fragmented if they exceed this threshold. - // Default is 16KiB - fragmentationThreshold: 0x4000, - - // If true, the server will automatically send a ping to all - // clients every 'keepaliveInterval' milliseconds. The timer is - // reset on any received data from the client. - keepalive: true, - - // The interval to send keepalive pings to connected clients if the - // connection is idle. Any received data will reset the counter. - keepaliveInterval: 20000, - - // If true, the server will consider any connection that has not - // received any data within the amount of time specified by - // 'keepaliveGracePeriod' after a keepalive ping has been sent to - // be dead, and will drop the connection. - // Ignored if keepalive is false. - dropConnectionOnKeepaliveTimeout: true, - - // The amount of time to wait after sending a keepalive ping before - // closing the connection if the connected peer does not respond. - // Ignored if keepalive is false. - keepaliveGracePeriod: 10000, - - // Whether to use native TCP keep-alive instead of WebSockets ping - // and pong packets. Native TCP keep-alive sends smaller packets - // on the wire and so uses bandwidth more efficiently. This may - // be more important when talking to mobile devices. - // If this value is set to true, then these values will be ignored: - // keepaliveGracePeriod - // dropConnectionOnKeepaliveTimeout - useNativeKeepalive: false, - - // If true, fragmented messages will be automatically assembled - // and the full message will be emitted via a 'message' event. - // If false, each frame will be emitted via a 'frame' event and - // the application will be responsible for aggregating multiple - // fragmented frames. Single-frame messages will emit a 'message' - // event in addition to the 'frame' event. - // Most users will want to leave this set to 'true' - assembleFragments: true, - - // If this is true, websocket connections will be accepted - // regardless of the path and protocol specified by the client. - // The protocol accepted will be the first that was requested - // by the client. Clients from any origin will be accepted. - // This should only be used in the simplest of cases. You should - // probably leave this set to 'false' and inspect the request - // object to make sure it's acceptable before accepting it. - autoAcceptConnections: false, - - // Whether or not the X-Forwarded-For header should be respected. - // It's important to set this to 'true' when accepting connections - // from untrusted clients, as a malicious client could spoof its - // IP address by simply setting this header. It's meant to be added - // by a trusted proxy or other intermediary within your own - // infrastructure. - // See: http://en.wikipedia.org/wiki/X-Forwarded-For - ignoreXForwardedFor: false, - - // The Nagle Algorithm makes more efficient use of network resources - // by introducing a small delay before sending small packets so that - // multiple messages can be batched together before going onto the - // wire. This however comes at the cost of latency, so the default - // is to disable it. If you don't need low latency and are streaming - // lots of small messages, you can change this to 'false' - disableNagleAlgorithm: true, - - // The number of milliseconds to wait after sending a close frame - // for an acknowledgement to come back before giving up and just - // closing the socket. - closeTimeout: 5000 - }; - extend(this.config, config); - - if (this.config.httpServer) { - if (!Array.isArray(this.config.httpServer)) { - this.config.httpServer = [this.config.httpServer]; - } - var upgradeHandler = this._handlers.upgrade; - this.config.httpServer.forEach(function(httpServer) { - httpServer.on('upgrade', upgradeHandler); - }); - } - else { - throw new Error('You must specify an httpServer on which to mount the WebSocket server.'); - } -}; - -WebSocketServer.prototype.unmount = function() { - var upgradeHandler = this._handlers.upgrade; - this.config.httpServer.forEach(function(httpServer) { - httpServer.removeListener('upgrade', upgradeHandler); - }); -}; - -WebSocketServer.prototype.closeAllConnections = function() { - this.connections.forEach(function(connection) { - connection.close(); - }); - this.pendingRequests.forEach(function(request) { - process.nextTick(function() { - request.reject(503); // HTTP 503 Service Unavailable - }); - }); -}; - -WebSocketServer.prototype.broadcast = function(data) { - if (Buffer.isBuffer(data)) { - this.broadcastBytes(data); - } - else if (typeof(data.toString) === 'function') { - this.broadcastUTF(data); - } -}; - -WebSocketServer.prototype.broadcastUTF = function(utfData) { - this.connections.forEach(function(connection) { - connection.sendUTF(utfData); - }); -}; - -WebSocketServer.prototype.broadcastBytes = function(binaryData) { - this.connections.forEach(function(connection) { - connection.sendBytes(binaryData); - }); -}; - -WebSocketServer.prototype.shutDown = function() { - this.unmount(); - this.closeAllConnections(); -}; - -WebSocketServer.prototype.handleUpgrade = function(request, socket) { - var wsRequest = new WebSocketRequest(socket, request, this.config); - try { - wsRequest.readHandshake(); - } - catch(e) { - wsRequest.reject( - e.httpCode ? e.httpCode : 400, - e.message, - e.headers - ); - debug('Invalid handshake: %s', e.message); - return; - } - - this.pendingRequests.push(wsRequest); - - wsRequest.once('requestAccepted', this._handlers.requestAccepted); - wsRequest.once('requestResolved', this._handlers.requestResolved); - - if (!this.config.autoAcceptConnections && utils.eventEmitterListenerCount(this, 'request') > 0) { - this.emit('request', wsRequest); - } - else if (this.config.autoAcceptConnections) { - wsRequest.accept(wsRequest.requestedProtocols[0], wsRequest.origin); - } - else { - wsRequest.reject(404, 'No handler is configured to accept the connection.'); - } -}; - -WebSocketServer.prototype.handleRequestAccepted = function(connection) { - var self = this; - connection.once('close', function(closeReason, description) { - self.handleConnectionClose(connection, closeReason, description); - }); - this.connections.push(connection); - this.emit('connect', connection); -}; - -WebSocketServer.prototype.handleConnectionClose = function(connection, closeReason, description) { - var index = this.connections.indexOf(connection); - if (index !== -1) { - this.connections.splice(index, 1); - } - this.emit('close', connection, closeReason, description); -}; - -WebSocketServer.prototype.handleRequestResolved = function(request) { - var index = this.pendingRequests.indexOf(request); - if (index !== -1) { this.pendingRequests.splice(index, 1); } -}; - -module.exports = WebSocketServer; diff --git a/node_modules/websocket/lib/browser.js b/node_modules/websocket/lib/browser.js deleted file mode 100644 index 51d1979..0000000 --- a/node_modules/websocket/lib/browser.js +++ /dev/null @@ -1,47 +0,0 @@ -var _global = (function () { - if (!this && typeof global !== 'undefined') { - return global; - } - return this; -})(); -var NativeWebSocket = _global.WebSocket || _global.MozWebSocket; -var websocket_version = require('./version'); - - -/** - * Expose a W3C WebSocket class with just one or two arguments. - */ -function W3CWebSocket(uri, protocols) { - var native_instance; - - if (protocols) { - native_instance = new NativeWebSocket(uri, protocols); - } - else { - native_instance = new NativeWebSocket(uri); - } - - /** - * 'native_instance' is an instance of nativeWebSocket (the browser's WebSocket - * class). Since it is an Object it will be returned as it is when creating an - * instance of W3CWebSocket via 'new W3CWebSocket()'. - * - * ECMAScript 5: http://bclary.com/2004/11/07/#a-13.2.2 - */ - return native_instance; -} -if (NativeWebSocket) { - ['CONNECTING', 'OPEN', 'CLOSING', 'CLOSED'].forEach(function(prop) { - Object.defineProperty(W3CWebSocket, prop, { - get: function() { return NativeWebSocket[prop]; } - }); - }); -} - -/** - * Module exports. - */ -module.exports = { - 'w3cwebsocket' : NativeWebSocket ? W3CWebSocket : null, - 'version' : websocket_version -}; diff --git a/node_modules/websocket/lib/utils.js b/node_modules/websocket/lib/utils.js deleted file mode 100644 index 02f1c39..0000000 --- a/node_modules/websocket/lib/utils.js +++ /dev/null @@ -1,66 +0,0 @@ -var noop = exports.noop = function(){}; - -exports.extend = function extend(dest, source) { - for (var prop in source) { - dest[prop] = source[prop]; - } -}; - -exports.eventEmitterListenerCount = - require('events').EventEmitter.listenerCount || - function(emitter, type) { return emitter.listeners(type).length; }; - -exports.bufferAllocUnsafe = Buffer.allocUnsafe ? - Buffer.allocUnsafe : - function oldBufferAllocUnsafe(size) { return new Buffer(size); }; - -exports.bufferFromString = Buffer.from ? - Buffer.from : - function oldBufferFromString(string, encoding) { - return new Buffer(string, encoding); - }; - -exports.BufferingLogger = function createBufferingLogger(identifier, uniqueID) { - var logFunction = require('debug')(identifier); - if (logFunction.enabled) { - var logger = new BufferingLogger(identifier, uniqueID, logFunction); - var debug = logger.log.bind(logger); - debug.printOutput = logger.printOutput.bind(logger); - debug.enabled = logFunction.enabled; - return debug; - } - logFunction.printOutput = noop; - return logFunction; -}; - -function BufferingLogger(identifier, uniqueID, logFunction) { - this.logFunction = logFunction; - this.identifier = identifier; - this.uniqueID = uniqueID; - this.buffer = []; -} - -BufferingLogger.prototype.log = function() { - this.buffer.push([ new Date(), Array.prototype.slice.call(arguments) ]); - return this; -}; - -BufferingLogger.prototype.clear = function() { - this.buffer = []; - return this; -}; - -BufferingLogger.prototype.printOutput = function(logFunction) { - if (!logFunction) { logFunction = this.logFunction; } - var uniqueID = this.uniqueID; - this.buffer.forEach(function(entry) { - var date = entry[0].toLocaleString(); - var args = entry[1].slice(); - var formatString = args[0]; - if (formatString !== (void 0) && formatString !== null) { - formatString = '%s - %s - ' + formatString.toString(); - args.splice(0, 1, formatString, date, uniqueID); - logFunction.apply(global, args); - } - }); -}; diff --git a/node_modules/websocket/lib/version.js b/node_modules/websocket/lib/version.js deleted file mode 100644 index 81f6e78..0000000 --- a/node_modules/websocket/lib/version.js +++ /dev/null @@ -1 +0,0 @@ -module.exports = require('../package.json').version; diff --git a/node_modules/websocket/lib/websocket.js b/node_modules/websocket/lib/websocket.js deleted file mode 100644 index 6242d56..0000000 --- a/node_modules/websocket/lib/websocket.js +++ /dev/null @@ -1,11 +0,0 @@ -module.exports = { - 'server' : require('./WebSocketServer'), - 'client' : require('./WebSocketClient'), - 'router' : require('./WebSocketRouter'), - 'frame' : require('./WebSocketFrame'), - 'request' : require('./WebSocketRequest'), - 'connection' : require('./WebSocketConnection'), - 'w3cwebsocket' : require('./W3CWebSocket'), - 'deprecation' : require('./Deprecation'), - 'version' : require('./version') -}; diff --git a/node_modules/websocket/node_modules/nan/CHANGELOG.md b/node_modules/websocket/node_modules/nan/CHANGELOG.md deleted file mode 100644 index 7cdfbe7..0000000 --- a/node_modules/websocket/node_modules/nan/CHANGELOG.md +++ /dev/null @@ -1,529 +0,0 @@ -# NAN ChangeLog - -**Version 2.14.0: current Node 12.2.0, Node 0.12: 0.12.18, Node 0.10: 0.10.48, iojs: 3.3.1** - -### 2.14.0 May 16 2019 - - - Feature: Add missing methods to Nan::Maybe (#852) 4e962489fb84a184035b9fa74f245f650249aca6 - -### 2.13.2 Mar 24 2019 - - - Bugfix: remove usage of deprecated `IsNearDeath` (#842) fbaf42252af279c3d867c6b193571f9711c39847 - -### 2.13.1 Mar 14 2019 - - - Bugfix: check V8 version directly instead of inferring from NMV (#840) 12f9df9f393285de8fb4a8cd01478dc4fe3b089d - -### 2.13.0 Mar 13 2019 - - - Feature: add support for node master (#831) 113c0282072e7ff4f9dfc98b432fd894b798c2c - -### 2.12.1 Dec 18 2018 - - - Bugfix: Fix build breakage with Node.js 10.0.0-10.9.0. (#833) 625e90e8fef8d39ffa7247250a76a100b2487474 - -### 2.12.0 Dec 16 2018 - - - Bugfix: Add scope.Escape() to Call() (#817) 2e5ed4fc3a8ac80a6ef1f2a55099ab3ac8800dc6 - - Bugfix: Fix Node.js v10.12.0 deprecation warnings. 509859cc23b1770376b56550a027840a2ce0f73d - - Feature: Allow SetWeak() for non-object persistent handles. (#824) e6ef6a48e7e671fe3e4b7dddaa8912a3f8262ecd - -### 2.11.1 Sep 29 2018 - - - Fix: adapt to V8 7.0 24a22c3b25eeeec2016c6ec239bdd6169e985447 - -### 2.11.0 Aug 25 2018 - - - Removal: remove `FunctionCallbackInfo::Callee` for nodejs `>= 10` 1a56c0a6efd4fac944cb46c30912a8e023bda7d4 - - Bugfix: Fix `AsyncProgressWorkerBase::WorkProgress` sends invalid data b0c764d1dab11e9f8b37ffb81e2560a4498aad5e - - Feature: Introduce `GetCurrentEventLoop` b4911b0bb1f6d47d860e10ec014d941c51efac5e - - Feature: Add `NAN_MODULE_WORKER_ENABLED` macro as a replacement for `NAN_MODULE` b058fb047d18a58250e66ae831444441c1f2ac7a - -### 2.10.0 Mar 16 2018 - - - Deprecation: Deprecate `MakeCallback` 5e92b19a59e194241d6a658bd6ff7bfbda372950 - - Feature: add `Nan::Call` overload 4482e1242fe124d166fc1a5b2be3c1cc849fe452 - - Feature: add more `Nan::Call` overloads 8584e63e6d04c7d2eb8c4a664e4ef57d70bf672b - - Feature: Fix deprecation warnings for Node 10 1caf258243b0602ed56922bde74f1c91b0cbcb6a - -### 2.9.2 Feb 22 2018 - - - Bugfix: Bandaid for async hooks 212bd2f849be14ef1b02fc85010b053daa24252b - -### 2.9.1 Feb 22 2018 - - - Bugfix: Avoid deprecation warnings in deprecated `Nan::Callback::operator()` 372b14d91289df4604b0f81780709708c45a9aa4 - - Bugfix: Avoid deprecation warnings in `Nan::JSON` 3bc294bce0b7d0a3ee4559926303e5ed4866fda2 - -### 2.9.0 Feb 22 2018 - - - Deprecation: Deprecate legacy `Callback::Call` 6dd5fa690af61ca3523004b433304c581b3ea309 - - Feature: introduce `AsyncResource` class 90c0a179c0d8cb5fd26f1a7d2b1d6231eb402d48o - - Feature: Add context aware `Nan::Callback::Call` functions 7169e09fb088418b6e388222e88b4c13f07ebaee - - Feature: Make `AsyncWorker` context aware 066ba21a6fb9e2b5230c9ed3a6fc51f1211736a4 - - Feature: add `Callback` overload to `Nan::Call` 5328daf66e202658c1dc0d916c3aaba99b3cc606 - - Bugfix: fix warning: suggest parentheses around `&&` within `||` b2bb63d68b8ae623a526b542764e1ac82319cb2c - - Bugfix: Fix compilation on io.js 3 d06114dba0a522fb436f0c5f47b994210968cd7b - -### 2.8.0 Nov 15 2017 - - - Deprecation: Deprecate `Nan::ForceSet` in favor of `Nan::DefineOwnProperty()` 95cbb976d6fbbba88ba0f86dd188223a8591b4e7 - - Feature: Add `Nan::AsyncProgressQueueWorker` a976636ecc2ef617d1b061ce4a6edf39923691cb - - Feature: Add `Nan::DefineOwnProperty()` 95cbb976d6fbbba88ba0f86dd188223a8591b4e7 - - Bugfix: Fix compiling on io.js 1 & 2 82705a64503ce60c62e98df5bd02972bba090900 - - Bugfix: Use DefineOwnProperty instead of ForceSet 95cbb976d6fbbba88ba0f86dd188223a8591b4e7 - -### 2.7.0 Aug 30 2017 - - - Feature: Add `Nan::To()` overload. b93280670c9f6da42ed4cf6cbf085ffdd87bd65b - - Bugfix: Fix ternary in `Nan::MaybeLocal::FromMaybe()`. 79a26f7d362e756a9524e672a82c3d603b542867 - -### 2.6.2 Apr 12 2017 - - - Bugfix: Fix v8::JSON::Parse() deprecation warning. 87f6a3c65815fa062296a994cc863e2fa124867d - -### 2.6.1 Apr 6 2017 - - - Bugfix: nan_json.h: fix build breakage in Node 6 ac8d47dc3c10bfbf3f15a6b951633120c0ee6d51 - -### 2.6.0 Apr 6 2017 - - - Feature: nan: add support for JSON::Parse & Stringify b533226c629cce70e1932a873bb6f849044a56c5 - -### 2.5.1 Jan 23 2017 - - - Bugfix: Fix disappearing handle for private value 6a80995694f162ef63dbc9948fbefd45d4485aa0 - - Bugfix: Add missing scopes a93b8bae6bc7d32a170db6e89228b7f60ee57112 - - Bugfix: Use string::data instead of string::front in NewOneByteString d5f920371e67e1f3b268295daee6e83af86b6e50 - -### 2.5.0 Dec 21 2016 - - - Feature: Support Private accessors a86255cb357e8ad8ccbf1f6a4a901c921e39a178 - - Bugfix: Abort in delete operators that shouldn't be called 0fe38215ff8581703967dfd26c12793feb960018 - -### 2.4.0 Jul 10 2016 - - - Feature: Rewrite Callback to add Callback::Reset c4cf44d61f8275cd5f7b0c911d7a806d4004f649 - - Feature: AsyncProgressWorker: add template types for .send 1242c9a11a7ed481c8f08ec06316385cacc513d0 - - Bugfix: Add constness to old Persistent comparison operators bd43cb9982c7639605d60fd073efe8cae165d9b2 - -### 2.3.5 May 31 2016 - - - Bugfix: Replace NAN_INLINE with 'inline' keyword. 71819d8725f822990f439479c9aba3b240804909 - -### 2.3.4 May 31 2016 - - - Bugfix: Remove V8 deprecation warnings 0592fb0a47f3a1c7763087ebea8e1138829f24f9 - - Bugfix: Fix new versions not to use WeakCallbackInfo::IsFirstPass 615c19d9e03d4be2049c10db0151edbc3b229246 - - Bugfix: Make ObjectWrap::handle() const d19af99595587fe7a26bd850af6595c2a7145afc - - Bugfix: Fix compilation errors related to 0592fb0a47f3a1c7763087ebea8e1138829f24f9 e9191c525b94f652718325e28610a1adcf90fed8 - -### 2.3.3 May 4 2016 - - - Bugfix: Refactor SetMethod() to deal with v8::Templates (#566) b9083cf6d5de6ebe6bcb49c7502fbb7c0d9ddda8 - -### 2.3.2 Apr 27 2016 - - - Bugfix: Fix compilation on outdated versions due to Handle removal f8b7c875d04d425a41dfd4f3f8345bc3a11e6c52 - -### 2.3.1 Apr 27 2016 - - - Bugfix: Don't use deprecated v8::Template::Set() in SetMethod a90951e9ea70fa1b3836af4b925322919159100e - -### 2.3.0 Apr 27 2016 - - - Feature: added Signal() for invoking async callbacks without sending data from AsyncProgressWorker d8adba45f20e077d00561b20199133620c990b38 - - Bugfix: Don't use deprecated v8::Template::Set() 00dacf0a4b86027415867fa7f1059acc499dcece - -### 2.2.1 Mar 29 2016 - - - Bugfix: Use NewFromUnsigned in ReturnValue::Set(uint32_t i) for pre_12 3a18f9bdce29826e0e4c217854bc476918241a58 - - Performance: Remove unneeeded nullptr checks b715ef44887931c94f0d1605b3b1a4156eebece9 - -### 2.2.0 Jan 9 2016 - - - Feature: Add Function::Call wrapper 4c157474dacf284d125c324177b45aa5dabc08c6 - - Feature: Rename GC*logueCallback to GCCallback for > 4.0 3603435109f981606d300eb88004ca101283acec - - Bugfix: Fix Global::Pass for old versions 367e82a60fbaa52716232cc89db1cc3f685d77d9 - - Bugfix: Remove weird MaybeLocal wrapping of what already is a MaybeLocal 23b4590db10c2ba66aee2338aebe9751c4cb190b - -### 2.1.0 Oct 8 2015 - - - Deprecation: Deprecate NanErrnoException in favor of ErrnoException 0af1ca4cf8b3f0f65ed31bc63a663ab3319da55c - - Feature: added helper class for accessing contents of typedarrays 17b51294c801e534479d5463697a73462d0ca555 - - Feature: [Maybe types] Add MakeMaybe(...) 48d7b53d9702b0c7a060e69ea10fea8fb48d814d - - Feature: new: allow utf16 string with length 66ac6e65c8ab9394ef588adfc59131b3b9d8347b - - Feature: Introduce SetCallHandler and SetCallAsFunctionHandler 7764a9a115d60ba10dc24d86feb0fbc9b4f75537 - - Bugfix: Enable creating Locals from Globals under Node 0.10. 9bf9b8b190821af889790fdc18ace57257e4f9ff - - Bugfix: Fix issue #462 where PropertyCallbackInfo data is not stored safely. 55f50adedd543098526c7b9f4fffd607d3f9861f - -### 2.0.9 Sep 8 2015 - - - Bugfix: EscapableHandleScope in Nan::NewBuffer for Node 0.8 and 0.10 b1654d7 - -### 2.0.8 Aug 28 2015 - - - Work around duplicate linking bug in clang 11902da - -### 2.0.7 Aug 26 2015 - - - Build: Repackage - -### 2.0.6 Aug 26 2015 - - - Bugfix: Properly handle null callback in FunctionTemplate factory 6e99cb1 - - Bugfix: Remove unused static std::map instances 525bddc - - Bugfix: Make better use of maybe versions of APIs bfba85b - - Bugfix: Fix shadowing issues with handle in ObjectWrap 0a9072d - -### 2.0.5 Aug 10 2015 - - - Bugfix: Reimplement weak callback in ObjectWrap 98d38c1 - - Bugfix: Make sure callback classes are not assignable, copyable or movable 81f9b1d - -### 2.0.4 Aug 6 2015 - - - Build: Repackage - -### 2.0.3 Aug 6 2015 - - - Bugfix: Don't use clang++ / g++ syntax extension. 231450e - -### 2.0.2 Aug 6 2015 - - - Build: Repackage - -### 2.0.1 Aug 6 2015 - - - Bugfix: Add workaround for missing REPLACE_INVALID_UTF8 60d6687 - - Bugfix: Reimplement ObjectWrap from scratch to prevent memory leaks 6484601 - - Bugfix: Fix Persistent leak in FunctionCallbackInfo and PropertyCallbackInfo 641ef5f - - Bugfix: Add missing overload for Nan::NewInstance that takes argc/argv 29450ed - -### 2.0.0 Jul 31 2015 - - - Change: Renamed identifiers with leading underscores b5932b4 - - Change: Replaced NanObjectWrapHandle with class NanObjectWrap 464f1e1 - - Change: Replace NanScope and NanEscpableScope macros with classes 47751c4 - - Change: Rename NanNewBufferHandle to NanNewBuffer 6745f99 - - Change: Rename NanBufferUse to NanNewBuffer 3e8b0a5 - - Change: Rename NanNewBuffer to NanCopyBuffer d6af78d - - Change: Remove Nan prefix from all names 72d1f67 - - Change: Update Buffer API for new upstream changes d5d3291 - - Change: Rename Scope and EscapableScope to HandleScope and EscapableHandleScope 21a7a6a - - Change: Get rid of Handles e6c0daf - - Feature: Support io.js 3 with V8 4.4 - - Feature: Introduce NanPersistent 7fed696 - - Feature: Introduce NanGlobal 4408da1 - - Feature: Added NanTryCatch 10f1ca4 - - Feature: Update for V8 v4.3 4b6404a - - Feature: Introduce NanNewOneByteString c543d32 - - Feature: Introduce namespace Nan 67ed1b1 - - Removal: Remove NanLocker and NanUnlocker dd6e401 - - Removal: Remove string converters, except NanUtf8String, which now follows the node implementation b5d00a9 - - Removal: Remove NanReturn* macros d90a25c - - Removal: Remove HasInstance e8f84fe - - -### 1.9.0 Jul 31 2015 - - - Feature: Added `NanFatalException` 81d4a2c - - Feature: Added more error types 4265f06 - - Feature: Added dereference and function call operators to NanCallback c4b2ed0 - - Feature: Added indexed GetFromPersistent and SaveToPersistent edd510c - - Feature: Added more overloads of SaveToPersistent and GetFromPersistent 8b1cef6 - - Feature: Added NanErrnoException dd87d9e - - Correctness: Prevent assign, copy, and move for classes that do not support it 1f55c59, 4b808cb, c96d9b2, fba4a29, 3357130 - - Deprecation: Deprecate `NanGetPointerSafe` and `NanSetPointerSafe` 81d4a2c - - Deprecation: Deprecate `NanBooleanOptionValue` and `NanUInt32OptionValue` 0ad254b - -### 1.8.4 Apr 26 2015 - - - Build: Repackage - -### 1.8.3 Apr 26 2015 - - - Bugfix: Include missing header 1af8648 - -### 1.8.2 Apr 23 2015 - - - Build: Repackage - -### 1.8.1 Apr 23 2015 - - - Bugfix: NanObjectWrapHandle should take a pointer 155f1d3 - -### 1.8.0 Apr 23 2015 - - - Feature: Allow primitives with NanReturnValue 2e4475e - - Feature: Added comparison operators to NanCallback 55b075e - - Feature: Backport thread local storage 15bb7fa - - Removal: Remove support for signatures with arguments 8a2069d - - Correcteness: Replaced NanObjectWrapHandle macro with function 0bc6d59 - -### 1.7.0 Feb 28 2015 - - - Feature: Made NanCallback::Call accept optional target 8d54da7 - - Feature: Support atom-shell 0.21 0b7f1bb - -### 1.6.2 Feb 6 2015 - - - Bugfix: NanEncode: fix argument type for node::Encode on io.js 2be8639 - -### 1.6.1 Jan 23 2015 - - - Build: version bump - -### 1.5.3 Jan 23 2015 - - - Build: repackage - -### 1.6.0 Jan 23 2015 - - - Deprecated `NanNewContextHandle` in favor of `NanNew` 49259af - - Support utility functions moved in newer v8 versions (Node 0.11.15, io.js 1.0) a0aa179 - - Added `NanEncode`, `NanDecodeBytes` and `NanDecodeWrite` 75e6fb9 - -### 1.5.2 Jan 23 2015 - - - Bugfix: Fix non-inline definition build error with clang++ 21d96a1, 60fadd4 - - Bugfix: Readded missing String constructors 18d828f - - Bugfix: Add overload handling NanNew(..) 5ef813b - - Bugfix: Fix uv_work_cb versioning 997e4ae - - Bugfix: Add function factory and test 4eca89c - - Bugfix: Add object template factory and test cdcb951 - - Correctness: Lifted an io.js related typedef c9490be - - Correctness: Make explicit downcasts of String lengths 00074e6 - - Windows: Limit the scope of disabled warning C4530 83d7deb - -### 1.5.1 Jan 15 2015 - - - Build: version bump - -### 1.4.3 Jan 15 2015 - - - Build: version bump - -### 1.4.2 Jan 15 2015 - - - Feature: Support io.js 0dbc5e8 - -### 1.5.0 Jan 14 2015 - - - Feature: Support io.js b003843 - - Correctness: Improved NanNew internals 9cd4f6a - - Feature: Implement progress to NanAsyncWorker 8d6a160 - -### 1.4.1 Nov 8 2014 - - - Bugfix: Handle DEBUG definition correctly - - Bugfix: Accept int as Boolean - -### 1.4.0 Nov 1 2014 - - - Feature: Added NAN_GC_CALLBACK 6a5c245 - - Performance: Removed unnecessary local handle creation 18a7243, 41fe2f8 - - Correctness: Added constness to references in NanHasInstance 02c61cd - - Warnings: Fixed spurious warnings from -Wundef and -Wshadow, 541b122, 99d8cb6 - - Windoze: Shut Visual Studio up when compiling 8d558c1 - - License: Switch to plain MIT from custom hacked MIT license 11de983 - - Build: Added test target to Makefile e232e46 - - Performance: Removed superfluous scope in NanAsyncWorker f4b7821 - - Sugar/Feature: Added NanReturnThis() and NanReturnHolder() shorthands 237a5ff, d697208 - - Feature: Added suitable overload of NanNew for v8::Integer::NewFromUnsigned b27b450 - -### 1.3.0 Aug 2 2014 - - - Added NanNew(std::string) - - Added NanNew(std::string&) - - Added NanAsciiString helper class - - Added NanUtf8String helper class - - Added NanUcs2String helper class - - Deprecated NanRawString() - - Deprecated NanCString() - - Added NanGetIsolateData(v8::Isolate *isolate) - - Added NanMakeCallback(v8::Handle target, v8::Handle func, int argc, v8::Handle* argv) - - Added NanMakeCallback(v8::Handle target, v8::Handle symbol, int argc, v8::Handle* argv) - - Added NanMakeCallback(v8::Handle target, const char* method, int argc, v8::Handle* argv) - - Added NanSetTemplate(v8::Handle templ, v8::Handle name , v8::Handle value, v8::PropertyAttribute attributes) - - Added NanSetPrototypeTemplate(v8::Local templ, v8::Handle name, v8::Handle value, v8::PropertyAttribute attributes) - - Added NanSetInstanceTemplate(v8::Local templ, const char *name, v8::Handle value) - - Added NanSetInstanceTemplate(v8::Local templ, v8::Handle name, v8::Handle value, v8::PropertyAttribute attributes) - -### 1.2.0 Jun 5 2014 - - - Add NanSetPrototypeTemplate - - Changed NAN_WEAK_CALLBACK internals, switched _NanWeakCallbackData to class, - introduced _NanWeakCallbackDispatcher - - Removed -Wno-unused-local-typedefs from test builds - - Made test builds Windows compatible ('Sleep()') - -### 1.1.2 May 28 2014 - - - Release to fix more stuff-ups in 1.1.1 - -### 1.1.1 May 28 2014 - - - Release to fix version mismatch in nan.h and lack of changelog entry for 1.1.0 - -### 1.1.0 May 25 2014 - - - Remove nan_isolate, use v8::Isolate::GetCurrent() internally instead - - Additional explicit overloads for NanNew(): (char*,int), (uint8_t*[,int]), - (uint16_t*[,int), double, int, unsigned int, bool, v8::String::ExternalStringResource*, - v8::String::ExternalAsciiStringResource* - - Deprecate NanSymbol() - - Added SetErrorMessage() and ErrorMessage() to NanAsyncWorker - -### 1.0.0 May 4 2014 - - - Heavy API changes for V8 3.25 / Node 0.11.13 - - Use cpplint.py - - Removed NanInitPersistent - - Removed NanPersistentToLocal - - Removed NanFromV8String - - Removed NanMakeWeak - - Removed NanNewLocal - - Removed NAN_WEAK_CALLBACK_OBJECT - - Removed NAN_WEAK_CALLBACK_DATA - - Introduce NanNew, replaces NanNewLocal, NanPersistentToLocal, adds many overloaded typed versions - - Introduce NanUndefined, NanNull, NanTrue and NanFalse - - Introduce NanEscapableScope and NanEscapeScope - - Introduce NanMakeWeakPersistent (requires a special callback to work on both old and new node) - - Introduce NanMakeCallback for node::MakeCallback - - Introduce NanSetTemplate - - Introduce NanGetCurrentContext - - Introduce NanCompileScript and NanRunScript - - Introduce NanAdjustExternalMemory - - Introduce NanAddGCEpilogueCallback, NanAddGCPrologueCallback, NanRemoveGCEpilogueCallback, NanRemoveGCPrologueCallback - - Introduce NanGetHeapStatistics - - Rename NanAsyncWorker#SavePersistent() to SaveToPersistent() - -### 0.8.0 Jan 9 2014 - - - NanDispose -> NanDisposePersistent, deprecate NanDispose - - Extract _NAN_*_RETURN_TYPE, pull up NAN_*() - -### 0.7.1 Jan 9 2014 - - - Fixes to work against debug builds of Node - - Safer NanPersistentToLocal (avoid reinterpret_cast) - - Speed up common NanRawString case by only extracting flattened string when necessary - -### 0.7.0 Dec 17 2013 - - - New no-arg form of NanCallback() constructor. - - NanCallback#Call takes Handle rather than Local - - Removed deprecated NanCallback#Run method, use NanCallback#Call instead - - Split off _NAN_*_ARGS_TYPE from _NAN_*_ARGS - - Restore (unofficial) Node 0.6 compatibility at NanCallback#Call() - - Introduce NanRawString() for char* (or appropriate void*) from v8::String - (replacement for NanFromV8String) - - Introduce NanCString() for null-terminated char* from v8::String - -### 0.6.0 Nov 21 2013 - - - Introduce NanNewLocal(v8::Handle value) for use in place of - v8::Local::New(...) since v8 started requiring isolate in Node 0.11.9 - -### 0.5.2 Nov 16 2013 - - - Convert SavePersistent and GetFromPersistent in NanAsyncWorker from protected and public - -### 0.5.1 Nov 12 2013 - - - Use node::MakeCallback() instead of direct v8::Function::Call() - -### 0.5.0 Nov 11 2013 - - - Added @TooTallNate as collaborator - - New, much simpler, "include_dirs" for binding.gyp - - Added full range of NAN_INDEX_* macros to match NAN_PROPERTY_* macros - -### 0.4.4 Nov 2 2013 - - - Isolate argument from v8::Persistent::MakeWeak removed for 0.11.8+ - -### 0.4.3 Nov 2 2013 - - - Include node_object_wrap.h, removed from node.h for Node 0.11.8. - -### 0.4.2 Nov 2 2013 - - - Handle deprecation of v8::Persistent::Dispose(v8::Isolate* isolate)) for - Node 0.11.8 release. - -### 0.4.1 Sep 16 2013 - - - Added explicit `#include ` as it was removed from node.h for v0.11.8 - -### 0.4.0 Sep 2 2013 - - - Added NAN_INLINE and NAN_DEPRECATED and made use of them - - Added NanError, NanTypeError and NanRangeError - - Cleaned up code - -### 0.3.2 Aug 30 2013 - - - Fix missing scope declaration in GetFromPersistent() and SaveToPersistent - in NanAsyncWorker - -### 0.3.1 Aug 20 2013 - - - fix "not all control paths return a value" compile warning on some platforms - -### 0.3.0 Aug 19 2013 - - - Made NAN work with NPM - - Lots of fixes to NanFromV8String, pulling in features from new Node core - - Changed node::encoding to Nan::Encoding in NanFromV8String to unify the API - - Added optional error number argument for NanThrowError() - - Added NanInitPersistent() - - Added NanReturnNull() and NanReturnEmptyString() - - Added NanLocker and NanUnlocker - - Added missing scopes - - Made sure to clear disposed Persistent handles - - Changed NanAsyncWorker to allocate error messages on the heap - - Changed NanThrowError(Local) to NanThrowError(Handle) - - Fixed leak in NanAsyncWorker when errmsg is used - -### 0.2.2 Aug 5 2013 - - - Fixed usage of undefined variable with node::BASE64 in NanFromV8String() - -### 0.2.1 Aug 5 2013 - - - Fixed 0.8 breakage, node::BUFFER encoding type not available in 0.8 for - NanFromV8String() - -### 0.2.0 Aug 5 2013 - - - Added NAN_PROPERTY_GETTER, NAN_PROPERTY_SETTER, NAN_PROPERTY_ENUMERATOR, - NAN_PROPERTY_DELETER, NAN_PROPERTY_QUERY - - Extracted _NAN_METHOD_ARGS, _NAN_GETTER_ARGS, _NAN_SETTER_ARGS, - _NAN_PROPERTY_GETTER_ARGS, _NAN_PROPERTY_SETTER_ARGS, - _NAN_PROPERTY_ENUMERATOR_ARGS, _NAN_PROPERTY_DELETER_ARGS, - _NAN_PROPERTY_QUERY_ARGS - - Added NanGetInternalFieldPointer, NanSetInternalFieldPointer - - Added NAN_WEAK_CALLBACK, NAN_WEAK_CALLBACK_OBJECT, - NAN_WEAK_CALLBACK_DATA, NanMakeWeak - - Renamed THROW_ERROR to _NAN_THROW_ERROR - - Added NanNewBufferHandle(char*, size_t, node::smalloc::FreeCallback, void*) - - Added NanBufferUse(char*, uint32_t) - - Added NanNewContextHandle(v8::ExtensionConfiguration*, - v8::Handle, v8::Handle) - - Fixed broken NanCallback#GetFunction() - - Added optional encoding and size arguments to NanFromV8String() - - Added NanGetPointerSafe() and NanSetPointerSafe() - - Added initial test suite (to be expanded) - - Allow NanUInt32OptionValue to convert any Number object - -### 0.1.0 Jul 21 2013 - - - Added `NAN_GETTER`, `NAN_SETTER` - - Added `NanThrowError` with single Local argument - - Added `NanNewBufferHandle` with single uint32_t argument - - Added `NanHasInstance(Persistent&, Handle)` - - Added `Local NanCallback#GetFunction()` - - Added `NanCallback#Call(int, Local[])` - - Deprecated `NanCallback#Run(int, Local[])` in favour of Call diff --git a/node_modules/websocket/node_modules/nan/LICENSE.md b/node_modules/websocket/node_modules/nan/LICENSE.md deleted file mode 100644 index dddd13d..0000000 --- a/node_modules/websocket/node_modules/nan/LICENSE.md +++ /dev/null @@ -1,13 +0,0 @@ -The MIT License (MIT) -===================== - -Copyright (c) 2018 NAN contributors ------------------------------------ - -*NAN contributors listed at * - -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. diff --git a/node_modules/websocket/node_modules/nan/README.md b/node_modules/websocket/node_modules/nan/README.md deleted file mode 100644 index 3389ef5..0000000 --- a/node_modules/websocket/node_modules/nan/README.md +++ /dev/null @@ -1,456 +0,0 @@ -Native Abstractions for Node.js -=============================== - -**A header file filled with macro and utility goodness for making add-on development for Node.js easier across versions 0.8, 0.10, 0.12, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11 and 12.** - -***Current version: 2.14.0*** - -*(See [CHANGELOG.md](https://github.com/nodejs/nan/blob/master/CHANGELOG.md) for complete ChangeLog)* - -[![NPM](https://nodei.co/npm/nan.png?downloads=true&downloadRank=true)](https://nodei.co/npm/nan/) [![NPM](https://nodei.co/npm-dl/nan.png?months=6&height=3)](https://nodei.co/npm/nan/) - -[![Build Status](https://api.travis-ci.org/nodejs/nan.svg?branch=master)](https://travis-ci.org/nodejs/nan) -[![Build status](https://ci.appveyor.com/api/projects/status/kh73pbm9dsju7fgh)](https://ci.appveyor.com/project/RodVagg/nan) - -Thanks to the crazy changes in V8 (and some in Node core), keeping native addons compiling happily across versions, particularly 0.10 to 0.12 to 4.0, is a minor nightmare. The goal of this project is to store all logic necessary to develop native Node.js addons without having to inspect `NODE_MODULE_VERSION` and get yourself into a macro-tangle. - -This project also contains some helper utilities that make addon development a bit more pleasant. - - * **[News & Updates](#news)** - * **[Usage](#usage)** - * **[Example](#example)** - * **[API](#api)** - * **[Tests](#tests)** - * **[Known issues](#issues)** - * **[Governance & Contributing](#governance)** - - - -## News & Updates - - - -## Usage - -Simply add **NAN** as a dependency in the *package.json* of your Node addon: - -``` bash -$ npm install --save nan -``` - -Pull in the path to **NAN** in your *binding.gyp* so that you can use `#include ` in your *.cpp* files: - -``` python -"include_dirs" : [ - "` when compiling your addon. - - - -## Example - -Just getting started with Nan? Take a look at the **[Node Add-on Examples](https://github.com/nodejs/node-addon-examples)**. - -Refer to a [quick-start **Nan** Boilerplate](https://github.com/fcanas/node-native-boilerplate) for a ready-to-go project that utilizes basic Nan functionality. - -For a simpler example, see the **[async pi estimation example](https://github.com/nodejs/nan/tree/master/examples/async_pi_estimate)** in the examples directory for full code and an explanation of what this Monte Carlo Pi estimation example does. Below are just some parts of the full example that illustrate the use of **NAN**. - -Yet another example is **[nan-example-eol](https://github.com/CodeCharmLtd/nan-example-eol)**. It shows newline detection implemented as a native addon. - -Also take a look at our comprehensive **[C++ test suite](https://github.com/nodejs/nan/tree/master/test/cpp)** which has a plethora of code snippets for your pasting pleasure. - - - -## API - -Additional to the NAN documentation below, please consult: - -* [The V8 Getting Started * Guide](https://github.com/v8/v8/wiki/Getting%20Started%20with%20Embedding) -* [The V8 Embedders * Guide](https://github.com/v8/v8/wiki/Embedder%27s%20Guide) -* [V8 API Documentation](https://v8docs.nodesource.com/) -* [Node Add-on Documentation](https://nodejs.org/api/addons.html) - - - -### JavaScript-accessible methods - -A _template_ is a blueprint for JavaScript functions and objects in a context. You can use a template to wrap C++ functions and data structures within JavaScript objects so that they can be manipulated from JavaScript. See the V8 Embedders Guide section on [Templates](https://github.com/v8/v8/wiki/Embedder%27s-Guide#templates) for further information. - -In order to expose functionality to JavaScript via a template, you must provide it to V8 in a form that it understands. Across the versions of V8 supported by NAN, JavaScript-accessible method signatures vary widely, NAN fully abstracts method declaration and provides you with an interface that is similar to the most recent V8 API but is backward-compatible with older versions that still use the now-deceased `v8::Argument` type. - -* **Method argument types** - - Nan::FunctionCallbackInfo - - Nan::PropertyCallbackInfo - - Nan::ReturnValue -* **Method declarations** - - Method declaration - - Getter declaration - - Setter declaration - - Property getter declaration - - Property setter declaration - - Property enumerator declaration - - Property deleter declaration - - Property query declaration - - Index getter declaration - - Index setter declaration - - Index enumerator declaration - - Index deleter declaration - - Index query declaration -* Method and template helpers - - Nan::SetMethod() - - Nan::SetPrototypeMethod() - - Nan::SetAccessor() - - Nan::SetNamedPropertyHandler() - - Nan::SetIndexedPropertyHandler() - - Nan::SetTemplate() - - Nan::SetPrototypeTemplate() - - Nan::SetInstanceTemplate() - - Nan::SetCallHandler() - - Nan::SetCallAsFunctionHandler() - -### Scopes - -A _local handle_ is a pointer to an object. All V8 objects are accessed using handles, they are necessary because of the way the V8 garbage collector works. - -A handle scope can be thought of as a container for any number of handles. When you've finished with your handles, instead of deleting each one individually you can simply delete their scope. - -The creation of `HandleScope` objects is different across the supported versions of V8. Therefore, NAN provides its own implementations that can be used safely across these. - - - Nan::HandleScope - - Nan::EscapableHandleScope - -Also see the V8 Embedders Guide section on [Handles and Garbage Collection](https://github.com/v8/v8/wiki/Embedder%27s%20Guide#handles-and-garbage-collection). - -### Persistent references - -An object reference that is independent of any `HandleScope` is a _persistent_ reference. Where a `Local` handle only lives as long as the `HandleScope` in which it was allocated, a `Persistent` handle remains valid until it is explicitly disposed. - -Due to the evolution of the V8 API, it is necessary for NAN to provide a wrapper implementation of the `Persistent` classes to supply compatibility across the V8 versions supported. - - - Nan::PersistentBase & v8::PersistentBase - - Nan::NonCopyablePersistentTraits & v8::NonCopyablePersistentTraits - - Nan::CopyablePersistentTraits & v8::CopyablePersistentTraits - - Nan::Persistent - - Nan::Global - - Nan::WeakCallbackInfo - - Nan::WeakCallbackType - -Also see the V8 Embedders Guide section on [Handles and Garbage Collection](https://developers.google.com/v8/embed#handles). - -### New - -NAN provides a `Nan::New()` helper for the creation of new JavaScript objects in a way that's compatible across the supported versions of V8. - - - Nan::New() - - Nan::Undefined() - - Nan::Null() - - Nan::True() - - Nan::False() - - Nan::EmptyString() - - -### Converters - -NAN contains functions that convert `v8::Value`s to other `v8::Value` types and native types. Since type conversion is not guaranteed to succeed, they return `Nan::Maybe` types. These converters can be used in place of `value->ToX()` and `value->XValue()` (where `X` is one of the types, e.g. `Boolean`) in a way that provides a consistent interface across V8 versions. Newer versions of V8 use the new `v8::Maybe` and `v8::MaybeLocal` types for these conversions, older versions don't have this functionality so it is provided by NAN. - - - Nan::To() - -### Maybe Types - -The `Nan::MaybeLocal` and `Nan::Maybe` types are monads that encapsulate `v8::Local` handles that _may be empty_. - -* **Maybe Types** - - Nan::MaybeLocal - - Nan::Maybe - - Nan::Nothing - - Nan::Just -* **Maybe Helpers** - - Nan::Call() - - Nan::ToDetailString() - - Nan::ToArrayIndex() - - Nan::Equals() - - Nan::NewInstance() - - Nan::GetFunction() - - Nan::Set() - - Nan::DefineOwnProperty() - - Nan::ForceSet() - - Nan::Get() - - Nan::GetPropertyAttributes() - - Nan::Has() - - Nan::Delete() - - Nan::GetPropertyNames() - - Nan::GetOwnPropertyNames() - - Nan::SetPrototype() - - Nan::ObjectProtoToString() - - Nan::HasOwnProperty() - - Nan::HasRealNamedProperty() - - Nan::HasRealIndexedProperty() - - Nan::HasRealNamedCallbackProperty() - - Nan::GetRealNamedPropertyInPrototypeChain() - - Nan::GetRealNamedProperty() - - Nan::CallAsFunction() - - Nan::CallAsConstructor() - - Nan::GetSourceLine() - - Nan::GetLineNumber() - - Nan::GetStartColumn() - - Nan::GetEndColumn() - - Nan::CloneElementAt() - - Nan::HasPrivate() - - Nan::GetPrivate() - - Nan::SetPrivate() - - Nan::DeletePrivate() - - Nan::MakeMaybe() - -### Script - -NAN provides a `v8::Script` helpers as the API has changed over the supported versions of V8. - - - Nan::CompileScript() - - Nan::RunScript() - - -### JSON - -The _JSON_ object provides the c++ versions of the methods offered by the `JSON` object in javascript. V8 exposes these methods via the `v8::JSON` object. - - - Nan::JSON.Parse - - Nan::JSON.Stringify - -Refer to the V8 JSON object in the [V8 documentation](https://v8docs.nodesource.com/node-8.11/da/d6f/classv8_1_1_j_s_o_n.html) for more information about these methods and their arguments. - -### Errors - -NAN includes helpers for creating, throwing and catching Errors as much of this functionality varies across the supported versions of V8 and must be abstracted. - -Note that an Error object is simply a specialized form of `v8::Value`. - -Also consult the V8 Embedders Guide section on [Exceptions](https://developers.google.com/v8/embed#exceptions) for more information. - - - Nan::Error() - - Nan::RangeError() - - Nan::ReferenceError() - - Nan::SyntaxError() - - Nan::TypeError() - - Nan::ThrowError() - - Nan::ThrowRangeError() - - Nan::ThrowReferenceError() - - Nan::ThrowSyntaxError() - - Nan::ThrowTypeError() - - Nan::FatalException() - - Nan::ErrnoException() - - Nan::TryCatch - - -### Buffers - -NAN's `node::Buffer` helpers exist as the API has changed across supported Node versions. Use these methods to ensure compatibility. - - - Nan::NewBuffer() - - Nan::CopyBuffer() - - Nan::FreeCallback() - -### Nan::Callback - -`Nan::Callback` makes it easier to use `v8::Function` handles as callbacks. A class that wraps a `v8::Function` handle, protecting it from garbage collection and making it particularly useful for storage and use across asynchronous execution. - - - Nan::Callback - -### Asynchronous work helpers - -`Nan::AsyncWorker`, `Nan::AsyncProgressWorker` and `Nan::AsyncProgressQueueWorker` are helper classes that make working with asynchronous code easier. - - - Nan::AsyncWorker - - Nan::AsyncProgressWorkerBase & Nan::AsyncProgressWorker - - Nan::AsyncProgressQueueWorker - - Nan::AsyncQueueWorker - -### Strings & Bytes - -Miscellaneous string & byte encoding and decoding functionality provided for compatibility across supported versions of V8 and Node. Implemented by NAN to ensure that all encoding types are supported, even for older versions of Node where they are missing. - - - Nan::Encoding - - Nan::Encode() - - Nan::DecodeBytes() - - Nan::DecodeWrite() - - -### Object Wrappers - -The `ObjectWrap` class can be used to make wrapped C++ objects and a factory of wrapped objects. - - - Nan::ObjectWrap - - -### V8 internals - -The hooks to access V8 internals—including GC and statistics—are different across the supported versions of V8, therefore NAN provides its own hooks that call the appropriate V8 methods. - - - NAN_GC_CALLBACK() - - Nan::AddGCEpilogueCallback() - - Nan::RemoveGCEpilogueCallback() - - Nan::AddGCPrologueCallback() - - Nan::RemoveGCPrologueCallback() - - Nan::GetHeapStatistics() - - Nan::SetCounterFunction() - - Nan::SetCreateHistogramFunction() - - Nan::SetAddHistogramSampleFunction() - - Nan::IdleNotification() - - Nan::LowMemoryNotification() - - Nan::ContextDisposedNotification() - - Nan::GetInternalFieldPointer() - - Nan::SetInternalFieldPointer() - - Nan::AdjustExternalMemory() - - -### Miscellaneous V8 Helpers - - - Nan::Utf8String - - Nan::GetCurrentContext() - - Nan::SetIsolateData() - - Nan::GetIsolateData() - - Nan::TypedArrayContents - - -### Miscellaneous Node Helpers - - - Nan::AsyncResource - - Nan::MakeCallback() - - NAN_MODULE_INIT() - - Nan::Export() - - - - - - -### Tests - -To run the NAN tests do: - -``` sh -npm install -npm run-script rebuild-tests -npm test -``` - -Or just: - -``` sh -npm install -make test -``` - - - -## Known issues - -### Compiling against Node.js 0.12 on OSX - -With new enough compilers available on OSX, the versions of V8 headers corresponding to Node.js 0.12 -do not compile anymore. The error looks something like: - -``` -❯ CXX(target) Release/obj.target/accessors/cpp/accessors.o -In file included from ../cpp/accessors.cpp:9: -In file included from ../../nan.h:51: -In file included from /Users/ofrobots/.node-gyp/0.12.18/include/node/node.h:61: -/Users/ofrobots/.node-gyp/0.12.18/include/node/v8.h:5800:54: error: 'CreateHandle' is a protected member of 'v8::HandleScope' - return Handle(reinterpret_cast(HandleScope::CreateHandle( - ~~~~~~~~~~~~~^~~~~~~~~~~~ -``` - -This can be worked around by patching your local versions of v8.h corresponding to Node 0.12 to make -`v8::Handle` a friend of `v8::HandleScope`. Since neither Node.js not V8 support this release line anymore -this patch cannot be released by either project in an official release. - -For this reason, we do not test against Node.js 0.12 on OSX in this project's CI. If you need to support -that configuration, you will need to either get an older compiler, or apply a source patch to the version -of V8 headers as a workaround. - - - -## Governance & Contributing - -NAN is governed by the [Node.js Addon API Working Group](https://github.com/nodejs/CTC/blob/master/WORKING_GROUPS.md#addon-api) - -### Addon API Working Group (WG) - -The NAN project is jointly governed by a Working Group which is responsible for high-level guidance of the project. - -Members of the WG are also known as Collaborators, there is no distinction between the two, unlike other Node.js projects. - -The WG has final authority over this project including: - -* Technical direction -* Project governance and process (including this policy) -* Contribution policy -* GitHub repository hosting -* Maintaining the list of additional Collaborators - -For the current list of WG members, see the project [README.md](./README.md#collaborators). - -Individuals making significant and valuable contributions are made members of the WG and given commit-access to the project. These individuals are identified by the WG and their addition to the WG is discussed via GitHub and requires unanimous consensus amongst those WG members participating in the discussion with a quorum of 50% of WG members required for acceptance of the vote. - -_Note:_ If you make a significant contribution and are not considered for commit-access log an issue or contact a WG member directly. - -For the current list of WG members / Collaborators, see the project [README.md](./README.md#collaborators). - -### Consensus Seeking Process - -The WG follows a [Consensus Seeking](https://en.wikipedia.org/wiki/Consensus-seeking_decision-making) decision making model. - -Modifications of the contents of the NAN repository are made on a collaborative basis. Anybody with a GitHub account may propose a modification via pull request and it will be considered by the WG. All pull requests must be reviewed and accepted by a WG member with sufficient expertise who is able to take full responsibility for the change. In the case of pull requests proposed by an existing WG member, an additional WG member is required for sign-off. Consensus should be sought if additional WG members participate and there is disagreement around a particular modification. - -If a change proposal cannot reach a consensus, a WG member can call for a vote amongst the members of the WG. Simple majority wins. - - - -## Developer's Certificate of Origin 1.1 - -By making a contribution to this project, I certify that: - -* (a) The contribution was created in whole or in part by me and I - have the right to submit it under the open source license - indicated in the file; or - -* (b) The contribution is based upon previous work that, to the best - of my knowledge, is covered under an appropriate open source - license and I have the right under that license to submit that - work with modifications, whether created in whole or in part - by me, under the same open source license (unless I am - permitted to submit under a different license), as indicated - in the file; or - -* (c) The contribution was provided directly to me by some other - person who certified (a), (b) or (c) and I have not modified - it. - -* (d) I understand and agree that this project and the contribution - are public and that a record of the contribution (including all - personal information I submit with it, including my sign-off) is - maintained indefinitely and may be redistributed consistent with - this project or the open source license(s) involved. - - - -### WG Members / Collaborators - - - - - - - - - - -
Rod VaggGitHub/rvaggTwitter/@rvagg
Benjamin ByholmGitHub/kkoopa-
Trevor NorrisGitHub/trevnorrisTwitter/@trevnorris
Nathan RajlichGitHub/TooTallNateTwitter/@TooTallNate
Brett LawsonGitHub/brett19Twitter/@brett19x
Ben NoordhuisGitHub/bnoordhuisTwitter/@bnoordhuis
David SiegelGitHub/agnatTwitter/@agnat
Michael Ira KrufkyGitHub/mkrufkyTwitter/@mkrufky
- -## Licence & copyright - -Copyright (c) 2018 NAN WG Members / Collaborators (listed above). - -Native Abstractions for Node.js is licensed under an MIT license. All rights not explicitly granted in the MIT license are reserved. See the included LICENSE file for more details. diff --git a/node_modules/websocket/node_modules/nan/doc/asyncworker.md b/node_modules/websocket/node_modules/nan/doc/asyncworker.md deleted file mode 100644 index 04231f8..0000000 --- a/node_modules/websocket/node_modules/nan/doc/asyncworker.md +++ /dev/null @@ -1,146 +0,0 @@ -## Asynchronous work helpers - -`Nan::AsyncWorker`, `Nan::AsyncProgressWorker` and `Nan::AsyncProgressQueueWorker` are helper classes that make working with asynchronous code easier. - - - Nan::AsyncWorker - - Nan::AsyncProgressWorkerBase & Nan::AsyncProgressWorker - - Nan::AsyncProgressQueueWorker - - Nan::AsyncQueueWorker - - -### Nan::AsyncWorker - -`Nan::AsyncWorker` is an _abstract_ class that you can subclass to have much of the annoying asynchronous queuing and handling taken care of for you. It can even store arbitrary V8 objects for you and have them persist while the asynchronous work is in progress. - -This class internally handles the details of creating an [`AsyncResource`][AsyncResource], and running the callback in the -correct async context. To be able to identify the async resources created by this class in async-hooks, provide a -`resource_name` to the constructor. It is recommended that the module name be used as a prefix to the `resource_name` to avoid -collisions in the names. For more details see [`AsyncResource`][AsyncResource] documentation. The `resource_name` needs to stay valid for the lifetime of the worker instance. - -Definition: - -```c++ -class AsyncWorker { - public: - explicit AsyncWorker(Callback *callback_, const char* resource_name = "nan:AsyncWorker"); - - virtual ~AsyncWorker(); - - virtual void WorkComplete(); - - void SaveToPersistent(const char *key, const v8::Local &value); - - void SaveToPersistent(const v8::Local &key, - const v8::Local &value); - - void SaveToPersistent(uint32_t index, - const v8::Local &value); - - v8::Local GetFromPersistent(const char *key) const; - - v8::Local GetFromPersistent(const v8::Local &key) const; - - v8::Local GetFromPersistent(uint32_t index) const; - - virtual void Execute() = 0; - - uv_work_t request; - - virtual void Destroy(); - - protected: - Persistent persistentHandle; - - Callback *callback; - - virtual void HandleOKCallback(); - - virtual void HandleErrorCallback(); - - void SetErrorMessage(const char *msg); - - const char* ErrorMessage(); -}; -``` - - -### Nan::AsyncProgressWorkerBase & Nan::AsyncProgressWorker - -`Nan::AsyncProgressWorkerBase` is an _abstract_ class template that extends `Nan::AsyncWorker` and adds additional progress reporting callbacks that can be used during the asynchronous work execution to provide progress data back to JavaScript. - -Previously the definition of `Nan::AsyncProgressWorker` only allowed sending `const char` data. Now extending `Nan::AsyncProgressWorker` will yield an instance of the implicit `Nan::AsyncProgressWorkerBase` template with type `` for compatibility. - -`Nan::AsyncProgressWorkerBase` & `Nan::AsyncProgressWorker` is intended for best-effort delivery of nonessential progress messages, e.g. a progress bar. The last event sent before the main thread is woken will be delivered. - -Definition: - -```c++ -template -class AsyncProgressWorkerBase : public AsyncWorker { - public: - explicit AsyncProgressWorkerBase(Callback *callback_, const char* resource_name = ...); - - virtual ~AsyncProgressWorkerBase(); - - void WorkProgress(); - - class ExecutionProgress { - public: - void Signal() const; - void Send(const T* data, size_t count) const; - }; - - virtual void Execute(const ExecutionProgress& progress) = 0; - - virtual void HandleProgressCallback(const T *data, size_t count) = 0; - - virtual void Destroy(); -}; - -typedef AsyncProgressWorkerBase AsyncProgressWorker; -``` - - -### Nan::AsyncProgressQueueWorker - -`Nan::AsyncProgressQueueWorker` is an _abstract_ class template that extends `Nan::AsyncWorker` and adds additional progress reporting callbacks that can be used during the asynchronous work execution to provide progress data back to JavaScript. - -`Nan::AsyncProgressQueueWorker` behaves exactly the same as `Nan::AsyncProgressWorker`, except all events are queued and delivered to the main thread. - -Definition: - -```c++ -template -class AsyncProgressQueueWorker : public AsyncWorker { - public: - explicit AsyncProgressQueueWorker(Callback *callback_, const char* resource_name = "nan:AsyncProgressQueueWorker"); - - virtual ~AsyncProgressQueueWorker(); - - void WorkProgress(); - - class ExecutionProgress { - public: - void Send(const T* data, size_t count) const; - }; - - virtual void Execute(const ExecutionProgress& progress) = 0; - - virtual void HandleProgressCallback(const T *data, size_t count) = 0; - - virtual void Destroy(); -}; -``` - - -### Nan::AsyncQueueWorker - -`Nan::AsyncQueueWorker` will run a `Nan::AsyncWorker` asynchronously via libuv. Both the `execute` and `after_work` steps are taken care of for you. Most of the logic for this is embedded in `Nan::AsyncWorker`. - -Definition: - -```c++ -void AsyncQueueWorker(AsyncWorker *); -``` - -[AsyncResource]: node_misc.md#api_nan_asyncresource diff --git a/node_modules/websocket/node_modules/nan/doc/buffers.md b/node_modules/websocket/node_modules/nan/doc/buffers.md deleted file mode 100644 index 8d8d25c..0000000 --- a/node_modules/websocket/node_modules/nan/doc/buffers.md +++ /dev/null @@ -1,54 +0,0 @@ -## Buffers - -NAN's `node::Buffer` helpers exist as the API has changed across supported Node versions. Use these methods to ensure compatibility. - - - Nan::NewBuffer() - - Nan::CopyBuffer() - - Nan::FreeCallback() - - -### Nan::NewBuffer() - -Allocate a new `node::Buffer` object with the specified size and optional data. Calls `node::Buffer::New()`. - -Note that when creating a `Buffer` using `Nan::NewBuffer()` and an existing `char*`, it is assumed that the ownership of the pointer is being transferred to the new `Buffer` for management. -When a `node::Buffer` instance is garbage collected and a `FreeCallback` has not been specified, `data` will be disposed of via a call to `free()`. -You _must not_ free the memory space manually once you have created a `Buffer` in this way. - -Signature: - -```c++ -Nan::MaybeLocal Nan::NewBuffer(uint32_t size) -Nan::MaybeLocal Nan::NewBuffer(char* data, uint32_t size) -Nan::MaybeLocal Nan::NewBuffer(char *data, - size_t length, - Nan::FreeCallback callback, - void *hint) -``` - - - -### Nan::CopyBuffer() - -Similar to [`Nan::NewBuffer()`](#api_nan_new_buffer) except that an implicit memcpy will occur within Node. Calls `node::Buffer::Copy()`. - -Management of the `char*` is left to the user, you should manually free the memory space if necessary as the new `Buffer` will have its own copy. - -Signature: - -```c++ -Nan::MaybeLocal Nan::CopyBuffer(const char *data, uint32_t size) -``` - - - -### Nan::FreeCallback() - -A free callback that can be provided to [`Nan::NewBuffer()`](#api_nan_new_buffer). -The supplied callback will be invoked when the `Buffer` undergoes garbage collection. - -Signature: - -```c++ -typedef void (*FreeCallback)(char *data, void *hint); -``` diff --git a/node_modules/websocket/node_modules/nan/doc/callback.md b/node_modules/websocket/node_modules/nan/doc/callback.md deleted file mode 100644 index f7af0bf..0000000 --- a/node_modules/websocket/node_modules/nan/doc/callback.md +++ /dev/null @@ -1,76 +0,0 @@ -## Nan::Callback - -`Nan::Callback` makes it easier to use `v8::Function` handles as callbacks. A class that wraps a `v8::Function` handle, protecting it from garbage collection and making it particularly useful for storage and use across asynchronous execution. - - - Nan::Callback - - -### Nan::Callback - -```c++ -class Callback { - public: - Callback(); - - explicit Callback(const v8::Local &fn); - - ~Callback(); - - bool operator==(const Callback &other) const; - - bool operator!=(const Callback &other) const; - - v8::Local operator*() const; - - MaybeLocal operator()(AsyncResource* async_resource, - v8::Local target, - int argc = 0, - v8::Local argv[] = 0) const; - - MaybeLocal operator()(AsyncResource* async_resource, - int argc = 0, - v8::Local argv[] = 0) const; - - void SetFunction(const v8::Local &fn); - - v8::Local GetFunction() const; - - bool IsEmpty() const; - - void Reset(const v8::Local &fn); - - void Reset(); - - MaybeLocal Call(v8::Local target, - int argc, - v8::Local argv[], - AsyncResource* async_resource) const; - MaybeLocal Call(int argc, - v8::Local argv[], - AsyncResource* async_resource) const; - - // Deprecated versions. Use the versions that accept an async_resource instead - // as they run the callback in the correct async context as specified by the - // resource. If you want to call a synchronous JS function (i.e. on a - // non-empty JS stack), you can use Nan::Call instead. - v8::Local operator()(v8::Local target, - int argc = 0, - v8::Local argv[] = 0) const; - - v8::Local operator()(int argc = 0, - v8::Local argv[] = 0) const; - v8::Local Call(v8::Local target, - int argc, - v8::Local argv[]) const; - - v8::Local Call(int argc, v8::Local argv[]) const; -}; -``` - -Example usage: - -```c++ -v8::Local function; -Nan::Callback callback(function); -callback.Call(0, 0); -``` diff --git a/node_modules/websocket/node_modules/nan/doc/converters.md b/node_modules/websocket/node_modules/nan/doc/converters.md deleted file mode 100644 index d20861b..0000000 --- a/node_modules/websocket/node_modules/nan/doc/converters.md +++ /dev/null @@ -1,41 +0,0 @@ -## Converters - -NAN contains functions that convert `v8::Value`s to other `v8::Value` types and native types. Since type conversion is not guaranteed to succeed, they return `Nan::Maybe` types. These converters can be used in place of `value->ToX()` and `value->XValue()` (where `X` is one of the types, e.g. `Boolean`) in a way that provides a consistent interface across V8 versions. Newer versions of V8 use the new `v8::Maybe` and `v8::MaybeLocal` types for these conversions, older versions don't have this functionality so it is provided by NAN. - - - Nan::To() - - -### Nan::To() - -Converts a `v8::Local` to a different subtype of `v8::Value` or to a native data type. Returns a `Nan::MaybeLocal<>` or a `Nan::Maybe<>` accordingly. - -See [maybe_types.md](./maybe_types.md) for more information on `Nan::Maybe` types. - -Signatures: - -```c++ -// V8 types -Nan::MaybeLocal Nan::To(v8::Local val); -Nan::MaybeLocal Nan::To(v8::Local val); -Nan::MaybeLocal Nan::To(v8::Local val); -Nan::MaybeLocal Nan::To(v8::Local val); -Nan::MaybeLocal Nan::To(v8::Local val); -Nan::MaybeLocal Nan::To(v8::Local val); -Nan::MaybeLocal Nan::To(v8::Local val); - -// Native types -Nan::Maybe Nan::To(v8::Local val); -Nan::Maybe Nan::To(v8::Local val); -Nan::Maybe Nan::To(v8::Local val); -Nan::Maybe Nan::To(v8::Local val); -Nan::Maybe Nan::To(v8::Local val); -``` - -### Example - -```c++ -v8::Local val; -Nan::MaybeLocal str = Nan::To(val); -Nan::Maybe d = Nan::To(val); -``` - diff --git a/node_modules/websocket/node_modules/nan/doc/errors.md b/node_modules/websocket/node_modules/nan/doc/errors.md deleted file mode 100644 index 8127a54..0000000 --- a/node_modules/websocket/node_modules/nan/doc/errors.md +++ /dev/null @@ -1,226 +0,0 @@ -## Errors - -NAN includes helpers for creating, throwing and catching Errors as much of this functionality varies across the supported versions of V8 and must be abstracted. - -Note that an Error object is simply a specialized form of `v8::Value`. - -Also consult the V8 Embedders Guide section on [Exceptions](https://developers.google.com/v8/embed#exceptions) for more information. - - - Nan::Error() - - Nan::RangeError() - - Nan::ReferenceError() - - Nan::SyntaxError() - - Nan::TypeError() - - Nan::ThrowError() - - Nan::ThrowRangeError() - - Nan::ThrowReferenceError() - - Nan::ThrowSyntaxError() - - Nan::ThrowTypeError() - - Nan::FatalException() - - Nan::ErrnoException() - - Nan::TryCatch - - - -### Nan::Error() - -Create a new Error object using the [v8::Exception](https://v8docs.nodesource.com/node-8.11/da/d6a/classv8_1_1_exception.html) class in a way that is compatible across the supported versions of V8. - -Note that an Error object is simply a specialized form of `v8::Value`. - -Signature: - -```c++ -v8::Local Nan::Error(const char *msg); -v8::Local Nan::Error(v8::Local msg); -``` - - - -### Nan::RangeError() - -Create a new RangeError object using the [v8::Exception](https://v8docs.nodesource.com/node-8.11/da/d6a/classv8_1_1_exception.html) class in a way that is compatible across the supported versions of V8. - -Note that an RangeError object is simply a specialized form of `v8::Value`. - -Signature: - -```c++ -v8::Local Nan::RangeError(const char *msg); -v8::Local Nan::RangeError(v8::Local msg); -``` - - - -### Nan::ReferenceError() - -Create a new ReferenceError object using the [v8::Exception](https://v8docs.nodesource.com/node-8.11/da/d6a/classv8_1_1_exception.html) class in a way that is compatible across the supported versions of V8. - -Note that an ReferenceError object is simply a specialized form of `v8::Value`. - -Signature: - -```c++ -v8::Local Nan::ReferenceError(const char *msg); -v8::Local Nan::ReferenceError(v8::Local msg); -``` - - - -### Nan::SyntaxError() - -Create a new SyntaxError object using the [v8::Exception](https://v8docs.nodesource.com/node-8.11/da/d6a/classv8_1_1_exception.html) class in a way that is compatible across the supported versions of V8. - -Note that an SyntaxError object is simply a specialized form of `v8::Value`. - -Signature: - -```c++ -v8::Local Nan::SyntaxError(const char *msg); -v8::Local Nan::SyntaxError(v8::Local msg); -``` - - - -### Nan::TypeError() - -Create a new TypeError object using the [v8::Exception](https://v8docs.nodesource.com/node-8.11/da/d6a/classv8_1_1_exception.html) class in a way that is compatible across the supported versions of V8. - -Note that an TypeError object is simply a specialized form of `v8::Value`. - -Signature: - -```c++ -v8::Local Nan::TypeError(const char *msg); -v8::Local Nan::TypeError(v8::Local msg); -``` - - - -### Nan::ThrowError() - -Throw an Error object (a specialized `v8::Value` as above) in the current context. If a `msg` is provided, a new Error object will be created. - -Signature: - -```c++ -void Nan::ThrowError(const char *msg); -void Nan::ThrowError(v8::Local msg); -void Nan::ThrowError(v8::Local error); -``` - - - -### Nan::ThrowRangeError() - -Throw an RangeError object (a specialized `v8::Value` as above) in the current context. If a `msg` is provided, a new RangeError object will be created. - -Signature: - -```c++ -void Nan::ThrowRangeError(const char *msg); -void Nan::ThrowRangeError(v8::Local msg); -void Nan::ThrowRangeError(v8::Local error); -``` - - - -### Nan::ThrowReferenceError() - -Throw an ReferenceError object (a specialized `v8::Value` as above) in the current context. If a `msg` is provided, a new ReferenceError object will be created. - -Signature: - -```c++ -void Nan::ThrowReferenceError(const char *msg); -void Nan::ThrowReferenceError(v8::Local msg); -void Nan::ThrowReferenceError(v8::Local error); -``` - - - -### Nan::ThrowSyntaxError() - -Throw an SyntaxError object (a specialized `v8::Value` as above) in the current context. If a `msg` is provided, a new SyntaxError object will be created. - -Signature: - -```c++ -void Nan::ThrowSyntaxError(const char *msg); -void Nan::ThrowSyntaxError(v8::Local msg); -void Nan::ThrowSyntaxError(v8::Local error); -``` - - - -### Nan::ThrowTypeError() - -Throw an TypeError object (a specialized `v8::Value` as above) in the current context. If a `msg` is provided, a new TypeError object will be created. - -Signature: - -```c++ -void Nan::ThrowTypeError(const char *msg); -void Nan::ThrowTypeError(v8::Local msg); -void Nan::ThrowTypeError(v8::Local error); -``` - - -### Nan::FatalException() - -Replaces `node::FatalException()` which has a different API across supported versions of Node. For use with [`Nan::TryCatch`](#api_nan_try_catch). - -Signature: - -```c++ -void Nan::FatalException(const Nan::TryCatch& try_catch); -``` - - -### Nan::ErrnoException() - -Replaces `node::ErrnoException()` which has a different API across supported versions of Node. - -Signature: - -```c++ -v8::Local Nan::ErrnoException(int errorno, - const char* syscall = NULL, - const char* message = NULL, - const char* path = NULL); -``` - - - -### Nan::TryCatch - -A simple wrapper around [`v8::TryCatch`](https://v8docs.nodesource.com/node-8.11/d4/dc6/classv8_1_1_try_catch.html) compatible with all supported versions of V8. Can be used as a direct replacement in most cases. See also [`Nan::FatalException()`](#api_nan_fatal_exception) for an internal use compatible with `node::FatalException`. - -Signature: - -```c++ -class Nan::TryCatch { - public: - Nan::TryCatch(); - - bool HasCaught() const; - - bool CanContinue() const; - - v8::Local ReThrow(); - - v8::Local Exception() const; - - // Nan::MaybeLocal for older versions of V8 - v8::MaybeLocal StackTrace() const; - - v8::Local Message() const; - - void Reset(); - - void SetVerbose(bool value); - - void SetCaptureMessage(bool value); -}; -``` - diff --git a/node_modules/websocket/node_modules/nan/doc/json.md b/node_modules/websocket/node_modules/nan/doc/json.md deleted file mode 100644 index 4fa78db..0000000 --- a/node_modules/websocket/node_modules/nan/doc/json.md +++ /dev/null @@ -1,62 +0,0 @@ -## JSON - -The _JSON_ object provides the c++ versions of the methods offered by the `JSON` object in javascript. V8 exposes these methods via the `v8::JSON` object. - - - Nan::JSON.Parse - - Nan::JSON.Stringify - -Refer to the V8 JSON object in the [V8 documentation](https://v8docs.nodesource.com/node-8.11/da/d6f/classv8_1_1_j_s_o_n.html) for more information about these methods and their arguments. - - - -### Nan::JSON.Parse - -A simple wrapper around [`v8::JSON::Parse`](https://v8docs.nodesource.com/node-8.11/da/d6f/classv8_1_1_j_s_o_n.html#a936310d2540fb630ed37d3ee3ffe4504). - -Definition: - -```c++ -Nan::MaybeLocal Nan::JSON::Parse(v8::Local json_string); -``` - -Use `JSON.Parse(json_string)` to parse a string into a `v8::Value`. - -Example: - -```c++ -v8::Local json_string = Nan::New("{ \"JSON\": \"object\" }").ToLocalChecked(); - -Nan::JSON NanJSON; -Nan::MaybeLocal result = NanJSON.Parse(json_string); -if (!result.IsEmpty()) { - v8::Local val = result.ToLocalChecked(); -} -``` - - - -### Nan::JSON.Stringify - -A simple wrapper around [`v8::JSON::Stringify`](https://v8docs.nodesource.com/node-8.11/da/d6f/classv8_1_1_j_s_o_n.html#a44b255c3531489ce43f6110209138860). - -Definition: - -```c++ -Nan::MaybeLocal Nan::JSON::Stringify(v8::Local json_object, v8::Local gap = v8::Local()); -``` - -Use `JSON.Stringify(value)` to stringify a `v8::Object`. - -Example: - -```c++ -// using `v8::Local val` from the `JSON::Parse` example -v8::Local obj = Nan::To(val).ToLocalChecked(); - -Nan::JSON NanJSON; -Nan::MaybeLocal result = NanJSON.Stringify(obj); -if (!result.IsEmpty()) { - v8::Local stringified = result.ToLocalChecked(); -} -``` - diff --git a/node_modules/websocket/node_modules/nan/doc/maybe_types.md b/node_modules/websocket/node_modules/nan/doc/maybe_types.md deleted file mode 100644 index 1a9fabf..0000000 --- a/node_modules/websocket/node_modules/nan/doc/maybe_types.md +++ /dev/null @@ -1,583 +0,0 @@ -## Maybe Types - -The `Nan::MaybeLocal` and `Nan::Maybe` types are monads that encapsulate `v8::Local` handles that _may be empty_. - -* **Maybe Types** - - Nan::MaybeLocal - - Nan::Maybe - - Nan::Nothing - - Nan::Just -* **Maybe Helpers** - - Nan::Call() - - Nan::ToDetailString() - - Nan::ToArrayIndex() - - Nan::Equals() - - Nan::NewInstance() - - Nan::GetFunction() - - Nan::Set() - - Nan::DefineOwnProperty() - - Nan::ForceSet() - - Nan::Get() - - Nan::GetPropertyAttributes() - - Nan::Has() - - Nan::Delete() - - Nan::GetPropertyNames() - - Nan::GetOwnPropertyNames() - - Nan::SetPrototype() - - Nan::ObjectProtoToString() - - Nan::HasOwnProperty() - - Nan::HasRealNamedProperty() - - Nan::HasRealIndexedProperty() - - Nan::HasRealNamedCallbackProperty() - - Nan::GetRealNamedPropertyInPrototypeChain() - - Nan::GetRealNamedProperty() - - Nan::CallAsFunction() - - Nan::CallAsConstructor() - - Nan::GetSourceLine() - - Nan::GetLineNumber() - - Nan::GetStartColumn() - - Nan::GetEndColumn() - - Nan::CloneElementAt() - - Nan::HasPrivate() - - Nan::GetPrivate() - - Nan::SetPrivate() - - Nan::DeletePrivate() - - Nan::MakeMaybe() - - -### Nan::MaybeLocal - -A `Nan::MaybeLocal` is a wrapper around [`v8::Local`](https://v8docs.nodesource.com/node-8.11/de/deb/classv8_1_1_local.html) that enforces a check that determines whether the `v8::Local` is empty before it can be used. - -If an API method returns a `Nan::MaybeLocal`, the API method can potentially fail either because an exception is thrown, or because an exception is pending, e.g. because a previous API call threw an exception that hasn't been caught yet, or because a `v8::TerminateExecution` exception was thrown. In that case, an empty `Nan::MaybeLocal` is returned. - -Definition: - -```c++ -template class Nan::MaybeLocal { - public: - MaybeLocal(); - - template MaybeLocal(v8::Local that); - - bool IsEmpty() const; - - template bool ToLocal(v8::Local *out); - - // Will crash if the MaybeLocal<> is empty. - v8::Local ToLocalChecked(); - - template v8::Local FromMaybe(v8::Local default_value) const; -}; -``` - -See the documentation for [`v8::MaybeLocal`](https://v8docs.nodesource.com/node-8.11/d8/d7d/classv8_1_1_maybe_local.html) for further details. - - -### Nan::Maybe - -A simple `Nan::Maybe` type, representing an object which may or may not have a value, see https://hackage.haskell.org/package/base/docs/Data-Maybe.html. - -If an API method returns a `Nan::Maybe<>`, the API method can potentially fail either because an exception is thrown, or because an exception is pending, e.g. because a previous API call threw an exception that hasn't been caught yet, or because a `v8::TerminateExecution` exception was thrown. In that case, a "Nothing" value is returned. - -Definition: - -```c++ -template class Nan::Maybe { - public: - bool IsNothing() const; - bool IsJust() const; - - // Will crash if the Maybe<> is nothing. - T FromJust(); - - T FromMaybe(const T& default_value); - - bool operator==(const Maybe &other); - - bool operator!=(const Maybe &other); -}; -``` - -See the documentation for [`v8::Maybe`](https://v8docs.nodesource.com/node-8.11/d9/d4b/classv8_1_1_maybe.html) for further details. - - -### Nan::Nothing - -Construct an empty `Nan::Maybe` type representing _nothing_. - -```c++ -template Nan::Maybe Nan::Nothing(); -``` - - -### Nan::Just - -Construct a `Nan::Maybe` type representing _just_ a value. - -```c++ -template Nan::Maybe Nan::Just(const T &t); -``` - - -### Nan::Call() - -A helper method for calling a synchronous [`v8::Function#Call()`](https://v8docs.nodesource.com/node-8.11/d5/d54/classv8_1_1_function.html#a9c3d0e4e13ddd7721fce238aa5b94a11) in a way compatible across supported versions of V8. - -For asynchronous callbacks, use Nan::Callback::Call along with an AsyncResource. - -Signature: - -```c++ -Nan::MaybeLocal Nan::Call(v8::Local fun, v8::Local recv, int argc, v8::Local argv[]); -Nan::MaybeLocal Nan::Call(const Nan::Callback& callback, v8::Local recv, - int argc, v8::Local argv[]); -Nan::MaybeLocal Nan::Call(const Nan::Callback& callback, int argc, v8::Local argv[]); -``` - - - -### Nan::ToDetailString() - -A helper method for calling [`v8::Value#ToDetailString()`](https://v8docs.nodesource.com/node-8.11/dc/d0a/classv8_1_1_value.html#a2f9770296dc2c8d274bc8cc0dca243e5) in a way compatible across supported versions of V8. - -Signature: - -```c++ -Nan::MaybeLocal Nan::ToDetailString(v8::Local val); -``` - - - -### Nan::ToArrayIndex() - -A helper method for calling [`v8::Value#ToArrayIndex()`](https://v8docs.nodesource.com/node-8.11/dc/d0a/classv8_1_1_value.html#acc5bbef3c805ec458470c0fcd6f13493) in a way compatible across supported versions of V8. - -Signature: - -```c++ -Nan::MaybeLocal Nan::ToArrayIndex(v8::Local val); -``` - - - -### Nan::Equals() - -A helper method for calling [`v8::Value#Equals()`](https://v8docs.nodesource.com/node-8.11/dc/d0a/classv8_1_1_value.html#a08fba1d776a59bbf6864b25f9152c64b) in a way compatible across supported versions of V8. - -Signature: - -```c++ -Nan::Maybe Nan::Equals(v8::Local a, v8::Local(b)); -``` - - - -### Nan::NewInstance() - -A helper method for calling [`v8::Function#NewInstance()`](https://v8docs.nodesource.com/node-8.11/d5/d54/classv8_1_1_function.html#ae477558b10c14b76ed00e8dbab44ce5b) and [`v8::ObjectTemplate#NewInstance()`](https://v8docs.nodesource.com/node-8.11/db/d5f/classv8_1_1_object_template.html#ad605a7543cfbc5dab54cdb0883d14ae4) in a way compatible across supported versions of V8. - -Signature: - -```c++ -Nan::MaybeLocal Nan::NewInstance(v8::Local h); -Nan::MaybeLocal Nan::NewInstance(v8::Local h, int argc, v8::Local argv[]); -Nan::MaybeLocal Nan::NewInstance(v8::Local h); -``` - - - -### Nan::GetFunction() - -A helper method for calling [`v8::FunctionTemplate#GetFunction()`](https://v8docs.nodesource.com/node-8.11/d8/d83/classv8_1_1_function_template.html#a56d904662a86eca78da37d9bb0ed3705) in a way compatible across supported versions of V8. - -Signature: - -```c++ -Nan::MaybeLocal Nan::GetFunction(v8::Local t); -``` - - - -### Nan::Set() - -A helper method for calling [`v8::Object#Set()`](https://v8docs.nodesource.com/node-8.11/db/d85/classv8_1_1_object.html#a67604ea3734f170c66026064ea808f20) in a way compatible across supported versions of V8. - -Signature: - -```c++ -Nan::Maybe Nan::Set(v8::Local obj, - v8::Local key, - v8::Local value) -Nan::Maybe Nan::Set(v8::Local obj, - uint32_t index, - v8::Local value); -``` - - - -### Nan::DefineOwnProperty() - -A helper method for calling [`v8::Object#DefineOwnProperty()`](https://v8docs.nodesource.com/node-8.11/db/d85/classv8_1_1_object.html#a6f76b2ed605cb8f9185b92de0033a820) in a way compatible across supported versions of V8. - -Signature: - -```c++ -Nan::Maybe Nan::DefineOwnProperty(v8::Local obj, - v8::Local key, - v8::Local value, - v8::PropertyAttribute attribs = v8::None); -``` - - - -### Nan::ForceSet() - -Deprecated, use Nan::DefineOwnProperty(). - -A helper method for calling [`v8::Object#ForceSet()`](https://v8docs.nodesource.com/node-0.12/db/d85/classv8_1_1_object.html#acfbdfd7427b516ebdb5c47c4df5ed96c) in a way compatible across supported versions of V8. - -Signature: - -```c++ -NAN_DEPRECATED Nan::Maybe Nan::ForceSet(v8::Local obj, - v8::Local key, - v8::Local value, - v8::PropertyAttribute attribs = v8::None); -``` - - - -### Nan::Get() - -A helper method for calling [`v8::Object#Get()`](https://v8docs.nodesource.com/node-8.11/db/d85/classv8_1_1_object.html#a2565f03e736694f6b1e1cf22a0b4eac2) in a way compatible across supported versions of V8. - -Signature: - -```c++ -Nan::MaybeLocal Nan::Get(v8::Local obj, - v8::Local key); -Nan::MaybeLocal Nan::Get(v8::Local obj, uint32_t index); -``` - - - -### Nan::GetPropertyAttributes() - -A helper method for calling [`v8::Object#GetPropertyAttributes()`](https://v8docs.nodesource.com/node-8.11/db/d85/classv8_1_1_object.html#a9b898894da3d1db2714fd9325a54fe57) in a way compatible across supported versions of V8. - -Signature: - -```c++ -Nan::Maybe Nan::GetPropertyAttributes( - v8::Local obj, - v8::Local key); -``` - - - -### Nan::Has() - -A helper method for calling [`v8::Object#Has()`](https://v8docs.nodesource.com/node-8.11/db/d85/classv8_1_1_object.html#ab3c3d89ea7c2f9afd08965bd7299a41d) in a way compatible across supported versions of V8. - -Signature: - -```c++ -Nan::Maybe Nan::Has(v8::Local obj, v8::Local key); -Nan::Maybe Nan::Has(v8::Local obj, uint32_t index); -``` - - - -### Nan::Delete() - -A helper method for calling [`v8::Object#Delete()`](https://v8docs.nodesource.com/node-8.11/db/d85/classv8_1_1_object.html#a48e4a19b2cedff867eecc73ddb7d377f) in a way compatible across supported versions of V8. - -Signature: - -```c++ -Nan::Maybe Nan::Delete(v8::Local obj, - v8::Local key); -Nan::Maybe Nan::Delete(v8::Local obj, uint32_t index); -``` - - - -### Nan::GetPropertyNames() - -A helper method for calling [`v8::Object#GetPropertyNames()`](https://v8docs.nodesource.com/node-8.11/db/d85/classv8_1_1_object.html#aced885270cfd2c956367b5eedc7fbfe8) in a way compatible across supported versions of V8. - -Signature: - -```c++ -Nan::MaybeLocal Nan::GetPropertyNames(v8::Local obj); -``` - - - -### Nan::GetOwnPropertyNames() - -A helper method for calling [`v8::Object#GetOwnPropertyNames()`](https://v8docs.nodesource.com/node-8.11/db/d85/classv8_1_1_object.html#a79a6e4d66049b9aa648ed4dfdb23e6eb) in a way compatible across supported versions of V8. - -Signature: - -```c++ -Nan::MaybeLocal Nan::GetOwnPropertyNames(v8::Local obj); -``` - - - -### Nan::SetPrototype() - -A helper method for calling [`v8::Object#SetPrototype()`](https://v8docs.nodesource.com/node-8.11/db/d85/classv8_1_1_object.html#a442706b22fceda6e6d1f632122a9a9f4) in a way compatible across supported versions of V8. - -Signature: - -```c++ -Nan::Maybe Nan::SetPrototype(v8::Local obj, - v8::Local prototype); -``` - - - -### Nan::ObjectProtoToString() - -A helper method for calling [`v8::Object#ObjectProtoToString()`](https://v8docs.nodesource.com/node-8.11/db/d85/classv8_1_1_object.html#ab7a92b4dcf822bef72f6c0ac6fea1f0b) in a way compatible across supported versions of V8. - -Signature: - -```c++ -Nan::MaybeLocal Nan::ObjectProtoToString(v8::Local obj); -``` - - - -### Nan::HasOwnProperty() - -A helper method for calling [`v8::Object#HasOwnProperty()`](https://v8docs.nodesource.com/node-8.11/db/d85/classv8_1_1_object.html#ab7b7245442ca6de1e1c145ea3fd653ff) in a way compatible across supported versions of V8. - -Signature: - -```c++ -Nan::Maybe Nan::HasOwnProperty(v8::Local obj, - v8::Local key); -``` - - - -### Nan::HasRealNamedProperty() - -A helper method for calling [`v8::Object#HasRealNamedProperty()`](https://v8docs.nodesource.com/node-8.11/db/d85/classv8_1_1_object.html#ad8b80a59c9eb3c1e6c3cd6c84571f767) in a way compatible across supported versions of V8. - -Signature: - -```c++ -Nan::Maybe Nan::HasRealNamedProperty(v8::Local obj, - v8::Local key); -``` - - - -### Nan::HasRealIndexedProperty() - -A helper method for calling [`v8::Object#HasRealIndexedProperty()`](https://v8docs.nodesource.com/node-8.11/db/d85/classv8_1_1_object.html#af94fc1135a5e74a2193fb72c3a1b9855) in a way compatible across supported versions of V8. - -Signature: - -```c++ -Nan::Maybe Nan::HasRealIndexedProperty(v8::Local obj, - uint32_t index); -``` - - - -### Nan::HasRealNamedCallbackProperty() - -A helper method for calling [`v8::Object#HasRealNamedCallbackProperty()`](https://v8docs.nodesource.com/node-8.11/db/d85/classv8_1_1_object.html#af743b7ea132b89f84d34d164d0668811) in a way compatible across supported versions of V8. - -Signature: - -```c++ -Nan::Maybe Nan::HasRealNamedCallbackProperty( - v8::Local obj, - v8::Local key); -``` - - - -### Nan::GetRealNamedPropertyInPrototypeChain() - -A helper method for calling [`v8::Object#GetRealNamedPropertyInPrototypeChain()`](https://v8docs.nodesource.com/node-8.11/db/d85/classv8_1_1_object.html#a8700b1862e6b4783716964ba4d5e6172) in a way compatible across supported versions of V8. - -Signature: - -```c++ -Nan::MaybeLocal Nan::GetRealNamedPropertyInPrototypeChain( - v8::Local obj, - v8::Local key); -``` - - - -### Nan::GetRealNamedProperty() - -A helper method for calling [`v8::Object#GetRealNamedProperty()`](https://v8docs.nodesource.com/node-8.11/db/d85/classv8_1_1_object.html#a84471a824576a5994fdd0ffcbf99ccc0) in a way compatible across supported versions of V8. - -Signature: - -```c++ -Nan::MaybeLocal Nan::GetRealNamedProperty(v8::Local obj, - v8::Local key); -``` - - - -### Nan::CallAsFunction() - -A helper method for calling [`v8::Object#CallAsFunction()`](https://v8docs.nodesource.com/node-8.11/db/d85/classv8_1_1_object.html#ad3ffc36f3dfc3592ce2a96bc047ee2cd) in a way compatible across supported versions of V8. - -Signature: - -```c++ -Nan::MaybeLocal Nan::CallAsFunction(v8::Local obj, - v8::Local recv, - int argc, - v8::Local argv[]); -``` - - - -### Nan::CallAsConstructor() - -A helper method for calling [`v8::Object#CallAsConstructor()`](https://v8docs.nodesource.com/node-8.11/db/d85/classv8_1_1_object.html#a50d571de50d0b0dfb28795619d07a01b) in a way compatible across supported versions of V8. - -Signature: - -```c++ -Nan::MaybeLocal Nan::CallAsConstructor(v8::Local obj, - int argc, - v8::Local argv[]); -``` - - - -### Nan::GetSourceLine() - -A helper method for calling [`v8::Message#GetSourceLine()`](https://v8docs.nodesource.com/node-8.11/d9/d28/classv8_1_1_message.html#a849f7a6c41549d83d8159825efccd23a) in a way compatible across supported versions of V8. - -Signature: - -```c++ -Nan::MaybeLocal Nan::GetSourceLine(v8::Local msg); -``` - - - -### Nan::GetLineNumber() - -A helper method for calling [`v8::Message#GetLineNumber()`](https://v8docs.nodesource.com/node-8.11/d9/d28/classv8_1_1_message.html#adbe46c10a88a6565f2732a2d2adf99b9) in a way compatible across supported versions of V8. - -Signature: - -```c++ -Nan::Maybe Nan::GetLineNumber(v8::Local msg); -``` - - - -### Nan::GetStartColumn() - -A helper method for calling [`v8::Message#GetStartColumn()`](https://v8docs.nodesource.com/node-8.11/d9/d28/classv8_1_1_message.html#a60ede616ba3822d712e44c7a74487ba6) in a way compatible across supported versions of V8. - -Signature: - -```c++ -Nan::Maybe Nan::GetStartColumn(v8::Local msg); -``` - - - -### Nan::GetEndColumn() - -A helper method for calling [`v8::Message#GetEndColumn()`](https://v8docs.nodesource.com/node-8.11/d9/d28/classv8_1_1_message.html#aaa004cf19e529da980bc19fcb76d93be) in a way compatible across supported versions of V8. - -Signature: - -```c++ -Nan::Maybe Nan::GetEndColumn(v8::Local msg); -``` - - - -### Nan::CloneElementAt() - -A helper method for calling [`v8::Array#CloneElementAt()`](https://v8docs.nodesource.com/node-4.8/d3/d32/classv8_1_1_array.html#a1d3a878d4c1c7cae974dd50a1639245e) in a way compatible across supported versions of V8. - -Signature: - -```c++ -Nan::MaybeLocal Nan::CloneElementAt(v8::Local array, uint32_t index); -``` - - -### Nan::HasPrivate() - -A helper method for calling [`v8::Object#HasPrivate()`](https://v8docs.nodesource.com/node-8.11/db/d85/classv8_1_1_object.html#af68a0b98066cfdeb8f943e98a40ba08d) in a way compatible across supported versions of V8. - -Signature: - -```c++ -Nan::Maybe Nan::HasPrivate(v8::Local object, v8::Local key); -``` - - -### Nan::GetPrivate() - -A helper method for calling [`v8::Object#GetPrivate()`](https://v8docs.nodesource.com/node-8.11/db/d85/classv8_1_1_object.html#a169f2da506acbec34deadd9149a1925a) in a way compatible across supported versions of V8. - -Signature: - -```c++ -Nan::MaybeLocal Nan::GetPrivate(v8::Local object, v8::Local key); -``` - - -### Nan::SetPrivate() - -A helper method for calling [`v8::Object#SetPrivate()`](https://v8docs.nodesource.com/node-8.11/db/d85/classv8_1_1_object.html#ace1769b0f3b86bfe9fda1010916360ee) in a way compatible across supported versions of V8. - -Signature: - -```c++ -Nan::Maybe Nan::SetPrivate(v8::Local object, v8::Local key, v8::Local value); -``` - - -### Nan::DeletePrivate() - -A helper method for calling [`v8::Object#DeletePrivate()`](https://v8docs.nodesource.com/node-8.11/db/d85/classv8_1_1_object.html#a138bb32a304f3982be02ad499693b8fd) in a way compatible across supported versions of V8. - -Signature: - -```c++ -Nan::Maybe Nan::DeletePrivate(v8::Local object, v8::Local key); -``` - - -### Nan::MakeMaybe() - -Wraps a `v8::Local<>` in a `Nan::MaybeLocal<>`. When called with a `Nan::MaybeLocal<>` it just returns its argument. This is useful in generic template code that builds on NAN. - -Synopsis: - -```c++ - MaybeLocal someNumber = MakeMaybe(New(3.141592654)); - MaybeLocal someString = MakeMaybe(New("probably")); -``` - -Signature: - -```c++ -template class MaybeMaybe> -Nan::MaybeLocal Nan::MakeMaybe(MaybeMaybe v); -``` diff --git a/node_modules/websocket/node_modules/nan/doc/methods.md b/node_modules/websocket/node_modules/nan/doc/methods.md deleted file mode 100644 index b2b26c3..0000000 --- a/node_modules/websocket/node_modules/nan/doc/methods.md +++ /dev/null @@ -1,661 +0,0 @@ -## JavaScript-accessible methods - -A _template_ is a blueprint for JavaScript functions and objects in a context. You can use a template to wrap C++ functions and data structures within JavaScript objects so that they can be manipulated from JavaScript. See the V8 Embedders Guide section on [Templates](https://github.com/v8/v8/wiki/Embedder%27s-Guide#templates) for further information. - -In order to expose functionality to JavaScript via a template, you must provide it to V8 in a form that it understands. Across the versions of V8 supported by NAN, JavaScript-accessible method signatures vary widely, NAN fully abstracts method declaration and provides you with an interface that is similar to the most recent V8 API but is backward-compatible with older versions that still use the now-deceased `v8::Argument` type. - -* **Method argument types** - - Nan::FunctionCallbackInfo - - Nan::PropertyCallbackInfo - - Nan::ReturnValue -* **Method declarations** - - Method declaration - - Getter declaration - - Setter declaration - - Property getter declaration - - Property setter declaration - - Property enumerator declaration - - Property deleter declaration - - Property query declaration - - Index getter declaration - - Index setter declaration - - Index enumerator declaration - - Index deleter declaration - - Index query declaration -* Method and template helpers - - Nan::SetMethod() - - Nan::SetPrototypeMethod() - - Nan::SetAccessor() - - Nan::SetNamedPropertyHandler() - - Nan::SetIndexedPropertyHandler() - - Nan::SetTemplate() - - Nan::SetPrototypeTemplate() - - Nan::SetInstanceTemplate() - - Nan::SetCallHandler() - - Nan::SetCallAsFunctionHandler() - - -### Nan::FunctionCallbackInfo - -`Nan::FunctionCallbackInfo` should be used in place of [`v8::FunctionCallbackInfo`](https://v8docs.nodesource.com/node-8.11/dd/d0d/classv8_1_1_function_callback_info.html), even with older versions of Node where `v8::FunctionCallbackInfo` does not exist. - -Definition: - -```c++ -template class FunctionCallbackInfo { - public: - ReturnValue GetReturnValue() const; - v8::Local Callee(); // NOTE: Not available in NodeJS >= 10.0.0 - v8::Local Data(); - v8::Local Holder(); - bool IsConstructCall(); - int Length() const; - v8::Local operator[](int i) const; - v8::Local This() const; - v8::Isolate *GetIsolate() const; -}; -``` - -See the [`v8::FunctionCallbackInfo`](https://v8docs.nodesource.com/node-8.11/dd/d0d/classv8_1_1_function_callback_info.html) documentation for usage details on these. See [`Nan::ReturnValue`](#api_nan_return_value) for further information on how to set a return value from methods. - -**Note:** `FunctionCallbackInfo::Callee` is removed in Node.js after `10.0.0` because it is was deprecated in V8. Consider using `info.Data()` to pass any information you need. - - -### Nan::PropertyCallbackInfo - -`Nan::PropertyCallbackInfo` should be used in place of [`v8::PropertyCallbackInfo`](https://v8docs.nodesource.com/node-8.11/d7/dc5/classv8_1_1_property_callback_info.html), even with older versions of Node where `v8::PropertyCallbackInfo` does not exist. - -Definition: - -```c++ -template class PropertyCallbackInfo : public PropertyCallbackInfoBase { - public: - ReturnValue GetReturnValue() const; - v8::Isolate* GetIsolate() const; - v8::Local Data() const; - v8::Local This() const; - v8::Local Holder() const; -}; -``` - -See the [`v8::PropertyCallbackInfo`](https://v8docs.nodesource.com/node-8.11/d7/dc5/classv8_1_1_property_callback_info.html) documentation for usage details on these. See [`Nan::ReturnValue`](#api_nan_return_value) for further information on how to set a return value from property accessor methods. - - -### Nan::ReturnValue - -`Nan::ReturnValue` is used in place of [`v8::ReturnValue`](https://v8docs.nodesource.com/node-8.11/da/da7/classv8_1_1_return_value.html) on both [`Nan::FunctionCallbackInfo`](#api_nan_function_callback_info) and [`Nan::PropertyCallbackInfo`](#api_nan_property_callback_info) as the return type of `GetReturnValue()`. - -Example usage: - -```c++ -void EmptyArray(const Nan::FunctionCallbackInfo& info) { - info.GetReturnValue().Set(Nan::New()); -} -``` - -Definition: - -```c++ -template class ReturnValue { - public: - // Handle setters - template void Set(const v8::Local &handle); - template void Set(const Nan::Global &handle); - - // Fast primitive setters - void Set(bool value); - void Set(double i); - void Set(int32_t i); - void Set(uint32_t i); - - // Fast JS primitive setters - void SetNull(); - void SetUndefined(); - void SetEmptyString(); - - // Convenience getter for isolate - v8::Isolate *GetIsolate() const; -}; -``` - -See the documentation on [`v8::ReturnValue`](https://v8docs.nodesource.com/node-8.11/da/da7/classv8_1_1_return_value.html) for further information on this. - - -### Method declaration - -JavaScript-accessible methods should be declared with the following signature to form a `Nan::FunctionCallback`: - -```c++ -typedef void(*FunctionCallback)(const FunctionCallbackInfo&); -``` - -Example: - -```c++ -void MethodName(const Nan::FunctionCallbackInfo& info) { - ... -} -``` - -You do not need to declare a new `HandleScope` within a method as one is implicitly created for you. - -**Example usage** - -```c++ -// .h: -class Foo : public Nan::ObjectWrap { - ... - - static void Bar(const Nan::FunctionCallbackInfo& info); - static void Baz(const Nan::FunctionCallbackInfo& info); -} - - -// .cc: -void Foo::Bar(const Nan::FunctionCallbackInfo& info) { - ... -} - -void Foo::Baz(const Nan::FunctionCallbackInfo& info) { - ... -} -``` - -A helper macro `NAN_METHOD(methodname)` exists, compatible with NAN v1 method declarations. - -**Example usage with `NAN_METHOD(methodname)`** - -```c++ -// .h: -class Foo : public Nan::ObjectWrap { - ... - - static NAN_METHOD(Bar); - static NAN_METHOD(Baz); -} - - -// .cc: -NAN_METHOD(Foo::Bar) { - ... -} - -NAN_METHOD(Foo::Baz) { - ... -} -``` - -Use [`Nan::SetPrototypeMethod`](#api_nan_set_prototype_method) to attach a method to a JavaScript function prototype or [`Nan::SetMethod`](#api_nan_set_method) to attach a method directly on a JavaScript object. - - -### Getter declaration - -JavaScript-accessible getters should be declared with the following signature to form a `Nan::GetterCallback`: - -```c++ -typedef void(*GetterCallback)(v8::Local, - const PropertyCallbackInfo&); -``` - -Example: - -```c++ -void GetterName(v8::Local property, - const Nan::PropertyCallbackInfo& info) { - ... -} -``` - -You do not need to declare a new `HandleScope` within a getter as one is implicitly created for you. - -A helper macro `NAN_GETTER(methodname)` exists, compatible with NAN v1 method declarations. - -Also see the V8 Embedders Guide documentation on [Accessors](https://developers.google.com/v8/embed#accesssors). - - -### Setter declaration - -JavaScript-accessible setters should be declared with the following signature to form a Nan::SetterCallback: - -```c++ -typedef void(*SetterCallback)(v8::Local, - v8::Local, - const PropertyCallbackInfo&); -``` - -Example: - -```c++ -void SetterName(v8::Local property, - v8::Local value, - const Nan::PropertyCallbackInfo& info) { - ... -} -``` - -You do not need to declare a new `HandleScope` within a setter as one is implicitly created for you. - -A helper macro `NAN_SETTER(methodname)` exists, compatible with NAN v1 method declarations. - -Also see the V8 Embedders Guide documentation on [Accessors](https://developers.google.com/v8/embed#accesssors). - - -### Property getter declaration - -JavaScript-accessible property getters should be declared with the following signature to form a Nan::PropertyGetterCallback: - -```c++ -typedef void(*PropertyGetterCallback)(v8::Local, - const PropertyCallbackInfo&); -``` - -Example: - -```c++ -void PropertyGetterName(v8::Local property, - const Nan::PropertyCallbackInfo& info) { - ... -} -``` - -You do not need to declare a new `HandleScope` within a property getter as one is implicitly created for you. - -A helper macro `NAN_PROPERTY_GETTER(methodname)` exists, compatible with NAN v1 method declarations. - -Also see the V8 Embedders Guide documentation on named property [Interceptors](https://developers.google.com/v8/embed#interceptors). - - -### Property setter declaration - -JavaScript-accessible property setters should be declared with the following signature to form a Nan::PropertySetterCallback: - -```c++ -typedef void(*PropertySetterCallback)(v8::Local, - v8::Local, - const PropertyCallbackInfo&); -``` - -Example: - -```c++ -void PropertySetterName(v8::Local property, - v8::Local value, - const Nan::PropertyCallbackInfo& info); -``` - -You do not need to declare a new `HandleScope` within a property setter as one is implicitly created for you. - -A helper macro `NAN_PROPERTY_SETTER(methodname)` exists, compatible with NAN v1 method declarations. - -Also see the V8 Embedders Guide documentation on named property [Interceptors](https://developers.google.com/v8/embed#interceptors). - - -### Property enumerator declaration - -JavaScript-accessible property enumerators should be declared with the following signature to form a Nan::PropertyEnumeratorCallback: - -```c++ -typedef void(*PropertyEnumeratorCallback)(const PropertyCallbackInfo&); -``` - -Example: - -```c++ -void PropertyEnumeratorName(const Nan::PropertyCallbackInfo& info); -``` - -You do not need to declare a new `HandleScope` within a property enumerator as one is implicitly created for you. - -A helper macro `NAN_PROPERTY_ENUMERATOR(methodname)` exists, compatible with NAN v1 method declarations. - -Also see the V8 Embedders Guide documentation on named property [Interceptors](https://developers.google.com/v8/embed#interceptors). - - -### Property deleter declaration - -JavaScript-accessible property deleters should be declared with the following signature to form a Nan::PropertyDeleterCallback: - -```c++ -typedef void(*PropertyDeleterCallback)(v8::Local, - const PropertyCallbackInfo&); -``` - -Example: - -```c++ -void PropertyDeleterName(v8::Local property, - const Nan::PropertyCallbackInfo& info); -``` - -You do not need to declare a new `HandleScope` within a property deleter as one is implicitly created for you. - -A helper macro `NAN_PROPERTY_DELETER(methodname)` exists, compatible with NAN v1 method declarations. - -Also see the V8 Embedders Guide documentation on named property [Interceptors](https://developers.google.com/v8/embed#interceptors). - - -### Property query declaration - -JavaScript-accessible property query methods should be declared with the following signature to form a Nan::PropertyQueryCallback: - -```c++ -typedef void(*PropertyQueryCallback)(v8::Local, - const PropertyCallbackInfo&); -``` - -Example: - -```c++ -void PropertyQueryName(v8::Local property, - const Nan::PropertyCallbackInfo& info); -``` - -You do not need to declare a new `HandleScope` within a property query method as one is implicitly created for you. - -A helper macro `NAN_PROPERTY_QUERY(methodname)` exists, compatible with NAN v1 method declarations. - -Also see the V8 Embedders Guide documentation on named property [Interceptors](https://developers.google.com/v8/embed#interceptors). - - -### Index getter declaration - -JavaScript-accessible index getter methods should be declared with the following signature to form a Nan::IndexGetterCallback: - -```c++ -typedef void(*IndexGetterCallback)(uint32_t, - const PropertyCallbackInfo&); -``` - -Example: - -```c++ -void IndexGetterName(uint32_t index, const PropertyCallbackInfo& info); -``` - -You do not need to declare a new `HandleScope` within a index getter as one is implicitly created for you. - -A helper macro `NAN_INDEX_GETTER(methodname)` exists, compatible with NAN v1 method declarations. - -Also see the V8 Embedders Guide documentation on indexed property [Interceptors](https://developers.google.com/v8/embed#interceptors). - - -### Index setter declaration - -JavaScript-accessible index setter methods should be declared with the following signature to form a Nan::IndexSetterCallback: - -```c++ -typedef void(*IndexSetterCallback)(uint32_t, - v8::Local, - const PropertyCallbackInfo&); -``` - -Example: - -```c++ -void IndexSetterName(uint32_t index, - v8::Local value, - const PropertyCallbackInfo& info); -``` - -You do not need to declare a new `HandleScope` within a index setter as one is implicitly created for you. - -A helper macro `NAN_INDEX_SETTER(methodname)` exists, compatible with NAN v1 method declarations. - -Also see the V8 Embedders Guide documentation on indexed property [Interceptors](https://developers.google.com/v8/embed#interceptors). - - -### Index enumerator declaration - -JavaScript-accessible index enumerator methods should be declared with the following signature to form a Nan::IndexEnumeratorCallback: - -```c++ -typedef void(*IndexEnumeratorCallback)(const PropertyCallbackInfo&); -``` - -Example: - -```c++ -void IndexEnumeratorName(const PropertyCallbackInfo& info); -``` - -You do not need to declare a new `HandleScope` within a index enumerator as one is implicitly created for you. - -A helper macro `NAN_INDEX_ENUMERATOR(methodname)` exists, compatible with NAN v1 method declarations. - -Also see the V8 Embedders Guide documentation on indexed property [Interceptors](https://developers.google.com/v8/embed#interceptors). - - -### Index deleter declaration - -JavaScript-accessible index deleter methods should be declared with the following signature to form a Nan::IndexDeleterCallback: - -```c++ -typedef void(*IndexDeleterCallback)(uint32_t, - const PropertyCallbackInfo&); -``` - -Example: - -```c++ -void IndexDeleterName(uint32_t index, const PropertyCallbackInfo& info); -``` - -You do not need to declare a new `HandleScope` within a index deleter as one is implicitly created for you. - -A helper macro `NAN_INDEX_DELETER(methodname)` exists, compatible with NAN v1 method declarations. - -Also see the V8 Embedders Guide documentation on indexed property [Interceptors](https://developers.google.com/v8/embed#interceptors). - - -### Index query declaration - -JavaScript-accessible index query methods should be declared with the following signature to form a Nan::IndexQueryCallback: - -```c++ -typedef void(*IndexQueryCallback)(uint32_t, - const PropertyCallbackInfo&); -``` - -Example: - -```c++ -void IndexQueryName(uint32_t index, const PropertyCallbackInfo& info); -``` - -You do not need to declare a new `HandleScope` within a index query method as one is implicitly created for you. - -A helper macro `NAN_INDEX_QUERY(methodname)` exists, compatible with NAN v1 method declarations. - -Also see the V8 Embedders Guide documentation on indexed property [Interceptors](https://developers.google.com/v8/embed#interceptors). - - -### Nan::SetMethod() - -Sets a method with a given name directly on a JavaScript object where the method has the `Nan::FunctionCallback` signature (see Method declaration). - -Signature: - -```c++ -void Nan::SetMethod(v8::Local recv, - const char *name, - Nan::FunctionCallback callback) -void Nan::SetMethod(v8::Local templ, - const char *name, - Nan::FunctionCallback callback) -``` - - -### Nan::SetPrototypeMethod() - -Sets a method with a given name on a `FunctionTemplate`'s prototype where the method has the `Nan::FunctionCallback` signature (see Method declaration). - -Signature: - -```c++ -void Nan::SetPrototypeMethod(v8::Local recv, - const char* name, - Nan::FunctionCallback callback) -``` - - -### Nan::SetAccessor() - -Sets getters and setters for a property with a given name on an `ObjectTemplate` or a plain `Object`. Accepts getters with the `Nan::GetterCallback` signature (see Getter declaration) and setters with the `Nan::SetterCallback` signature (see Setter declaration). - -Signature: - -```c++ -void SetAccessor(v8::Local tpl, - v8::Local name, - Nan::GetterCallback getter, - Nan::SetterCallback setter = 0, - v8::Local data = v8::Local(), - v8::AccessControl settings = v8::DEFAULT, - v8::PropertyAttribute attribute = v8::None, - imp::Sig signature = imp::Sig()); -bool SetAccessor(v8::Local obj, - v8::Local name, - Nan::GetterCallback getter, - Nan::SetterCallback setter = 0, - v8::Local data = v8::Local(), - v8::AccessControl settings = v8::DEFAULT, - v8::PropertyAttribute attribute = v8::None) -``` - -See the V8 [`ObjectTemplate#SetAccessor()`](https://v8docs.nodesource.com/node-8.11/db/d5f/classv8_1_1_object_template.html#aca0ed196f8a9adb1f68b1aadb6c9cd77) and [`Object#SetAccessor()`](https://v8docs.nodesource.com/node-8.11/db/d85/classv8_1_1_object.html#ae91b3b56b357f285288c89fbddc46d1b) for further information about how to use `Nan::SetAccessor()`. - - -### Nan::SetNamedPropertyHandler() - -Sets named property getters, setters, query, deleter and enumerator methods on an `ObjectTemplate`. Accepts: - -* Property getters with the `Nan::PropertyGetterCallback` signature (see Property getter declaration) -* Property setters with the `Nan::PropertySetterCallback` signature (see Property setter declaration) -* Property query methods with the `Nan::PropertyQueryCallback` signature (see Property query declaration) -* Property deleters with the `Nan::PropertyDeleterCallback` signature (see Property deleter declaration) -* Property enumerators with the `Nan::PropertyEnumeratorCallback` signature (see Property enumerator declaration) - -Signature: - -```c++ -void SetNamedPropertyHandler(v8::Local tpl, - Nan::PropertyGetterCallback getter, - Nan::PropertySetterCallback setter = 0, - Nan::PropertyQueryCallback query = 0, - Nan::PropertyDeleterCallback deleter = 0, - Nan::PropertyEnumeratorCallback enumerator = 0, - v8::Local data = v8::Local()) -``` - -See the V8 [`ObjectTemplate#SetNamedPropertyHandler()`](https://v8docs.nodesource.com/node-8.11/db/d5f/classv8_1_1_object_template.html#a33b3ebd7de641f6cc6414b7de01fc1c7) for further information about how to use `Nan::SetNamedPropertyHandler()`. - - -### Nan::SetIndexedPropertyHandler() - -Sets indexed property getters, setters, query, deleter and enumerator methods on an `ObjectTemplate`. Accepts: - -* Indexed property getters with the `Nan::IndexGetterCallback` signature (see Index getter declaration) -* Indexed property setters with the `Nan::IndexSetterCallback` signature (see Index setter declaration) -* Indexed property query methods with the `Nan::IndexQueryCallback` signature (see Index query declaration) -* Indexed property deleters with the `Nan::IndexDeleterCallback` signature (see Index deleter declaration) -* Indexed property enumerators with the `Nan::IndexEnumeratorCallback` signature (see Index enumerator declaration) - -Signature: - -```c++ -void SetIndexedPropertyHandler(v8::Local tpl, - Nan::IndexGetterCallback getter, - Nan::IndexSetterCallback setter = 0, - Nan::IndexQueryCallback query = 0, - Nan::IndexDeleterCallback deleter = 0, - Nan::IndexEnumeratorCallback enumerator = 0, - v8::Local data = v8::Local()) -``` - -See the V8 [`ObjectTemplate#SetIndexedPropertyHandler()`](https://v8docs.nodesource.com/node-8.11/db/d5f/classv8_1_1_object_template.html#ac89f06d634add0e890452033f7d17ff1) for further information about how to use `Nan::SetIndexedPropertyHandler()`. - - -### Nan::SetTemplate() - -Adds properties on an `Object`'s or `Function`'s template. - -Signature: - -```c++ -void Nan::SetTemplate(v8::Local templ, - const char *name, - v8::Local value); -void Nan::SetTemplate(v8::Local templ, - v8::Local name, - v8::Local value, - v8::PropertyAttribute attributes) -``` - -Calls the `Template`'s [`Set()`](https://v8docs.nodesource.com/node-8.11/db/df7/classv8_1_1_template.html#ae3fbaff137557aa6a0233bc7e52214ac). - - -### Nan::SetPrototypeTemplate() - -Adds properties on an `Object`'s or `Function`'s prototype template. - -Signature: - -```c++ -void Nan::SetPrototypeTemplate(v8::Local templ, - const char *name, - v8::Local value); -void Nan::SetPrototypeTemplate(v8::Local templ, - v8::Local name, - v8::Local value, - v8::PropertyAttribute attributes) -``` - -Calls the `FunctionTemplate`'s _PrototypeTemplate's_ [`Set()`](https://v8docs.nodesource.com/node-8.11/db/df7/classv8_1_1_template.html#a2db6a56597bf23c59659c0659e564ddf). - - -### Nan::SetInstanceTemplate() - -Use to add instance properties on `FunctionTemplate`'s. - -Signature: - -```c++ -void Nan::SetInstanceTemplate(v8::Local templ, - const char *name, - v8::Local value); -void Nan::SetInstanceTemplate(v8::Local templ, - v8::Local name, - v8::Local value, - v8::PropertyAttribute attributes) -``` - -Calls the `FunctionTemplate`'s _InstanceTemplate's_ [`Set()`](https://v8docs.nodesource.com/node-8.11/db/df7/classv8_1_1_template.html#a2db6a56597bf23c59659c0659e564ddf). - - -### Nan::SetCallHandler() - -Set the call-handler callback for a `v8::FunctionTemplate`. -This callback is called whenever the function created from this FunctionTemplate is called. - -Signature: - -```c++ -void Nan::SetCallHandler(v8::Local templ, Nan::FunctionCallback callback, v8::Local data = v8::Local()) -``` - -Calls the `FunctionTemplate`'s [`SetCallHandler()`](https://v8docs.nodesource.com/node-8.11/d8/d83/classv8_1_1_function_template.html#ab7574b298db3c27fbc2ed465c08ea2f8). - - -### Nan::SetCallAsFunctionHandler() - -Sets the callback to be used when calling instances created from the `v8::ObjectTemplate` as a function. -If no callback is set, instances behave like normal JavaScript objects that cannot be called as a function. - -Signature: - -```c++ -void Nan::SetCallAsFunctionHandler(v8::Local templ, Nan::FunctionCallback callback, v8::Local data = v8::Local()) -``` - -Calls the `ObjectTemplate`'s [`SetCallAsFunctionHandler()`](https://v8docs.nodesource.com/node-8.11/db/d5f/classv8_1_1_object_template.html#a5e9612fc80bf6db8f2da199b9b0bd04e). - diff --git a/node_modules/websocket/node_modules/nan/doc/new.md b/node_modules/websocket/node_modules/nan/doc/new.md deleted file mode 100644 index 359df43..0000000 --- a/node_modules/websocket/node_modules/nan/doc/new.md +++ /dev/null @@ -1,147 +0,0 @@ -## New - -NAN provides a `Nan::New()` helper for the creation of new JavaScript objects in a way that's compatible across the supported versions of V8. - - - Nan::New() - - Nan::Undefined() - - Nan::Null() - - Nan::True() - - Nan::False() - - Nan::EmptyString() - - - -### Nan::New() - -`Nan::New()` should be used to instantiate new JavaScript objects. - -Refer to the specific V8 type in the [V8 documentation](https://v8docs.nodesource.com/node-8.11/d1/d83/classv8_1_1_data.html) for information on the types of arguments required for instantiation. - -Signatures: - -Return types are mostly omitted from the signatures for simplicity. In most cases the type will be contained within a `v8::Local`. The following types will be contained within a `Nan::MaybeLocal`: `v8::String`, `v8::Date`, `v8::RegExp`, `v8::Script`, `v8::UnboundScript`. - -Empty objects: - -```c++ -Nan::New(); -``` - -Generic single and multiple-argument: - -```c++ -Nan::New(A0 arg0); -Nan::New(A0 arg0, A1 arg1); -Nan::New(A0 arg0, A1 arg1, A2 arg2); -Nan::New(A0 arg0, A1 arg1, A2 arg2, A3 arg3); -``` - -For creating `v8::FunctionTemplate` and `v8::Function` objects: - -_The definition of `Nan::FunctionCallback` can be found in the [Method declaration](./methods.md#api_nan_method) documentation._ - -```c++ -Nan::New(Nan::FunctionCallback callback, - v8::Local data = v8::Local()); -Nan::New(Nan::FunctionCallback callback, - v8::Local data = v8::Local(), - A2 a2 = A2()); -``` - -Native number types: - -```c++ -v8::Local Nan::New(bool value); -v8::Local Nan::New(int32_t value); -v8::Local Nan::New(uint32_t value); -v8::Local Nan::New(double value); -``` - -String types: - -```c++ -Nan::MaybeLocal Nan::New(std::string const& value); -Nan::MaybeLocal Nan::New(const char * value, int length); -Nan::MaybeLocal Nan::New(const char * value); -Nan::MaybeLocal Nan::New(const uint16_t * value); -Nan::MaybeLocal Nan::New(const uint16_t * value, int length); -``` - -Specialized types: - -```c++ -v8::Local Nan::New(v8::String::ExternalStringResource * value); -v8::Local Nan::New(Nan::ExternalOneByteStringResource * value); -v8::Local Nan::New(v8::Local pattern, v8::RegExp::Flags flags); -``` - -Note that `Nan::ExternalOneByteStringResource` maps to [`v8::String::ExternalOneByteStringResource`](https://v8docs.nodesource.com/node-8.11/d9/db3/classv8_1_1_string_1_1_external_one_byte_string_resource.html), and `v8::String::ExternalAsciiStringResource` in older versions of V8. - - - -### Nan::Undefined() - -A helper method to reference the `v8::Undefined` object in a way that is compatible across all supported versions of V8. - -Signature: - -```c++ -v8::Local Nan::Undefined() -``` - - -### Nan::Null() - -A helper method to reference the `v8::Null` object in a way that is compatible across all supported versions of V8. - -Signature: - -```c++ -v8::Local Nan::Null() -``` - - -### Nan::True() - -A helper method to reference the `v8::Boolean` object representing the `true` value in a way that is compatible across all supported versions of V8. - -Signature: - -```c++ -v8::Local Nan::True() -``` - - -### Nan::False() - -A helper method to reference the `v8::Boolean` object representing the `false` value in a way that is compatible across all supported versions of V8. - -Signature: - -```c++ -v8::Local Nan::False() -``` - - -### Nan::EmptyString() - -Call [`v8::String::Empty`](https://v8docs.nodesource.com/node-8.11/d2/db3/classv8_1_1_string.html#a7c1bc8886115d7ee46f1d571dd6ebc6d) to reference the empty string in a way that is compatible across all supported versions of V8. - -Signature: - -```c++ -v8::Local Nan::EmptyString() -``` - - - -### Nan::NewOneByteString() - -An implementation of [`v8::String::NewFromOneByte()`](https://v8docs.nodesource.com/node-8.11/d2/db3/classv8_1_1_string.html#a5264d50b96d2c896ce525a734dc10f09) provided for consistent availability and API across supported versions of V8. Allocates a new string from Latin-1 data. - -Signature: - -```c++ -Nan::MaybeLocal Nan::NewOneByteString(const uint8_t * value, - int length = -1) -``` diff --git a/node_modules/websocket/node_modules/nan/doc/node_misc.md b/node_modules/websocket/node_modules/nan/doc/node_misc.md deleted file mode 100644 index 17578e3..0000000 --- a/node_modules/websocket/node_modules/nan/doc/node_misc.md +++ /dev/null @@ -1,123 +0,0 @@ -## Miscellaneous Node Helpers - - - Nan::AsyncResource - - Nan::MakeCallback() - - NAN_MODULE_INIT() - - Nan::Export() - - -### Nan::AsyncResource - -This class is analogous to the `AsyncResource` JavaScript class exposed by Node's [async_hooks][] API. - -When calling back into JavaScript asynchronously, special care must be taken to ensure that the runtime can properly track -async hops. `Nan::AsyncResource` is a class that provides an RAII wrapper around `node::EmitAsyncInit`, `node::EmitAsyncDestroy`, -and `node::MakeCallback`. Using this mechanism to call back into JavaScript, as opposed to `Nan::MakeCallback` or -`v8::Function::Call` ensures that the callback is executed in the correct async context. This ensures that async mechanisms -such as domains and [async_hooks][] function correctly. - -Definition: - -```c++ -class AsyncResource { - public: - AsyncResource(v8::Local name, - v8::Local resource = New()); - AsyncResource(const char* name, - v8::Local resource = New()); - ~AsyncResource(); - - v8::MaybeLocal runInAsyncScope(v8::Local target, - v8::Local func, - int argc, - v8::Local* argv); - v8::MaybeLocal runInAsyncScope(v8::Local target, - v8::Local symbol, - int argc, - v8::Local* argv); - v8::MaybeLocal runInAsyncScope(v8::Local target, - const char* method, - int argc, - v8::Local* argv); -}; -``` - -* `name`: Identifier for the kind of resource that is being provided for diagnostics information exposed by the [async_hooks][] - API. This will be passed to the possible `init` hook as the `type`. To avoid name collisions with other modules we recommend - that the name include the name of the owning module as a prefix. For example `mysql` module could use something like - `mysql:batch-db-query-resource`. -* `resource`: An optional object associated with the async work that will be passed to the possible [async_hooks][] - `init` hook. If this parameter is omitted, or an empty handle is provided, this object will be created automatically. -* When calling JS on behalf of this resource, one can use `runInAsyncScope`. This will ensure that the callback runs in the - correct async execution context. -* `AsyncDestroy` is automatically called when an AsyncResource object is destroyed. - -For more details, see the Node [async_hooks][] documentation. You might also want to take a look at the documentation for the -[N-API counterpart][napi]. For example usage, see the `asyncresource.cpp` example in the `test/cpp` directory. - - -### Nan::MakeCallback() - -Deprecated wrappers around the legacy `node::MakeCallback()` APIs. Node.js 10+ -has deprecated these legacy APIs as they do not provide a mechanism to preserve -async context. - -We recommend that you use the `AsyncResource` class and `AsyncResource::runInAsyncScope` instead of using `Nan::MakeCallback` or -`v8::Function#Call()` directly. `AsyncResource` properly takes care of running the callback in the correct async execution -context – something that is essential for functionality like domains, async_hooks and async debugging. - -Signatures: - -```c++ -NAN_DEPRECATED -v8::Local Nan::MakeCallback(v8::Local target, - v8::Local func, - int argc, - v8::Local* argv); -NAN_DEPRECATED -v8::Local Nan::MakeCallback(v8::Local target, - v8::Local symbol, - int argc, - v8::Local* argv); -NAN_DEPRECATED -v8::Local Nan::MakeCallback(v8::Local target, - const char* method, - int argc, - v8::Local* argv); -``` - - - -### NAN_MODULE_INIT() - -Used to define the entry point function to a Node add-on. Creates a function with a given `name` that receives a `target` object representing the equivalent of the JavaScript `exports` object. - -See example below. - - -### Nan::Export() - -A simple helper to register a `v8::FunctionTemplate` from a JavaScript-accessible method (see [Methods](./methods.md)) as a property on an object. Can be used in a way similar to assigning properties to `module.exports` in JavaScript. - -Signature: - -```c++ -void Export(v8::Local target, const char *name, Nan::FunctionCallback f) -``` - -Also available as the shortcut `NAN_EXPORT` macro. - -Example: - -```c++ -NAN_METHOD(Foo) { - ... -} - -NAN_MODULE_INIT(Init) { - NAN_EXPORT(target, Foo); -} -``` - -[async_hooks]: https://nodejs.org/dist/latest-v9.x/docs/api/async_hooks.html -[napi]: https://nodejs.org/dist/latest-v9.x/docs/api/n-api.html#n_api_custom_asynchronous_operations diff --git a/node_modules/websocket/node_modules/nan/doc/object_wrappers.md b/node_modules/websocket/node_modules/nan/doc/object_wrappers.md deleted file mode 100644 index 08dd6b5..0000000 --- a/node_modules/websocket/node_modules/nan/doc/object_wrappers.md +++ /dev/null @@ -1,263 +0,0 @@ -## Object Wrappers - -The `ObjectWrap` class can be used to make wrapped C++ objects and a factory of wrapped objects. - - - Nan::ObjectWrap - - - -### Nan::ObjectWrap() - -A reimplementation of `node::ObjectWrap` that adds some API not present in older versions of Node. Should be preferred over `node::ObjectWrap` in all cases for consistency. - -Definition: - -```c++ -class ObjectWrap { - public: - ObjectWrap(); - - virtual ~ObjectWrap(); - - template - static inline T* Unwrap(v8::Local handle); - - inline v8::Local handle(); - - inline Nan::Persistent& persistent(); - - protected: - inline void Wrap(v8::Local handle); - - inline void MakeWeak(); - - /* Ref() marks the object as being attached to an event loop. - * Refed objects will not be garbage collected, even if - * all references are lost. - */ - virtual void Ref(); - - /* Unref() marks an object as detached from the event loop. This is its - * default state. When an object with a "weak" reference changes from - * attached to detached state it will be freed. Be careful not to access - * the object after making this call as it might be gone! - * (A "weak reference" means an object that only has a - * persistant handle.) - * - * DO NOT CALL THIS FROM DESTRUCTOR - */ - virtual void Unref(); - - int refs_; // ro -}; -``` - -See the Node documentation on [Wrapping C++ Objects](https://nodejs.org/api/addons.html#addons_wrapping_c_objects) for more details. - -### This vs. Holder - -When calling `Unwrap`, it is important that the argument is indeed some JavaScript object which got wrapped by a `Wrap` call for this class or any derived class. -The `Signature` installed by [`Nan::SetPrototypeMethod()`](methods.md#api_nan_set_prototype_method) does ensure that `info.Holder()` is just such an instance. -In Node 0.12 and later, `info.This()` will also be of such a type, since otherwise the invocation will get rejected. -However, in Node 0.10 and before it was possible to invoke a method on a JavaScript object which just had the extension type in its prototype chain. -In such a situation, calling `Unwrap` on `info.This()` will likely lead to a failed assertion causing a crash, but could lead to even more serious corruption. - -On the other hand, calling `Unwrap` in an [accessor](methods.md#api_nan_set_accessor) should not use `Holder()` if the accessor is defined on the prototype. -So either define your accessors on the instance template, -or use `This()` after verifying that it is indeed a valid object. - -### Examples - -#### Basic - -```c++ -class MyObject : public Nan::ObjectWrap { - public: - static NAN_MODULE_INIT(Init) { - v8::Local tpl = Nan::New(New); - tpl->SetClassName(Nan::New("MyObject").ToLocalChecked()); - tpl->InstanceTemplate()->SetInternalFieldCount(1); - - Nan::SetPrototypeMethod(tpl, "getHandle", GetHandle); - Nan::SetPrototypeMethod(tpl, "getValue", GetValue); - - constructor().Reset(Nan::GetFunction(tpl).ToLocalChecked()); - Nan::Set(target, Nan::New("MyObject").ToLocalChecked(), - Nan::GetFunction(tpl).ToLocalChecked()); - } - - private: - explicit MyObject(double value = 0) : value_(value) {} - ~MyObject() {} - - static NAN_METHOD(New) { - if (info.IsConstructCall()) { - double value = info[0]->IsUndefined() ? 0 : Nan::To(info[0]).FromJust(); - MyObject *obj = new MyObject(value); - obj->Wrap(info.This()); - info.GetReturnValue().Set(info.This()); - } else { - const int argc = 1; - v8::Local argv[argc] = {info[0]}; - v8::Local cons = Nan::New(constructor()); - info.GetReturnValue().Set(Nan::NewInstance(cons, argc, argv).ToLocalChecked()); - } - } - - static NAN_METHOD(GetHandle) { - MyObject* obj = Nan::ObjectWrap::Unwrap(info.Holder()); - info.GetReturnValue().Set(obj->handle()); - } - - static NAN_METHOD(GetValue) { - MyObject* obj = Nan::ObjectWrap::Unwrap(info.Holder()); - info.GetReturnValue().Set(obj->value_); - } - - static inline Nan::Persistent & constructor() { - static Nan::Persistent my_constructor; - return my_constructor; - } - - double value_; -}; - -NODE_MODULE(objectwrapper, MyObject::Init) -``` - -To use in Javascript: - -```Javascript -var objectwrapper = require('bindings')('objectwrapper'); - -var obj = new objectwrapper.MyObject(5); -console.log('Should be 5: ' + obj.getValue()); -``` - -#### Factory of wrapped objects - -```c++ -class MyFactoryObject : public Nan::ObjectWrap { - public: - static NAN_MODULE_INIT(Init) { - v8::Local tpl = Nan::New(New); - tpl->InstanceTemplate()->SetInternalFieldCount(1); - - Nan::SetPrototypeMethod(tpl, "getValue", GetValue); - - constructor().Reset(Nan::GetFunction(tpl).ToLocalChecked()); - } - - static NAN_METHOD(NewInstance) { - v8::Local cons = Nan::New(constructor()); - double value = info[0]->IsNumber() ? Nan::To(info[0]).FromJust() : 0; - const int argc = 1; - v8::Local argv[1] = {Nan::New(value)}; - info.GetReturnValue().Set(Nan::NewInstance(cons, argc, argv).ToLocalChecked()); - } - - // Needed for the next example: - inline double value() const { - return value_; - } - - private: - explicit MyFactoryObject(double value = 0) : value_(value) {} - ~MyFactoryObject() {} - - static NAN_METHOD(New) { - if (info.IsConstructCall()) { - double value = info[0]->IsNumber() ? Nan::To(info[0]).FromJust() : 0; - MyFactoryObject * obj = new MyFactoryObject(value); - obj->Wrap(info.This()); - info.GetReturnValue().Set(info.This()); - } else { - const int argc = 1; - v8::Local argv[argc] = {info[0]}; - v8::Local cons = Nan::New(constructor()); - info.GetReturnValue().Set(Nan::NewInstance(cons, argc, argv).ToLocalChecked()); - } - } - - static NAN_METHOD(GetValue) { - MyFactoryObject* obj = ObjectWrap::Unwrap(info.Holder()); - info.GetReturnValue().Set(obj->value_); - } - - static inline Nan::Persistent & constructor() { - static Nan::Persistent my_constructor; - return my_constructor; - } - - double value_; -}; - -NAN_MODULE_INIT(Init) { - MyFactoryObject::Init(target); - Nan::Set(target, - Nan::New("newFactoryObjectInstance").ToLocalChecked(), - Nan::GetFunction( - Nan::New(MyFactoryObject::NewInstance)).ToLocalChecked() - ); -} - -NODE_MODULE(wrappedobjectfactory, Init) -``` - -To use in Javascript: - -```Javascript -var wrappedobjectfactory = require('bindings')('wrappedobjectfactory'); - -var obj = wrappedobjectfactory.newFactoryObjectInstance(10); -console.log('Should be 10: ' + obj.getValue()); -``` - -#### Passing wrapped objects around - -Use the `MyFactoryObject` class above along with the following: - -```c++ -static NAN_METHOD(Sum) { - Nan::MaybeLocal maybe1 = Nan::To(info[0]); - Nan::MaybeLocal maybe2 = Nan::To(info[1]); - - // Quick check: - if (maybe1.IsEmpty() || maybe2.IsEmpty()) { - // return value is undefined by default - return; - } - - MyFactoryObject* obj1 = - Nan::ObjectWrap::Unwrap(maybe1.ToLocalChecked()); - MyFactoryObject* obj2 = - Nan::ObjectWrap::Unwrap(maybe2.ToLocalChecked()); - - info.GetReturnValue().Set(Nan::New(obj1->value() + obj2->value())); -} - -NAN_MODULE_INIT(Init) { - MyFactoryObject::Init(target); - Nan::Set(target, - Nan::New("newFactoryObjectInstance").ToLocalChecked(), - Nan::GetFunction( - Nan::New(MyFactoryObject::NewInstance)).ToLocalChecked() - ); - Nan::Set(target, - Nan::New("sum").ToLocalChecked(), - Nan::GetFunction(Nan::New(Sum)).ToLocalChecked() - ); -} - -NODE_MODULE(myaddon, Init) -``` - -To use in Javascript: - -```Javascript -var myaddon = require('bindings')('myaddon'); - -var obj1 = myaddon.newFactoryObjectInstance(5); -var obj2 = myaddon.newFactoryObjectInstance(10); -console.log('sum of object values: ' + myaddon.sum(obj1, obj2)); -``` diff --git a/node_modules/websocket/node_modules/nan/doc/persistent.md b/node_modules/websocket/node_modules/nan/doc/persistent.md deleted file mode 100644 index bec9c3f..0000000 --- a/node_modules/websocket/node_modules/nan/doc/persistent.md +++ /dev/null @@ -1,296 +0,0 @@ -## Persistent references - -An object reference that is independent of any `HandleScope` is a _persistent_ reference. Where a `Local` handle only lives as long as the `HandleScope` in which it was allocated, a `Persistent` handle remains valid until it is explicitly disposed. - -Due to the evolution of the V8 API, it is necessary for NAN to provide a wrapper implementation of the `Persistent` classes to supply compatibility across the V8 versions supported. - - - Nan::PersistentBase & v8::PersistentBase - - Nan::NonCopyablePersistentTraits & v8::NonCopyablePersistentTraits - - Nan::CopyablePersistentTraits & v8::CopyablePersistentTraits - - Nan::Persistent - - Nan::Global - - Nan::WeakCallbackInfo - - Nan::WeakCallbackType - -Also see the V8 Embedders Guide section on [Handles and Garbage Collection](https://developers.google.com/v8/embed#handles). - - -### Nan::PersistentBase & v8::PersistentBase - -A persistent handle contains a reference to a storage cell in V8 which holds an object value and which is updated by the garbage collector whenever the object is moved. A new storage cell can be created using the constructor or `Nan::PersistentBase::Reset()`. Existing handles can be disposed using an argument-less `Nan::PersistentBase::Reset()`. - -Definition: - -_(note: this is implemented as `Nan::PersistentBase` for older versions of V8 and the native `v8::PersistentBase` is used for newer versions of V8)_ - -```c++ -template class PersistentBase { - public: - /** - * If non-empty, destroy the underlying storage cell - */ - void Reset(); - - /** - * If non-empty, destroy the underlying storage cell and create a new one with - * the contents of another if it is also non-empty - */ - template void Reset(const v8::Local &other); - - /** - * If non-empty, destroy the underlying storage cell and create a new one with - * the contents of another if it is also non-empty - */ - template void Reset(const PersistentBase &other); - - /** Returns true if the handle is empty. */ - bool IsEmpty() const; - - /** - * If non-empty, destroy the underlying storage cell - * IsEmpty() will return true after this call. - */ - void Empty(); - - template bool operator==(const PersistentBase &that); - - template bool operator==(const v8::Local &that); - - template bool operator!=(const PersistentBase &that); - - template bool operator!=(const v8::Local &that); - - /** - * Install a finalization callback on this object. - * NOTE: There is no guarantee as to *when* or even *if* the callback is - * invoked. The invocation is performed solely on a best effort basis. - * As always, GC-based finalization should *not* be relied upon for any - * critical form of resource management! At the moment you can either - * specify a parameter for the callback or the location of two internal - * fields in the dying object. - */ - template - void SetWeak(P *parameter, - typename WeakCallbackInfo

::Callback callback, - WeakCallbackType type); - - void ClearWeak(); - - /** - * Marks the reference to this object independent. Garbage collector is free - * to ignore any object groups containing this object. Weak callback for an - * independent handle should not assume that it will be preceded by a global - * GC prologue callback or followed by a global GC epilogue callback. - */ - void MarkIndependent() const; - - bool IsIndependent() const; - - /** Checks if the handle holds the only reference to an object. */ - bool IsNearDeath() const; - - /** Returns true if the handle's reference is weak. */ - bool IsWeak() const -}; -``` - -See the V8 documentation for [`PersistentBase`](https://v8docs.nodesource.com/node-8.11/d4/dca/classv8_1_1_persistent_base.html) for further information. - -**Tip:** To get a `v8::Local` reference to the original object back from a `PersistentBase` or `Persistent` object: - -```c++ -v8::Local object = Nan::New(persistent); -``` - - -### Nan::NonCopyablePersistentTraits & v8::NonCopyablePersistentTraits - -Default traits for `Nan::Persistent`. This class does not allow use of the a copy constructor or assignment operator. At present `kResetInDestructor` is not set, but that will change in a future version. - -Definition: - -_(note: this is implemented as `Nan::NonCopyablePersistentTraits` for older versions of V8 and the native `v8::NonCopyablePersistentTraits` is used for newer versions of V8)_ - -```c++ -template class NonCopyablePersistentTraits { - public: - typedef Persistent > NonCopyablePersistent; - - static const bool kResetInDestructor = false; - - template - static void Copy(const Persistent &source, - NonCopyablePersistent *dest); - - template static void Uncompilable(); -}; -``` - -See the V8 documentation for [`NonCopyablePersistentTraits`](https://v8docs.nodesource.com/node-8.11/de/d73/classv8_1_1_non_copyable_persistent_traits.html) for further information. - - -### Nan::CopyablePersistentTraits & v8::CopyablePersistentTraits - -A helper class of traits to allow copying and assignment of `Persistent`. This will clone the contents of storage cell, but not any of the flags, etc.. - -Definition: - -_(note: this is implemented as `Nan::CopyablePersistentTraits` for older versions of V8 and the native `v8::NonCopyablePersistentTraits` is used for newer versions of V8)_ - -```c++ -template -class CopyablePersistentTraits { - public: - typedef Persistent > CopyablePersistent; - - static const bool kResetInDestructor = true; - - template - static void Copy(const Persistent &source, - CopyablePersistent *dest); -}; -``` - -See the V8 documentation for [`CopyablePersistentTraits`](https://v8docs.nodesource.com/node-8.11/da/d5c/structv8_1_1_copyable_persistent_traits.html) for further information. - - -### Nan::Persistent - -A type of `PersistentBase` which allows copy and assignment. Copy, assignment and destructor behavior is controlled by the traits class `M`. - -Definition: - -```c++ -template > -class Persistent; - -template class Persistent : public PersistentBase { - public: - /** - * A Persistent with no storage cell. - */ - Persistent(); - - /** - * Construct a Persistent from a v8::Local. When the v8::Local is non-empty, a - * new storage cell is created pointing to the same object, and no flags are - * set. - */ - template Persistent(v8::Local that); - - /** - * Construct a Persistent from a Persistent. When the Persistent is non-empty, - * a new storage cell is created pointing to the same object, and no flags are - * set. - */ - Persistent(const Persistent &that); - - /** - * The copy constructors and assignment operator create a Persistent exactly - * as the Persistent constructor, but the Copy function from the traits class - * is called, allowing the setting of flags based on the copied Persistent. - */ - Persistent &operator=(const Persistent &that); - - template - Persistent &operator=(const Persistent &that); - - /** - * The destructor will dispose the Persistent based on the kResetInDestructor - * flags in the traits class. Since not calling dispose can result in a - * memory leak, it is recommended to always set this flag. - */ - ~Persistent(); -}; -``` - -See the V8 documentation for [`Persistent`](https://v8docs.nodesource.com/node-8.11/d2/d78/classv8_1_1_persistent.html) for further information. - - -### Nan::Global - -A type of `PersistentBase` which has move semantics. - -```c++ -template class Global : public PersistentBase { - public: - /** - * A Global with no storage cell. - */ - Global(); - - /** - * Construct a Global from a v8::Local. When the v8::Local is non-empty, a new - * storage cell is created pointing to the same object, and no flags are set. - */ - template Global(v8::Local that); - /** - * Construct a Global from a PersistentBase. When the Persistent is non-empty, - * a new storage cell is created pointing to the same object, and no flags are - * set. - */ - template Global(const PersistentBase &that); - - /** - * Pass allows returning globals from functions, etc. - */ - Global Pass(); -}; -``` - -See the V8 documentation for [`Global`](https://v8docs.nodesource.com/node-8.11/d5/d40/classv8_1_1_global.html) for further information. - - -### Nan::WeakCallbackInfo - -`Nan::WeakCallbackInfo` is used as an argument when setting a persistent reference as weak. You may need to free any external resources attached to the object. It is a mirror of `v8:WeakCallbackInfo` as found in newer versions of V8. - -Definition: - -```c++ -template class WeakCallbackInfo { - public: - typedef void (*Callback)(const WeakCallbackInfo& data); - - v8::Isolate *GetIsolate() const; - - /** - * Get the parameter that was associated with the weak handle. - */ - T *GetParameter() const; - - /** - * Get pointer from internal field, index can be 0 or 1. - */ - void *GetInternalField(int index) const; -}; -``` - -Example usage: - -```c++ -void weakCallback(const WeakCallbackInfo &data) { - int *parameter = data.GetParameter(); - delete parameter; -} - -Persistent obj; -int *data = new int(0); -obj.SetWeak(data, callback, WeakCallbackType::kParameter); -``` - -See the V8 documentation for [`WeakCallbackInfo`](https://v8docs.nodesource.com/node-8.11/d8/d06/classv8_1_1_weak_callback_info.html) for further information. - - -### Nan::WeakCallbackType - -Represents the type of a weak callback. -A weak callback of type `kParameter` makes the supplied parameter to `Nan::PersistentBase::SetWeak` available through `WeakCallbackInfo::GetParameter`. -A weak callback of type `kInternalFields` uses up to two internal fields at indices 0 and 1 on the `Nan::PersistentBase` being made weak. -Note that only `v8::Object`s and derivatives can have internal fields. - -Definition: - -```c++ -enum class WeakCallbackType { kParameter, kInternalFields }; -``` diff --git a/node_modules/websocket/node_modules/nan/doc/scopes.md b/node_modules/websocket/node_modules/nan/doc/scopes.md deleted file mode 100644 index 27ab863..0000000 --- a/node_modules/websocket/node_modules/nan/doc/scopes.md +++ /dev/null @@ -1,73 +0,0 @@ -## Scopes - -A _local handle_ is a pointer to an object. All V8 objects are accessed using handles, they are necessary because of the way the V8 garbage collector works. - -A handle scope can be thought of as a container for any number of handles. When you've finished with your handles, instead of deleting each one individually you can simply delete their scope. - -The creation of `HandleScope` objects is different across the supported versions of V8. Therefore, NAN provides its own implementations that can be used safely across these. - - - Nan::HandleScope - - Nan::EscapableHandleScope - -Also see the V8 Embedders Guide section on [Handles and Garbage Collection](https://github.com/v8/v8/wiki/Embedder%27s%20Guide#handles-and-garbage-collection). - - -### Nan::HandleScope - -A simple wrapper around [`v8::HandleScope`](https://v8docs.nodesource.com/node-8.11/d3/d95/classv8_1_1_handle_scope.html). - -Definition: - -```c++ -class Nan::HandleScope { - public: - Nan::HandleScope(); - static int NumberOfHandles(); -}; -``` - -Allocate a new `Nan::HandleScope` whenever you are creating new V8 JavaScript objects. Note that an implicit `HandleScope` is created for you on JavaScript-accessible methods so you do not need to insert one yourself. - -Example: - -```c++ -// new object is created, it needs a new scope: -void Pointless() { - Nan::HandleScope scope; - v8::Local obj = Nan::New(); -} - -// JavaScript-accessible method already has a HandleScope -NAN_METHOD(Pointless2) { - v8::Local obj = Nan::New(); -} -``` - - -### Nan::EscapableHandleScope - -Similar to [`Nan::HandleScope`](#api_nan_handle_scope) but should be used in cases where a function needs to return a V8 JavaScript type that has been created within it. - -Definition: - -```c++ -class Nan::EscapableHandleScope { - public: - Nan::EscapableHandleScope(); - static int NumberOfHandles(); - template v8::Local Escape(v8::Local value); -} -``` - -Use `Escape(value)` to return the object. - -Example: - -```c++ -v8::Local EmptyObj() { - Nan::EscapableHandleScope scope; - v8::Local obj = Nan::New(); - return scope.Escape(obj); -} -``` - diff --git a/node_modules/websocket/node_modules/nan/doc/script.md b/node_modules/websocket/node_modules/nan/doc/script.md deleted file mode 100644 index 945398f..0000000 --- a/node_modules/websocket/node_modules/nan/doc/script.md +++ /dev/null @@ -1,38 +0,0 @@ -## Script - -NAN provides a `v8::Script` helpers as the API has changed over the supported versions of V8. - - - Nan::CompileScript() - - Nan::RunScript() - - - -### Nan::CompileScript() - -A wrapper around [`v8::ScriptCompiler::Compile()`](https://v8docs.nodesource.com/node-8.11/da/da5/classv8_1_1_script_compiler.html#a93f5072a0db55d881b969e9fc98e564b). - -Note that `Nan::BoundScript` is an alias for `v8::Script`. - -Signature: - -```c++ -Nan::MaybeLocal Nan::CompileScript( - v8::Local s, - const v8::ScriptOrigin& origin); -Nan::MaybeLocal Nan::CompileScript(v8::Local s); -``` - - - -### Nan::RunScript() - -Calls `script->Run()` or `script->BindToCurrentContext()->Run(Nan::GetCurrentContext())`. - -Note that `Nan::BoundScript` is an alias for `v8::Script` and `Nan::UnboundScript` is an alias for `v8::UnboundScript` where available and `v8::Script` on older versions of V8. - -Signature: - -```c++ -Nan::MaybeLocal Nan::RunScript(v8::Local script) -Nan::MaybeLocal Nan::RunScript(v8::Local script) -``` diff --git a/node_modules/websocket/node_modules/nan/doc/string_bytes.md b/node_modules/websocket/node_modules/nan/doc/string_bytes.md deleted file mode 100644 index 7c1bd32..0000000 --- a/node_modules/websocket/node_modules/nan/doc/string_bytes.md +++ /dev/null @@ -1,62 +0,0 @@ -## Strings & Bytes - -Miscellaneous string & byte encoding and decoding functionality provided for compatibility across supported versions of V8 and Node. Implemented by NAN to ensure that all encoding types are supported, even for older versions of Node where they are missing. - - - Nan::Encoding - - Nan::Encode() - - Nan::DecodeBytes() - - Nan::DecodeWrite() - - - -### Nan::Encoding - -An enum representing the supported encoding types. A copy of `node::encoding` that is consistent across versions of Node. - -Definition: - -```c++ -enum Nan::Encoding { ASCII, UTF8, BASE64, UCS2, BINARY, HEX, BUFFER } -``` - - - -### Nan::Encode() - -A wrapper around `node::Encode()` that provides a consistent implementation across supported versions of Node. - -Signature: - -```c++ -v8::Local Nan::Encode(const void *buf, - size_t len, - enum Nan::Encoding encoding = BINARY); -``` - - - -### Nan::DecodeBytes() - -A wrapper around `node::DecodeBytes()` that provides a consistent implementation across supported versions of Node. - -Signature: - -```c++ -ssize_t Nan::DecodeBytes(v8::Local val, - enum Nan::Encoding encoding = BINARY); -``` - - - -### Nan::DecodeWrite() - -A wrapper around `node::DecodeWrite()` that provides a consistent implementation across supported versions of Node. - -Signature: - -```c++ -ssize_t Nan::DecodeWrite(char *buf, - size_t len, - v8::Local val, - enum Nan::Encoding encoding = BINARY); -``` diff --git a/node_modules/websocket/node_modules/nan/doc/v8_internals.md b/node_modules/websocket/node_modules/nan/doc/v8_internals.md deleted file mode 100644 index 88bd2de..0000000 --- a/node_modules/websocket/node_modules/nan/doc/v8_internals.md +++ /dev/null @@ -1,199 +0,0 @@ -## V8 internals - -The hooks to access V8 internals—including GC and statistics—are different across the supported versions of V8, therefore NAN provides its own hooks that call the appropriate V8 methods. - - - NAN_GC_CALLBACK() - - Nan::AddGCEpilogueCallback() - - Nan::RemoveGCEpilogueCallback() - - Nan::AddGCPrologueCallback() - - Nan::RemoveGCPrologueCallback() - - Nan::GetHeapStatistics() - - Nan::SetCounterFunction() - - Nan::SetCreateHistogramFunction() - - Nan::SetAddHistogramSampleFunction() - - Nan::IdleNotification() - - Nan::LowMemoryNotification() - - Nan::ContextDisposedNotification() - - Nan::GetInternalFieldPointer() - - Nan::SetInternalFieldPointer() - - Nan::AdjustExternalMemory() - - - -### NAN_GC_CALLBACK(callbackname) - -Use `NAN_GC_CALLBACK` to declare your callbacks for `Nan::AddGCPrologueCallback()` and `Nan::AddGCEpilogueCallback()`. Your new method receives the arguments `v8::GCType type` and `v8::GCCallbackFlags flags`. - -```c++ -static Nan::Persistent callback; - -NAN_GC_CALLBACK(gcPrologueCallback) { - v8::Local argv[] = { Nan::New("prologue").ToLocalChecked() }; - Nan::MakeCallback(Nan::GetCurrentContext()->Global(), Nan::New(callback), 1, argv); -} - -NAN_METHOD(Hook) { - callback.Reset(To(args[0]).ToLocalChecked()); - Nan::AddGCPrologueCallback(gcPrologueCallback); - info.GetReturnValue().Set(info.Holder()); -} -``` - - -### Nan::AddGCEpilogueCallback() - -Signature: - -```c++ -void Nan::AddGCEpilogueCallback(v8::Isolate::GCEpilogueCallback callback, v8::GCType gc_type_filter = v8::kGCTypeAll) -``` - -Calls V8's [`AddGCEpilogueCallback()`](https://v8docs.nodesource.com/node-8.11/d5/dda/classv8_1_1_isolate.html#a580f976e4290cead62c2fc4dd396be3e). - - -### Nan::RemoveGCEpilogueCallback() - -Signature: - -```c++ -void Nan::RemoveGCEpilogueCallback(v8::Isolate::GCEpilogueCallback callback) -``` - -Calls V8's [`RemoveGCEpilogueCallback()`](https://v8docs.nodesource.com/node-8.11/d5/dda/classv8_1_1_isolate.html#adca9294555a3908e9f23c7bb0f0f284c). - - -### Nan::AddGCPrologueCallback() - -Signature: - -```c++ -void Nan::AddGCPrologueCallback(v8::Isolate::GCPrologueCallback, v8::GCType gc_type_filter callback) -``` - -Calls V8's [`AddGCPrologueCallback()`](https://v8docs.nodesource.com/node-8.11/d5/dda/classv8_1_1_isolate.html#a6dbef303603ebdb03da6998794ea05b8). - - -### Nan::RemoveGCPrologueCallback() - -Signature: - -```c++ -void Nan::RemoveGCPrologueCallback(v8::Isolate::GCPrologueCallback callback) -``` - -Calls V8's [`RemoveGCPrologueCallback()`](https://v8docs.nodesource.com/node-8.11/d5/dda/classv8_1_1_isolate.html#a5f72c7cda21415ce062bbe5c58abe09e). - - -### Nan::GetHeapStatistics() - -Signature: - -```c++ -void Nan::GetHeapStatistics(v8::HeapStatistics *heap_statistics) -``` - -Calls V8's [`GetHeapStatistics()`](https://v8docs.nodesource.com/node-8.11/d5/dda/classv8_1_1_isolate.html#a5593ac74687b713095c38987e5950b34). - - -### Nan::SetCounterFunction() - -Signature: - -```c++ -void Nan::SetCounterFunction(v8::CounterLookupCallback cb) -``` - -Calls V8's [`SetCounterFunction()`](https://v8docs.nodesource.com/node-8.11/d5/dda/classv8_1_1_isolate.html#a045d7754e62fa0ec72ae6c259b29af94). - - -### Nan::SetCreateHistogramFunction() - -Signature: - -```c++ -void Nan::SetCreateHistogramFunction(v8::CreateHistogramCallback cb) -``` - -Calls V8's [`SetCreateHistogramFunction()`](https://v8docs.nodesource.com/node-8.11/d5/dda/classv8_1_1_isolate.html#a542d67e85089cb3f92aadf032f99e732). - - -### Nan::SetAddHistogramSampleFunction() - -Signature: - -```c++ -void Nan::SetAddHistogramSampleFunction(v8::AddHistogramSampleCallback cb) -``` - -Calls V8's [`SetAddHistogramSampleFunction()`](https://v8docs.nodesource.com/node-8.11/d5/dda/classv8_1_1_isolate.html#aeb420b690bc2c216882d6fdd00ddd3ea). - - -### Nan::IdleNotification() - -Signature: - -```c++ -bool Nan::IdleNotification(int idle_time_in_ms) -``` - -Calls V8's [`IdleNotification()` or `IdleNotificationDeadline()`](https://v8docs.nodesource.com/node-8.11/d5/dda/classv8_1_1_isolate.html#ad6a2a02657f5425ad460060652a5a118) depending on V8 version. - - -### Nan::LowMemoryNotification() - -Signature: - -```c++ -void Nan::LowMemoryNotification() -``` - -Calls V8's [`LowMemoryNotification()`](https://v8docs.nodesource.com/node-8.11/d5/dda/classv8_1_1_isolate.html#a24647f61d6b41f69668094bdcd6ea91f). - - -### Nan::ContextDisposedNotification() - -Signature: - -```c++ -void Nan::ContextDisposedNotification() -``` - -Calls V8's [`ContextDisposedNotification()`](https://v8docs.nodesource.com/node-8.11/d5/dda/classv8_1_1_isolate.html#ad7f5dc559866343fe6cd8db1f134d48b). - - -### Nan::GetInternalFieldPointer() - -Gets a pointer to the internal field with at `index` from a V8 `Object` handle. - -Signature: - -```c++ -void* Nan::GetInternalFieldPointer(v8::Local object, int index) -``` - -Calls the Object's [`GetAlignedPointerFromInternalField()` or `GetPointerFromInternalField()`](https://v8docs.nodesource.com/node-8.11/db/d85/classv8_1_1_object.html#a580ea84afb26c005d6762eeb9e3c308f) depending on the version of V8. - - -### Nan::SetInternalFieldPointer() - -Sets the value of the internal field at `index` on a V8 `Object` handle. - -Signature: - -```c++ -void Nan::SetInternalFieldPointer(v8::Local object, int index, void* value) -``` - -Calls the Object's [`SetAlignedPointerInInternalField()` or `SetPointerInInternalField()`](https://v8docs.nodesource.com/node-8.11/db/d85/classv8_1_1_object.html#ab3c57184263cf29963ef0017bec82281) depending on the version of V8. - - -### Nan::AdjustExternalMemory() - -Signature: - -```c++ -int Nan::AdjustExternalMemory(int bytesChange) -``` - -Calls V8's [`AdjustAmountOfExternalAllocatedMemory()`](https://v8docs.nodesource.com/node-8.11/d5/dda/classv8_1_1_isolate.html#ae1a59cac60409d3922582c4af675473e). - diff --git a/node_modules/websocket/node_modules/nan/doc/v8_misc.md b/node_modules/websocket/node_modules/nan/doc/v8_misc.md deleted file mode 100644 index 8e2db20..0000000 --- a/node_modules/websocket/node_modules/nan/doc/v8_misc.md +++ /dev/null @@ -1,85 +0,0 @@ -## Miscellaneous V8 Helpers - - - Nan::Utf8String - - Nan::GetCurrentContext() - - Nan::SetIsolateData() - - Nan::GetIsolateData() - - Nan::TypedArrayContents - - - -### Nan::Utf8String - -Converts an object to a UTF-8-encoded character array. If conversion to a string fails (e.g. due to an exception in the toString() method of the object) then the length() method returns 0 and the * operator returns NULL. The underlying memory used for this object is managed by the object. - -An implementation of [`v8::String::Utf8Value`](https://v8docs.nodesource.com/node-8.11/d4/d1b/classv8_1_1_string_1_1_utf8_value.html) that is consistent across all supported versions of V8. - -Definition: - -```c++ -class Nan::Utf8String { - public: - Nan::Utf8String(v8::Local from); - - int length() const; - - char* operator*(); - const char* operator*() const; -}; -``` - - -### Nan::GetCurrentContext() - -A call to [`v8::Isolate::GetCurrent()->GetCurrentContext()`](https://v8docs.nodesource.com/node-8.11/d5/dda/classv8_1_1_isolate.html#a81c7a1ed7001ae2a65e89107f75fd053) that works across all supported versions of V8. - -Signature: - -```c++ -v8::Local Nan::GetCurrentContext() -``` - - -### Nan::SetIsolateData() - -A helper to provide a consistent API to [`v8::Isolate#SetData()`](https://v8docs.nodesource.com/node-8.11/d5/dda/classv8_1_1_isolate.html#a7acadfe7965997e9c386a05f098fbe36). - -Signature: - -```c++ -void Nan::SetIsolateData(v8::Isolate *isolate, T *data) -``` - - - -### Nan::GetIsolateData() - -A helper to provide a consistent API to [`v8::Isolate#GetData()`](https://v8docs.nodesource.com/node-8.11/d5/dda/classv8_1_1_isolate.html#aabd223436bc1100a787dadaa024c6257). - -Signature: - -```c++ -T *Nan::GetIsolateData(v8::Isolate *isolate) -``` - - -### Nan::TypedArrayContents - -A helper class for accessing the contents of an ArrayBufferView (aka a typedarray) from C++. If the input array is not a valid typedarray, then the data pointer of TypedArrayContents will default to `NULL` and the length will be 0. If the data pointer is not compatible with the alignment requirements of type, an assertion error will fail. - -Note that you must store a reference to the `array` object while you are accessing its contents. - -Definition: - -```c++ -template -class Nan::TypedArrayContents { - public: - TypedArrayContents(v8::Local array); - - size_t length() const; - - T* const operator*(); - const T* const operator*() const; -}; -``` diff --git a/node_modules/websocket/node_modules/nan/include_dirs.js b/node_modules/websocket/node_modules/nan/include_dirs.js deleted file mode 100644 index 4f1dfb4..0000000 --- a/node_modules/websocket/node_modules/nan/include_dirs.js +++ /dev/null @@ -1 +0,0 @@ -console.log(require('path').relative('.', __dirname)); diff --git a/node_modules/websocket/node_modules/nan/nan.h b/node_modules/websocket/node_modules/nan/nan.h deleted file mode 100644 index 514115d..0000000 --- a/node_modules/websocket/node_modules/nan/nan.h +++ /dev/null @@ -1,2892 +0,0 @@ -/********************************************************************* - * NAN - Native Abstractions for Node.js - * - * Copyright (c) 2018 NAN contributors: - * - Rod Vagg - * - Benjamin Byholm - * - Trevor Norris - * - Nathan Rajlich - * - Brett Lawson - * - Ben Noordhuis - * - David Siegel - * - Michael Ira Krufky - * - * MIT License - * - * Version 2.14.0: current Node 12.2.0, Node 12: 0.12.18, Node 10: 0.10.48, iojs: 3.3.1 - * - * See https://github.com/nodejs/nan for the latest update to this file - **********************************************************************************/ - -#ifndef NAN_H_ -#define NAN_H_ - -#include - -#define NODE_0_10_MODULE_VERSION 11 -#define NODE_0_12_MODULE_VERSION 14 -#define ATOM_0_21_MODULE_VERSION 41 -#define IOJS_1_0_MODULE_VERSION 42 -#define IOJS_1_1_MODULE_VERSION 43 -#define IOJS_2_0_MODULE_VERSION 44 -#define IOJS_3_0_MODULE_VERSION 45 -#define NODE_4_0_MODULE_VERSION 46 -#define NODE_5_0_MODULE_VERSION 47 -#define NODE_6_0_MODULE_VERSION 48 -#define NODE_7_0_MODULE_VERSION 51 -#define NODE_8_0_MODULE_VERSION 57 -#define NODE_9_0_MODULE_VERSION 59 -#define NODE_10_0_MODULE_VERSION 64 -#define NODE_11_0_MODULE_VERSION 67 -#define NODE_12_0_MODULE_VERSION 72 - -#ifdef _MSC_VER -# define NAN_HAS_CPLUSPLUS_11 (_MSC_VER >= 1800) -#else -# define NAN_HAS_CPLUSPLUS_11 (__cplusplus >= 201103L) -#endif - -#if NODE_MODULE_VERSION >= IOJS_3_0_MODULE_VERSION && !NAN_HAS_CPLUSPLUS_11 -# error This version of node/NAN/v8 requires a C++11 compiler -#endif - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#if defined(_MSC_VER) -# pragma warning( push ) -# pragma warning( disable : 4530 ) -# include -# include -# include -# pragma warning( pop ) -#else -# include -# include -# include -#endif - -// uv helpers -#ifdef UV_VERSION_MAJOR -# ifndef UV_VERSION_PATCH -# define UV_VERSION_PATCH 0 -# endif -# define NAUV_UVVERSION ((UV_VERSION_MAJOR << 16) | \ - (UV_VERSION_MINOR << 8) | \ - (UV_VERSION_PATCH)) -#else -# define NAUV_UVVERSION 0x000b00 -#endif - -#if NAUV_UVVERSION < 0x000b0b -# ifdef WIN32 -# include -# else -# include -# endif -#endif - -namespace Nan { - -#define NAN_CONCAT(a, b) NAN_CONCAT_HELPER(a, b) -#define NAN_CONCAT_HELPER(a, b) a##b - -#define NAN_INLINE inline // TODO(bnoordhuis) Remove in v3.0.0. - -#if defined(__GNUC__) && \ - !(defined(V8_DISABLE_DEPRECATIONS) && V8_DISABLE_DEPRECATIONS) -# define NAN_DEPRECATED __attribute__((deprecated)) -#elif defined(_MSC_VER) && \ - !(defined(V8_DISABLE_DEPRECATIONS) && V8_DISABLE_DEPRECATIONS) -# define NAN_DEPRECATED __declspec(deprecated) -#else -# define NAN_DEPRECATED -#endif - -#if NAN_HAS_CPLUSPLUS_11 -# define NAN_DISALLOW_ASSIGN(CLASS) void operator=(const CLASS&) = delete; -# define NAN_DISALLOW_COPY(CLASS) CLASS(const CLASS&) = delete; -# define NAN_DISALLOW_MOVE(CLASS) \ - CLASS(CLASS&&) = delete; /* NOLINT(build/c++11) */ \ - void operator=(CLASS&&) = delete; -#else -# define NAN_DISALLOW_ASSIGN(CLASS) void operator=(const CLASS&); -# define NAN_DISALLOW_COPY(CLASS) CLASS(const CLASS&); -# define NAN_DISALLOW_MOVE(CLASS) -#endif - -#define NAN_DISALLOW_ASSIGN_COPY(CLASS) \ - NAN_DISALLOW_ASSIGN(CLASS) \ - NAN_DISALLOW_COPY(CLASS) - -#define NAN_DISALLOW_ASSIGN_MOVE(CLASS) \ - NAN_DISALLOW_ASSIGN(CLASS) \ - NAN_DISALLOW_MOVE(CLASS) - -#define NAN_DISALLOW_COPY_MOVE(CLASS) \ - NAN_DISALLOW_COPY(CLASS) \ - NAN_DISALLOW_MOVE(CLASS) - -#define NAN_DISALLOW_ASSIGN_COPY_MOVE(CLASS) \ - NAN_DISALLOW_ASSIGN(CLASS) \ - NAN_DISALLOW_COPY(CLASS) \ - NAN_DISALLOW_MOVE(CLASS) - -#define TYPE_CHECK(T, S) \ - while (false) { \ - *(static_cast(0)) = static_cast(0); \ - } - -//=== RegistrationFunction ===================================================== - -#if NODE_MODULE_VERSION < IOJS_3_0_MODULE_VERSION - typedef v8::Handle ADDON_REGISTER_FUNCTION_ARGS_TYPE; -#else - typedef v8::Local ADDON_REGISTER_FUNCTION_ARGS_TYPE; -#endif - -#define NAN_MODULE_INIT(name) \ - void name(Nan::ADDON_REGISTER_FUNCTION_ARGS_TYPE target) - -#if NODE_MAJOR_VERSION >= 10 || \ - NODE_MAJOR_VERSION == 9 && NODE_MINOR_VERSION >= 3 -#define NAN_MODULE_WORKER_ENABLED(module_name, registration) \ - extern "C" NODE_MODULE_EXPORT void \ - NAN_CONCAT(node_register_module_v, NODE_MODULE_VERSION)( \ - v8::Local exports, v8::Local module, \ - v8::Local context) \ - { \ - registration(exports); \ - } -#else -#define NAN_MODULE_WORKER_ENABLED(module_name, registration) \ - NODE_MODULE(module_name, registration) -#endif - -//=== CallbackInfo ============================================================= - -#include "nan_callbacks.h" // NOLINT(build/include) - -//============================================================================== - -#if (NODE_MODULE_VERSION < NODE_0_12_MODULE_VERSION) -typedef v8::Script UnboundScript; -typedef v8::Script BoundScript; -#else -typedef v8::UnboundScript UnboundScript; -typedef v8::Script BoundScript; -#endif - -#if (NODE_MODULE_VERSION < ATOM_0_21_MODULE_VERSION) -typedef v8::String::ExternalAsciiStringResource - ExternalOneByteStringResource; -#else -typedef v8::String::ExternalOneByteStringResource - ExternalOneByteStringResource; -#endif - -#if (NODE_MODULE_VERSION > NODE_0_10_MODULE_VERSION) -template -class NonCopyablePersistentTraits : - public v8::NonCopyablePersistentTraits {}; -template -class CopyablePersistentTraits : - public v8::CopyablePersistentTraits {}; - -template -class PersistentBase : - public v8::PersistentBase {}; - -template > -class Persistent; -#else -template class NonCopyablePersistentTraits; -template class PersistentBase; -template class WeakCallbackData; -template > -class Persistent; -#endif // NODE_MODULE_VERSION - -template -class Maybe { - public: - inline bool IsNothing() const { return !has_value_; } - inline bool IsJust() const { return has_value_; } - - inline T ToChecked() const { return FromJust(); } - inline void Check() const { FromJust(); } - - inline bool To(T* out) const { - if (IsJust()) *out = value_; - return IsJust(); - } - - inline T FromJust() const { -#if defined(V8_ENABLE_CHECKS) - assert(IsJust() && "FromJust is Nothing"); -#endif // V8_ENABLE_CHECKS - return value_; - } - - inline T FromMaybe(const T& default_value) const { - return has_value_ ? value_ : default_value; - } - - inline bool operator==(const Maybe &other) const { - return (IsJust() == other.IsJust()) && - (!IsJust() || FromJust() == other.FromJust()); - } - - inline bool operator!=(const Maybe &other) const { - return !operator==(other); - } - -#if defined(V8_MAJOR_VERSION) && (V8_MAJOR_VERSION > 4 || \ - (V8_MAJOR_VERSION == 4 && defined(V8_MINOR_VERSION) && V8_MINOR_VERSION >= 3)) - // Allow implicit conversions from v8::Maybe to Nan::Maybe. - Maybe(const v8::Maybe& that) // NOLINT(runtime/explicit) - : has_value_(that.IsJust()) - , value_(that.FromMaybe(T())) {} -#endif - - private: - Maybe() : has_value_(false) {} - explicit Maybe(const T& t) : has_value_(true), value_(t) {} - bool has_value_; - T value_; - - template - friend Maybe Nothing(); - template - friend Maybe Just(const U& u); -}; - -template -inline Maybe Nothing() { - return Maybe(); -} - -template -inline Maybe Just(const T& t) { - return Maybe(t); -} - -#if defined(V8_MAJOR_VERSION) && (V8_MAJOR_VERSION > 4 || \ - (V8_MAJOR_VERSION == 4 && defined(V8_MINOR_VERSION) && V8_MINOR_VERSION >= 3)) -# include "nan_maybe_43_inl.h" // NOLINT(build/include) -#else -# include "nan_maybe_pre_43_inl.h" // NOLINT(build/include) -#endif - -#include "nan_converters.h" // NOLINT(build/include) -#include "nan_new.h" // NOLINT(build/include) - -#if NAUV_UVVERSION < 0x000b17 -#define NAUV_WORK_CB(func) \ - void func(uv_async_t *async, int) -#else -#define NAUV_WORK_CB(func) \ - void func(uv_async_t *async) -#endif - -#if NAUV_UVVERSION >= 0x000b0b - -typedef uv_key_t nauv_key_t; - -inline int nauv_key_create(nauv_key_t *key) { - return uv_key_create(key); -} - -inline void nauv_key_delete(nauv_key_t *key) { - uv_key_delete(key); -} - -inline void* nauv_key_get(nauv_key_t *key) { - return uv_key_get(key); -} - -inline void nauv_key_set(nauv_key_t *key, void *value) { - uv_key_set(key, value); -} - -#else - -/* Implement thread local storage for older versions of libuv. - * This is essentially a backport of libuv commit 5d2434bf - * written by Ben Noordhuis, adjusted for names and inline. - */ - -#ifndef WIN32 - -typedef pthread_key_t nauv_key_t; - -inline int nauv_key_create(nauv_key_t* key) { - return -pthread_key_create(key, NULL); -} - -inline void nauv_key_delete(nauv_key_t* key) { - if (pthread_key_delete(*key)) - abort(); -} - -inline void* nauv_key_get(nauv_key_t* key) { - return pthread_getspecific(*key); -} - -inline void nauv_key_set(nauv_key_t* key, void* value) { - if (pthread_setspecific(*key, value)) - abort(); -} - -#else - -typedef struct { - DWORD tls_index; -} nauv_key_t; - -inline int nauv_key_create(nauv_key_t* key) { - key->tls_index = TlsAlloc(); - if (key->tls_index == TLS_OUT_OF_INDEXES) - return UV_ENOMEM; - return 0; -} - -inline void nauv_key_delete(nauv_key_t* key) { - if (TlsFree(key->tls_index) == FALSE) - abort(); - key->tls_index = TLS_OUT_OF_INDEXES; -} - -inline void* nauv_key_get(nauv_key_t* key) { - void* value = TlsGetValue(key->tls_index); - if (value == NULL) - if (GetLastError() != ERROR_SUCCESS) - abort(); - return value; -} - -inline void nauv_key_set(nauv_key_t* key, void* value) { - if (TlsSetValue(key->tls_index, value) == FALSE) - abort(); -} - -#endif -#endif - -#if NODE_MODULE_VERSION < IOJS_3_0_MODULE_VERSION -template -v8::Local New(v8::Handle); -#endif - -#if defined(V8_MAJOR_VERSION) && (V8_MAJOR_VERSION > 4 || \ - (V8_MAJOR_VERSION == 4 && defined(V8_MINOR_VERSION) && V8_MINOR_VERSION >= 3)) - typedef v8::WeakCallbackType WeakCallbackType; -#else -struct WeakCallbackType { - enum E {kParameter, kInternalFields}; - E type; - WeakCallbackType(E other) : type(other) {} // NOLINT(runtime/explicit) - inline bool operator==(E other) { return other == this->type; } - inline bool operator!=(E other) { return !operator==(other); } -}; -#endif - -template class WeakCallbackInfo; - -#if NODE_MODULE_VERSION > NODE_0_10_MODULE_VERSION -# include "nan_persistent_12_inl.h" // NOLINT(build/include) -#else -# include "nan_persistent_pre_12_inl.h" // NOLINT(build/include) -#endif - -namespace imp { - static const size_t kMaxLength = 0x3fffffff; - // v8::String::REPLACE_INVALID_UTF8 was introduced - // in node.js v0.10.29 and v0.8.27. -#if NODE_MAJOR_VERSION > 0 || \ - NODE_MINOR_VERSION > 10 || \ - NODE_MINOR_VERSION == 10 && NODE_PATCH_VERSION >= 29 || \ - NODE_MINOR_VERSION == 8 && NODE_PATCH_VERSION >= 27 - static const unsigned kReplaceInvalidUtf8 = v8::String::REPLACE_INVALID_UTF8; -#else - static const unsigned kReplaceInvalidUtf8 = 0; -#endif -} // end of namespace imp - -//=== HandleScope ============================================================== - -class HandleScope { - v8::HandleScope scope; - - public: -#if NODE_MODULE_VERSION > NODE_0_10_MODULE_VERSION - inline HandleScope() : scope(v8::Isolate::GetCurrent()) {} - inline static int NumberOfHandles() { - return v8::HandleScope::NumberOfHandles(v8::Isolate::GetCurrent()); - } -#else - inline HandleScope() : scope() {} - inline static int NumberOfHandles() { - return v8::HandleScope::NumberOfHandles(); - } -#endif - - private: - // Make it hard to create heap-allocated or illegal handle scopes by - // disallowing certain operations. - HandleScope(const HandleScope &); - void operator=(const HandleScope &); - void *operator new(size_t size); - void operator delete(void *, size_t) { - abort(); - } -}; - -class EscapableHandleScope { - public: -#if NODE_MODULE_VERSION > NODE_0_10_MODULE_VERSION - inline EscapableHandleScope() : scope(v8::Isolate::GetCurrent()) {} - - inline static int NumberOfHandles() { - return v8::EscapableHandleScope::NumberOfHandles(v8::Isolate::GetCurrent()); - } - - template - inline v8::Local Escape(v8::Local value) { - return scope.Escape(value); - } - - private: - v8::EscapableHandleScope scope; -#else - inline EscapableHandleScope() : scope() {} - - inline static int NumberOfHandles() { - return v8::HandleScope::NumberOfHandles(); - } - - template - inline v8::Local Escape(v8::Local value) { - return scope.Close(value); - } - - private: - v8::HandleScope scope; -#endif - - private: - // Make it hard to create heap-allocated or illegal handle scopes by - // disallowing certain operations. - EscapableHandleScope(const EscapableHandleScope &); - void operator=(const EscapableHandleScope &); - void *operator new(size_t size); - void operator delete(void *, size_t) { - abort(); - } -}; - -//=== TryCatch ================================================================= - -class TryCatch { - v8::TryCatch try_catch_; - friend void FatalException(const TryCatch&); - - public: -#if NODE_MODULE_VERSION > NODE_0_12_MODULE_VERSION - TryCatch() : try_catch_(v8::Isolate::GetCurrent()) {} -#endif - - inline bool HasCaught() const { return try_catch_.HasCaught(); } - - inline bool CanContinue() const { return try_catch_.CanContinue(); } - - inline v8::Local ReThrow() { -#if NODE_MODULE_VERSION < IOJS_3_0_MODULE_VERSION - return New(try_catch_.ReThrow()); -#else - return try_catch_.ReThrow(); -#endif - } - - inline v8::Local Exception() const { - return try_catch_.Exception(); - } - -#if defined(V8_MAJOR_VERSION) && (V8_MAJOR_VERSION > 4 || \ - (V8_MAJOR_VERSION == 4 && defined(V8_MINOR_VERSION) && V8_MINOR_VERSION >= 3)) - inline v8::MaybeLocal StackTrace() const { - v8::Isolate *isolate = v8::Isolate::GetCurrent(); - v8::EscapableHandleScope scope(isolate); - return scope.Escape(try_catch_.StackTrace(isolate->GetCurrentContext()) - .FromMaybe(v8::Local())); - } -#else - inline MaybeLocal StackTrace() const { - return try_catch_.StackTrace(); - } -#endif - - inline v8::Local Message() const { - return try_catch_.Message(); - } - - inline void Reset() { try_catch_.Reset(); } - - inline void SetVerbose(bool value) { try_catch_.SetVerbose(value); } - - inline void SetCaptureMessage(bool value) { - try_catch_.SetCaptureMessage(value); - } -}; - -v8::Local MakeCallback(v8::Local target, - v8::Local func, - int argc, - v8::Local* argv); -v8::Local MakeCallback(v8::Local target, - v8::Local symbol, - int argc, - v8::Local* argv); -v8::Local MakeCallback(v8::Local target, - const char* method, - int argc, - v8::Local* argv); - -// === AsyncResource =========================================================== - -class AsyncResource { - public: - AsyncResource( - v8::Local name - , v8::Local resource = New()) { -#if NODE_MODULE_VERSION >= NODE_9_0_MODULE_VERSION - v8::Isolate* isolate = v8::Isolate::GetCurrent(); - - if (resource.IsEmpty()) { - resource = New(); - } - - context = node::EmitAsyncInit(isolate, resource, name); -#endif - } - - AsyncResource( - const char* name - , v8::Local resource = New()) { -#if NODE_MODULE_VERSION >= NODE_9_0_MODULE_VERSION - v8::Isolate* isolate = v8::Isolate::GetCurrent(); - - if (resource.IsEmpty()) { - resource = New(); - } - - v8::Local name_string = - New(name).ToLocalChecked(); - context = node::EmitAsyncInit(isolate, resource, name_string); -#endif - } - - ~AsyncResource() { -#if NODE_MODULE_VERSION >= NODE_9_0_MODULE_VERSION - v8::Isolate* isolate = v8::Isolate::GetCurrent(); - node::EmitAsyncDestroy(isolate, context); -#endif - } - - inline MaybeLocal runInAsyncScope( - v8::Local target - , v8::Local func - , int argc - , v8::Local* argv) { -#if NODE_MODULE_VERSION < NODE_9_0_MODULE_VERSION - return MakeCallback(target, func, argc, argv); -#else - return node::MakeCallback( - v8::Isolate::GetCurrent(), target, func, argc, argv, context); -#endif - } - - inline MaybeLocal runInAsyncScope( - v8::Local target - , v8::Local symbol - , int argc - , v8::Local* argv) { -#if NODE_MODULE_VERSION < NODE_9_0_MODULE_VERSION - return MakeCallback(target, symbol, argc, argv); -#else - return node::MakeCallback( - v8::Isolate::GetCurrent(), target, symbol, argc, argv, context); -#endif - } - - inline MaybeLocal runInAsyncScope( - v8::Local target - , const char* method - , int argc - , v8::Local* argv) { -#if NODE_MODULE_VERSION < NODE_9_0_MODULE_VERSION - return MakeCallback(target, method, argc, argv); -#else - return node::MakeCallback( - v8::Isolate::GetCurrent(), target, method, argc, argv, context); -#endif - } - - private: - NAN_DISALLOW_ASSIGN_COPY_MOVE(AsyncResource) -#if NODE_MODULE_VERSION >= NODE_9_0_MODULE_VERSION - node::async_context context; -#endif -}; - -inline uv_loop_t* GetCurrentEventLoop() { -#if NODE_MAJOR_VERSION >= 10 || \ - NODE_MAJOR_VERSION == 9 && NODE_MINOR_VERSION >= 3 || \ - NODE_MAJOR_VERSION == 8 && NODE_MINOR_VERSION >= 10 - return node::GetCurrentEventLoop(v8::Isolate::GetCurrent()); -#else - return uv_default_loop(); -#endif -} - -//============ ================================================================= - -/* node 0.12 */ -#if NODE_MODULE_VERSION >= NODE_0_12_MODULE_VERSION - inline - void SetCounterFunction(v8::CounterLookupCallback cb) { - v8::Isolate::GetCurrent()->SetCounterFunction(cb); - } - - inline - void SetCreateHistogramFunction(v8::CreateHistogramCallback cb) { - v8::Isolate::GetCurrent()->SetCreateHistogramFunction(cb); - } - - inline - void SetAddHistogramSampleFunction(v8::AddHistogramSampleCallback cb) { - v8::Isolate::GetCurrent()->SetAddHistogramSampleFunction(cb); - } - -#if defined(V8_MAJOR_VERSION) && (V8_MAJOR_VERSION > 4 || \ - (V8_MAJOR_VERSION == 4 && defined(V8_MINOR_VERSION) && V8_MINOR_VERSION >= 3)) - inline bool IdleNotification(int idle_time_in_ms) { - return v8::Isolate::GetCurrent()->IdleNotificationDeadline( - idle_time_in_ms * 0.001); - } -# else - inline bool IdleNotification(int idle_time_in_ms) { - return v8::Isolate::GetCurrent()->IdleNotification(idle_time_in_ms); - } -#endif - - inline void LowMemoryNotification() { - v8::Isolate::GetCurrent()->LowMemoryNotification(); - } - - inline void ContextDisposedNotification() { - v8::Isolate::GetCurrent()->ContextDisposedNotification(); - } -#else - inline - void SetCounterFunction(v8::CounterLookupCallback cb) { - v8::V8::SetCounterFunction(cb); - } - - inline - void SetCreateHistogramFunction(v8::CreateHistogramCallback cb) { - v8::V8::SetCreateHistogramFunction(cb); - } - - inline - void SetAddHistogramSampleFunction(v8::AddHistogramSampleCallback cb) { - v8::V8::SetAddHistogramSampleFunction(cb); - } - - inline bool IdleNotification(int idle_time_in_ms) { - return v8::V8::IdleNotification(idle_time_in_ms); - } - - inline void LowMemoryNotification() { - v8::V8::LowMemoryNotification(); - } - - inline void ContextDisposedNotification() { - v8::V8::ContextDisposedNotification(); - } -#endif - -#if (NODE_MODULE_VERSION > NODE_0_10_MODULE_VERSION) // Node 0.12 - inline v8::Local Undefined() { -# if NODE_MODULE_VERSION < IOJS_3_0_MODULE_VERSION - EscapableHandleScope scope; - return scope.Escape(New(v8::Undefined(v8::Isolate::GetCurrent()))); -# else - return v8::Undefined(v8::Isolate::GetCurrent()); -# endif - } - - inline v8::Local Null() { -# if NODE_MODULE_VERSION < IOJS_3_0_MODULE_VERSION - EscapableHandleScope scope; - return scope.Escape(New(v8::Null(v8::Isolate::GetCurrent()))); -# else - return v8::Null(v8::Isolate::GetCurrent()); -# endif - } - - inline v8::Local True() { -# if NODE_MODULE_VERSION < IOJS_3_0_MODULE_VERSION - EscapableHandleScope scope; - return scope.Escape(New(v8::True(v8::Isolate::GetCurrent()))); -# else - return v8::True(v8::Isolate::GetCurrent()); -# endif - } - - inline v8::Local False() { -# if NODE_MODULE_VERSION < IOJS_3_0_MODULE_VERSION - EscapableHandleScope scope; - return scope.Escape(New(v8::False(v8::Isolate::GetCurrent()))); -# else - return v8::False(v8::Isolate::GetCurrent()); -# endif - } - - inline v8::Local EmptyString() { - return v8::String::Empty(v8::Isolate::GetCurrent()); - } - - inline int AdjustExternalMemory(int bc) { - return static_cast( - v8::Isolate::GetCurrent()->AdjustAmountOfExternalAllocatedMemory(bc)); - } - - inline void SetTemplate( - v8::Local templ - , const char *name - , v8::Local value) { - templ->Set(v8::Isolate::GetCurrent(), name, value); - } - - inline void SetTemplate( - v8::Local templ - , v8::Local name - , v8::Local value - , v8::PropertyAttribute attributes) { - templ->Set(name, value, attributes); - } - - inline v8::Local GetCurrentContext() { - return v8::Isolate::GetCurrent()->GetCurrentContext(); - } - - inline void* GetInternalFieldPointer( - v8::Local object - , int index) { - return object->GetAlignedPointerFromInternalField(index); - } - - inline void SetInternalFieldPointer( - v8::Local object - , int index - , void* value) { - object->SetAlignedPointerInInternalField(index, value); - } - -# define NAN_GC_CALLBACK(name) \ - void name(v8::Isolate *isolate, v8::GCType type, v8::GCCallbackFlags flags) - -#if NODE_MODULE_VERSION <= NODE_4_0_MODULE_VERSION - typedef v8::Isolate::GCEpilogueCallback GCEpilogueCallback; - typedef v8::Isolate::GCPrologueCallback GCPrologueCallback; -#else - typedef v8::Isolate::GCCallback GCEpilogueCallback; - typedef v8::Isolate::GCCallback GCPrologueCallback; -#endif - - inline void AddGCEpilogueCallback( - GCEpilogueCallback callback - , v8::GCType gc_type_filter = v8::kGCTypeAll) { - v8::Isolate::GetCurrent()->AddGCEpilogueCallback(callback, gc_type_filter); - } - - inline void RemoveGCEpilogueCallback( - GCEpilogueCallback callback) { - v8::Isolate::GetCurrent()->RemoveGCEpilogueCallback(callback); - } - - inline void AddGCPrologueCallback( - GCPrologueCallback callback - , v8::GCType gc_type_filter = v8::kGCTypeAll) { - v8::Isolate::GetCurrent()->AddGCPrologueCallback(callback, gc_type_filter); - } - - inline void RemoveGCPrologueCallback( - GCPrologueCallback callback) { - v8::Isolate::GetCurrent()->RemoveGCPrologueCallback(callback); - } - - inline void GetHeapStatistics( - v8::HeapStatistics *heap_statistics) { - v8::Isolate::GetCurrent()->GetHeapStatistics(heap_statistics); - } - -# define X(NAME) \ - inline v8::Local NAME(const char *msg) { \ - EscapableHandleScope scope; \ - return scope.Escape(v8::Exception::NAME(New(msg).ToLocalChecked())); \ - } \ - \ - inline \ - v8::Local NAME(v8::Local msg) { \ - return v8::Exception::NAME(msg); \ - } \ - \ - inline void Throw ## NAME(const char *msg) { \ - HandleScope scope; \ - v8::Isolate::GetCurrent()->ThrowException( \ - v8::Exception::NAME(New(msg).ToLocalChecked())); \ - } \ - \ - inline void Throw ## NAME(v8::Local msg) { \ - HandleScope scope; \ - v8::Isolate::GetCurrent()->ThrowException( \ - v8::Exception::NAME(msg)); \ - } - - X(Error) - X(RangeError) - X(ReferenceError) - X(SyntaxError) - X(TypeError) - -# undef X - - inline void ThrowError(v8::Local error) { - v8::Isolate::GetCurrent()->ThrowException(error); - } - - inline MaybeLocal NewBuffer( - char *data - , size_t length -#if NODE_MODULE_VERSION > IOJS_2_0_MODULE_VERSION - , node::Buffer::FreeCallback callback -#else - , node::smalloc::FreeCallback callback -#endif - , void *hint - ) { - // arbitrary buffer lengths requires - // NODE_MODULE_VERSION >= IOJS_3_0_MODULE_VERSION - assert(length <= imp::kMaxLength && "too large buffer"); -#if NODE_MODULE_VERSION > IOJS_2_0_MODULE_VERSION - return node::Buffer::New( - v8::Isolate::GetCurrent(), data, length, callback, hint); -#else - return node::Buffer::New(v8::Isolate::GetCurrent(), data, length, callback, - hint); -#endif - } - - inline MaybeLocal CopyBuffer( - const char *data - , uint32_t size - ) { - // arbitrary buffer lengths requires - // NODE_MODULE_VERSION >= IOJS_3_0_MODULE_VERSION - assert(size <= imp::kMaxLength && "too large buffer"); -#if NODE_MODULE_VERSION > IOJS_2_0_MODULE_VERSION - return node::Buffer::Copy( - v8::Isolate::GetCurrent(), data, size); -#else - return node::Buffer::New(v8::Isolate::GetCurrent(), data, size); -#endif - } - - inline MaybeLocal NewBuffer(uint32_t size) { - // arbitrary buffer lengths requires - // NODE_MODULE_VERSION >= IOJS_3_0_MODULE_VERSION - assert(size <= imp::kMaxLength && "too large buffer"); -#if NODE_MODULE_VERSION > IOJS_2_0_MODULE_VERSION - return node::Buffer::New( - v8::Isolate::GetCurrent(), size); -#else - return node::Buffer::New(v8::Isolate::GetCurrent(), size); -#endif - } - - inline MaybeLocal NewBuffer( - char* data - , uint32_t size - ) { - // arbitrary buffer lengths requires - // NODE_MODULE_VERSION >= IOJS_3_0_MODULE_VERSION - assert(size <= imp::kMaxLength && "too large buffer"); -#if NODE_MODULE_VERSION > IOJS_2_0_MODULE_VERSION - return node::Buffer::New(v8::Isolate::GetCurrent(), data, size); -#else - return node::Buffer::Use(v8::Isolate::GetCurrent(), data, size); -#endif - } - -#if defined(V8_MAJOR_VERSION) && (V8_MAJOR_VERSION > 4 || \ - (V8_MAJOR_VERSION == 4 && defined(V8_MINOR_VERSION) && V8_MINOR_VERSION >= 3)) - inline MaybeLocal - NewOneByteString(const uint8_t * value, int length = -1) { - return v8::String::NewFromOneByte(v8::Isolate::GetCurrent(), value, - v8::NewStringType::kNormal, length); - } - - inline MaybeLocal CompileScript( - v8::Local s - , const v8::ScriptOrigin& origin - ) { - v8::Isolate *isolate = v8::Isolate::GetCurrent(); - v8::EscapableHandleScope scope(isolate); - v8::ScriptCompiler::Source source(s, origin); - return scope.Escape( - v8::ScriptCompiler::Compile(isolate->GetCurrentContext(), &source) - .FromMaybe(v8::Local())); - } - - inline MaybeLocal CompileScript( - v8::Local s - ) { - v8::Isolate *isolate = v8::Isolate::GetCurrent(); - v8::EscapableHandleScope scope(isolate); - v8::ScriptCompiler::Source source(s); - return scope.Escape( - v8::ScriptCompiler::Compile(isolate->GetCurrentContext(), &source) - .FromMaybe(v8::Local())); - } - - inline MaybeLocal RunScript( - v8::Local script - ) { - v8::Isolate *isolate = v8::Isolate::GetCurrent(); - v8::EscapableHandleScope scope(isolate); - return scope.Escape(script->BindToCurrentContext() - ->Run(isolate->GetCurrentContext()) - .FromMaybe(v8::Local())); - } - - inline MaybeLocal RunScript( - v8::Local script - ) { - v8::Isolate *isolate = v8::Isolate::GetCurrent(); - v8::EscapableHandleScope scope(isolate); - return scope.Escape(script->Run(isolate->GetCurrentContext()) - .FromMaybe(v8::Local())); - } -#else - inline MaybeLocal - NewOneByteString(const uint8_t * value, int length = -1) { - return v8::String::NewFromOneByte(v8::Isolate::GetCurrent(), value, - v8::String::kNormalString, length); - } - - inline MaybeLocal CompileScript( - v8::Local s - , const v8::ScriptOrigin& origin - ) { - v8::ScriptCompiler::Source source(s, origin); - return v8::ScriptCompiler::Compile(v8::Isolate::GetCurrent(), &source); - } - - inline MaybeLocal CompileScript( - v8::Local s - ) { - v8::ScriptCompiler::Source source(s); - return v8::ScriptCompiler::Compile(v8::Isolate::GetCurrent(), &source); - } - - inline MaybeLocal RunScript( - v8::Local script - ) { - EscapableHandleScope scope; - return scope.Escape(script->BindToCurrentContext()->Run()); - } - - inline MaybeLocal RunScript( - v8::Local script - ) { - return script->Run(); - } -#endif - - NAN_DEPRECATED inline v8::Local MakeCallback( - v8::Local target - , v8::Local func - , int argc - , v8::Local* argv) { -#if NODE_MODULE_VERSION < IOJS_3_0_MODULE_VERSION - EscapableHandleScope scope; - return scope.Escape(New(node::MakeCallback( - v8::Isolate::GetCurrent(), target, func, argc, argv))); -#else -# if NODE_MODULE_VERSION >= NODE_9_0_MODULE_VERSION - AsyncResource res("nan:makeCallback"); - return res.runInAsyncScope(target, func, argc, argv) - .FromMaybe(v8::Local()); -# else - return node::MakeCallback( - v8::Isolate::GetCurrent(), target, func, argc, argv); -# endif // NODE_MODULE_VERSION >= NODE_9_0_MODULE_VERSION -#endif // NODE_MODULE_VERSION < IOJS_3_0_MODULE_VERSION - } - - NAN_DEPRECATED inline v8::Local MakeCallback( - v8::Local target - , v8::Local symbol - , int argc - , v8::Local* argv) { -#if NODE_MODULE_VERSION < IOJS_3_0_MODULE_VERSION - EscapableHandleScope scope; - return scope.Escape(New(node::MakeCallback( - v8::Isolate::GetCurrent(), target, symbol, argc, argv))); -#else -# if NODE_MODULE_VERSION >= NODE_9_0_MODULE_VERSION - AsyncResource res("nan:makeCallback"); - return res.runInAsyncScope(target, symbol, argc, argv) - .FromMaybe(v8::Local()); -# else - return node::MakeCallback( - v8::Isolate::GetCurrent(), target, symbol, argc, argv); -# endif // NODE_MODULE_VERSION >= NODE_9_0_MODULE_VERSION -#endif // NODE_MODULE_VERSION < IOJS_3_0_MODULE_VERSION - } - - NAN_DEPRECATED inline v8::Local MakeCallback( - v8::Local target - , const char* method - , int argc - , v8::Local* argv) { -#if NODE_MODULE_VERSION < IOJS_3_0_MODULE_VERSION - EscapableHandleScope scope; - return scope.Escape(New(node::MakeCallback( - v8::Isolate::GetCurrent(), target, method, argc, argv))); -#else -# if NODE_MODULE_VERSION >= NODE_9_0_MODULE_VERSION - AsyncResource res("nan:makeCallback"); - return res.runInAsyncScope(target, method, argc, argv) - .FromMaybe(v8::Local()); -# else - return node::MakeCallback( - v8::Isolate::GetCurrent(), target, method, argc, argv); -# endif // NODE_MODULE_VERSION >= NODE_9_0_MODULE_VERSION -#endif // NODE_MODULE_VERSION < IOJS_3_0_MODULE_VERSION - } - - inline void FatalException(const TryCatch& try_catch) { - node::FatalException(v8::Isolate::GetCurrent(), try_catch.try_catch_); - } - - inline v8::Local ErrnoException( - int errorno - , const char* syscall = NULL - , const char* message = NULL - , const char* path = NULL) { - return node::ErrnoException(v8::Isolate::GetCurrent(), errorno, syscall, - message, path); - } - - NAN_DEPRECATED inline v8::Local NanErrnoException( - int errorno - , const char* syscall = NULL - , const char* message = NULL - , const char* path = NULL) { - return ErrnoException(errorno, syscall, message, path); - } - - template - inline void SetIsolateData( - v8::Isolate *isolate - , T *data - ) { - isolate->SetData(0, data); - } - - template - inline T *GetIsolateData( - v8::Isolate *isolate - ) { - return static_cast(isolate->GetData(0)); - } - -class Utf8String { - public: - inline explicit Utf8String(v8::Local from) : - length_(0), str_(str_st_) { - HandleScope scope; - if (!from.IsEmpty()) { -#if NODE_MAJOR_VERSION >= 10 - v8::Local context = GetCurrentContext(); - v8::Local string = - from->ToString(context).FromMaybe(v8::Local()); -#else - v8::Local string = from->ToString(); -#endif - if (!string.IsEmpty()) { - size_t len = 3 * string->Length() + 1; - assert(len <= INT_MAX); - if (len > sizeof (str_st_)) { - str_ = static_cast(malloc(len)); - assert(str_ != 0); - } - const int flags = - v8::String::NO_NULL_TERMINATION | imp::kReplaceInvalidUtf8; -#if NODE_MAJOR_VERSION >= 11 - length_ = string->WriteUtf8(v8::Isolate::GetCurrent(), str_, - static_cast(len), 0, flags); -#else - // See https://github.com/nodejs/nan/issues/832. - // Disable the warning as there is no way around it. -#ifdef _MSC_VER -#pragma warning(push) -#pragma warning(disable : 4996) -#endif -#ifdef __GNUC__ -#pragma GCC diagnostic push -#pragma GCC diagnostic ignored "-Wdeprecated-declarations" -#endif - length_ = string->WriteUtf8(str_, static_cast(len), 0, flags); -#ifdef __GNUC__ -#pragma GCC diagnostic pop -#endif -#ifdef _MSC_VER -#pragma warning(pop) -#endif -#endif // NODE_MAJOR_VERSION < 11 - str_[length_] = '\0'; - } - } - } - - inline int length() const { - return length_; - } - - inline char* operator*() { return str_; } - inline const char* operator*() const { return str_; } - - inline ~Utf8String() { - if (str_ != str_st_) { - free(str_); - } - } - - private: - NAN_DISALLOW_ASSIGN_COPY_MOVE(Utf8String) - - int length_; - char *str_; - char str_st_[1024]; -}; - -#else // Node 0.8 and 0.10 - inline v8::Local Undefined() { - EscapableHandleScope scope; - return scope.Escape(New(v8::Undefined())); - } - - inline v8::Local Null() { - EscapableHandleScope scope; - return scope.Escape(New(v8::Null())); - } - - inline v8::Local True() { - EscapableHandleScope scope; - return scope.Escape(New(v8::True())); - } - - inline v8::Local False() { - EscapableHandleScope scope; - return scope.Escape(New(v8::False())); - } - - inline v8::Local EmptyString() { - return v8::String::Empty(); - } - - inline int AdjustExternalMemory(int bc) { - return static_cast(v8::V8::AdjustAmountOfExternalAllocatedMemory(bc)); - } - - inline void SetTemplate( - v8::Local templ - , const char *name - , v8::Local value) { - templ->Set(name, value); - } - - inline void SetTemplate( - v8::Local templ - , v8::Local name - , v8::Local value - , v8::PropertyAttribute attributes) { - templ->Set(name, value, attributes); - } - - inline v8::Local GetCurrentContext() { - return v8::Context::GetCurrent(); - } - - inline void* GetInternalFieldPointer( - v8::Local object - , int index) { - return object->GetPointerFromInternalField(index); - } - - inline void SetInternalFieldPointer( - v8::Local object - , int index - , void* value) { - object->SetPointerInInternalField(index, value); - } - -# define NAN_GC_CALLBACK(name) \ - void name(v8::GCType type, v8::GCCallbackFlags flags) - - inline void AddGCEpilogueCallback( - v8::GCEpilogueCallback callback - , v8::GCType gc_type_filter = v8::kGCTypeAll) { - v8::V8::AddGCEpilogueCallback(callback, gc_type_filter); - } - inline void RemoveGCEpilogueCallback( - v8::GCEpilogueCallback callback) { - v8::V8::RemoveGCEpilogueCallback(callback); - } - inline void AddGCPrologueCallback( - v8::GCPrologueCallback callback - , v8::GCType gc_type_filter = v8::kGCTypeAll) { - v8::V8::AddGCPrologueCallback(callback, gc_type_filter); - } - inline void RemoveGCPrologueCallback( - v8::GCPrologueCallback callback) { - v8::V8::RemoveGCPrologueCallback(callback); - } - inline void GetHeapStatistics( - v8::HeapStatistics *heap_statistics) { - v8::V8::GetHeapStatistics(heap_statistics); - } - -# define X(NAME) \ - inline v8::Local NAME(const char *msg) { \ - EscapableHandleScope scope; \ - return scope.Escape(v8::Exception::NAME(New(msg).ToLocalChecked())); \ - } \ - \ - inline \ - v8::Local NAME(v8::Local msg) { \ - return v8::Exception::NAME(msg); \ - } \ - \ - inline void Throw ## NAME(const char *msg) { \ - HandleScope scope; \ - v8::ThrowException(v8::Exception::NAME(New(msg).ToLocalChecked())); \ - } \ - \ - inline \ - void Throw ## NAME(v8::Local errmsg) { \ - HandleScope scope; \ - v8::ThrowException(v8::Exception::NAME(errmsg)); \ - } - - X(Error) - X(RangeError) - X(ReferenceError) - X(SyntaxError) - X(TypeError) - -# undef X - - inline void ThrowError(v8::Local error) { - v8::ThrowException(error); - } - - inline MaybeLocal NewBuffer( - char *data - , size_t length - , node::Buffer::free_callback callback - , void *hint - ) { - EscapableHandleScope scope; - // arbitrary buffer lengths requires - // NODE_MODULE_VERSION >= IOJS_3_0_MODULE_VERSION - assert(length <= imp::kMaxLength && "too large buffer"); - return scope.Escape( - New(node::Buffer::New(data, length, callback, hint)->handle_)); - } - - inline MaybeLocal CopyBuffer( - const char *data - , uint32_t size - ) { - EscapableHandleScope scope; - // arbitrary buffer lengths requires - // NODE_MODULE_VERSION >= IOJS_3_0_MODULE_VERSION - assert(size <= imp::kMaxLength && "too large buffer"); -#if NODE_MODULE_VERSION >= NODE_0_10_MODULE_VERSION - return scope.Escape(New(node::Buffer::New(data, size)->handle_)); -#else - return scope.Escape( - New(node::Buffer::New(const_cast(data), size)->handle_)); -#endif - } - - inline MaybeLocal NewBuffer(uint32_t size) { - // arbitrary buffer lengths requires - // NODE_MODULE_VERSION >= IOJS_3_0_MODULE_VERSION - EscapableHandleScope scope; - assert(size <= imp::kMaxLength && "too large buffer"); - return scope.Escape(New(node::Buffer::New(size)->handle_)); - } - - inline void FreeData(char *data, void *hint) { - (void) hint; // unused - delete[] data; - } - - inline MaybeLocal NewBuffer( - char* data - , uint32_t size - ) { - EscapableHandleScope scope; - // arbitrary buffer lengths requires - // NODE_MODULE_VERSION >= IOJS_3_0_MODULE_VERSION - assert(size <= imp::kMaxLength && "too large buffer"); - return scope.Escape( - New(node::Buffer::New(data, size, FreeData, NULL)->handle_)); - } - -namespace imp { -inline void -widenString(std::vector *ws, const uint8_t *s, int l) { - size_t len = static_cast(l); - if (l < 0) { - len = strlen(reinterpret_cast(s)); - } - assert(len <= INT_MAX && "string too long"); - ws->resize(len); - std::copy(s, s + len, ws->begin()); // NOLINT(build/include_what_you_use) -} -} // end of namespace imp - - inline MaybeLocal - NewOneByteString(const uint8_t * value, int length = -1) { - std::vector wideString; // NOLINT(build/include_what_you_use) - imp::widenString(&wideString, value, length); - return v8::String::New(wideString.data(), - static_cast(wideString.size())); - } - - inline MaybeLocal CompileScript( - v8::Local s - , const v8::ScriptOrigin& origin - ) { - return v8::Script::Compile(s, const_cast(&origin)); - } - - inline MaybeLocal CompileScript( - v8::Local s - ) { - return v8::Script::Compile(s); - } - - inline - MaybeLocal RunScript(v8::Local script) { - return script->Run(); - } - - inline v8::Local MakeCallback( - v8::Local target - , v8::Local func - , int argc - , v8::Local* argv) { - v8::HandleScope scope; - return scope.Close(New(node::MakeCallback(target, func, argc, argv))); - } - - inline v8::Local MakeCallback( - v8::Local target - , v8::Local symbol - , int argc - , v8::Local* argv) { - v8::HandleScope scope; - return scope.Close(New(node::MakeCallback(target, symbol, argc, argv))); - } - - inline v8::Local MakeCallback( - v8::Local target - , const char* method - , int argc - , v8::Local* argv) { - v8::HandleScope scope; - return scope.Close(New(node::MakeCallback(target, method, argc, argv))); - } - - inline void FatalException(const TryCatch& try_catch) { - node::FatalException(const_cast(try_catch.try_catch_)); - } - - inline v8::Local ErrnoException( - int errorno - , const char* syscall = NULL - , const char* message = NULL - , const char* path = NULL) { - return node::ErrnoException(errorno, syscall, message, path); - } - - NAN_DEPRECATED inline v8::Local NanErrnoException( - int errorno - , const char* syscall = NULL - , const char* message = NULL - , const char* path = NULL) { - return ErrnoException(errorno, syscall, message, path); - } - - - template - inline void SetIsolateData( - v8::Isolate *isolate - , T *data - ) { - isolate->SetData(data); - } - - template - inline T *GetIsolateData( - v8::Isolate *isolate - ) { - return static_cast(isolate->GetData()); - } - -class Utf8String { - public: - inline explicit Utf8String(v8::Local from) : - length_(0), str_(str_st_) { - v8::HandleScope scope; - if (!from.IsEmpty()) { - v8::Local string = from->ToString(); - if (!string.IsEmpty()) { - size_t len = 3 * string->Length() + 1; - assert(len <= INT_MAX); - if (len > sizeof (str_st_)) { - str_ = static_cast(malloc(len)); - assert(str_ != 0); - } - const int flags = - v8::String::NO_NULL_TERMINATION | imp::kReplaceInvalidUtf8; - length_ = string->WriteUtf8(str_, static_cast(len), 0, flags); - str_[length_] = '\0'; - } - } - } - - inline int length() const { - return length_; - } - - inline char* operator*() { return str_; } - inline const char* operator*() const { return str_; } - - inline ~Utf8String() { - if (str_ != str_st_) { - free(str_); - } - } - - private: - NAN_DISALLOW_ASSIGN_COPY_MOVE(Utf8String) - - int length_; - char *str_; - char str_st_[1024]; -}; - -#endif // NODE_MODULE_VERSION - -typedef void (*FreeCallback)(char *data, void *hint); - -typedef const FunctionCallbackInfo& NAN_METHOD_ARGS_TYPE; -typedef void NAN_METHOD_RETURN_TYPE; - -typedef const PropertyCallbackInfo& NAN_GETTER_ARGS_TYPE; -typedef void NAN_GETTER_RETURN_TYPE; - -typedef const PropertyCallbackInfo& NAN_SETTER_ARGS_TYPE; -typedef void NAN_SETTER_RETURN_TYPE; - -typedef const PropertyCallbackInfo& - NAN_PROPERTY_GETTER_ARGS_TYPE; -typedef void NAN_PROPERTY_GETTER_RETURN_TYPE; - -typedef const PropertyCallbackInfo& - NAN_PROPERTY_SETTER_ARGS_TYPE; -typedef void NAN_PROPERTY_SETTER_RETURN_TYPE; - -typedef const PropertyCallbackInfo& - NAN_PROPERTY_ENUMERATOR_ARGS_TYPE; -typedef void NAN_PROPERTY_ENUMERATOR_RETURN_TYPE; - -typedef const PropertyCallbackInfo& - NAN_PROPERTY_DELETER_ARGS_TYPE; -typedef void NAN_PROPERTY_DELETER_RETURN_TYPE; - -typedef const PropertyCallbackInfo& - NAN_PROPERTY_QUERY_ARGS_TYPE; -typedef void NAN_PROPERTY_QUERY_RETURN_TYPE; - -typedef const PropertyCallbackInfo& NAN_INDEX_GETTER_ARGS_TYPE; -typedef void NAN_INDEX_GETTER_RETURN_TYPE; - -typedef const PropertyCallbackInfo& NAN_INDEX_SETTER_ARGS_TYPE; -typedef void NAN_INDEX_SETTER_RETURN_TYPE; - -typedef const PropertyCallbackInfo& - NAN_INDEX_ENUMERATOR_ARGS_TYPE; -typedef void NAN_INDEX_ENUMERATOR_RETURN_TYPE; - -typedef const PropertyCallbackInfo& - NAN_INDEX_DELETER_ARGS_TYPE; -typedef void NAN_INDEX_DELETER_RETURN_TYPE; - -typedef const PropertyCallbackInfo& - NAN_INDEX_QUERY_ARGS_TYPE; -typedef void NAN_INDEX_QUERY_RETURN_TYPE; - -#define NAN_METHOD(name) \ - Nan::NAN_METHOD_RETURN_TYPE name(Nan::NAN_METHOD_ARGS_TYPE info) -#define NAN_GETTER(name) \ - Nan::NAN_GETTER_RETURN_TYPE name( \ - v8::Local property \ - , Nan::NAN_GETTER_ARGS_TYPE info) -#define NAN_SETTER(name) \ - Nan::NAN_SETTER_RETURN_TYPE name( \ - v8::Local property \ - , v8::Local value \ - , Nan::NAN_SETTER_ARGS_TYPE info) -#define NAN_PROPERTY_GETTER(name) \ - Nan::NAN_PROPERTY_GETTER_RETURN_TYPE name( \ - v8::Local property \ - , Nan::NAN_PROPERTY_GETTER_ARGS_TYPE info) -#define NAN_PROPERTY_SETTER(name) \ - Nan::NAN_PROPERTY_SETTER_RETURN_TYPE name( \ - v8::Local property \ - , v8::Local value \ - , Nan::NAN_PROPERTY_SETTER_ARGS_TYPE info) -#define NAN_PROPERTY_ENUMERATOR(name) \ - Nan::NAN_PROPERTY_ENUMERATOR_RETURN_TYPE name( \ - Nan::NAN_PROPERTY_ENUMERATOR_ARGS_TYPE info) -#define NAN_PROPERTY_DELETER(name) \ - Nan::NAN_PROPERTY_DELETER_RETURN_TYPE name( \ - v8::Local property \ - , Nan::NAN_PROPERTY_DELETER_ARGS_TYPE info) -#define NAN_PROPERTY_QUERY(name) \ - Nan::NAN_PROPERTY_QUERY_RETURN_TYPE name( \ - v8::Local property \ - , Nan::NAN_PROPERTY_QUERY_ARGS_TYPE info) -# define NAN_INDEX_GETTER(name) \ - Nan::NAN_INDEX_GETTER_RETURN_TYPE name( \ - uint32_t index \ - , Nan::NAN_INDEX_GETTER_ARGS_TYPE info) -#define NAN_INDEX_SETTER(name) \ - Nan::NAN_INDEX_SETTER_RETURN_TYPE name( \ - uint32_t index \ - , v8::Local value \ - , Nan::NAN_INDEX_SETTER_ARGS_TYPE info) -#define NAN_INDEX_ENUMERATOR(name) \ - Nan::NAN_INDEX_ENUMERATOR_RETURN_TYPE \ - name(Nan::NAN_INDEX_ENUMERATOR_ARGS_TYPE info) -#define NAN_INDEX_DELETER(name) \ - Nan::NAN_INDEX_DELETER_RETURN_TYPE name( \ - uint32_t index \ - , Nan::NAN_INDEX_DELETER_ARGS_TYPE info) -#define NAN_INDEX_QUERY(name) \ - Nan::NAN_INDEX_QUERY_RETURN_TYPE name( \ - uint32_t index \ - , Nan::NAN_INDEX_QUERY_ARGS_TYPE info) - -class Callback { - public: - Callback() {} - - explicit Callback(const v8::Local &fn) : handle_(fn) {} - - ~Callback() { - handle_.Reset(); - } - - bool operator==(const Callback &other) const { - return handle_ == other.handle_; - } - - bool operator!=(const Callback &other) const { - return !operator==(other); - } - - inline - v8::Local operator*() const { return GetFunction(); } - - NAN_DEPRECATED inline v8::Local operator()( - v8::Local target - , int argc = 0 - , v8::Local argv[] = 0) const { -#if NODE_MODULE_VERSION > NODE_0_10_MODULE_VERSION - v8::Isolate *isolate = v8::Isolate::GetCurrent(); -# if NODE_MODULE_VERSION >= NODE_9_0_MODULE_VERSION - AsyncResource async("nan:Callback:operator()"); - return Call_(isolate, target, argc, argv, &async) - .FromMaybe(v8::Local()); -# else - return Call_(isolate, target, argc, argv); -# endif // NODE_MODULE_VERSION >= NODE_9_0_MODULE_VERSION -#else - return Call_(target, argc, argv); -#endif // NODE_MODULE_VERSION > NODE_0_10_MODULE_VERSION - } - - NAN_DEPRECATED inline v8::Local operator()( - int argc = 0 - , v8::Local argv[] = 0) const { -#if NODE_MODULE_VERSION > NODE_0_10_MODULE_VERSION - v8::Isolate *isolate = v8::Isolate::GetCurrent(); - v8::EscapableHandleScope scope(isolate); -# if NODE_MODULE_VERSION >= NODE_9_0_MODULE_VERSION - AsyncResource async("nan:Callback:operator()"); - return scope.Escape(Call_(isolate, isolate->GetCurrentContext()->Global(), - argc, argv, &async) - .FromMaybe(v8::Local())); -# else - return scope.Escape( - Call_(isolate, isolate->GetCurrentContext()->Global(), argc, argv)); -# endif // NODE_MODULE_VERSION >= NODE_9_0_MODULE_VERSION -#else - v8::HandleScope scope; - return scope.Close(Call_(v8::Context::GetCurrent()->Global(), argc, argv)); -#endif // NODE_MODULE_VERSION > NODE_0_10_MODULE_VERSION - } - - inline MaybeLocal operator()( - AsyncResource* resource - , int argc = 0 - , v8::Local argv[] = 0) const { - return this->Call(argc, argv, resource); - } - - inline MaybeLocal operator()( - AsyncResource* resource - , v8::Local target - , int argc = 0 - , v8::Local argv[] = 0) const { - return this->Call(target, argc, argv, resource); - } - - // TODO(kkoopa): remove - inline void SetFunction(const v8::Local &fn) { - Reset(fn); - } - - inline void Reset(const v8::Local &fn) { - handle_.Reset(fn); - } - - inline void Reset() { - handle_.Reset(); - } - - inline v8::Local GetFunction() const { - return New(handle_); - } - - inline bool IsEmpty() const { - return handle_.IsEmpty(); - } - - // Deprecated: For async callbacks Use the versions that accept an - // AsyncResource. If this callback does not correspond to an async resource, - // that is, it is a synchronous function call on a non-empty JS stack, you - // should Nan::Call instead. - NAN_DEPRECATED inline v8::Local - Call(v8::Local target - , int argc - , v8::Local argv[]) const { -#if NODE_MODULE_VERSION > NODE_0_10_MODULE_VERSION - v8::Isolate *isolate = v8::Isolate::GetCurrent(); -# if NODE_MODULE_VERSION >= NODE_9_0_MODULE_VERSION - AsyncResource async("nan:Callback:Call"); - return Call_(isolate, target, argc, argv, &async) - .FromMaybe(v8::Local()); -# else - return Call_(isolate, target, argc, argv); -# endif // NODE_MODULE_VERSION >= NODE_9_0_MODULE_VERSION -#else - return Call_(target, argc, argv); -#endif - } - - // Deprecated: For async callbacks Use the versions that accept an - // AsyncResource. If this callback does not correspond to an async resource, - // that is, it is a synchronous function call on a non-empty JS stack, you - // should Nan::Call instead. - NAN_DEPRECATED inline v8::Local - Call(int argc, v8::Local argv[]) const { -#if NODE_MODULE_VERSION > NODE_0_10_MODULE_VERSION - v8::Isolate *isolate = v8::Isolate::GetCurrent(); - v8::EscapableHandleScope scope(isolate); -# if NODE_MODULE_VERSION >= NODE_9_0_MODULE_VERSION - AsyncResource async("nan:Callback:Call"); - return scope.Escape(Call_(isolate, isolate->GetCurrentContext()->Global(), - argc, argv, &async) - .FromMaybe(v8::Local())); -# else - return scope.Escape( - Call_(isolate, isolate->GetCurrentContext()->Global(), argc, argv)); -# endif // NODE_MODULE_VERSION >= NODE_9_0_MODULE_VERSION -#else - v8::HandleScope scope; - return scope.Close(Call_(v8::Context::GetCurrent()->Global(), argc, argv)); -#endif - } - - inline MaybeLocal - Call(v8::Local target - , int argc - , v8::Local argv[] - , AsyncResource* resource) const { -#if NODE_MODULE_VERSION >= NODE_9_0_MODULE_VERSION - v8::Isolate* isolate = v8::Isolate::GetCurrent(); - return Call_(isolate, target, argc, argv, resource); -#elif NODE_MODULE_VERSION > NODE_0_10_MODULE_VERSION - v8::Isolate *isolate = v8::Isolate::GetCurrent(); - return Call_(isolate, target, argc, argv); -#else - return Call_(target, argc, argv); -#endif - } - - inline MaybeLocal - Call(int argc, v8::Local argv[], AsyncResource* resource) const { -#if NODE_MODULE_VERSION >= NODE_9_0_MODULE_VERSION - v8::Isolate* isolate = v8::Isolate::GetCurrent(); - return Call(isolate->GetCurrentContext()->Global(), argc, argv, resource); -#elif NODE_MODULE_VERSION > NODE_0_10_MODULE_VERSION - v8::Isolate *isolate = v8::Isolate::GetCurrent(); - v8::EscapableHandleScope scope(isolate); - return scope.Escape( - Call_(isolate, isolate->GetCurrentContext()->Global(), argc, argv)); -#else - v8::HandleScope scope; - return scope.Close(Call_(v8::Context::GetCurrent()->Global(), argc, argv)); -#endif - } - - private: - NAN_DISALLOW_ASSIGN_COPY_MOVE(Callback) - Persistent handle_; - -#if NODE_MODULE_VERSION >= NODE_9_0_MODULE_VERSION - MaybeLocal Call_(v8::Isolate *isolate - , v8::Local target - , int argc - , v8::Local argv[] - , AsyncResource* resource) const { - EscapableHandleScope scope; - v8::Local func = New(handle_); - auto maybe = resource->runInAsyncScope(target, func, argc, argv); - v8::Local local; - if (!maybe.ToLocal(&local)) return MaybeLocal(); - return scope.Escape(local); - } -#elif NODE_MODULE_VERSION > NODE_0_10_MODULE_VERSION - v8::Local Call_(v8::Isolate *isolate - , v8::Local target - , int argc - , v8::Local argv[]) const { - EscapableHandleScope scope; - - v8::Local callback = New(handle_); -# if NODE_MODULE_VERSION < IOJS_3_0_MODULE_VERSION - return scope.Escape(New(node::MakeCallback( - isolate - , target - , callback - , argc - , argv - ))); -# else - return scope.Escape(node::MakeCallback( - isolate - , target - , callback - , argc - , argv - )); -# endif - } -#else - v8::Local Call_(v8::Local target - , int argc - , v8::Local argv[]) const { - EscapableHandleScope scope; - - v8::Local callback = New(handle_); - return scope.Escape(New(node::MakeCallback( - target - , callback - , argc - , argv - ))); - } -#endif -}; - -inline MaybeLocal Call( - const Nan::Callback& callback - , v8::Local recv - , int argc - , v8::Local argv[]) { - return Call(*callback, recv, argc, argv); -} - -inline MaybeLocal Call( - const Nan::Callback& callback - , int argc - , v8::Local argv[]) { -#if NODE_MODULE_VERSION > NODE_0_10_MODULE_VERSION - v8::Isolate* isolate = v8::Isolate::GetCurrent(); - v8::EscapableHandleScope scope(isolate); - return scope.Escape( - Call(*callback, isolate->GetCurrentContext()->Global(), argc, argv) - .FromMaybe(v8::Local())); -#else - EscapableHandleScope scope; - return scope.Escape( - Call(*callback, v8::Context::GetCurrent()->Global(), argc, argv) - .FromMaybe(v8::Local())); -#endif -} - -inline MaybeLocal Call( - v8::Local symbol - , v8::Local recv - , int argc - , v8::Local argv[]) { - EscapableHandleScope scope; - v8::Local fn_v = - Get(recv, symbol).FromMaybe(v8::Local()); - if (fn_v.IsEmpty() || !fn_v->IsFunction()) return v8::Local(); - v8::Local fn = fn_v.As(); - return scope.Escape( - Call(fn, recv, argc, argv).FromMaybe(v8::Local())); -} - -inline MaybeLocal Call( - const char* method - , v8::Local recv - , int argc - , v8::Local argv[]) { - EscapableHandleScope scope; - v8::Local method_string = - New(method).ToLocalChecked(); - return scope.Escape( - Call(method_string, recv, argc, argv).FromMaybe(v8::Local())); -} - -/* abstract */ class AsyncWorker { - public: - explicit AsyncWorker(Callback *callback_, - const char* resource_name = "nan:AsyncWorker") - : callback(callback_), errmsg_(NULL) { - request.data = this; - - HandleScope scope; - v8::Local obj = New(); - persistentHandle.Reset(obj); - async_resource = new AsyncResource(resource_name, obj); - } - - virtual ~AsyncWorker() { - HandleScope scope; - - if (!persistentHandle.IsEmpty()) - persistentHandle.Reset(); - delete callback; - delete[] errmsg_; - delete async_resource; - } - - virtual void WorkComplete() { - HandleScope scope; - - if (errmsg_ == NULL) - HandleOKCallback(); - else - HandleErrorCallback(); - delete callback; - callback = NULL; - } - - inline void SaveToPersistent( - const char *key, const v8::Local &value) { - HandleScope scope; - Set(New(persistentHandle), New(key).ToLocalChecked(), value).FromJust(); - } - - inline void SaveToPersistent( - const v8::Local &key, const v8::Local &value) { - HandleScope scope; - Set(New(persistentHandle), key, value).FromJust(); - } - - inline void SaveToPersistent( - uint32_t index, const v8::Local &value) { - HandleScope scope; - Set(New(persistentHandle), index, value).FromJust(); - } - - inline v8::Local GetFromPersistent(const char *key) const { - EscapableHandleScope scope; - return scope.Escape( - Get(New(persistentHandle), New(key).ToLocalChecked()) - .FromMaybe(v8::Local())); - } - - inline v8::Local - GetFromPersistent(const v8::Local &key) const { - EscapableHandleScope scope; - return scope.Escape( - Get(New(persistentHandle), key) - .FromMaybe(v8::Local())); - } - - inline v8::Local GetFromPersistent(uint32_t index) const { - EscapableHandleScope scope; - return scope.Escape( - Get(New(persistentHandle), index) - .FromMaybe(v8::Local())); - } - - virtual void Execute() = 0; - - uv_work_t request; - - virtual void Destroy() { - delete this; - } - - protected: - Persistent persistentHandle; - Callback *callback; - AsyncResource *async_resource; - - virtual void HandleOKCallback() { - HandleScope scope; - - callback->Call(0, NULL, async_resource); - } - - virtual void HandleErrorCallback() { - HandleScope scope; - - v8::Local argv[] = { - v8::Exception::Error(New(ErrorMessage()).ToLocalChecked()) - }; - callback->Call(1, argv, async_resource); - } - - void SetErrorMessage(const char *msg) { - delete[] errmsg_; - - size_t size = strlen(msg) + 1; - errmsg_ = new char[size]; - memcpy(errmsg_, msg, size); - } - - const char* ErrorMessage() const { - return errmsg_; - } - - private: - NAN_DISALLOW_ASSIGN_COPY_MOVE(AsyncWorker) - char *errmsg_; -}; - -/* abstract */ class AsyncBareProgressWorkerBase : public AsyncWorker { - public: - explicit AsyncBareProgressWorkerBase( - Callback *callback_, - const char* resource_name = "nan:AsyncBareProgressWorkerBase") - : AsyncWorker(callback_, resource_name) { - uv_async_init( - GetCurrentEventLoop() - , &async - , AsyncProgress_ - ); - async.data = this; - } - - virtual ~AsyncBareProgressWorkerBase() { - } - - virtual void WorkProgress() = 0; - - virtual void Destroy() { - uv_close(reinterpret_cast(&async), AsyncClose_); - } - - private: - inline static NAUV_WORK_CB(AsyncProgress_) { - AsyncBareProgressWorkerBase *worker = - static_cast(async->data); - worker->WorkProgress(); - } - - inline static void AsyncClose_(uv_handle_t* handle) { - AsyncBareProgressWorkerBase *worker = - static_cast(handle->data); - delete worker; - } - - protected: - uv_async_t async; -}; - -template -/* abstract */ -class AsyncBareProgressWorker : public AsyncBareProgressWorkerBase { - public: - explicit AsyncBareProgressWorker( - Callback *callback_, - const char* resource_name = "nan:AsyncBareProgressWorker") - : AsyncBareProgressWorkerBase(callback_, resource_name) { - uv_mutex_init(&async_lock); - } - - virtual ~AsyncBareProgressWorker() { - uv_mutex_destroy(&async_lock); - } - - class ExecutionProgress { - friend class AsyncBareProgressWorker; - public: - void Signal() const { - uv_mutex_lock(&that_->async_lock); - uv_async_send(&that_->async); - uv_mutex_unlock(&that_->async_lock); - } - - void Send(const T* data, size_t count) const { - that_->SendProgress_(data, count); - } - - private: - explicit ExecutionProgress(AsyncBareProgressWorker *that) : that_(that) {} - NAN_DISALLOW_ASSIGN_COPY_MOVE(ExecutionProgress) - AsyncBareProgressWorker* const that_; - }; - - virtual void Execute(const ExecutionProgress& progress) = 0; - virtual void HandleProgressCallback(const T *data, size_t size) = 0; - - protected: - uv_mutex_t async_lock; - - private: - void Execute() /*final override*/ { - ExecutionProgress progress(this); - Execute(progress); - } - - virtual void SendProgress_(const T *data, size_t count) = 0; -}; - -template -/* abstract */ -class AsyncProgressWorkerBase : public AsyncBareProgressWorker { - public: - explicit AsyncProgressWorkerBase( - Callback *callback_, - const char* resource_name = "nan:AsyncProgressWorkerBase") - : AsyncBareProgressWorker(callback_, resource_name), asyncdata_(NULL), - asyncsize_(0) { - } - - virtual ~AsyncProgressWorkerBase() { - delete[] asyncdata_; - } - - void WorkProgress() { - uv_mutex_lock(&this->async_lock); - T *data = asyncdata_; - size_t size = asyncsize_; - asyncdata_ = NULL; - asyncsize_ = 0; - uv_mutex_unlock(&this->async_lock); - - // Don't send progress events after we've already completed. - if (this->callback) { - this->HandleProgressCallback(data, size); - } - delete[] data; - } - - private: - void SendProgress_(const T *data, size_t count) { - T *new_data = new T[count]; - { - T *it = new_data; - std::copy(data, data + count, it); - } - - uv_mutex_lock(&this->async_lock); - T *old_data = asyncdata_; - asyncdata_ = new_data; - asyncsize_ = count; - uv_async_send(&this->async); - uv_mutex_unlock(&this->async_lock); - - delete[] old_data; - } - - T *asyncdata_; - size_t asyncsize_; -}; - -// This ensures compatibility to the previous un-templated AsyncProgressWorker -// class definition. -typedef AsyncProgressWorkerBase AsyncProgressWorker; - -template -/* abstract */ -class AsyncBareProgressQueueWorker : public AsyncBareProgressWorkerBase { - public: - explicit AsyncBareProgressQueueWorker( - Callback *callback_, - const char* resource_name = "nan:AsyncBareProgressQueueWorker") - : AsyncBareProgressWorkerBase(callback_, resource_name) { - } - - virtual ~AsyncBareProgressQueueWorker() { - } - - class ExecutionProgress { - friend class AsyncBareProgressQueueWorker; - public: - void Send(const T* data, size_t count) const { - that_->SendProgress_(data, count); - } - - private: - explicit ExecutionProgress(AsyncBareProgressQueueWorker *that) - : that_(that) {} - NAN_DISALLOW_ASSIGN_COPY_MOVE(ExecutionProgress) - AsyncBareProgressQueueWorker* const that_; - }; - - virtual void Execute(const ExecutionProgress& progress) = 0; - virtual void HandleProgressCallback(const T *data, size_t size) = 0; - - private: - void Execute() /*final override*/ { - ExecutionProgress progress(this); - Execute(progress); - } - - virtual void SendProgress_(const T *data, size_t count) = 0; -}; - -template -/* abstract */ -class AsyncProgressQueueWorker : public AsyncBareProgressQueueWorker { - public: - explicit AsyncProgressQueueWorker( - Callback *callback_, - const char* resource_name = "nan:AsyncProgressQueueWorker") - : AsyncBareProgressQueueWorker(callback_) { - uv_mutex_init(&async_lock); - } - - virtual ~AsyncProgressQueueWorker() { - uv_mutex_lock(&async_lock); - - while (!asyncdata_.empty()) { - std::pair &datapair = asyncdata_.front(); - T *data = datapair.first; - - asyncdata_.pop(); - - delete[] data; - } - - uv_mutex_unlock(&async_lock); - uv_mutex_destroy(&async_lock); - } - - void WorkComplete() { - WorkProgress(); - AsyncWorker::WorkComplete(); - } - - void WorkProgress() { - uv_mutex_lock(&async_lock); - - while (!asyncdata_.empty()) { - std::pair &datapair = asyncdata_.front(); - - T *data = datapair.first; - size_t size = datapair.second; - - asyncdata_.pop(); - uv_mutex_unlock(&async_lock); - - // Don't send progress events after we've already completed. - if (this->callback) { - this->HandleProgressCallback(data, size); - } - - delete[] data; - - uv_mutex_lock(&async_lock); - } - - uv_mutex_unlock(&async_lock); - } - - private: - void SendProgress_(const T *data, size_t count) { - T *new_data = new T[count]; - { - T *it = new_data; - std::copy(data, data + count, it); - } - - uv_mutex_lock(&async_lock); - asyncdata_.push(std::pair(new_data, count)); - uv_mutex_unlock(&async_lock); - - uv_async_send(&this->async); - } - - uv_mutex_t async_lock; - std::queue > asyncdata_; -}; - -inline void AsyncExecute (uv_work_t* req) { - AsyncWorker *worker = static_cast(req->data); - worker->Execute(); -} - -inline void AsyncExecuteComplete (uv_work_t* req) { - AsyncWorker* worker = static_cast(req->data); - worker->WorkComplete(); - worker->Destroy(); -} - -inline void AsyncQueueWorker (AsyncWorker* worker) { - uv_queue_work( - GetCurrentEventLoop() - , &worker->request - , AsyncExecute - , reinterpret_cast(AsyncExecuteComplete) - ); -} - -namespace imp { - -inline -ExternalOneByteStringResource const* -GetExternalResource(v8::Local str) { -#if NODE_MODULE_VERSION < ATOM_0_21_MODULE_VERSION - return str->GetExternalAsciiStringResource(); -#else - return str->GetExternalOneByteStringResource(); -#endif -} - -inline -bool -IsExternal(v8::Local str) { -#if NODE_MODULE_VERSION < ATOM_0_21_MODULE_VERSION - return str->IsExternalAscii(); -#else - return str->IsExternalOneByte(); -#endif -} - -} // end of namespace imp - -enum Encoding {ASCII, UTF8, BASE64, UCS2, BINARY, HEX, BUFFER}; - -#if NODE_MODULE_VERSION < NODE_0_10_MODULE_VERSION -# include "nan_string_bytes.h" // NOLINT(build/include) -#endif - -inline v8::Local Encode( - const void *buf, size_t len, enum Encoding encoding = BINARY) { -#if (NODE_MODULE_VERSION >= ATOM_0_21_MODULE_VERSION) - v8::Isolate* isolate = v8::Isolate::GetCurrent(); - node::encoding node_enc = static_cast(encoding); - - if (encoding == UCS2) { - return node::Encode( - isolate - , reinterpret_cast(buf) - , len / 2); - } else { - return node::Encode( - isolate - , reinterpret_cast(buf) - , len - , node_enc); - } -#elif (NODE_MODULE_VERSION > NODE_0_10_MODULE_VERSION) - return node::Encode( - v8::Isolate::GetCurrent() - , buf, len - , static_cast(encoding)); -#else -# if NODE_MODULE_VERSION >= NODE_0_10_MODULE_VERSION - return node::Encode(buf, len, static_cast(encoding)); -# else - return imp::Encode(reinterpret_cast(buf), len, encoding); -# endif -#endif -} - -inline ssize_t DecodeBytes( - v8::Local val, enum Encoding encoding = BINARY) { -#if (NODE_MODULE_VERSION > NODE_0_10_MODULE_VERSION) - return node::DecodeBytes( - v8::Isolate::GetCurrent() - , val - , static_cast(encoding)); -#else -# if (NODE_MODULE_VERSION < NODE_0_10_MODULE_VERSION) - if (encoding == BUFFER) { - return node::DecodeBytes(val, node::BINARY); - } -# endif - return node::DecodeBytes(val, static_cast(encoding)); -#endif -} - -inline ssize_t DecodeWrite( - char *buf - , size_t len - , v8::Local val - , enum Encoding encoding = BINARY) { -#if (NODE_MODULE_VERSION > NODE_0_10_MODULE_VERSION) - return node::DecodeWrite( - v8::Isolate::GetCurrent() - , buf - , len - , val - , static_cast(encoding)); -#else -# if (NODE_MODULE_VERSION < NODE_0_10_MODULE_VERSION) - if (encoding == BUFFER) { - return node::DecodeWrite(buf, len, val, node::BINARY); - } -# endif - return node::DecodeWrite( - buf - , len - , val - , static_cast(encoding)); -#endif -} - -inline void SetPrototypeTemplate( - v8::Local templ - , const char *name - , v8::Local value -) { - HandleScope scope; - SetTemplate(templ->PrototypeTemplate(), name, value); -} - -inline void SetPrototypeTemplate( - v8::Local templ - , v8::Local name - , v8::Local value - , v8::PropertyAttribute attributes -) { - HandleScope scope; - SetTemplate(templ->PrototypeTemplate(), name, value, attributes); -} - -inline void SetInstanceTemplate( - v8::Local templ - , const char *name - , v8::Local value -) { - HandleScope scope; - SetTemplate(templ->InstanceTemplate(), name, value); -} - -inline void SetInstanceTemplate( - v8::Local templ - , v8::Local name - , v8::Local value - , v8::PropertyAttribute attributes -) { - HandleScope scope; - SetTemplate(templ->InstanceTemplate(), name, value, attributes); -} - -namespace imp { - -// Note(@agnat): Helper to distinguish different receiver types. The first -// version deals with receivers derived from v8::Template. The second version -// handles everything else. The final argument only serves as discriminator and -// is unused. -template -inline -void -SetMethodAux(T recv, - v8::Local name, - v8::Local tpl, - v8::Template *) { - recv->Set(name, tpl); -} - -template -inline -void -SetMethodAux(T recv, - v8::Local name, - v8::Local tpl, - ...) { - Set(recv, name, GetFunction(tpl).ToLocalChecked()); -} - -} // end of namespace imp - -template class HandleType> -inline void SetMethod( - HandleType recv - , const char *name - , FunctionCallback callback) { - HandleScope scope; - v8::Local t = New(callback); - v8::Local fn_name = New(name).ToLocalChecked(); - t->SetClassName(fn_name); - // Note(@agnat): Pass an empty T* as discriminator. See note on - // SetMethodAux(...) above - imp::SetMethodAux(recv, fn_name, t, static_cast(0)); -} - -inline void SetPrototypeMethod( - v8::Local recv - , const char* name, FunctionCallback callback) { - HandleScope scope; - v8::Local t = New( - callback - , v8::Local() - , New(recv)); - v8::Local fn_name = New(name).ToLocalChecked(); - recv->PrototypeTemplate()->Set(fn_name, t); - t->SetClassName(fn_name); -} - -//=== Accessors and Such ======================================================= - -inline void SetAccessor( - v8::Local tpl - , v8::Local name - , GetterCallback getter - , SetterCallback setter = 0 - , v8::Local data = v8::Local() - , v8::AccessControl settings = v8::DEFAULT - , v8::PropertyAttribute attribute = v8::None - , imp::Sig signature = imp::Sig()) { - HandleScope scope; - - imp::NativeGetter getter_ = - imp::GetterCallbackWrapper; - imp::NativeSetter setter_ = - setter ? imp::SetterCallbackWrapper : 0; - - v8::Local otpl = New(); - otpl->SetInternalFieldCount(imp::kAccessorFieldCount); - v8::Local obj = NewInstance(otpl).ToLocalChecked(); - - obj->SetInternalField( - imp::kGetterIndex - , New(reinterpret_cast(getter))); - - if (setter != 0) { - obj->SetInternalField( - imp::kSetterIndex - , New(reinterpret_cast(setter))); - } - - if (!data.IsEmpty()) { - obj->SetInternalField(imp::kDataIndex, data); - } - - tpl->SetAccessor( - name - , getter_ - , setter_ - , obj - , settings - , attribute - , signature); -} - -inline bool SetAccessor( - v8::Local obj - , v8::Local name - , GetterCallback getter - , SetterCallback setter = 0 - , v8::Local data = v8::Local() - , v8::AccessControl settings = v8::DEFAULT - , v8::PropertyAttribute attribute = v8::None) { - HandleScope scope; - - imp::NativeGetter getter_ = - imp::GetterCallbackWrapper; - imp::NativeSetter setter_ = - setter ? imp::SetterCallbackWrapper : 0; - - v8::Local otpl = New(); - otpl->SetInternalFieldCount(imp::kAccessorFieldCount); - v8::Local dataobj = NewInstance(otpl).ToLocalChecked(); - - dataobj->SetInternalField( - imp::kGetterIndex - , New(reinterpret_cast(getter))); - - if (!data.IsEmpty()) { - dataobj->SetInternalField(imp::kDataIndex, data); - } - - if (setter) { - dataobj->SetInternalField( - imp::kSetterIndex - , New(reinterpret_cast(setter))); - } - -#if (NODE_MODULE_VERSION >= NODE_6_0_MODULE_VERSION) - return obj->SetAccessor( - GetCurrentContext() - , name - , getter_ - , setter_ - , dataobj - , settings - , attribute).FromMaybe(false); -#else - return obj->SetAccessor( - name - , getter_ - , setter_ - , dataobj - , settings - , attribute); -#endif -} - -inline void SetNamedPropertyHandler( - v8::Local tpl - , PropertyGetterCallback getter - , PropertySetterCallback setter = 0 - , PropertyQueryCallback query = 0 - , PropertyDeleterCallback deleter = 0 - , PropertyEnumeratorCallback enumerator = 0 - , v8::Local data = v8::Local()) { - HandleScope scope; - - imp::NativePropertyGetter getter_ = - imp::PropertyGetterCallbackWrapper; - imp::NativePropertySetter setter_ = - setter ? imp::PropertySetterCallbackWrapper : 0; - imp::NativePropertyQuery query_ = - query ? imp::PropertyQueryCallbackWrapper : 0; - imp::NativePropertyDeleter *deleter_ = - deleter ? imp::PropertyDeleterCallbackWrapper : 0; - imp::NativePropertyEnumerator enumerator_ = - enumerator ? imp::PropertyEnumeratorCallbackWrapper : 0; - - v8::Local otpl = New(); - otpl->SetInternalFieldCount(imp::kPropertyFieldCount); - v8::Local obj = NewInstance(otpl).ToLocalChecked(); - obj->SetInternalField( - imp::kPropertyGetterIndex - , New(reinterpret_cast(getter))); - - if (setter) { - obj->SetInternalField( - imp::kPropertySetterIndex - , New(reinterpret_cast(setter))); - } - - if (query) { - obj->SetInternalField( - imp::kPropertyQueryIndex - , New(reinterpret_cast(query))); - } - - if (deleter) { - obj->SetInternalField( - imp::kPropertyDeleterIndex - , New(reinterpret_cast(deleter))); - } - - if (enumerator) { - obj->SetInternalField( - imp::kPropertyEnumeratorIndex - , New(reinterpret_cast(enumerator))); - } - - if (!data.IsEmpty()) { - obj->SetInternalField(imp::kDataIndex, data); - } - -#if NODE_MODULE_VERSION > NODE_0_12_MODULE_VERSION - tpl->SetHandler(v8::NamedPropertyHandlerConfiguration( - getter_, setter_, query_, deleter_, enumerator_, obj)); -#else - tpl->SetNamedPropertyHandler( - getter_ - , setter_ - , query_ - , deleter_ - , enumerator_ - , obj); -#endif -} - -inline void SetIndexedPropertyHandler( - v8::Local tpl - , IndexGetterCallback getter - , IndexSetterCallback setter = 0 - , IndexQueryCallback query = 0 - , IndexDeleterCallback deleter = 0 - , IndexEnumeratorCallback enumerator = 0 - , v8::Local data = v8::Local()) { - HandleScope scope; - - imp::NativeIndexGetter getter_ = - imp::IndexGetterCallbackWrapper; - imp::NativeIndexSetter setter_ = - setter ? imp::IndexSetterCallbackWrapper : 0; - imp::NativeIndexQuery query_ = - query ? imp::IndexQueryCallbackWrapper : 0; - imp::NativeIndexDeleter deleter_ = - deleter ? imp::IndexDeleterCallbackWrapper : 0; - imp::NativeIndexEnumerator enumerator_ = - enumerator ? imp::IndexEnumeratorCallbackWrapper : 0; - - v8::Local otpl = New(); - otpl->SetInternalFieldCount(imp::kIndexPropertyFieldCount); - v8::Local obj = NewInstance(otpl).ToLocalChecked(); - obj->SetInternalField( - imp::kIndexPropertyGetterIndex - , New(reinterpret_cast(getter))); - - if (setter) { - obj->SetInternalField( - imp::kIndexPropertySetterIndex - , New(reinterpret_cast(setter))); - } - - if (query) { - obj->SetInternalField( - imp::kIndexPropertyQueryIndex - , New(reinterpret_cast(query))); - } - - if (deleter) { - obj->SetInternalField( - imp::kIndexPropertyDeleterIndex - , New(reinterpret_cast(deleter))); - } - - if (enumerator) { - obj->SetInternalField( - imp::kIndexPropertyEnumeratorIndex - , New(reinterpret_cast(enumerator))); - } - - if (!data.IsEmpty()) { - obj->SetInternalField(imp::kDataIndex, data); - } - -#if NODE_MODULE_VERSION > NODE_0_12_MODULE_VERSION - tpl->SetHandler(v8::IndexedPropertyHandlerConfiguration( - getter_, setter_, query_, deleter_, enumerator_, obj)); -#else - tpl->SetIndexedPropertyHandler( - getter_ - , setter_ - , query_ - , deleter_ - , enumerator_ - , obj); -#endif -} - -inline void SetCallHandler( - v8::Local tpl - , FunctionCallback callback - , v8::Local data = v8::Local()) { - HandleScope scope; - - v8::Local otpl = New(); - otpl->SetInternalFieldCount(imp::kFunctionFieldCount); - v8::Local obj = NewInstance(otpl).ToLocalChecked(); - - obj->SetInternalField( - imp::kFunctionIndex - , New(reinterpret_cast(callback))); - - if (!data.IsEmpty()) { - obj->SetInternalField(imp::kDataIndex, data); - } - - tpl->SetCallHandler(imp::FunctionCallbackWrapper, obj); -} - - -inline void SetCallAsFunctionHandler( - v8::Local tpl, - FunctionCallback callback, - v8::Local data = v8::Local()) { - HandleScope scope; - - v8::Local otpl = New(); - otpl->SetInternalFieldCount(imp::kFunctionFieldCount); - v8::Local obj = NewInstance(otpl).ToLocalChecked(); - - obj->SetInternalField( - imp::kFunctionIndex - , New(reinterpret_cast(callback))); - - if (!data.IsEmpty()) { - obj->SetInternalField(imp::kDataIndex, data); - } - - tpl->SetCallAsFunctionHandler(imp::FunctionCallbackWrapper, obj); -} - -//=== Weak Persistent Handling ================================================= - -#include "nan_weak.h" // NOLINT(build/include) - -//=== ObjectWrap =============================================================== - -#include "nan_object_wrap.h" // NOLINT(build/include) - -//=== HiddenValue/Private ====================================================== - -#include "nan_private.h" // NOLINT(build/include) - -//=== Export ================================================================== - -inline -void -Export(ADDON_REGISTER_FUNCTION_ARGS_TYPE target, const char *name, - FunctionCallback f) { - HandleScope scope; - - Set(target, New(name).ToLocalChecked(), - GetFunction(New(f)).ToLocalChecked()); -} - -//=== Tap Reverse Binding ===================================================== - -struct Tap { - explicit Tap(v8::Local t) : t_() { - HandleScope scope; - - t_.Reset(To(t).ToLocalChecked()); - } - - ~Tap() { t_.Reset(); } // not sure if neccessary - - inline void plan(int i) { - HandleScope scope; - v8::Local arg = New(i); - Call("plan", New(t_), 1, &arg); - } - - inline void ok(bool isOk, const char *msg = NULL) { - HandleScope scope; - v8::Local args[2]; - args[0] = New(isOk); - if (msg) args[1] = New(msg).ToLocalChecked(); - Call("ok", New(t_), msg ? 2 : 1, args); - } - - inline void pass(const char * msg = NULL) { - HandleScope scope; - v8::Local hmsg; - if (msg) hmsg = New(msg).ToLocalChecked(); - Call("pass", New(t_), msg ? 1 : 0, &hmsg); - } - - inline void end() { - HandleScope scope; - Call("end", New(t_), 0, NULL); - } - - private: - Persistent t_; -}; - -#define NAN_STRINGIZE2(x) #x -#define NAN_STRINGIZE(x) NAN_STRINGIZE2(x) -#define NAN_TEST_EXPRESSION(expression) \ - ( expression ), __FILE__ ":" NAN_STRINGIZE(__LINE__) ": " #expression - -#define NAN_EXPORT(target, function) Export(target, #function, function) - -#undef TYPE_CHECK - -//=== Generic Maybefication =================================================== - -namespace imp { - -template struct Maybefier; - -template struct Maybefier > { - inline static MaybeLocal convert(v8::Local v) { - return v; - } -}; - -template struct Maybefier > { - inline static MaybeLocal convert(MaybeLocal v) { - return v; - } -}; - -} // end of namespace imp - -template class MaybeMaybe> -inline MaybeLocal -MakeMaybe(MaybeMaybe v) { - return imp::Maybefier >::convert(v); -} - -//=== TypedArrayContents ======================================================= - -#include "nan_typedarray_contents.h" // NOLINT(build/include) - -//=== JSON ===================================================================== - -#include "nan_json.h" // NOLINT(build/include) - -} // end of namespace Nan - -#endif // NAN_H_ diff --git a/node_modules/websocket/node_modules/nan/nan_callbacks.h b/node_modules/websocket/node_modules/nan/nan_callbacks.h deleted file mode 100644 index 53ede84..0000000 --- a/node_modules/websocket/node_modules/nan/nan_callbacks.h +++ /dev/null @@ -1,88 +0,0 @@ -/********************************************************************* - * NAN - Native Abstractions for Node.js - * - * Copyright (c) 2018 NAN contributors - * - * MIT License - ********************************************************************/ - -#ifndef NAN_CALLBACKS_H_ -#define NAN_CALLBACKS_H_ - -template class FunctionCallbackInfo; -template class PropertyCallbackInfo; -template class Global; - -typedef void(*FunctionCallback)(const FunctionCallbackInfo&); -typedef void(*GetterCallback) - (v8::Local, const PropertyCallbackInfo&); -typedef void(*SetterCallback)( - v8::Local, - v8::Local, - const PropertyCallbackInfo&); -typedef void(*PropertyGetterCallback)( - v8::Local, - const PropertyCallbackInfo&); -typedef void(*PropertySetterCallback)( - v8::Local, - v8::Local, - const PropertyCallbackInfo&); -typedef void(*PropertyEnumeratorCallback) - (const PropertyCallbackInfo&); -typedef void(*PropertyDeleterCallback)( - v8::Local, - const PropertyCallbackInfo&); -typedef void(*PropertyQueryCallback)( - v8::Local, - const PropertyCallbackInfo&); -typedef void(*IndexGetterCallback)( - uint32_t, - const PropertyCallbackInfo&); -typedef void(*IndexSetterCallback)( - uint32_t, - v8::Local, - const PropertyCallbackInfo&); -typedef void(*IndexEnumeratorCallback) - (const PropertyCallbackInfo&); -typedef void(*IndexDeleterCallback)( - uint32_t, - const PropertyCallbackInfo&); -typedef void(*IndexQueryCallback)( - uint32_t, - const PropertyCallbackInfo&); - -namespace imp { -typedef v8::Local Sig; - -static const int kDataIndex = 0; - -static const int kFunctionIndex = 1; -static const int kFunctionFieldCount = 2; - -static const int kGetterIndex = 1; -static const int kSetterIndex = 2; -static const int kAccessorFieldCount = 3; - -static const int kPropertyGetterIndex = 1; -static const int kPropertySetterIndex = 2; -static const int kPropertyEnumeratorIndex = 3; -static const int kPropertyDeleterIndex = 4; -static const int kPropertyQueryIndex = 5; -static const int kPropertyFieldCount = 6; - -static const int kIndexPropertyGetterIndex = 1; -static const int kIndexPropertySetterIndex = 2; -static const int kIndexPropertyEnumeratorIndex = 3; -static const int kIndexPropertyDeleterIndex = 4; -static const int kIndexPropertyQueryIndex = 5; -static const int kIndexPropertyFieldCount = 6; - -} // end of namespace imp - -#if NODE_MODULE_VERSION > NODE_0_10_MODULE_VERSION -# include "nan_callbacks_12_inl.h" // NOLINT(build/include) -#else -# include "nan_callbacks_pre_12_inl.h" // NOLINT(build/include) -#endif - -#endif // NAN_CALLBACKS_H_ diff --git a/node_modules/websocket/node_modules/nan/nan_callbacks_12_inl.h b/node_modules/websocket/node_modules/nan/nan_callbacks_12_inl.h deleted file mode 100644 index c27b18d..0000000 --- a/node_modules/websocket/node_modules/nan/nan_callbacks_12_inl.h +++ /dev/null @@ -1,514 +0,0 @@ -/********************************************************************* - * NAN - Native Abstractions for Node.js - * - * Copyright (c) 2018 NAN contributors - * - * MIT License - ********************************************************************/ - -#ifndef NAN_CALLBACKS_12_INL_H_ -#define NAN_CALLBACKS_12_INL_H_ - -template -class ReturnValue { - v8::ReturnValue value_; - - public: - template - explicit inline ReturnValue(const v8::ReturnValue &value) : - value_(value) {} - template - explicit inline ReturnValue(const ReturnValue& that) - : value_(that.value_) { - TYPE_CHECK(T, S); - } - - // Handle setters - template inline void Set(const v8::Local &handle) { - TYPE_CHECK(T, S); - value_.Set(handle); - } - - template inline void Set(const Global &handle) { - TYPE_CHECK(T, S); -#if defined(V8_MAJOR_VERSION) && (V8_MAJOR_VERSION > 4 || \ - (V8_MAJOR_VERSION == 4 && defined(V8_MINOR_VERSION) && \ - (V8_MINOR_VERSION > 5 || (V8_MINOR_VERSION == 5 && \ - defined(V8_BUILD_NUMBER) && V8_BUILD_NUMBER >= 8)))) - value_.Set(handle); -#else - value_.Set(*reinterpret_cast*>(&handle)); - const_cast &>(handle).Reset(); -#endif - } - - // Fast primitive setters - inline void Set(bool value) { - TYPE_CHECK(T, v8::Boolean); - value_.Set(value); - } - - inline void Set(double i) { - TYPE_CHECK(T, v8::Number); - value_.Set(i); - } - - inline void Set(int32_t i) { - TYPE_CHECK(T, v8::Integer); - value_.Set(i); - } - - inline void Set(uint32_t i) { - TYPE_CHECK(T, v8::Integer); - value_.Set(i); - } - - // Fast JS primitive setters - inline void SetNull() { - TYPE_CHECK(T, v8::Primitive); - value_.SetNull(); - } - - inline void SetUndefined() { - TYPE_CHECK(T, v8::Primitive); - value_.SetUndefined(); - } - - inline void SetEmptyString() { - TYPE_CHECK(T, v8::String); - value_.SetEmptyString(); - } - - // Convenience getter for isolate - inline v8::Isolate *GetIsolate() const { - return value_.GetIsolate(); - } - - // Pointer setter: Uncompilable to prevent inadvertent misuse. - template - inline void Set(S *whatever) { TYPE_CHECK(S*, v8::Primitive); } -}; - -template -class FunctionCallbackInfo { - const v8::FunctionCallbackInfo &info_; - const v8::Local data_; - - public: - explicit inline FunctionCallbackInfo( - const v8::FunctionCallbackInfo &info - , v8::Local data) : - info_(info) - , data_(data) {} - - inline ReturnValue GetReturnValue() const { - return ReturnValue(info_.GetReturnValue()); - } - -#if NODE_MAJOR_VERSION < 10 - inline v8::Local Callee() const { return info_.Callee(); } -#endif - inline v8::Local Data() const { return data_; } - inline v8::Local Holder() const { return info_.Holder(); } - inline bool IsConstructCall() const { return info_.IsConstructCall(); } - inline int Length() const { return info_.Length(); } - inline v8::Local operator[](int i) const { return info_[i]; } - inline v8::Local This() const { return info_.This(); } - inline v8::Isolate *GetIsolate() const { return info_.GetIsolate(); } - - - protected: - static const int kHolderIndex = 0; - static const int kIsolateIndex = 1; - static const int kReturnValueDefaultValueIndex = 2; - static const int kReturnValueIndex = 3; - static const int kDataIndex = 4; - static const int kCalleeIndex = 5; - static const int kContextSaveIndex = 6; - static const int kArgsLength = 7; - - private: - NAN_DISALLOW_ASSIGN_COPY_MOVE(FunctionCallbackInfo) -}; - -template -class PropertyCallbackInfo { - const v8::PropertyCallbackInfo &info_; - const v8::Local data_; - - public: - explicit inline PropertyCallbackInfo( - const v8::PropertyCallbackInfo &info - , const v8::Local data) : - info_(info) - , data_(data) {} - - inline v8::Isolate* GetIsolate() const { return info_.GetIsolate(); } - inline v8::Local Data() const { return data_; } - inline v8::Local This() const { return info_.This(); } - inline v8::Local Holder() const { return info_.Holder(); } - inline ReturnValue GetReturnValue() const { - return ReturnValue(info_.GetReturnValue()); - } - - protected: - static const int kHolderIndex = 0; - static const int kIsolateIndex = 1; - static const int kReturnValueDefaultValueIndex = 2; - static const int kReturnValueIndex = 3; - static const int kDataIndex = 4; - static const int kThisIndex = 5; - static const int kArgsLength = 6; - - private: - NAN_DISALLOW_ASSIGN_COPY_MOVE(PropertyCallbackInfo) -}; - -namespace imp { -static -void FunctionCallbackWrapper(const v8::FunctionCallbackInfo &info) { - v8::Local obj = info.Data().As(); - FunctionCallback callback = reinterpret_cast( - reinterpret_cast( - obj->GetInternalField(kFunctionIndex).As()->Value())); - FunctionCallbackInfo - cbinfo(info, obj->GetInternalField(kDataIndex)); - callback(cbinfo); -} - -typedef void (*NativeFunction)(const v8::FunctionCallbackInfo &); - -#if NODE_MODULE_VERSION > NODE_0_12_MODULE_VERSION -static -void GetterCallbackWrapper( - v8::Local property - , const v8::PropertyCallbackInfo &info) { - v8::Local obj = info.Data().As(); - PropertyCallbackInfo - cbinfo(info, obj->GetInternalField(kDataIndex)); - GetterCallback callback = reinterpret_cast( - reinterpret_cast( - obj->GetInternalField(kGetterIndex).As()->Value())); - callback(property.As(), cbinfo); -} - -typedef void (*NativeGetter) - (v8::Local, const v8::PropertyCallbackInfo &); - -static -void SetterCallbackWrapper( - v8::Local property - , v8::Local value - , const v8::PropertyCallbackInfo &info) { - v8::Local obj = info.Data().As(); - PropertyCallbackInfo - cbinfo(info, obj->GetInternalField(kDataIndex)); - SetterCallback callback = reinterpret_cast( - reinterpret_cast( - obj->GetInternalField(kSetterIndex).As()->Value())); - callback(property.As(), value, cbinfo); -} - -typedef void (*NativeSetter)( - v8::Local - , v8::Local - , const v8::PropertyCallbackInfo &); -#else -static -void GetterCallbackWrapper( - v8::Local property - , const v8::PropertyCallbackInfo &info) { - v8::Local obj = info.Data().As(); - PropertyCallbackInfo - cbinfo(info, obj->GetInternalField(kDataIndex)); - GetterCallback callback = reinterpret_cast( - reinterpret_cast( - obj->GetInternalField(kGetterIndex).As()->Value())); - callback(property, cbinfo); -} - -typedef void (*NativeGetter) - (v8::Local, const v8::PropertyCallbackInfo &); - -static -void SetterCallbackWrapper( - v8::Local property - , v8::Local value - , const v8::PropertyCallbackInfo &info) { - v8::Local obj = info.Data().As(); - PropertyCallbackInfo - cbinfo(info, obj->GetInternalField(kDataIndex)); - SetterCallback callback = reinterpret_cast( - reinterpret_cast( - obj->GetInternalField(kSetterIndex).As()->Value())); - callback(property, value, cbinfo); -} - -typedef void (*NativeSetter)( - v8::Local - , v8::Local - , const v8::PropertyCallbackInfo &); -#endif - -#if NODE_MODULE_VERSION > NODE_0_12_MODULE_VERSION -static -void PropertyGetterCallbackWrapper( - v8::Local property - , const v8::PropertyCallbackInfo &info) { - v8::Local obj = info.Data().As(); - PropertyCallbackInfo - cbinfo(info, obj->GetInternalField(kDataIndex)); - PropertyGetterCallback callback = reinterpret_cast( - reinterpret_cast( - obj->GetInternalField(kPropertyGetterIndex) - .As()->Value())); - callback(property.As(), cbinfo); -} - -typedef void (*NativePropertyGetter) - (v8::Local, const v8::PropertyCallbackInfo &); - -static -void PropertySetterCallbackWrapper( - v8::Local property - , v8::Local value - , const v8::PropertyCallbackInfo &info) { - v8::Local obj = info.Data().As(); - PropertyCallbackInfo - cbinfo(info, obj->GetInternalField(kDataIndex)); - PropertySetterCallback callback = reinterpret_cast( - reinterpret_cast( - obj->GetInternalField(kPropertySetterIndex) - .As()->Value())); - callback(property.As(), value, cbinfo); -} - -typedef void (*NativePropertySetter)( - v8::Local - , v8::Local - , const v8::PropertyCallbackInfo &); - -static -void PropertyEnumeratorCallbackWrapper( - const v8::PropertyCallbackInfo &info) { - v8::Local obj = info.Data().As(); - PropertyCallbackInfo - cbinfo(info, obj->GetInternalField(kDataIndex)); - PropertyEnumeratorCallback callback = - reinterpret_cast(reinterpret_cast( - obj->GetInternalField(kPropertyEnumeratorIndex) - .As()->Value())); - callback(cbinfo); -} - -typedef void (*NativePropertyEnumerator) - (const v8::PropertyCallbackInfo &); - -static -void PropertyDeleterCallbackWrapper( - v8::Local property - , const v8::PropertyCallbackInfo &info) { - v8::Local obj = info.Data().As(); - PropertyCallbackInfo - cbinfo(info, obj->GetInternalField(kDataIndex)); - PropertyDeleterCallback callback = reinterpret_cast( - reinterpret_cast( - obj->GetInternalField(kPropertyDeleterIndex) - .As()->Value())); - callback(property.As(), cbinfo); -} - -typedef void (NativePropertyDeleter) - (v8::Local, const v8::PropertyCallbackInfo &); - -static -void PropertyQueryCallbackWrapper( - v8::Local property - , const v8::PropertyCallbackInfo &info) { - v8::Local obj = info.Data().As(); - PropertyCallbackInfo - cbinfo(info, obj->GetInternalField(kDataIndex)); - PropertyQueryCallback callback = reinterpret_cast( - reinterpret_cast( - obj->GetInternalField(kPropertyQueryIndex) - .As()->Value())); - callback(property.As(), cbinfo); -} - -typedef void (*NativePropertyQuery) - (v8::Local, const v8::PropertyCallbackInfo &); -#else -static -void PropertyGetterCallbackWrapper( - v8::Local property - , const v8::PropertyCallbackInfo &info) { - v8::Local obj = info.Data().As(); - PropertyCallbackInfo - cbinfo(info, obj->GetInternalField(kDataIndex)); - PropertyGetterCallback callback = reinterpret_cast( - reinterpret_cast( - obj->GetInternalField(kPropertyGetterIndex) - .As()->Value())); - callback(property, cbinfo); -} - -typedef void (*NativePropertyGetter) - (v8::Local, const v8::PropertyCallbackInfo &); - -static -void PropertySetterCallbackWrapper( - v8::Local property - , v8::Local value - , const v8::PropertyCallbackInfo &info) { - v8::Local obj = info.Data().As(); - PropertyCallbackInfo - cbinfo(info, obj->GetInternalField(kDataIndex)); - PropertySetterCallback callback = reinterpret_cast( - reinterpret_cast( - obj->GetInternalField(kPropertySetterIndex) - .As()->Value())); - callback(property, value, cbinfo); -} - -typedef void (*NativePropertySetter)( - v8::Local - , v8::Local - , const v8::PropertyCallbackInfo &); - -static -void PropertyEnumeratorCallbackWrapper( - const v8::PropertyCallbackInfo &info) { - v8::Local obj = info.Data().As(); - PropertyCallbackInfo - cbinfo(info, obj->GetInternalField(kDataIndex)); - PropertyEnumeratorCallback callback = - reinterpret_cast(reinterpret_cast( - obj->GetInternalField(kPropertyEnumeratorIndex) - .As()->Value())); - callback(cbinfo); -} - -typedef void (*NativePropertyEnumerator) - (const v8::PropertyCallbackInfo &); - -static -void PropertyDeleterCallbackWrapper( - v8::Local property - , const v8::PropertyCallbackInfo &info) { - v8::Local obj = info.Data().As(); - PropertyCallbackInfo - cbinfo(info, obj->GetInternalField(kDataIndex)); - PropertyDeleterCallback callback = reinterpret_cast( - reinterpret_cast( - obj->GetInternalField(kPropertyDeleterIndex) - .As()->Value())); - callback(property, cbinfo); -} - -typedef void (NativePropertyDeleter) - (v8::Local, const v8::PropertyCallbackInfo &); - -static -void PropertyQueryCallbackWrapper( - v8::Local property - , const v8::PropertyCallbackInfo &info) { - v8::Local obj = info.Data().As(); - PropertyCallbackInfo - cbinfo(info, obj->GetInternalField(kDataIndex)); - PropertyQueryCallback callback = reinterpret_cast( - reinterpret_cast( - obj->GetInternalField(kPropertyQueryIndex) - .As()->Value())); - callback(property, cbinfo); -} - -typedef void (*NativePropertyQuery) - (v8::Local, const v8::PropertyCallbackInfo &); -#endif - -static -void IndexGetterCallbackWrapper( - uint32_t index, const v8::PropertyCallbackInfo &info) { - v8::Local obj = info.Data().As(); - PropertyCallbackInfo - cbinfo(info, obj->GetInternalField(kDataIndex)); - IndexGetterCallback callback = reinterpret_cast( - reinterpret_cast( - obj->GetInternalField(kIndexPropertyGetterIndex) - .As()->Value())); - callback(index, cbinfo); -} - -typedef void (*NativeIndexGetter) - (uint32_t, const v8::PropertyCallbackInfo &); - -static -void IndexSetterCallbackWrapper( - uint32_t index - , v8::Local value - , const v8::PropertyCallbackInfo &info) { - v8::Local obj = info.Data().As(); - PropertyCallbackInfo - cbinfo(info, obj->GetInternalField(kDataIndex)); - IndexSetterCallback callback = reinterpret_cast( - reinterpret_cast( - obj->GetInternalField(kIndexPropertySetterIndex) - .As()->Value())); - callback(index, value, cbinfo); -} - -typedef void (*NativeIndexSetter)( - uint32_t - , v8::Local - , const v8::PropertyCallbackInfo &); - -static -void IndexEnumeratorCallbackWrapper( - const v8::PropertyCallbackInfo &info) { - v8::Local obj = info.Data().As(); - PropertyCallbackInfo - cbinfo(info, obj->GetInternalField(kDataIndex)); - IndexEnumeratorCallback callback = reinterpret_cast( - reinterpret_cast( - obj->GetInternalField( - kIndexPropertyEnumeratorIndex).As()->Value())); - callback(cbinfo); -} - -typedef void (*NativeIndexEnumerator) - (const v8::PropertyCallbackInfo &); - -static -void IndexDeleterCallbackWrapper( - uint32_t index, const v8::PropertyCallbackInfo &info) { - v8::Local obj = info.Data().As(); - PropertyCallbackInfo - cbinfo(info, obj->GetInternalField(kDataIndex)); - IndexDeleterCallback callback = reinterpret_cast( - reinterpret_cast( - obj->GetInternalField(kIndexPropertyDeleterIndex) - .As()->Value())); - callback(index, cbinfo); -} - -typedef void (*NativeIndexDeleter) - (uint32_t, const v8::PropertyCallbackInfo &); - -static -void IndexQueryCallbackWrapper( - uint32_t index, const v8::PropertyCallbackInfo &info) { - v8::Local obj = info.Data().As(); - PropertyCallbackInfo - cbinfo(info, obj->GetInternalField(kDataIndex)); - IndexQueryCallback callback = reinterpret_cast( - reinterpret_cast( - obj->GetInternalField(kIndexPropertyQueryIndex) - .As()->Value())); - callback(index, cbinfo); -} - -typedef void (*NativeIndexQuery) - (uint32_t, const v8::PropertyCallbackInfo &); -} // end of namespace imp - -#endif // NAN_CALLBACKS_12_INL_H_ diff --git a/node_modules/websocket/node_modules/nan/nan_callbacks_pre_12_inl.h b/node_modules/websocket/node_modules/nan/nan_callbacks_pre_12_inl.h deleted file mode 100644 index c9ba499..0000000 --- a/node_modules/websocket/node_modules/nan/nan_callbacks_pre_12_inl.h +++ /dev/null @@ -1,520 +0,0 @@ -/********************************************************************* - * NAN - Native Abstractions for Node.js - * - * Copyright (c) 2018 NAN contributors - * - * MIT License - ********************************************************************/ - -#ifndef NAN_CALLBACKS_PRE_12_INL_H_ -#define NAN_CALLBACKS_PRE_12_INL_H_ - -namespace imp { -template class ReturnValueImp; -} // end of namespace imp - -template -class ReturnValue { - v8::Isolate *isolate_; - v8::Persistent *value_; - friend class imp::ReturnValueImp; - - public: - template - explicit inline ReturnValue(v8::Isolate *isolate, v8::Persistent *p) : - isolate_(isolate), value_(p) {} - template - explicit inline ReturnValue(const ReturnValue& that) - : isolate_(that.isolate_), value_(that.value_) { - TYPE_CHECK(T, S); - } - - // Handle setters - template inline void Set(const v8::Local &handle) { - TYPE_CHECK(T, S); - value_->Dispose(); - *value_ = v8::Persistent::New(handle); - } - - template inline void Set(const Global &handle) { - TYPE_CHECK(T, S); - value_->Dispose(); - *value_ = v8::Persistent::New(handle.persistent); - const_cast &>(handle).Reset(); - } - - // Fast primitive setters - inline void Set(bool value) { - v8::HandleScope scope; - - TYPE_CHECK(T, v8::Boolean); - value_->Dispose(); - *value_ = v8::Persistent::New(v8::Boolean::New(value)); - } - - inline void Set(double i) { - v8::HandleScope scope; - - TYPE_CHECK(T, v8::Number); - value_->Dispose(); - *value_ = v8::Persistent::New(v8::Number::New(i)); - } - - inline void Set(int32_t i) { - v8::HandleScope scope; - - TYPE_CHECK(T, v8::Integer); - value_->Dispose(); - *value_ = v8::Persistent::New(v8::Int32::New(i)); - } - - inline void Set(uint32_t i) { - v8::HandleScope scope; - - TYPE_CHECK(T, v8::Integer); - value_->Dispose(); - *value_ = v8::Persistent::New(v8::Uint32::NewFromUnsigned(i)); - } - - // Fast JS primitive setters - inline void SetNull() { - v8::HandleScope scope; - - TYPE_CHECK(T, v8::Primitive); - value_->Dispose(); - *value_ = v8::Persistent::New(v8::Null()); - } - - inline void SetUndefined() { - v8::HandleScope scope; - - TYPE_CHECK(T, v8::Primitive); - value_->Dispose(); - *value_ = v8::Persistent::New(v8::Undefined()); - } - - inline void SetEmptyString() { - v8::HandleScope scope; - - TYPE_CHECK(T, v8::String); - value_->Dispose(); - *value_ = v8::Persistent::New(v8::String::Empty()); - } - - // Convenience getter for isolate - inline v8::Isolate *GetIsolate() const { - return isolate_; - } - - // Pointer setter: Uncompilable to prevent inadvertent misuse. - template - inline void Set(S *whatever) { TYPE_CHECK(S*, v8::Primitive); } -}; - -template -class FunctionCallbackInfo { - const v8::Arguments &args_; - v8::Local data_; - ReturnValue return_value_; - v8::Persistent retval_; - - public: - explicit inline FunctionCallbackInfo( - const v8::Arguments &args - , v8::Local data) : - args_(args) - , data_(data) - , return_value_(args.GetIsolate(), &retval_) - , retval_(v8::Persistent::New(v8::Undefined())) {} - - inline ~FunctionCallbackInfo() { - retval_.Dispose(); - retval_.Clear(); - } - - inline ReturnValue GetReturnValue() const { - return ReturnValue(return_value_); - } - - inline v8::Local Callee() const { return args_.Callee(); } - inline v8::Local Data() const { return data_; } - inline v8::Local Holder() const { return args_.Holder(); } - inline bool IsConstructCall() const { return args_.IsConstructCall(); } - inline int Length() const { return args_.Length(); } - inline v8::Local operator[](int i) const { return args_[i]; } - inline v8::Local This() const { return args_.This(); } - inline v8::Isolate *GetIsolate() const { return args_.GetIsolate(); } - - - protected: - static const int kHolderIndex = 0; - static const int kIsolateIndex = 1; - static const int kReturnValueDefaultValueIndex = 2; - static const int kReturnValueIndex = 3; - static const int kDataIndex = 4; - static const int kCalleeIndex = 5; - static const int kContextSaveIndex = 6; - static const int kArgsLength = 7; - - private: - NAN_DISALLOW_ASSIGN_COPY_MOVE(FunctionCallbackInfo) -}; - -template -class PropertyCallbackInfoBase { - const v8::AccessorInfo &info_; - const v8::Local data_; - - public: - explicit inline PropertyCallbackInfoBase( - const v8::AccessorInfo &info - , const v8::Local data) : - info_(info) - , data_(data) {} - - inline v8::Isolate* GetIsolate() const { return info_.GetIsolate(); } - inline v8::Local Data() const { return data_; } - inline v8::Local This() const { return info_.This(); } - inline v8::Local Holder() const { return info_.Holder(); } - - protected: - static const int kHolderIndex = 0; - static const int kIsolateIndex = 1; - static const int kReturnValueDefaultValueIndex = 2; - static const int kReturnValueIndex = 3; - static const int kDataIndex = 4; - static const int kThisIndex = 5; - static const int kArgsLength = 6; - - private: - NAN_DISALLOW_ASSIGN_COPY_MOVE(PropertyCallbackInfoBase) -}; - -template -class PropertyCallbackInfo : public PropertyCallbackInfoBase { - ReturnValue return_value_; - v8::Persistent retval_; - - public: - explicit inline PropertyCallbackInfo( - const v8::AccessorInfo &info - , const v8::Local data) : - PropertyCallbackInfoBase(info, data) - , return_value_(info.GetIsolate(), &retval_) - , retval_(v8::Persistent::New(v8::Undefined())) {} - - inline ~PropertyCallbackInfo() { - retval_.Dispose(); - retval_.Clear(); - } - - inline ReturnValue GetReturnValue() const { return return_value_; } -}; - -template<> -class PropertyCallbackInfo : - public PropertyCallbackInfoBase { - ReturnValue return_value_; - v8::Persistent retval_; - - public: - explicit inline PropertyCallbackInfo( - const v8::AccessorInfo &info - , const v8::Local data) : - PropertyCallbackInfoBase(info, data) - , return_value_(info.GetIsolate(), &retval_) - , retval_(v8::Persistent::New(v8::Local())) {} - - inline ~PropertyCallbackInfo() { - retval_.Dispose(); - retval_.Clear(); - } - - inline ReturnValue GetReturnValue() const { - return return_value_; - } -}; - -template<> -class PropertyCallbackInfo : - public PropertyCallbackInfoBase { - ReturnValue return_value_; - v8::Persistent retval_; - - public: - explicit inline PropertyCallbackInfo( - const v8::AccessorInfo &info - , const v8::Local data) : - PropertyCallbackInfoBase(info, data) - , return_value_(info.GetIsolate(), &retval_) - , retval_(v8::Persistent::New(v8::Local())) {} - - inline ~PropertyCallbackInfo() { - retval_.Dispose(); - retval_.Clear(); - } - - inline ReturnValue GetReturnValue() const { - return return_value_; - } -}; - -template<> -class PropertyCallbackInfo : - public PropertyCallbackInfoBase { - ReturnValue return_value_; - v8::Persistent retval_; - - public: - explicit inline PropertyCallbackInfo( - const v8::AccessorInfo &info - , const v8::Local data) : - PropertyCallbackInfoBase(info, data) - , return_value_(info.GetIsolate(), &retval_) - , retval_(v8::Persistent::New(v8::Local())) {} - - inline ~PropertyCallbackInfo() { - retval_.Dispose(); - retval_.Clear(); - } - - inline ReturnValue GetReturnValue() const { - return return_value_; - } -}; - -namespace imp { -template -class ReturnValueImp : public ReturnValue { - public: - explicit ReturnValueImp(ReturnValue that) : - ReturnValue(that) {} - inline v8::Handle Value() { - return *ReturnValue::value_; - } -}; - -static -v8::Handle FunctionCallbackWrapper(const v8::Arguments &args) { - v8::Local obj = args.Data().As(); - FunctionCallback callback = reinterpret_cast( - reinterpret_cast( - obj->GetInternalField(kFunctionIndex).As()->Value())); - FunctionCallbackInfo - cbinfo(args, obj->GetInternalField(kDataIndex)); - callback(cbinfo); - return ReturnValueImp(cbinfo.GetReturnValue()).Value(); -} - -typedef v8::Handle (*NativeFunction)(const v8::Arguments &); - -static -v8::Handle GetterCallbackWrapper( - v8::Local property, const v8::AccessorInfo &info) { - v8::Local obj = info.Data().As(); - PropertyCallbackInfo - cbinfo(info, obj->GetInternalField(kDataIndex)); - GetterCallback callback = reinterpret_cast( - reinterpret_cast( - obj->GetInternalField(kGetterIndex).As()->Value())); - callback(property, cbinfo); - return ReturnValueImp(cbinfo.GetReturnValue()).Value(); -} - -typedef v8::Handle (*NativeGetter) - (v8::Local, const v8::AccessorInfo &); - -static -void SetterCallbackWrapper( - v8::Local property - , v8::Local value - , const v8::AccessorInfo &info) { - v8::Local obj = info.Data().As(); - PropertyCallbackInfo - cbinfo(info, obj->GetInternalField(kDataIndex)); - SetterCallback callback = reinterpret_cast( - reinterpret_cast( - obj->GetInternalField(kSetterIndex).As()->Value())); - callback(property, value, cbinfo); -} - -typedef void (*NativeSetter) - (v8::Local, v8::Local, const v8::AccessorInfo &); - -static -v8::Handle PropertyGetterCallbackWrapper( - v8::Local property, const v8::AccessorInfo &info) { - v8::Local obj = info.Data().As(); - PropertyCallbackInfo - cbinfo(info, obj->GetInternalField(kDataIndex)); - PropertyGetterCallback callback = reinterpret_cast( - reinterpret_cast( - obj->GetInternalField(kPropertyGetterIndex) - .As()->Value())); - callback(property, cbinfo); - return ReturnValueImp(cbinfo.GetReturnValue()).Value(); -} - -typedef v8::Handle (*NativePropertyGetter) - (v8::Local, const v8::AccessorInfo &); - -static -v8::Handle PropertySetterCallbackWrapper( - v8::Local property - , v8::Local value - , const v8::AccessorInfo &info) { - v8::Local obj = info.Data().As(); - PropertyCallbackInfo - cbinfo(info, obj->GetInternalField(kDataIndex)); - PropertySetterCallback callback = reinterpret_cast( - reinterpret_cast( - obj->GetInternalField(kPropertySetterIndex) - .As()->Value())); - callback(property, value, cbinfo); - return ReturnValueImp(cbinfo.GetReturnValue()).Value(); -} - -typedef v8::Handle (*NativePropertySetter) - (v8::Local, v8::Local, const v8::AccessorInfo &); - -static -v8::Handle PropertyEnumeratorCallbackWrapper( - const v8::AccessorInfo &info) { - v8::Local obj = info.Data().As(); - PropertyCallbackInfo - cbinfo(info, obj->GetInternalField(kDataIndex)); - PropertyEnumeratorCallback callback = - reinterpret_cast(reinterpret_cast( - obj->GetInternalField(kPropertyEnumeratorIndex) - .As()->Value())); - callback(cbinfo); - return ReturnValueImp(cbinfo.GetReturnValue()).Value(); -} - -typedef v8::Handle (*NativePropertyEnumerator) - (const v8::AccessorInfo &); - -static -v8::Handle PropertyDeleterCallbackWrapper( - v8::Local property - , const v8::AccessorInfo &info) { - v8::Local obj = info.Data().As(); - PropertyCallbackInfo - cbinfo(info, obj->GetInternalField(kDataIndex)); - PropertyDeleterCallback callback = reinterpret_cast( - reinterpret_cast( - obj->GetInternalField(kPropertyDeleterIndex) - .As()->Value())); - callback(property, cbinfo); - return ReturnValueImp(cbinfo.GetReturnValue()).Value(); -} - -typedef v8::Handle (NativePropertyDeleter) - (v8::Local, const v8::AccessorInfo &); - -static -v8::Handle PropertyQueryCallbackWrapper( - v8::Local property, const v8::AccessorInfo &info) { - v8::Local obj = info.Data().As(); - PropertyCallbackInfo - cbinfo(info, obj->GetInternalField(kDataIndex)); - PropertyQueryCallback callback = reinterpret_cast( - reinterpret_cast( - obj->GetInternalField(kPropertyQueryIndex) - .As()->Value())); - callback(property, cbinfo); - return ReturnValueImp(cbinfo.GetReturnValue()).Value(); -} - -typedef v8::Handle (*NativePropertyQuery) - (v8::Local, const v8::AccessorInfo &); - -static -v8::Handle IndexGetterCallbackWrapper( - uint32_t index, const v8::AccessorInfo &info) { - v8::Local obj = info.Data().As(); - PropertyCallbackInfo - cbinfo(info, obj->GetInternalField(kDataIndex)); - IndexGetterCallback callback = reinterpret_cast( - reinterpret_cast( - obj->GetInternalField(kIndexPropertyGetterIndex) - .As()->Value())); - callback(index, cbinfo); - return ReturnValueImp(cbinfo.GetReturnValue()).Value(); -} - -typedef v8::Handle (*NativeIndexGetter) - (uint32_t, const v8::AccessorInfo &); - -static -v8::Handle IndexSetterCallbackWrapper( - uint32_t index - , v8::Local value - , const v8::AccessorInfo &info) { - v8::Local obj = info.Data().As(); - PropertyCallbackInfo - cbinfo(info, obj->GetInternalField(kDataIndex)); - IndexSetterCallback callback = reinterpret_cast( - reinterpret_cast( - obj->GetInternalField(kIndexPropertySetterIndex) - .As()->Value())); - callback(index, value, cbinfo); - return ReturnValueImp(cbinfo.GetReturnValue()).Value(); -} - -typedef v8::Handle (*NativeIndexSetter) - (uint32_t, v8::Local, const v8::AccessorInfo &); - -static -v8::Handle IndexEnumeratorCallbackWrapper( - const v8::AccessorInfo &info) { - v8::Local obj = info.Data().As(); - PropertyCallbackInfo - cbinfo(info, obj->GetInternalField(kDataIndex)); - IndexEnumeratorCallback callback = reinterpret_cast( - reinterpret_cast( - obj->GetInternalField(kIndexPropertyEnumeratorIndex) - .As()->Value())); - callback(cbinfo); - return ReturnValueImp(cbinfo.GetReturnValue()).Value(); -} - -typedef v8::Handle (*NativeIndexEnumerator) - (const v8::AccessorInfo &); - -static -v8::Handle IndexDeleterCallbackWrapper( - uint32_t index, const v8::AccessorInfo &info) { - v8::Local obj = info.Data().As(); - PropertyCallbackInfo - cbinfo(info, obj->GetInternalField(kDataIndex)); - IndexDeleterCallback callback = reinterpret_cast( - reinterpret_cast( - obj->GetInternalField(kIndexPropertyDeleterIndex) - .As()->Value())); - callback(index, cbinfo); - return ReturnValueImp(cbinfo.GetReturnValue()).Value(); -} - -typedef v8::Handle (*NativeIndexDeleter) - (uint32_t, const v8::AccessorInfo &); - -static -v8::Handle IndexQueryCallbackWrapper( - uint32_t index, const v8::AccessorInfo &info) { - v8::Local obj = info.Data().As(); - PropertyCallbackInfo - cbinfo(info, obj->GetInternalField(kDataIndex)); - IndexQueryCallback callback = reinterpret_cast( - reinterpret_cast( - obj->GetInternalField(kIndexPropertyQueryIndex) - .As()->Value())); - callback(index, cbinfo); - return ReturnValueImp(cbinfo.GetReturnValue()).Value(); -} - -typedef v8::Handle (*NativeIndexQuery) - (uint32_t, const v8::AccessorInfo &); -} // end of namespace imp - -#endif // NAN_CALLBACKS_PRE_12_INL_H_ diff --git a/node_modules/websocket/node_modules/nan/nan_converters.h b/node_modules/websocket/node_modules/nan/nan_converters.h deleted file mode 100644 index c0b3272..0000000 --- a/node_modules/websocket/node_modules/nan/nan_converters.h +++ /dev/null @@ -1,72 +0,0 @@ -/********************************************************************* - * NAN - Native Abstractions for Node.js - * - * Copyright (c) 2018 NAN contributors - * - * MIT License - ********************************************************************/ - -#ifndef NAN_CONVERTERS_H_ -#define NAN_CONVERTERS_H_ - -namespace imp { -template struct ToFactoryBase { - typedef MaybeLocal return_t; -}; -template struct ValueFactoryBase { typedef Maybe return_t; }; - -template struct ToFactory; - -template<> -struct ToFactory : ToFactoryBase { - static inline return_t convert(v8::Local val) { - if (val.IsEmpty() || !val->IsFunction()) return MaybeLocal(); - return MaybeLocal(val.As()); - } -}; - -#define X(TYPE) \ - template<> \ - struct ToFactory : ToFactoryBase { \ - static inline return_t convert(v8::Local val); \ - }; - -X(Boolean) -X(Number) -X(String) -X(Object) -X(Integer) -X(Uint32) -X(Int32) - -#undef X - -#define X(TYPE) \ - template<> \ - struct ToFactory : ValueFactoryBase { \ - static inline return_t convert(v8::Local val); \ - }; - -X(bool) -X(double) -X(int64_t) -X(uint32_t) -X(int32_t) - -#undef X -} // end of namespace imp - -template -inline -typename imp::ToFactory::return_t To(v8::Local val) { - return imp::ToFactory::convert(val); -} - -#if defined(V8_MAJOR_VERSION) && (V8_MAJOR_VERSION > 4 || \ - (V8_MAJOR_VERSION == 4 && defined(V8_MINOR_VERSION) && V8_MINOR_VERSION >= 3)) -# include "nan_converters_43_inl.h" -#else -# include "nan_converters_pre_43_inl.h" -#endif - -#endif // NAN_CONVERTERS_H_ diff --git a/node_modules/websocket/node_modules/nan/nan_converters_43_inl.h b/node_modules/websocket/node_modules/nan/nan_converters_43_inl.h deleted file mode 100644 index 41b72de..0000000 --- a/node_modules/websocket/node_modules/nan/nan_converters_43_inl.h +++ /dev/null @@ -1,68 +0,0 @@ -/********************************************************************* - * NAN - Native Abstractions for Node.js - * - * Copyright (c) 2018 NAN contributors - * - * MIT License - ********************************************************************/ - -#ifndef NAN_CONVERTERS_43_INL_H_ -#define NAN_CONVERTERS_43_INL_H_ - -#define X(TYPE) \ -imp::ToFactory::return_t \ -imp::ToFactory::convert(v8::Local val) { \ - v8::Isolate *isolate = v8::Isolate::GetCurrent(); \ - v8::EscapableHandleScope scope(isolate); \ - return scope.Escape( \ - val->To ## TYPE(isolate->GetCurrentContext()) \ - .FromMaybe(v8::Local())); \ -} - -X(Number) -X(String) -X(Object) -X(Integer) -X(Uint32) -X(Int32) -// V8 <= 7.0 -#if V8_MAJOR_VERSION < 7 || (V8_MAJOR_VERSION == 7 && V8_MINOR_VERSION == 0) -X(Boolean) -#else -imp::ToFactory::return_t \ -imp::ToFactory::convert(v8::Local val) { \ - v8::Isolate *isolate = v8::Isolate::GetCurrent(); \ - v8::EscapableHandleScope scope(isolate); \ - return scope.Escape(val->ToBoolean(isolate)); \ -} -#endif - -#undef X - -#define X(TYPE, NAME) \ -imp::ToFactory::return_t \ -imp::ToFactory::convert(v8::Local val) { \ - v8::Isolate *isolate = v8::Isolate::GetCurrent(); \ - v8::HandleScope scope(isolate); \ - return val->NAME ## Value(isolate->GetCurrentContext()); \ -} - -X(double, Number) -X(int64_t, Integer) -X(uint32_t, Uint32) -X(int32_t, Int32) -// V8 <= 7.0 -#if V8_MAJOR_VERSION < 7 || (V8_MAJOR_VERSION == 7 && V8_MINOR_VERSION == 0) -X(bool, Boolean) -#else -imp::ToFactory::return_t \ -imp::ToFactory::convert(v8::Local val) { \ - v8::Isolate *isolate = v8::Isolate::GetCurrent(); \ - v8::HandleScope scope(isolate); \ - return Just(val->BooleanValue(isolate)); \ -} -#endif - -#undef X - -#endif // NAN_CONVERTERS_43_INL_H_ diff --git a/node_modules/websocket/node_modules/nan/nan_converters_pre_43_inl.h b/node_modules/websocket/node_modules/nan/nan_converters_pre_43_inl.h deleted file mode 100644 index ae0518a..0000000 --- a/node_modules/websocket/node_modules/nan/nan_converters_pre_43_inl.h +++ /dev/null @@ -1,42 +0,0 @@ -/********************************************************************* - * NAN - Native Abstractions for Node.js - * - * Copyright (c) 2018 NAN contributors - * - * MIT License - ********************************************************************/ - -#ifndef NAN_CONVERTERS_PRE_43_INL_H_ -#define NAN_CONVERTERS_PRE_43_INL_H_ - -#define X(TYPE) \ -imp::ToFactory::return_t \ -imp::ToFactory::convert(v8::Local val) { \ - return val->To ## TYPE(); \ -} - -X(Boolean) -X(Number) -X(String) -X(Object) -X(Integer) -X(Uint32) -X(Int32) - -#undef X - -#define X(TYPE, NAME) \ -imp::ToFactory::return_t \ -imp::ToFactory::convert(v8::Local val) { \ - return Just(val->NAME ## Value()); \ -} - -X(bool, Boolean) -X(double, Number) -X(int64_t, Integer) -X(uint32_t, Uint32) -X(int32_t, Int32) - -#undef X - -#endif // NAN_CONVERTERS_PRE_43_INL_H_ diff --git a/node_modules/websocket/node_modules/nan/nan_define_own_property_helper.h b/node_modules/websocket/node_modules/nan/nan_define_own_property_helper.h deleted file mode 100644 index d710ef2..0000000 --- a/node_modules/websocket/node_modules/nan/nan_define_own_property_helper.h +++ /dev/null @@ -1,29 +0,0 @@ -/********************************************************************* - * NAN - Native Abstractions for Node.js - * - * Copyright (c) 2018 NAN contributors - * - * MIT License - ********************************************************************/ - -#ifndef NAN_DEFINE_OWN_PROPERTY_HELPER_H_ -#define NAN_DEFINE_OWN_PROPERTY_HELPER_H_ - -namespace imp { - -inline Maybe DefineOwnPropertyHelper( - v8::PropertyAttribute current - , v8::Handle obj - , v8::Handle key - , v8::Handle value - , v8::PropertyAttribute attribs = v8::None) { - return !(current & v8::DontDelete) || // configurable OR - (!(current & v8::ReadOnly) && // writable AND - !((attribs ^ current) & ~v8::ReadOnly)) // same excluding RO - ? Just(obj->ForceSet(key, value, attribs)) - : Nothing(); -} - -} // end of namespace imp - -#endif // NAN_DEFINE_OWN_PROPERTY_HELPER_H_ diff --git a/node_modules/websocket/node_modules/nan/nan_implementation_12_inl.h b/node_modules/websocket/node_modules/nan/nan_implementation_12_inl.h deleted file mode 100644 index 255293a..0000000 --- a/node_modules/websocket/node_modules/nan/nan_implementation_12_inl.h +++ /dev/null @@ -1,430 +0,0 @@ -/********************************************************************* - * NAN - Native Abstractions for Node.js - * - * Copyright (c) 2018 NAN contributors - * - * MIT License - ********************************************************************/ - -#ifndef NAN_IMPLEMENTATION_12_INL_H_ -#define NAN_IMPLEMENTATION_12_INL_H_ -//============================================================================== -// node v0.11 implementation -//============================================================================== - -namespace imp { - -//=== Array ==================================================================== - -Factory::return_t -Factory::New() { - return v8::Array::New(v8::Isolate::GetCurrent()); -} - -Factory::return_t -Factory::New(int length) { - return v8::Array::New(v8::Isolate::GetCurrent(), length); -} - -//=== Boolean ================================================================== - -Factory::return_t -Factory::New(bool value) { - return v8::Boolean::New(v8::Isolate::GetCurrent(), value); -} - -//=== Boolean Object =========================================================== - -Factory::return_t -Factory::New(bool value) { -#if (NODE_MODULE_VERSION >= NODE_6_0_MODULE_VERSION) - return v8::BooleanObject::New( - v8::Isolate::GetCurrent(), value).As(); -#else - return v8::BooleanObject::New(value).As(); -#endif -} - -//=== Context ================================================================== - -Factory::return_t -Factory::New( v8::ExtensionConfiguration* extensions - , v8::Local tmpl - , v8::Local obj) { - return v8::Context::New(v8::Isolate::GetCurrent(), extensions, tmpl, obj); -} - -//=== Date ===================================================================== - -#if defined(V8_MAJOR_VERSION) && (V8_MAJOR_VERSION > 4 || \ - (V8_MAJOR_VERSION == 4 && defined(V8_MINOR_VERSION) && V8_MINOR_VERSION >= 3)) -Factory::return_t -Factory::New(double value) { - v8::Isolate *isolate = v8::Isolate::GetCurrent(); - v8::EscapableHandleScope scope(isolate); - return scope.Escape(v8::Date::New(isolate->GetCurrentContext(), value) - .FromMaybe(v8::Local()).As()); -} -#else -Factory::return_t -Factory::New(double value) { - return v8::Date::New(v8::Isolate::GetCurrent(), value).As(); -} -#endif - -//=== External ================================================================= - -Factory::return_t -Factory::New(void * value) { - return v8::External::New(v8::Isolate::GetCurrent(), value); -} - -//=== Function ================================================================= - -Factory::return_t -Factory::New( FunctionCallback callback - , v8::Local data) { - v8::Isolate *isolate = v8::Isolate::GetCurrent(); - v8::EscapableHandleScope scope(isolate); - v8::Local tpl = v8::ObjectTemplate::New(isolate); - tpl->SetInternalFieldCount(imp::kFunctionFieldCount); - v8::Local obj = NewInstance(tpl).ToLocalChecked(); - - obj->SetInternalField( - imp::kFunctionIndex - , v8::External::New(isolate, reinterpret_cast(callback))); - - v8::Local val = v8::Local::New(isolate, data); - - if (!val.IsEmpty()) { - obj->SetInternalField(imp::kDataIndex, val); - } - -#if NODE_MAJOR_VERSION >= 10 - v8::Local context = isolate->GetCurrentContext(); - v8::Local function = - v8::Function::New(context, imp::FunctionCallbackWrapper, obj) - .ToLocalChecked(); -#else - v8::Local function = - v8::Function::New(isolate, imp::FunctionCallbackWrapper, obj); -#endif - - return scope.Escape(function); -} - -//=== Function Template ======================================================== - -Factory::return_t -Factory::New( FunctionCallback callback - , v8::Local data - , v8::Local signature) { - v8::Isolate *isolate = v8::Isolate::GetCurrent(); - if (callback) { - v8::EscapableHandleScope scope(isolate); - v8::Local tpl = v8::ObjectTemplate::New(isolate); - tpl->SetInternalFieldCount(imp::kFunctionFieldCount); - v8::Local obj = NewInstance(tpl).ToLocalChecked(); - - obj->SetInternalField( - imp::kFunctionIndex - , v8::External::New(isolate, reinterpret_cast(callback))); - v8::Local val = v8::Local::New(isolate, data); - - if (!val.IsEmpty()) { - obj->SetInternalField(imp::kDataIndex, val); - } - - return scope.Escape(v8::FunctionTemplate::New( isolate - , imp::FunctionCallbackWrapper - , obj - , signature)); - } else { - return v8::FunctionTemplate::New(isolate, 0, data, signature); - } -} - -//=== Number =================================================================== - -Factory::return_t -Factory::New(double value) { - return v8::Number::New(v8::Isolate::GetCurrent(), value); -} - -//=== Number Object ============================================================ - -Factory::return_t -Factory::New(double value) { - return v8::NumberObject::New( v8::Isolate::GetCurrent() - , value).As(); -} - -//=== Integer, Int32 and Uint32 ================================================ - -template -typename IntegerFactory::return_t -IntegerFactory::New(int32_t value) { - return To(T::New(v8::Isolate::GetCurrent(), value)); -} - -template -typename IntegerFactory::return_t -IntegerFactory::New(uint32_t value) { - return To(T::NewFromUnsigned(v8::Isolate::GetCurrent(), value)); -} - -Factory::return_t -Factory::New(int32_t value) { - return To( - v8::Uint32::NewFromUnsigned(v8::Isolate::GetCurrent(), value)); -} - -Factory::return_t -Factory::New(uint32_t value) { - return To( - v8::Uint32::NewFromUnsigned(v8::Isolate::GetCurrent(), value)); -} - -//=== Object =================================================================== - -Factory::return_t -Factory::New() { - return v8::Object::New(v8::Isolate::GetCurrent()); -} - -//=== Object Template ========================================================== - -Factory::return_t -Factory::New() { - return v8::ObjectTemplate::New(v8::Isolate::GetCurrent()); -} - -//=== RegExp =================================================================== - -#if defined(V8_MAJOR_VERSION) && (V8_MAJOR_VERSION > 4 || \ - (V8_MAJOR_VERSION == 4 && defined(V8_MINOR_VERSION) && V8_MINOR_VERSION >= 3)) -Factory::return_t -Factory::New( - v8::Local pattern - , v8::RegExp::Flags flags) { - v8::Isolate *isolate = v8::Isolate::GetCurrent(); - v8::EscapableHandleScope scope(isolate); - return scope.Escape( - v8::RegExp::New(isolate->GetCurrentContext(), pattern, flags) - .FromMaybe(v8::Local())); -} -#else -Factory::return_t -Factory::New( - v8::Local pattern - , v8::RegExp::Flags flags) { - return v8::RegExp::New(pattern, flags); -} -#endif - -//=== Script =================================================================== - -#if defined(V8_MAJOR_VERSION) && (V8_MAJOR_VERSION > 4 || \ - (V8_MAJOR_VERSION == 4 && defined(V8_MINOR_VERSION) && V8_MINOR_VERSION >= 3)) -Factory::return_t -Factory::New( v8::Local source) { - v8::Isolate *isolate = v8::Isolate::GetCurrent(); - v8::EscapableHandleScope scope(isolate); - v8::ScriptCompiler::Source src(source); - return scope.Escape( - v8::ScriptCompiler::Compile(isolate->GetCurrentContext(), &src) - .FromMaybe(v8::Local())); -} - -Factory::return_t -Factory::New( v8::Local source - , v8::ScriptOrigin const& origin) { - v8::Isolate *isolate = v8::Isolate::GetCurrent(); - v8::EscapableHandleScope scope(isolate); - v8::ScriptCompiler::Source src(source, origin); - return scope.Escape( - v8::ScriptCompiler::Compile(isolate->GetCurrentContext(), &src) - .FromMaybe(v8::Local())); -} -#else -Factory::return_t -Factory::New( v8::Local source) { - v8::ScriptCompiler::Source src(source); - return v8::ScriptCompiler::Compile(v8::Isolate::GetCurrent(), &src); -} - -Factory::return_t -Factory::New( v8::Local source - , v8::ScriptOrigin const& origin) { - v8::ScriptCompiler::Source src(source, origin); - return v8::ScriptCompiler::Compile(v8::Isolate::GetCurrent(), &src); -} -#endif - -//=== Signature ================================================================ - -Factory::return_t -Factory::New(Factory::FTH receiver) { - return v8::Signature::New(v8::Isolate::GetCurrent(), receiver); -} - -//=== String =================================================================== - -Factory::return_t -Factory::New() { - return v8::String::Empty(v8::Isolate::GetCurrent()); -} - -#if defined(V8_MAJOR_VERSION) && (V8_MAJOR_VERSION > 4 || \ - (V8_MAJOR_VERSION == 4 && defined(V8_MINOR_VERSION) && V8_MINOR_VERSION >= 3)) -Factory::return_t -Factory::New(const char * value, int length) { - return v8::String::NewFromUtf8( - v8::Isolate::GetCurrent(), value, v8::NewStringType::kNormal, length); -} - -Factory::return_t -Factory::New(std::string const& value) { - assert(value.size() <= INT_MAX && "string too long"); - return v8::String::NewFromUtf8(v8::Isolate::GetCurrent(), - value.data(), v8::NewStringType::kNormal, static_cast(value.size())); -} - -Factory::return_t -Factory::New(const uint16_t * value, int length) { - return v8::String::NewFromTwoByte(v8::Isolate::GetCurrent(), value, - v8::NewStringType::kNormal, length); -} - -Factory::return_t -Factory::New(v8::String::ExternalStringResource * value) { - return v8::String::NewExternalTwoByte(v8::Isolate::GetCurrent(), value); -} - -Factory::return_t -Factory::New(ExternalOneByteStringResource * value) { - return v8::String::NewExternalOneByte(v8::Isolate::GetCurrent(), value); -} -#else -Factory::return_t -Factory::New(const char * value, int length) { - return v8::String::NewFromUtf8(v8::Isolate::GetCurrent(), value, - v8::String::kNormalString, length); -} - -Factory::return_t -Factory::New( - std::string const& value) /* NOLINT(build/include_what_you_use) */ { - assert(value.size() <= INT_MAX && "string too long"); - return v8::String::NewFromUtf8(v8::Isolate::GetCurrent(), value.data(), - v8::String::kNormalString, - static_cast(value.size())); -} - -Factory::return_t -Factory::New(const uint16_t * value, int length) { - return v8::String::NewFromTwoByte(v8::Isolate::GetCurrent(), value, - v8::String::kNormalString, length); -} - -Factory::return_t -Factory::New(v8::String::ExternalStringResource * value) { - return v8::String::NewExternal(v8::Isolate::GetCurrent(), value); -} - -Factory::return_t -Factory::New(ExternalOneByteStringResource * value) { - return v8::String::NewExternal(v8::Isolate::GetCurrent(), value); -} -#endif - -//=== String Object ============================================================ - -// See https://github.com/nodejs/nan/pull/811#discussion_r224594980. -// Disable the warning as there is no way around it. -// TODO(bnoordhuis) Use isolate-based version in Node.js v12. -Factory::return_t -Factory::New(v8::Local value) { -// V8 > 7.0 -#if V8_MAJOR_VERSION > 7 || (V8_MAJOR_VERSION == 7 && V8_MINOR_VERSION > 0) - return v8::StringObject::New(v8::Isolate::GetCurrent(), value) - .As(); -#else -#ifdef _MSC_VER -#pragma warning(push) -#pragma warning(disable : 4996) -#endif -#ifdef __GNUC__ -#pragma GCC diagnostic push -#pragma GCC diagnostic ignored "-Wdeprecated-declarations" -#endif - return v8::StringObject::New(value).As(); -#ifdef __GNUC__ -#pragma GCC diagnostic pop -#endif -#ifdef _MSC_VER -#pragma warning(pop) -#endif -#endif -} - -//=== Unbound Script =========================================================== - -#if defined(V8_MAJOR_VERSION) && (V8_MAJOR_VERSION > 4 || \ - (V8_MAJOR_VERSION == 4 && defined(V8_MINOR_VERSION) && V8_MINOR_VERSION >= 3)) -Factory::return_t -Factory::New(v8::Local source) { - v8::ScriptCompiler::Source src(source); - return v8::ScriptCompiler::CompileUnboundScript( - v8::Isolate::GetCurrent(), &src); -} - -Factory::return_t -Factory::New( v8::Local source - , v8::ScriptOrigin const& origin) { - v8::ScriptCompiler::Source src(source, origin); - return v8::ScriptCompiler::CompileUnboundScript( - v8::Isolate::GetCurrent(), &src); -} -#else -Factory::return_t -Factory::New(v8::Local source) { - v8::ScriptCompiler::Source src(source); - return v8::ScriptCompiler::CompileUnbound(v8::Isolate::GetCurrent(), &src); -} - -Factory::return_t -Factory::New( v8::Local source - , v8::ScriptOrigin const& origin) { - v8::ScriptCompiler::Source src(source, origin); - return v8::ScriptCompiler::CompileUnbound(v8::Isolate::GetCurrent(), &src); -} -#endif - -} // end of namespace imp - -//=== Presistents and Handles ================================================== - -#if NODE_MODULE_VERSION < IOJS_3_0_MODULE_VERSION -template -inline v8::Local New(v8::Handle h) { - return v8::Local::New(v8::Isolate::GetCurrent(), h); -} -#endif - -template -inline v8::Local New(v8::Persistent const& p) { - return v8::Local::New(v8::Isolate::GetCurrent(), p); -} - -template -inline v8::Local New(Persistent const& p) { - return v8::Local::New(v8::Isolate::GetCurrent(), p); -} - -template -inline v8::Local New(Global const& p) { - return v8::Local::New(v8::Isolate::GetCurrent(), p); -} - -#endif // NAN_IMPLEMENTATION_12_INL_H_ diff --git a/node_modules/websocket/node_modules/nan/nan_implementation_pre_12_inl.h b/node_modules/websocket/node_modules/nan/nan_implementation_pre_12_inl.h deleted file mode 100644 index 1472421..0000000 --- a/node_modules/websocket/node_modules/nan/nan_implementation_pre_12_inl.h +++ /dev/null @@ -1,263 +0,0 @@ -/********************************************************************* - * NAN - Native Abstractions for Node.js - * - * Copyright (c) 2018 NAN contributors - * - * MIT License - ********************************************************************/ - -#ifndef NAN_IMPLEMENTATION_PRE_12_INL_H_ -#define NAN_IMPLEMENTATION_PRE_12_INL_H_ - -//============================================================================== -// node v0.10 implementation -//============================================================================== - -namespace imp { - -//=== Array ==================================================================== - -Factory::return_t -Factory::New() { - return v8::Array::New(); -} - -Factory::return_t -Factory::New(int length) { - return v8::Array::New(length); -} - -//=== Boolean ================================================================== - -Factory::return_t -Factory::New(bool value) { - return v8::Boolean::New(value)->ToBoolean(); -} - -//=== Boolean Object =========================================================== - -Factory::return_t -Factory::New(bool value) { - return v8::BooleanObject::New(value).As(); -} - -//=== Context ================================================================== - -Factory::return_t -Factory::New( v8::ExtensionConfiguration* extensions - , v8::Local tmpl - , v8::Local obj) { - v8::Persistent ctx = v8::Context::New(extensions, tmpl, obj); - v8::Local lctx = v8::Local::New(ctx); - ctx.Dispose(); - return lctx; -} - -//=== Date ===================================================================== - -Factory::return_t -Factory::New(double value) { - return v8::Date::New(value).As(); -} - -//=== External ================================================================= - -Factory::return_t -Factory::New(void * value) { - return v8::External::New(value); -} - -//=== Function ================================================================= - -Factory::return_t -Factory::New( FunctionCallback callback - , v8::Local data) { - v8::HandleScope scope; - - return scope.Close(Factory::New( - callback, data, v8::Local()) - ->GetFunction()); -} - - -//=== FunctionTemplate ========================================================= - -Factory::return_t -Factory::New( FunctionCallback callback - , v8::Local data - , v8::Local signature) { - if (callback) { - v8::HandleScope scope; - - v8::Local tpl = v8::ObjectTemplate::New(); - tpl->SetInternalFieldCount(imp::kFunctionFieldCount); - v8::Local obj = tpl->NewInstance(); - - obj->SetInternalField( - imp::kFunctionIndex - , v8::External::New(reinterpret_cast(callback))); - - v8::Local val = v8::Local::New(data); - - if (!val.IsEmpty()) { - obj->SetInternalField(imp::kDataIndex, val); - } - - // Note(agnat): Emulate length argument here. Unfortunately, I couldn't find - // a way. Have at it though... - return scope.Close( - v8::FunctionTemplate::New(imp::FunctionCallbackWrapper - , obj - , signature)); - } else { - return v8::FunctionTemplate::New(0, data, signature); - } -} - -//=== Number =================================================================== - -Factory::return_t -Factory::New(double value) { - return v8::Number::New(value); -} - -//=== Number Object ============================================================ - -Factory::return_t -Factory::New(double value) { - return v8::NumberObject::New(value).As(); -} - -//=== Integer, Int32 and Uint32 ================================================ - -template -typename IntegerFactory::return_t -IntegerFactory::New(int32_t value) { - return To(T::New(value)); -} - -template -typename IntegerFactory::return_t -IntegerFactory::New(uint32_t value) { - return To(T::NewFromUnsigned(value)); -} - -Factory::return_t -Factory::New(int32_t value) { - return To(v8::Uint32::NewFromUnsigned(value)); -} - -Factory::return_t -Factory::New(uint32_t value) { - return To(v8::Uint32::NewFromUnsigned(value)); -} - - -//=== Object =================================================================== - -Factory::return_t -Factory::New() { - return v8::Object::New(); -} - -//=== Object Template ========================================================== - -Factory::return_t -Factory::New() { - return v8::ObjectTemplate::New(); -} - -//=== RegExp =================================================================== - -Factory::return_t -Factory::New( - v8::Local pattern - , v8::RegExp::Flags flags) { - return v8::RegExp::New(pattern, flags); -} - -//=== Script =================================================================== - -Factory::return_t -Factory::New( v8::Local source) { - return v8::Script::New(source); -} -Factory::return_t -Factory::New( v8::Local source - , v8::ScriptOrigin const& origin) { - return v8::Script::New(source, const_cast(&origin)); -} - -//=== Signature ================================================================ - -Factory::return_t -Factory::New(Factory::FTH receiver) { - return v8::Signature::New(receiver); -} - -//=== String =================================================================== - -Factory::return_t -Factory::New() { - return v8::String::Empty(); -} - -Factory::return_t -Factory::New(const char * value, int length) { - return v8::String::New(value, length); -} - -Factory::return_t -Factory::New( - std::string const& value) /* NOLINT(build/include_what_you_use) */ { - assert(value.size() <= INT_MAX && "string too long"); - return v8::String::New(value.data(), static_cast(value.size())); -} - -Factory::return_t -Factory::New(const uint16_t * value, int length) { - return v8::String::New(value, length); -} - -Factory::return_t -Factory::New(v8::String::ExternalStringResource * value) { - return v8::String::NewExternal(value); -} - -Factory::return_t -Factory::New(v8::String::ExternalAsciiStringResource * value) { - return v8::String::NewExternal(value); -} - -//=== String Object ============================================================ - -Factory::return_t -Factory::New(v8::Local value) { - return v8::StringObject::New(value).As(); -} - -} // end of namespace imp - -//=== Presistents and Handles ================================================== - -template -inline v8::Local New(v8::Handle h) { - return v8::Local::New(h); -} - -template -inline v8::Local New(v8::Persistent const& p) { - return v8::Local::New(p); -} - -template -inline v8::Local New(Persistent const& p) { - return v8::Local::New(p.persistent); -} - -template -inline v8::Local New(Global const& p) { - return v8::Local::New(p.persistent); -} - -#endif // NAN_IMPLEMENTATION_PRE_12_INL_H_ diff --git a/node_modules/websocket/node_modules/nan/nan_json.h b/node_modules/websocket/node_modules/nan/nan_json.h deleted file mode 100644 index 33ac8ba..0000000 --- a/node_modules/websocket/node_modules/nan/nan_json.h +++ /dev/null @@ -1,166 +0,0 @@ -/********************************************************************* - * NAN - Native Abstractions for Node.js - * - * Copyright (c) 2018 NAN contributors - * - * MIT License - ********************************************************************/ - -#ifndef NAN_JSON_H_ -#define NAN_JSON_H_ - -#if NODE_MODULE_VERSION < NODE_0_12_MODULE_VERSION -#define NAN_JSON_H_NEED_PARSE 1 -#else -#define NAN_JSON_H_NEED_PARSE 0 -#endif // NODE_MODULE_VERSION < NODE_0_12_MODULE_VERSION - -#if NODE_MODULE_VERSION >= NODE_7_0_MODULE_VERSION -#define NAN_JSON_H_NEED_STRINGIFY 0 -#else -#define NAN_JSON_H_NEED_STRINGIFY 1 -#endif // NODE_MODULE_VERSION >= NODE_7_0_MODULE_VERSION - -class JSON { - public: - JSON() { -#if NAN_JSON_H_NEED_PARSE + NAN_JSON_H_NEED_STRINGIFY - Nan::HandleScope scope; - - Nan::MaybeLocal maybe_global_json = Nan::Get( - Nan::GetCurrentContext()->Global(), - Nan::New("JSON").ToLocalChecked() - ); - - assert(!maybe_global_json.IsEmpty() && "global JSON is empty"); - v8::Local val_global_json = maybe_global_json.ToLocalChecked(); - - assert(val_global_json->IsObject() && "global JSON is not an object"); - Nan::MaybeLocal maybe_obj_global_json = - Nan::To(val_global_json); - - assert(!maybe_obj_global_json.IsEmpty() && "global JSON object is empty"); - v8::Local global_json = maybe_obj_global_json.ToLocalChecked(); - -#if NAN_JSON_H_NEED_PARSE - Nan::MaybeLocal maybe_parse_method = Nan::Get( - global_json, Nan::New("parse").ToLocalChecked() - ); - - assert(!maybe_parse_method.IsEmpty() && "JSON.parse is empty"); - v8::Local parse_method = maybe_parse_method.ToLocalChecked(); - - assert(parse_method->IsFunction() && "JSON.parse is not a function"); - parse_cb_.Reset(parse_method.As()); -#endif // NAN_JSON_H_NEED_PARSE - -#if NAN_JSON_H_NEED_STRINGIFY - Nan::MaybeLocal maybe_stringify_method = Nan::Get( - global_json, Nan::New("stringify").ToLocalChecked() - ); - - assert(!maybe_stringify_method.IsEmpty() && "JSON.stringify is empty"); - v8::Local stringify_method = - maybe_stringify_method.ToLocalChecked(); - - assert( - stringify_method->IsFunction() && "JSON.stringify is not a function" - ); - stringify_cb_.Reset(stringify_method.As()); -#endif // NAN_JSON_H_NEED_STRINGIFY -#endif // NAN_JSON_H_NEED_PARSE + NAN_JSON_H_NEED_STRINGIFY - } - - inline - Nan::MaybeLocal Parse(v8::Local json_string) { - Nan::EscapableHandleScope scope; -#if NAN_JSON_H_NEED_PARSE - return scope.Escape(parse(json_string)); -#else - Nan::MaybeLocal result; -#if NODE_MODULE_VERSION >= NODE_0_12_MODULE_VERSION && \ - NODE_MODULE_VERSION <= IOJS_2_0_MODULE_VERSION - result = v8::JSON::Parse(json_string); -#else -#if NODE_MODULE_VERSION > NODE_6_0_MODULE_VERSION - v8::Local context_or_isolate = Nan::GetCurrentContext(); -#else - v8::Isolate* context_or_isolate = v8::Isolate::GetCurrent(); -#endif // NODE_MODULE_VERSION > NODE_6_0_MODULE_VERSION - result = v8::JSON::Parse(context_or_isolate, json_string); -#endif // NODE_MODULE_VERSION >= NODE_0_12_MODULE_VERSION && - // NODE_MODULE_VERSION <= IOJS_2_0_MODULE_VERSION - if (result.IsEmpty()) return v8::Local(); - return scope.Escape(result.ToLocalChecked()); -#endif // NAN_JSON_H_NEED_PARSE - } - - inline - Nan::MaybeLocal Stringify(v8::Local json_object) { - Nan::EscapableHandleScope scope; - Nan::MaybeLocal result = -#if NAN_JSON_H_NEED_STRINGIFY - Nan::To(stringify(json_object)); -#else - v8::JSON::Stringify(Nan::GetCurrentContext(), json_object); -#endif // NAN_JSON_H_NEED_STRINGIFY - if (result.IsEmpty()) return v8::Local(); - return scope.Escape(result.ToLocalChecked()); - } - - inline - Nan::MaybeLocal Stringify(v8::Local json_object, - v8::Local gap) { - Nan::EscapableHandleScope scope; - Nan::MaybeLocal result = -#if NAN_JSON_H_NEED_STRINGIFY - Nan::To(stringify(json_object, gap)); -#else - v8::JSON::Stringify(Nan::GetCurrentContext(), json_object, gap); -#endif // NAN_JSON_H_NEED_STRINGIFY - if (result.IsEmpty()) return v8::Local(); - return scope.Escape(result.ToLocalChecked()); - } - - private: - NAN_DISALLOW_ASSIGN_COPY_MOVE(JSON) -#if NAN_JSON_H_NEED_PARSE - Nan::Callback parse_cb_; -#endif // NAN_JSON_H_NEED_PARSE -#if NAN_JSON_H_NEED_STRINGIFY - Nan::Callback stringify_cb_; -#endif // NAN_JSON_H_NEED_STRINGIFY - -#if NAN_JSON_H_NEED_PARSE - inline v8::Local parse(v8::Local arg) { - assert(!parse_cb_.IsEmpty() && "parse_cb_ is empty"); - AsyncResource resource("nan:JSON.parse"); - return parse_cb_.Call(1, &arg, &resource).FromMaybe(v8::Local()); - } -#endif // NAN_JSON_H_NEED_PARSE - -#if NAN_JSON_H_NEED_STRINGIFY - inline v8::Local stringify(v8::Local arg) { - assert(!stringify_cb_.IsEmpty() && "stringify_cb_ is empty"); - AsyncResource resource("nan:JSON.stringify"); - return stringify_cb_.Call(1, &arg, &resource) - .FromMaybe(v8::Local()); - } - - inline v8::Local stringify(v8::Local arg, - v8::Local gap) { - assert(!stringify_cb_.IsEmpty() && "stringify_cb_ is empty"); - - v8::Local argv[] = { - arg, - Nan::Null(), - gap - }; - AsyncResource resource("nan:JSON.stringify"); - return stringify_cb_.Call(3, argv, &resource) - .FromMaybe(v8::Local()); - } -#endif // NAN_JSON_H_NEED_STRINGIFY -}; - -#endif // NAN_JSON_H_ diff --git a/node_modules/websocket/node_modules/nan/nan_maybe_43_inl.h b/node_modules/websocket/node_modules/nan/nan_maybe_43_inl.h deleted file mode 100644 index c04ce30..0000000 --- a/node_modules/websocket/node_modules/nan/nan_maybe_43_inl.h +++ /dev/null @@ -1,356 +0,0 @@ -/********************************************************************* - * NAN - Native Abstractions for Node.js - * - * Copyright (c) 2018 NAN contributors - * - * MIT License - ********************************************************************/ - -#ifndef NAN_MAYBE_43_INL_H_ -#define NAN_MAYBE_43_INL_H_ - -template -using MaybeLocal = v8::MaybeLocal; - -inline -MaybeLocal ToDetailString(v8::Local val) { - v8::Isolate *isolate = v8::Isolate::GetCurrent(); - v8::EscapableHandleScope scope(isolate); - return scope.Escape(val->ToDetailString(isolate->GetCurrentContext()) - .FromMaybe(v8::Local())); -} - -inline -MaybeLocal ToArrayIndex(v8::Local val) { - v8::Isolate *isolate = v8::Isolate::GetCurrent(); - v8::EscapableHandleScope scope(isolate); - return scope.Escape(val->ToArrayIndex(isolate->GetCurrentContext()) - .FromMaybe(v8::Local())); -} - -inline -Maybe Equals(v8::Local a, v8::Local(b)) { - v8::Isolate *isolate = v8::Isolate::GetCurrent(); - v8::HandleScope scope(isolate); - return a->Equals(isolate->GetCurrentContext(), b); -} - -inline -MaybeLocal NewInstance(v8::Local h) { - v8::Isolate *isolate = v8::Isolate::GetCurrent(); - v8::EscapableHandleScope scope(isolate); - return scope.Escape(h->NewInstance(isolate->GetCurrentContext()) - .FromMaybe(v8::Local())); -} - -inline -MaybeLocal NewInstance( - v8::Local h - , int argc - , v8::Local argv[]) { - v8::Isolate *isolate = v8::Isolate::GetCurrent(); - v8::EscapableHandleScope scope(isolate); - return scope.Escape(h->NewInstance(isolate->GetCurrentContext(), argc, argv) - .FromMaybe(v8::Local())); -} - -inline -MaybeLocal NewInstance(v8::Local h) { - v8::Isolate *isolate = v8::Isolate::GetCurrent(); - v8::EscapableHandleScope scope(isolate); - return scope.Escape(h->NewInstance(isolate->GetCurrentContext()) - .FromMaybe(v8::Local())); -} - - -inline MaybeLocal GetFunction( - v8::Local t) { - v8::Isolate *isolate = v8::Isolate::GetCurrent(); - v8::EscapableHandleScope scope(isolate); - return scope.Escape(t->GetFunction(isolate->GetCurrentContext()) - .FromMaybe(v8::Local())); -} - -inline Maybe Set( - v8::Local obj - , v8::Local key - , v8::Local value) { - v8::Isolate *isolate = v8::Isolate::GetCurrent(); - v8::HandleScope scope(isolate); - return obj->Set(isolate->GetCurrentContext(), key, value); -} - -inline Maybe Set( - v8::Local obj - , uint32_t index - , v8::Local value) { - v8::Isolate *isolate = v8::Isolate::GetCurrent(); - v8::HandleScope scope(isolate); - return obj->Set(isolate->GetCurrentContext(), index, value); -} - -#if NODE_MODULE_VERSION < NODE_4_0_MODULE_VERSION -#include "nan_define_own_property_helper.h" // NOLINT(build/include) -#endif - -inline Maybe DefineOwnProperty( - v8::Local obj - , v8::Local key - , v8::Local value - , v8::PropertyAttribute attribs = v8::None) { - v8::Isolate *isolate = v8::Isolate::GetCurrent(); - v8::HandleScope scope(isolate); -#if NODE_MODULE_VERSION >= NODE_4_0_MODULE_VERSION - return obj->DefineOwnProperty(isolate->GetCurrentContext(), key, value, - attribs); -#else - Maybe maybeCurrent = - obj->GetPropertyAttributes(isolate->GetCurrentContext(), key); - if (maybeCurrent.IsNothing()) { - return Nothing(); - } - v8::PropertyAttribute current = maybeCurrent.FromJust(); - return imp::DefineOwnPropertyHelper(current, obj, key, value, attribs); -#endif -} - -NAN_DEPRECATED inline Maybe ForceSet( - v8::Local obj - , v8::Local key - , v8::Local value - , v8::PropertyAttribute attribs = v8::None) { - v8::Isolate *isolate = v8::Isolate::GetCurrent(); - v8::HandleScope scope(isolate); -#if NODE_MODULE_VERSION >= NODE_9_0_MODULE_VERSION - return key->IsName() - ? obj->DefineOwnProperty(isolate->GetCurrentContext(), - key.As(), value, attribs) - : Nothing(); -#else - return obj->ForceSet(isolate->GetCurrentContext(), key, value, attribs); -#endif -} - -inline MaybeLocal Get( - v8::Local obj - , v8::Local key) { - v8::Isolate *isolate = v8::Isolate::GetCurrent(); - v8::EscapableHandleScope scope(isolate); - return scope.Escape(obj->Get(isolate->GetCurrentContext(), key) - .FromMaybe(v8::Local())); -} - -inline -MaybeLocal Get(v8::Local obj, uint32_t index) { - v8::Isolate *isolate = v8::Isolate::GetCurrent(); - v8::EscapableHandleScope scope(isolate); - return scope.Escape(obj->Get(isolate->GetCurrentContext(), index) - .FromMaybe(v8::Local())); -} - -inline v8::PropertyAttribute GetPropertyAttributes( - v8::Local obj - , v8::Local key) { - v8::Isolate *isolate = v8::Isolate::GetCurrent(); - v8::HandleScope scope(isolate); - return obj->GetPropertyAttributes(isolate->GetCurrentContext(), key) - .FromJust(); -} - -inline Maybe Has( - v8::Local obj - , v8::Local key) { - v8::Isolate *isolate = v8::Isolate::GetCurrent(); - v8::HandleScope scope(isolate); - return obj->Has(isolate->GetCurrentContext(), key); -} - -inline Maybe Has(v8::Local obj, uint32_t index) { - v8::Isolate *isolate = v8::Isolate::GetCurrent(); - v8::HandleScope scope(isolate); - return obj->Has(isolate->GetCurrentContext(), index); -} - -inline Maybe Delete( - v8::Local obj - , v8::Local key) { - v8::Isolate *isolate = v8::Isolate::GetCurrent(); - v8::HandleScope scope(isolate); - return obj->Delete(isolate->GetCurrentContext(), key); -} - -inline -Maybe Delete(v8::Local obj, uint32_t index) { - v8::Isolate *isolate = v8::Isolate::GetCurrent(); - v8::HandleScope scope(isolate); - return obj->Delete(isolate->GetCurrentContext(), index); -} - -inline -MaybeLocal GetPropertyNames(v8::Local obj) { - v8::Isolate *isolate = v8::Isolate::GetCurrent(); - v8::EscapableHandleScope scope(isolate); - return scope.Escape(obj->GetPropertyNames(isolate->GetCurrentContext()) - .FromMaybe(v8::Local())); -} - -inline -MaybeLocal GetOwnPropertyNames(v8::Local obj) { - v8::Isolate *isolate = v8::Isolate::GetCurrent(); - v8::EscapableHandleScope scope(isolate); - return scope.Escape(obj->GetOwnPropertyNames(isolate->GetCurrentContext()) - .FromMaybe(v8::Local())); -} - -inline Maybe SetPrototype( - v8::Local obj - , v8::Local prototype) { - v8::Isolate *isolate = v8::Isolate::GetCurrent(); - v8::HandleScope scope(isolate); - return obj->SetPrototype(isolate->GetCurrentContext(), prototype); -} - -inline MaybeLocal ObjectProtoToString( - v8::Local obj) { - v8::Isolate *isolate = v8::Isolate::GetCurrent(); - v8::EscapableHandleScope scope(isolate); - return scope.Escape(obj->ObjectProtoToString(isolate->GetCurrentContext()) - .FromMaybe(v8::Local())); -} - -inline Maybe HasOwnProperty( - v8::Local obj - , v8::Local key) { - v8::Isolate *isolate = v8::Isolate::GetCurrent(); - v8::HandleScope scope(isolate); - return obj->HasOwnProperty(isolate->GetCurrentContext(), key); -} - -inline Maybe HasRealNamedProperty( - v8::Local obj - , v8::Local key) { - v8::Isolate *isolate = v8::Isolate::GetCurrent(); - v8::HandleScope scope(isolate); - return obj->HasRealNamedProperty(isolate->GetCurrentContext(), key); -} - -inline Maybe HasRealIndexedProperty( - v8::Local obj - , uint32_t index) { - v8::Isolate *isolate = v8::Isolate::GetCurrent(); - v8::HandleScope scope(isolate); - return obj->HasRealIndexedProperty(isolate->GetCurrentContext(), index); -} - -inline Maybe HasRealNamedCallbackProperty( - v8::Local obj - , v8::Local key) { - v8::Isolate *isolate = v8::Isolate::GetCurrent(); - v8::HandleScope scope(isolate); - return obj->HasRealNamedCallbackProperty(isolate->GetCurrentContext(), key); -} - -inline MaybeLocal GetRealNamedPropertyInPrototypeChain( - v8::Local obj - , v8::Local key) { - v8::Isolate *isolate = v8::Isolate::GetCurrent(); - v8::EscapableHandleScope scope(isolate); - return scope.Escape(obj->GetRealNamedPropertyInPrototypeChain( - isolate->GetCurrentContext(), key) - .FromMaybe(v8::Local())); -} - -inline MaybeLocal GetRealNamedProperty( - v8::Local obj - , v8::Local key) { - v8::Isolate *isolate = v8::Isolate::GetCurrent(); - v8::EscapableHandleScope scope(isolate); - return scope.Escape( - obj->GetRealNamedProperty(isolate->GetCurrentContext(), key) - .FromMaybe(v8::Local())); -} - -inline MaybeLocal CallAsFunction( - v8::Local obj - , v8::Local recv - , int argc - , v8::Local argv[]) { - v8::Isolate *isolate = v8::Isolate::GetCurrent(); - v8::EscapableHandleScope scope(isolate); - return scope.Escape( - obj->CallAsFunction(isolate->GetCurrentContext(), recv, argc, argv) - .FromMaybe(v8::Local())); -} - -inline MaybeLocal CallAsConstructor( - v8::Local obj - , int argc, v8::Local argv[]) { - v8::Isolate *isolate = v8::Isolate::GetCurrent(); - v8::EscapableHandleScope scope(isolate); - return scope.Escape( - obj->CallAsConstructor(isolate->GetCurrentContext(), argc, argv) - .FromMaybe(v8::Local())); -} - -inline -MaybeLocal GetSourceLine(v8::Local msg) { - v8::Isolate *isolate = v8::Isolate::GetCurrent(); - v8::EscapableHandleScope scope(isolate); - return scope.Escape(msg->GetSourceLine(isolate->GetCurrentContext()) - .FromMaybe(v8::Local())); -} - -inline Maybe GetLineNumber(v8::Local msg) { - v8::Isolate *isolate = v8::Isolate::GetCurrent(); - v8::HandleScope scope(isolate); - return msg->GetLineNumber(isolate->GetCurrentContext()); -} - -inline Maybe GetStartColumn(v8::Local msg) { - v8::Isolate *isolate = v8::Isolate::GetCurrent(); - v8::HandleScope scope(isolate); - return msg->GetStartColumn(isolate->GetCurrentContext()); -} - -inline Maybe GetEndColumn(v8::Local msg) { - v8::Isolate *isolate = v8::Isolate::GetCurrent(); - v8::HandleScope scope(isolate); - return msg->GetEndColumn(isolate->GetCurrentContext()); -} - -inline MaybeLocal CloneElementAt( - v8::Local array - , uint32_t index) { -#if (NODE_MODULE_VERSION >= NODE_6_0_MODULE_VERSION) - v8::Isolate *isolate = v8::Isolate::GetCurrent(); - v8::EscapableHandleScope scope(isolate); - v8::Local context = isolate->GetCurrentContext(); - v8::Local elem; - v8::Local obj; - if (!array->Get(context, index).ToLocal(&elem)) { - return scope.Escape(obj); - } - if (!elem->ToObject(context).ToLocal(&obj)) { - return scope.Escape(v8::Local()); - } - return scope.Escape(obj->Clone()); -#else - v8::Isolate *isolate = v8::Isolate::GetCurrent(); - v8::EscapableHandleScope scope(isolate); - return scope.Escape(array->CloneElementAt(isolate->GetCurrentContext(), index) - .FromMaybe(v8::Local())); -#endif -} - -inline MaybeLocal Call( - v8::Local fun - , v8::Local recv - , int argc - , v8::Local argv[]) { - v8::Isolate *isolate = v8::Isolate::GetCurrent(); - v8::EscapableHandleScope scope(isolate); - return scope.Escape(fun->Call(isolate->GetCurrentContext(), recv, argc, argv) - .FromMaybe(v8::Local())); -} - -#endif // NAN_MAYBE_43_INL_H_ diff --git a/node_modules/websocket/node_modules/nan/nan_maybe_pre_43_inl.h b/node_modules/websocket/node_modules/nan/nan_maybe_pre_43_inl.h deleted file mode 100644 index 83325ae..0000000 --- a/node_modules/websocket/node_modules/nan/nan_maybe_pre_43_inl.h +++ /dev/null @@ -1,268 +0,0 @@ -/********************************************************************* - * NAN - Native Abstractions for Node.js - * - * Copyright (c) 2018 NAN contributors - * - * MIT License - ********************************************************************/ - -#ifndef NAN_MAYBE_PRE_43_INL_H_ -#define NAN_MAYBE_PRE_43_INL_H_ - -template -class MaybeLocal { - public: - inline MaybeLocal() : val_(v8::Local()) {} - - template -# if NODE_MODULE_VERSION >= NODE_0_12_MODULE_VERSION - inline - MaybeLocal(v8::Local that) : val_(that) {} // NOLINT(runtime/explicit) -# else - inline - MaybeLocal(v8::Local that) : // NOLINT(runtime/explicit) - val_(*reinterpret_cast*>(&that)) {} -# endif - - inline bool IsEmpty() const { return val_.IsEmpty(); } - - template - inline bool ToLocal(v8::Local *out) const { - *out = val_; - return !IsEmpty(); - } - - inline v8::Local ToLocalChecked() const { -#if defined(V8_ENABLE_CHECKS) - assert(!IsEmpty() && "ToLocalChecked is Empty"); -#endif // V8_ENABLE_CHECKS - return val_; - } - - template - inline v8::Local FromMaybe(v8::Local default_value) const { - return IsEmpty() ? default_value : v8::Local(val_); - } - - private: - v8::Local val_; -}; - -inline -MaybeLocal ToDetailString(v8::Handle val) { - return MaybeLocal(val->ToDetailString()); -} - -inline -MaybeLocal ToArrayIndex(v8::Handle val) { - return MaybeLocal(val->ToArrayIndex()); -} - -inline -Maybe Equals(v8::Handle a, v8::Handle(b)) { - return Just(a->Equals(b)); -} - -inline -MaybeLocal NewInstance(v8::Handle h) { - return MaybeLocal(h->NewInstance()); -} - -inline -MaybeLocal NewInstance( - v8::Local h - , int argc - , v8::Local argv[]) { - return MaybeLocal(h->NewInstance(argc, argv)); -} - -inline -MaybeLocal NewInstance(v8::Handle h) { - return MaybeLocal(h->NewInstance()); -} - -inline -MaybeLocal GetFunction(v8::Handle t) { - return MaybeLocal(t->GetFunction()); -} - -inline Maybe Set( - v8::Handle obj - , v8::Handle key - , v8::Handle value) { - return Just(obj->Set(key, value)); -} - -inline Maybe Set( - v8::Handle obj - , uint32_t index - , v8::Handle value) { - return Just(obj->Set(index, value)); -} - -#include "nan_define_own_property_helper.h" // NOLINT(build/include) - -inline Maybe DefineOwnProperty( - v8::Handle obj - , v8::Handle key - , v8::Handle value - , v8::PropertyAttribute attribs = v8::None) { - v8::PropertyAttribute current = obj->GetPropertyAttributes(key); - return imp::DefineOwnPropertyHelper(current, obj, key, value, attribs); -} - -NAN_DEPRECATED inline Maybe ForceSet( - v8::Handle obj - , v8::Handle key - , v8::Handle value - , v8::PropertyAttribute attribs = v8::None) { - return Just(obj->ForceSet(key, value, attribs)); -} - -inline MaybeLocal Get( - v8::Handle obj - , v8::Handle key) { - return MaybeLocal(obj->Get(key)); -} - -inline MaybeLocal Get( - v8::Handle obj - , uint32_t index) { - return MaybeLocal(obj->Get(index)); -} - -inline Maybe GetPropertyAttributes( - v8::Handle obj - , v8::Handle key) { - return Just(obj->GetPropertyAttributes(key)); -} - -inline Maybe Has( - v8::Handle obj - , v8::Handle key) { - return Just(obj->Has(key)); -} - -inline Maybe Has( - v8::Handle obj - , uint32_t index) { - return Just(obj->Has(index)); -} - -inline Maybe Delete( - v8::Handle obj - , v8::Handle key) { - return Just(obj->Delete(key)); -} - -inline Maybe Delete( - v8::Handle obj - , uint32_t index) { - return Just(obj->Delete(index)); -} - -inline -MaybeLocal GetPropertyNames(v8::Handle obj) { - return MaybeLocal(obj->GetPropertyNames()); -} - -inline -MaybeLocal GetOwnPropertyNames(v8::Handle obj) { - return MaybeLocal(obj->GetOwnPropertyNames()); -} - -inline Maybe SetPrototype( - v8::Handle obj - , v8::Handle prototype) { - return Just(obj->SetPrototype(prototype)); -} - -inline MaybeLocal ObjectProtoToString( - v8::Handle obj) { - return MaybeLocal(obj->ObjectProtoToString()); -} - -inline Maybe HasOwnProperty( - v8::Handle obj - , v8::Handle key) { - return Just(obj->HasOwnProperty(key)); -} - -inline Maybe HasRealNamedProperty( - v8::Handle obj - , v8::Handle key) { - return Just(obj->HasRealNamedProperty(key)); -} - -inline Maybe HasRealIndexedProperty( - v8::Handle obj - , uint32_t index) { - return Just(obj->HasRealIndexedProperty(index)); -} - -inline Maybe HasRealNamedCallbackProperty( - v8::Handle obj - , v8::Handle key) { - return Just(obj->HasRealNamedCallbackProperty(key)); -} - -inline MaybeLocal GetRealNamedPropertyInPrototypeChain( - v8::Handle obj - , v8::Handle key) { - return MaybeLocal( - obj->GetRealNamedPropertyInPrototypeChain(key)); -} - -inline MaybeLocal GetRealNamedProperty( - v8::Handle obj - , v8::Handle key) { - return MaybeLocal(obj->GetRealNamedProperty(key)); -} - -inline MaybeLocal CallAsFunction( - v8::Handle obj - , v8::Handle recv - , int argc - , v8::Handle argv[]) { - return MaybeLocal(obj->CallAsFunction(recv, argc, argv)); -} - -inline MaybeLocal CallAsConstructor( - v8::Handle obj - , int argc - , v8::Local argv[]) { - return MaybeLocal(obj->CallAsConstructor(argc, argv)); -} - -inline -MaybeLocal GetSourceLine(v8::Handle msg) { - return MaybeLocal(msg->GetSourceLine()); -} - -inline Maybe GetLineNumber(v8::Handle msg) { - return Just(msg->GetLineNumber()); -} - -inline Maybe GetStartColumn(v8::Handle msg) { - return Just(msg->GetStartColumn()); -} - -inline Maybe GetEndColumn(v8::Handle msg) { - return Just(msg->GetEndColumn()); -} - -inline MaybeLocal CloneElementAt( - v8::Handle array - , uint32_t index) { - return MaybeLocal(array->CloneElementAt(index)); -} - -inline MaybeLocal Call( - v8::Local fun - , v8::Local recv - , int argc - , v8::Local argv[]) { - return MaybeLocal(fun->Call(recv, argc, argv)); -} - -#endif // NAN_MAYBE_PRE_43_INL_H_ diff --git a/node_modules/websocket/node_modules/nan/nan_new.h b/node_modules/websocket/node_modules/nan/nan_new.h deleted file mode 100644 index cdf8bbe..0000000 --- a/node_modules/websocket/node_modules/nan/nan_new.h +++ /dev/null @@ -1,340 +0,0 @@ -/********************************************************************* - * NAN - Native Abstractions for Node.js - * - * Copyright (c) 2018 NAN contributors - * - * MIT License - ********************************************************************/ - -#ifndef NAN_NEW_H_ -#define NAN_NEW_H_ - -namespace imp { // scnr - -// TODO(agnat): Generalize -template v8::Local To(v8::Local i); - -template <> -inline -v8::Local -To(v8::Local i) { - return Nan::To(i).ToLocalChecked(); -} - -template <> -inline -v8::Local -To(v8::Local i) { - return Nan::To(i).ToLocalChecked(); -} - -template <> -inline -v8::Local -To(v8::Local i) { - return Nan::To(i).ToLocalChecked(); -} - -template struct FactoryBase { - typedef v8::Local return_t; -}; - -template struct MaybeFactoryBase { - typedef MaybeLocal return_t; -}; - -template struct Factory; - -template <> -struct Factory : FactoryBase { - static inline return_t New(); - static inline return_t New(int length); -}; - -template <> -struct Factory : FactoryBase { - static inline return_t New(bool value); -}; - -template <> -struct Factory : FactoryBase { - static inline return_t New(bool value); -}; - -template <> -struct Factory : FactoryBase { - static inline - return_t - New( v8::ExtensionConfiguration* extensions = NULL - , v8::Local tmpl = v8::Local() - , v8::Local obj = v8::Local()); -}; - -template <> -struct Factory : MaybeFactoryBase { - static inline return_t New(double value); -}; - -template <> -struct Factory : FactoryBase { - static inline return_t New(void *value); -}; - -template <> -struct Factory : FactoryBase { - static inline - return_t - New( FunctionCallback callback - , v8::Local data = v8::Local()); -}; - -template <> -struct Factory : FactoryBase { - static inline - return_t - New( FunctionCallback callback = NULL - , v8::Local data = v8::Local() - , v8::Local signature = v8::Local()); -}; - -template <> -struct Factory : FactoryBase { - static inline return_t New(double value); -}; - -template <> -struct Factory : FactoryBase { - static inline return_t New(double value); -}; - -template -struct IntegerFactory : FactoryBase { - typedef typename FactoryBase::return_t return_t; - static inline return_t New(int32_t value); - static inline return_t New(uint32_t value); -}; - -template <> -struct Factory : IntegerFactory {}; - -template <> -struct Factory : IntegerFactory {}; - -template <> -struct Factory : FactoryBase { - static inline return_t New(int32_t value); - static inline return_t New(uint32_t value); -}; - -template <> -struct Factory : FactoryBase { - static inline return_t New(); -}; - -template <> -struct Factory : FactoryBase { - static inline return_t New(); -}; - -template <> -struct Factory : MaybeFactoryBase { - static inline return_t New( - v8::Local pattern, v8::RegExp::Flags flags); -}; - -template <> -struct Factory : MaybeFactoryBase { - static inline return_t New( v8::Local source); - static inline return_t New( v8::Local source - , v8::ScriptOrigin const& origin); -}; - -template <> -struct Factory : FactoryBase { - typedef v8::Local FTH; - static inline return_t New(FTH receiver = FTH()); -}; - -template <> -struct Factory : MaybeFactoryBase { - static inline return_t New(); - static inline return_t New(const char *value, int length = -1); - static inline return_t New(const uint16_t *value, int length = -1); - static inline return_t New(std::string const& value); - - static inline return_t New(v8::String::ExternalStringResource * value); - static inline return_t New(ExternalOneByteStringResource * value); -}; - -template <> -struct Factory : FactoryBase { - static inline return_t New(v8::Local value); -}; - -} // end of namespace imp - -#if (NODE_MODULE_VERSION >= 12) - -namespace imp { - -template <> -struct Factory : MaybeFactoryBase { - static inline return_t New( v8::Local source); - static inline return_t New( v8::Local source - , v8::ScriptOrigin const& origin); -}; - -} // end of namespace imp - -# include "nan_implementation_12_inl.h" - -#else // NODE_MODULE_VERSION >= 12 - -# include "nan_implementation_pre_12_inl.h" - -#endif - -//=== API ====================================================================== - -template -typename imp::Factory::return_t -New() { - return imp::Factory::New(); -} - -template -typename imp::Factory::return_t -New(A0 arg0) { - return imp::Factory::New(arg0); -} - -template -typename imp::Factory::return_t -New(A0 arg0, A1 arg1) { - return imp::Factory::New(arg0, arg1); -} - -template -typename imp::Factory::return_t -New(A0 arg0, A1 arg1, A2 arg2) { - return imp::Factory::New(arg0, arg1, arg2); -} - -template -typename imp::Factory::return_t -New(A0 arg0, A1 arg1, A2 arg2, A3 arg3) { - return imp::Factory::New(arg0, arg1, arg2, arg3); -} - -// Note(agnat): When passing overloaded function pointers to template functions -// as generic arguments the compiler needs help in picking the right overload. -// These two functions handle New and New with -// all argument variations. - -// v8::Function and v8::FunctionTemplate with one or two arguments -template -typename imp::Factory::return_t -New( FunctionCallback callback - , v8::Local data = v8::Local()) { - return imp::Factory::New(callback, data); -} - -// v8::Function and v8::FunctionTemplate with three arguments -template -typename imp::Factory::return_t -New( FunctionCallback callback - , v8::Local data = v8::Local() - , A2 a2 = A2()) { - return imp::Factory::New(callback, data, a2); -} - -// Convenience - -#if NODE_MODULE_VERSION < IOJS_3_0_MODULE_VERSION -template inline v8::Local New(v8::Handle h); -#endif - -#if NODE_MODULE_VERSION > NODE_0_10_MODULE_VERSION -template - inline v8::Local New(v8::Persistent const& p); -#else -template inline v8::Local New(v8::Persistent const& p); -#endif -template -inline v8::Local New(Persistent const& p); -template -inline v8::Local New(Global const& p); - -inline -imp::Factory::return_t -New(bool value) { - return New(value); -} - -inline -imp::Factory::return_t -New(int32_t value) { - return New(value); -} - -inline -imp::Factory::return_t -New(uint32_t value) { - return New(value); -} - -inline -imp::Factory::return_t -New(double value) { - return New(value); -} - -inline -imp::Factory::return_t -New(std::string const& value) { // NOLINT(build/include_what_you_use) - return New(value); -} - -inline -imp::Factory::return_t -New(const char * value, int length) { - return New(value, length); -} - -inline -imp::Factory::return_t -New(const uint16_t * value, int length) { - return New(value, length); -} - -inline -imp::Factory::return_t -New(const char * value) { - return New(value); -} - -inline -imp::Factory::return_t -New(const uint16_t * value) { - return New(value); -} - -inline -imp::Factory::return_t -New(v8::String::ExternalStringResource * value) { - return New(value); -} - -inline -imp::Factory::return_t -New(ExternalOneByteStringResource * value) { - return New(value); -} - -inline -imp::Factory::return_t -New(v8::Local pattern, v8::RegExp::Flags flags) { - return New(pattern, flags); -} - -#endif // NAN_NEW_H_ diff --git a/node_modules/websocket/node_modules/nan/nan_object_wrap.h b/node_modules/websocket/node_modules/nan/nan_object_wrap.h deleted file mode 100644 index 386affa..0000000 --- a/node_modules/websocket/node_modules/nan/nan_object_wrap.h +++ /dev/null @@ -1,156 +0,0 @@ -/********************************************************************* - * NAN - Native Abstractions for Node.js - * - * Copyright (c) 2018 NAN contributors - * - * MIT License - ********************************************************************/ - -#ifndef NAN_OBJECT_WRAP_H_ -#define NAN_OBJECT_WRAP_H_ - -class ObjectWrap { - public: - ObjectWrap() { - refs_ = 0; - } - - - virtual ~ObjectWrap() { - if (persistent().IsEmpty()) { - return; - } - - persistent().ClearWeak(); - persistent().Reset(); - } - - - template - static inline T* Unwrap(v8::Local object) { - assert(!object.IsEmpty()); - assert(object->InternalFieldCount() > 0); - // Cast to ObjectWrap before casting to T. A direct cast from void - // to T won't work right when T has more than one base class. - void* ptr = GetInternalFieldPointer(object, 0); - ObjectWrap* wrap = static_cast(ptr); - return static_cast(wrap); - } - - - inline v8::Local handle() const { - return New(handle_); - } - - - inline Persistent& persistent() { - return handle_; - } - - - protected: - inline void Wrap(v8::Local object) { - assert(persistent().IsEmpty()); - assert(object->InternalFieldCount() > 0); - SetInternalFieldPointer(object, 0, this); - persistent().Reset(object); - MakeWeak(); - } - -#if defined(V8_MAJOR_VERSION) && (V8_MAJOR_VERSION > 4 || \ - (V8_MAJOR_VERSION == 4 && defined(V8_MINOR_VERSION) && V8_MINOR_VERSION >= 3)) - - inline void MakeWeak() { - persistent().v8::PersistentBase::SetWeak( - this, WeakCallback, v8::WeakCallbackType::kParameter); -#if NODE_MAJOR_VERSION < 10 - // FIXME(bnoordhuis) Probably superfluous in older Node.js versions too. - persistent().MarkIndependent(); -#endif - } - -#elif NODE_MODULE_VERSION > NODE_0_10_MODULE_VERSION - - inline void MakeWeak() { - persistent().v8::PersistentBase::SetWeak(this, WeakCallback); - persistent().MarkIndependent(); - } - -#else - - inline void MakeWeak() { - persistent().persistent.MakeWeak(this, WeakCallback); - persistent().MarkIndependent(); - } - -#endif - - /* Ref() marks the object as being attached to an event loop. - * Refed objects will not be garbage collected, even if - * all references are lost. - */ - virtual void Ref() { - assert(!persistent().IsEmpty()); - persistent().ClearWeak(); - refs_++; - } - - /* Unref() marks an object as detached from the event loop. This is its - * default state. When an object with a "weak" reference changes from - * attached to detached state it will be freed. Be careful not to access - * the object after making this call as it might be gone! - * (A "weak reference" means an object that only has a - * persistant handle.) - * - * DO NOT CALL THIS FROM DESTRUCTOR - */ - virtual void Unref() { - assert(!persistent().IsEmpty()); - assert(!persistent().IsWeak()); - assert(refs_ > 0); - if (--refs_ == 0) - MakeWeak(); - } - - int refs_; // ro - - private: - NAN_DISALLOW_ASSIGN_COPY_MOVE(ObjectWrap) -#if defined(V8_MAJOR_VERSION) && (V8_MAJOR_VERSION > 4 || \ - (V8_MAJOR_VERSION == 4 && defined(V8_MINOR_VERSION) && V8_MINOR_VERSION >= 3)) - - static void - WeakCallback(v8::WeakCallbackInfo const& info) { - ObjectWrap* wrap = info.GetParameter(); - assert(wrap->refs_ == 0); - wrap->handle_.Reset(); - delete wrap; - } - -#elif NODE_MODULE_VERSION > NODE_0_10_MODULE_VERSION - - static void - WeakCallback(v8::WeakCallbackData const& data) { - ObjectWrap* wrap = data.GetParameter(); - assert(wrap->refs_ == 0); - assert(wrap->handle_.IsNearDeath()); - wrap->handle_.Reset(); - delete wrap; - } - -#else - - static void WeakCallback(v8::Persistent value, void *data) { - ObjectWrap *wrap = static_cast(data); - assert(wrap->refs_ == 0); - assert(wrap->handle_.IsNearDeath()); - wrap->handle_.Reset(); - delete wrap; - } - -#endif - Persistent handle_; -}; - - -#endif // NAN_OBJECT_WRAP_H_ diff --git a/node_modules/websocket/node_modules/nan/nan_persistent_12_inl.h b/node_modules/websocket/node_modules/nan/nan_persistent_12_inl.h deleted file mode 100644 index d9649e8..0000000 --- a/node_modules/websocket/node_modules/nan/nan_persistent_12_inl.h +++ /dev/null @@ -1,132 +0,0 @@ -/********************************************************************* - * NAN - Native Abstractions for Node.js - * - * Copyright (c) 2018 NAN contributors - * - * MIT License - ********************************************************************/ - -#ifndef NAN_PERSISTENT_12_INL_H_ -#define NAN_PERSISTENT_12_INL_H_ - -template class Persistent : - public v8::Persistent { - public: - inline Persistent() : v8::Persistent() {} - - template inline Persistent(v8::Local that) : - v8::Persistent(v8::Isolate::GetCurrent(), that) {} - - template - inline - Persistent(const v8::Persistent &that) : // NOLINT(runtime/explicit) - v8::Persistent(v8::Isolate::GetCurrent(), that) {} - - inline void Reset() { v8::PersistentBase::Reset(); } - - template - inline void Reset(const v8::Local &other) { - v8::PersistentBase::Reset(v8::Isolate::GetCurrent(), other); - } - - template - inline void Reset(const v8::PersistentBase &other) { - v8::PersistentBase::Reset(v8::Isolate::GetCurrent(), other); - } - - template - inline void SetWeak( - P *parameter - , typename WeakCallbackInfo

::Callback callback - , WeakCallbackType type); - - private: - inline T *operator*() const { return *PersistentBase::persistent; } - - template - inline void Copy(const Persistent &that) { - TYPE_CHECK(T, S); - - this->Reset(); - - if (!that.IsEmpty()) { - this->Reset(that); - M::Copy(that, this); - } - } -}; - -#if defined(V8_MAJOR_VERSION) && (V8_MAJOR_VERSION > 4 || \ - (V8_MAJOR_VERSION == 4 && defined(V8_MINOR_VERSION) && V8_MINOR_VERSION >= 3)) -template -class Global : public v8::Global { - public: - inline Global() : v8::Global() {} - - template inline Global(v8::Local that) : - v8::Global(v8::Isolate::GetCurrent(), that) {} - - template - inline - Global(const v8::PersistentBase &that) : // NOLINT(runtime/explicit) - v8::Global(v8::Isolate::GetCurrent(), that) {} - - inline void Reset() { v8::PersistentBase::Reset(); } - - template - inline void Reset(const v8::Local &other) { - v8::PersistentBase::Reset(v8::Isolate::GetCurrent(), other); - } - - template - inline void Reset(const v8::PersistentBase &other) { - v8::PersistentBase::Reset(v8::Isolate::GetCurrent(), other); - } - - template - inline void SetWeak( - P *parameter - , typename WeakCallbackInfo

::Callback callback - , WeakCallbackType type) { - reinterpret_cast*>(this)->SetWeak( - parameter, callback, type); - } -}; -#else -template -class Global : public v8::UniquePersistent { - public: - inline Global() : v8::UniquePersistent() {} - - template inline Global(v8::Local that) : - v8::UniquePersistent(v8::Isolate::GetCurrent(), that) {} - - template - inline - Global(const v8::PersistentBase &that) : // NOLINT(runtime/explicit) - v8::UniquePersistent(v8::Isolate::GetCurrent(), that) {} - - inline void Reset() { v8::PersistentBase::Reset(); } - - template - inline void Reset(const v8::Local &other) { - v8::PersistentBase::Reset(v8::Isolate::GetCurrent(), other); - } - - template - inline void Reset(const v8::PersistentBase &other) { - v8::PersistentBase::Reset(v8::Isolate::GetCurrent(), other); - } - - template - inline void SetWeak( - P *parameter - , typename WeakCallbackInfo

::Callback callback - , WeakCallbackType type) { - reinterpret_cast*>(this)->SetWeak( - parameter, callback, type); - } -}; -#endif - -#endif // NAN_PERSISTENT_12_INL_H_ diff --git a/node_modules/websocket/node_modules/nan/nan_persistent_pre_12_inl.h b/node_modules/websocket/node_modules/nan/nan_persistent_pre_12_inl.h deleted file mode 100644 index 4c9c59d..0000000 --- a/node_modules/websocket/node_modules/nan/nan_persistent_pre_12_inl.h +++ /dev/null @@ -1,242 +0,0 @@ -/********************************************************************* - * NAN - Native Abstractions for Node.js - * - * Copyright (c) 2018 NAN contributors - * - * MIT License - ********************************************************************/ - -#ifndef NAN_PERSISTENT_PRE_12_INL_H_ -#define NAN_PERSISTENT_PRE_12_INL_H_ - -template -class PersistentBase { - v8::Persistent persistent; - template - friend v8::Local New(const PersistentBase &p); - template - friend v8::Local New(const Persistent &p); - template - friend v8::Local New(const Global &p); - template friend class ReturnValue; - - public: - inline PersistentBase() : - persistent() {} - - inline void Reset() { - persistent.Dispose(); - persistent.Clear(); - } - - template - inline void Reset(const v8::Local &other) { - TYPE_CHECK(T, S); - - if (!persistent.IsEmpty()) { - persistent.Dispose(); - } - - if (other.IsEmpty()) { - persistent.Clear(); - } else { - persistent = v8::Persistent::New(other); - } - } - - template - inline void Reset(const PersistentBase &other) { - TYPE_CHECK(T, S); - - if (!persistent.IsEmpty()) { - persistent.Dispose(); - } - - if (other.IsEmpty()) { - persistent.Clear(); - } else { - persistent = v8::Persistent::New(other.persistent); - } - } - - inline bool IsEmpty() const { return persistent.IsEmpty(); } - - inline void Empty() { persistent.Clear(); } - - template - inline bool operator==(const PersistentBase &that) const { - return this->persistent == that.persistent; - } - - template - inline bool operator==(const v8::Local &that) const { - return this->persistent == that; - } - - template - inline bool operator!=(const PersistentBase &that) const { - return !operator==(that); - } - - template - inline bool operator!=(const v8::Local &that) const { - return !operator==(that); - } - - template - inline void SetWeak( - P *parameter - , typename WeakCallbackInfo

::Callback callback - , WeakCallbackType type); - - inline void ClearWeak() { persistent.ClearWeak(); } - - inline void MarkIndependent() { persistent.MarkIndependent(); } - - inline bool IsIndependent() const { return persistent.IsIndependent(); } - - inline bool IsNearDeath() const { return persistent.IsNearDeath(); } - - inline bool IsWeak() const { return persistent.IsWeak(); } - - private: - inline explicit PersistentBase(v8::Persistent that) : - persistent(that) { } - inline explicit PersistentBase(T *val) : persistent(val) {} - template friend class Persistent; - template friend class Global; - friend class ObjectWrap; -}; - -template -class NonCopyablePersistentTraits { - public: - typedef Persistent > - NonCopyablePersistent; - static const bool kResetInDestructor = false; - template - inline static void Copy(const Persistent &source, - NonCopyablePersistent *dest) { - Uncompilable(); - } - - template inline static void Uncompilable() { - TYPE_CHECK(O, v8::Primitive); - } -}; - -template -struct CopyablePersistentTraits { - typedef Persistent > CopyablePersistent; - static const bool kResetInDestructor = true; - template - static inline void Copy(const Persistent &source, - CopyablePersistent *dest) {} -}; - -template class Persistent : - public PersistentBase { - public: - inline Persistent() {} - - template inline Persistent(v8::Handle that) - : PersistentBase(v8::Persistent::New(that)) { - TYPE_CHECK(T, S); - } - - inline Persistent(const Persistent &that) : PersistentBase() { - Copy(that); - } - - template - inline Persistent(const Persistent &that) : - PersistentBase() { - Copy(that); - } - - inline Persistent &operator=(const Persistent &that) { - Copy(that); - return *this; - } - - template - inline Persistent &operator=(const Persistent &that) { - Copy(that); - return *this; - } - - inline ~Persistent() { - if (M::kResetInDestructor) this->Reset(); - } - - private: - inline T *operator*() const { return *PersistentBase::persistent; } - - template - inline void Copy(const Persistent &that) { - TYPE_CHECK(T, S); - - this->Reset(); - - if (!that.IsEmpty()) { - this->persistent = v8::Persistent::New(that.persistent); - M::Copy(that, this); - } - } -}; - -template -class Global : public PersistentBase { - struct RValue { - inline explicit RValue(Global* obj) : object(obj) {} - Global* object; - }; - - public: - inline Global() : PersistentBase(0) { } - - template - inline Global(v8::Local that) // NOLINT(runtime/explicit) - : PersistentBase(v8::Persistent::New(that)) { - TYPE_CHECK(T, S); - } - - template - inline Global(const PersistentBase &that) // NOLINT(runtime/explicit) - : PersistentBase(that) { - TYPE_CHECK(T, S); - } - /** - * Move constructor. - */ - inline Global(RValue rvalue) // NOLINT(runtime/explicit) - : PersistentBase(rvalue.object->persistent) { - rvalue.object->Reset(); - } - inline ~Global() { this->Reset(); } - /** - * Move via assignment. - */ - template - inline Global &operator=(Global rhs) { - TYPE_CHECK(T, S); - this->Reset(rhs.persistent); - rhs.Reset(); - return *this; - } - /** - * Cast operator for moves. - */ - inline operator RValue() { return RValue(this); } - /** - * Pass allows returning uniques from functions, etc. - */ - Global Pass() { return Global(RValue(this)); } - - private: - Global(Global &); - void operator=(Global &); - template friend class ReturnValue; -}; - -#endif // NAN_PERSISTENT_PRE_12_INL_H_ diff --git a/node_modules/websocket/node_modules/nan/nan_private.h b/node_modules/websocket/node_modules/nan/nan_private.h deleted file mode 100644 index 15f44cc..0000000 --- a/node_modules/websocket/node_modules/nan/nan_private.h +++ /dev/null @@ -1,73 +0,0 @@ -/********************************************************************* - * NAN - Native Abstractions for Node.js - * - * Copyright (c) 2018 NAN contributors - * - * MIT License - ********************************************************************/ - -#ifndef NAN_PRIVATE_H_ -#define NAN_PRIVATE_H_ - -inline Maybe -HasPrivate(v8::Local object, v8::Local key) { - HandleScope scope; -#if NODE_MODULE_VERSION >= NODE_6_0_MODULE_VERSION - v8::Isolate *isolate = v8::Isolate::GetCurrent(); - v8::Local context = isolate->GetCurrentContext(); - v8::Local private_key = v8::Private::ForApi(isolate, key); - return object->HasPrivate(context, private_key); -#else - return Just(!object->GetHiddenValue(key).IsEmpty()); -#endif -} - -inline MaybeLocal -GetPrivate(v8::Local object, v8::Local key) { -#if NODE_MODULE_VERSION >= NODE_6_0_MODULE_VERSION - v8::Isolate *isolate = v8::Isolate::GetCurrent(); - v8::EscapableHandleScope scope(isolate); - v8::Local context = isolate->GetCurrentContext(); - v8::Local private_key = v8::Private::ForApi(isolate, key); - v8::MaybeLocal v = object->GetPrivate(context, private_key); - return scope.Escape(v.ToLocalChecked()); -#else - EscapableHandleScope scope; - v8::Local v = object->GetHiddenValue(key); - if (v.IsEmpty()) { - v = Undefined(); - } - return scope.Escape(v); -#endif -} - -inline Maybe SetPrivate( - v8::Local object, - v8::Local key, - v8::Local value) { -#if NODE_MODULE_VERSION >= NODE_6_0_MODULE_VERSION - HandleScope scope; - v8::Isolate *isolate = v8::Isolate::GetCurrent(); - v8::Local context = isolate->GetCurrentContext(); - v8::Local private_key = v8::Private::ForApi(isolate, key); - return object->SetPrivate(context, private_key, value); -#else - return Just(object->SetHiddenValue(key, value)); -#endif -} - -inline Maybe DeletePrivate( - v8::Local object, - v8::Local key) { -#if NODE_MODULE_VERSION >= NODE_6_0_MODULE_VERSION - HandleScope scope; - v8::Isolate *isolate = v8::Isolate::GetCurrent(); - v8::Local private_key = v8::Private::ForApi(isolate, key); - return object->DeletePrivate(isolate->GetCurrentContext(), private_key); -#else - return Just(object->DeleteHiddenValue(key)); -#endif -} - -#endif // NAN_PRIVATE_H_ - diff --git a/node_modules/websocket/node_modules/nan/nan_string_bytes.h b/node_modules/websocket/node_modules/nan/nan_string_bytes.h deleted file mode 100644 index a2e6437..0000000 --- a/node_modules/websocket/node_modules/nan/nan_string_bytes.h +++ /dev/null @@ -1,305 +0,0 @@ -// Copyright Joyent, Inc. and other Node contributors. -// -// 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. - -#ifndef NAN_STRING_BYTES_H_ -#define NAN_STRING_BYTES_H_ - -// Decodes a v8::Local or Buffer to a raw char* - -namespace imp { - -using v8::Local; -using v8::Object; -using v8::String; -using v8::Value; - - -//// Base 64 //// - -#define base64_encoded_size(size) ((size + 2 - ((size + 2) % 3)) / 3 * 4) - - - -//// HEX //// - -static bool contains_non_ascii_slow(const char* buf, size_t len) { - for (size_t i = 0; i < len; ++i) { - if (buf[i] & 0x80) return true; - } - return false; -} - - -static bool contains_non_ascii(const char* src, size_t len) { - if (len < 16) { - return contains_non_ascii_slow(src, len); - } - - const unsigned bytes_per_word = sizeof(void*); - const unsigned align_mask = bytes_per_word - 1; - const unsigned unaligned = reinterpret_cast(src) & align_mask; - - if (unaligned > 0) { - const unsigned n = bytes_per_word - unaligned; - if (contains_non_ascii_slow(src, n)) return true; - src += n; - len -= n; - } - - -#if defined(__x86_64__) || defined(_WIN64) - const uintptr_t mask = 0x8080808080808080ll; -#else - const uintptr_t mask = 0x80808080l; -#endif - - const uintptr_t* srcw = reinterpret_cast(src); - - for (size_t i = 0, n = len / bytes_per_word; i < n; ++i) { - if (srcw[i] & mask) return true; - } - - const unsigned remainder = len & align_mask; - if (remainder > 0) { - const size_t offset = len - remainder; - if (contains_non_ascii_slow(src + offset, remainder)) return true; - } - - return false; -} - - -static void force_ascii_slow(const char* src, char* dst, size_t len) { - for (size_t i = 0; i < len; ++i) { - dst[i] = src[i] & 0x7f; - } -} - - -static void force_ascii(const char* src, char* dst, size_t len) { - if (len < 16) { - force_ascii_slow(src, dst, len); - return; - } - - const unsigned bytes_per_word = sizeof(void*); - const unsigned align_mask = bytes_per_word - 1; - const unsigned src_unalign = reinterpret_cast(src) & align_mask; - const unsigned dst_unalign = reinterpret_cast(dst) & align_mask; - - if (src_unalign > 0) { - if (src_unalign == dst_unalign) { - const unsigned unalign = bytes_per_word - src_unalign; - force_ascii_slow(src, dst, unalign); - src += unalign; - dst += unalign; - len -= src_unalign; - } else { - force_ascii_slow(src, dst, len); - return; - } - } - -#if defined(__x86_64__) || defined(_WIN64) - const uintptr_t mask = ~0x8080808080808080ll; -#else - const uintptr_t mask = ~0x80808080l; -#endif - - const uintptr_t* srcw = reinterpret_cast(src); - uintptr_t* dstw = reinterpret_cast(dst); - - for (size_t i = 0, n = len / bytes_per_word; i < n; ++i) { - dstw[i] = srcw[i] & mask; - } - - const unsigned remainder = len & align_mask; - if (remainder > 0) { - const size_t offset = len - remainder; - force_ascii_slow(src + offset, dst + offset, remainder); - } -} - - -static size_t base64_encode(const char* src, - size_t slen, - char* dst, - size_t dlen) { - // We know how much we'll write, just make sure that there's space. - assert(dlen >= base64_encoded_size(slen) && - "not enough space provided for base64 encode"); - - dlen = base64_encoded_size(slen); - - unsigned a; - unsigned b; - unsigned c; - unsigned i; - unsigned k; - unsigned n; - - static const char table[] = "ABCDEFGHIJKLMNOPQRSTUVWXYZ" - "abcdefghijklmnopqrstuvwxyz" - "0123456789+/"; - - i = 0; - k = 0; - n = slen / 3 * 3; - - while (i < n) { - a = src[i + 0] & 0xff; - b = src[i + 1] & 0xff; - c = src[i + 2] & 0xff; - - dst[k + 0] = table[a >> 2]; - dst[k + 1] = table[((a & 3) << 4) | (b >> 4)]; - dst[k + 2] = table[((b & 0x0f) << 2) | (c >> 6)]; - dst[k + 3] = table[c & 0x3f]; - - i += 3; - k += 4; - } - - if (n != slen) { - switch (slen - n) { - case 1: - a = src[i + 0] & 0xff; - dst[k + 0] = table[a >> 2]; - dst[k + 1] = table[(a & 3) << 4]; - dst[k + 2] = '='; - dst[k + 3] = '='; - break; - - case 2: - a = src[i + 0] & 0xff; - b = src[i + 1] & 0xff; - dst[k + 0] = table[a >> 2]; - dst[k + 1] = table[((a & 3) << 4) | (b >> 4)]; - dst[k + 2] = table[(b & 0x0f) << 2]; - dst[k + 3] = '='; - break; - } - } - - return dlen; -} - - -static size_t hex_encode(const char* src, size_t slen, char* dst, size_t dlen) { - // We know how much we'll write, just make sure that there's space. - assert(dlen >= slen * 2 && - "not enough space provided for hex encode"); - - dlen = slen * 2; - for (uint32_t i = 0, k = 0; k < dlen; i += 1, k += 2) { - static const char hex[] = "0123456789abcdef"; - uint8_t val = static_cast(src[i]); - dst[k + 0] = hex[val >> 4]; - dst[k + 1] = hex[val & 15]; - } - - return dlen; -} - - - -static Local Encode(const char* buf, - size_t buflen, - enum Encoding encoding) { - assert(buflen <= node::Buffer::kMaxLength); - if (!buflen && encoding != BUFFER) - return New("").ToLocalChecked(); - - Local val; - switch (encoding) { - case BUFFER: - return CopyBuffer(buf, buflen).ToLocalChecked(); - - case ASCII: - if (contains_non_ascii(buf, buflen)) { - char* out = new char[buflen]; - force_ascii(buf, out, buflen); - val = New(out, buflen).ToLocalChecked(); - delete[] out; - } else { - val = New(buf, buflen).ToLocalChecked(); - } - break; - - case UTF8: - val = New(buf, buflen).ToLocalChecked(); - break; - - case BINARY: { - // TODO(isaacs) use ExternalTwoByteString? - const unsigned char *cbuf = reinterpret_cast(buf); - uint16_t * twobytebuf = new uint16_t[buflen]; - for (size_t i = 0; i < buflen; i++) { - // XXX is the following line platform independent? - twobytebuf[i] = cbuf[i]; - } - val = New(twobytebuf, buflen).ToLocalChecked(); - delete[] twobytebuf; - break; - } - - case BASE64: { - size_t dlen = base64_encoded_size(buflen); - char* dst = new char[dlen]; - - size_t written = base64_encode(buf, buflen, dst, dlen); - assert(written == dlen); - - val = New(dst, dlen).ToLocalChecked(); - delete[] dst; - break; - } - - case UCS2: { - const uint16_t* data = reinterpret_cast(buf); - val = New(data, buflen / 2).ToLocalChecked(); - break; - } - - case HEX: { - size_t dlen = buflen * 2; - char* dst = new char[dlen]; - size_t written = hex_encode(buf, buflen, dst, dlen); - assert(written == dlen); - - val = New(dst, dlen).ToLocalChecked(); - delete[] dst; - break; - } - - default: - assert(0 && "unknown encoding"); - break; - } - - return val; -} - -#undef base64_encoded_size - -} // end of namespace imp - -#endif // NAN_STRING_BYTES_H_ diff --git a/node_modules/websocket/node_modules/nan/nan_typedarray_contents.h b/node_modules/websocket/node_modules/nan/nan_typedarray_contents.h deleted file mode 100644 index d28ae32..0000000 --- a/node_modules/websocket/node_modules/nan/nan_typedarray_contents.h +++ /dev/null @@ -1,90 +0,0 @@ -/********************************************************************* - * NAN - Native Abstractions for Node.js - * - * Copyright (c) 2018 NAN contributors - * - * MIT License - ********************************************************************/ - -#ifndef NAN_TYPEDARRAY_CONTENTS_H_ -#define NAN_TYPEDARRAY_CONTENTS_H_ - -template -class TypedArrayContents { - public: - inline explicit TypedArrayContents(v8::Local from) : - length_(0), data_(NULL) { - HandleScope scope; - - size_t length = 0; - void* data = NULL; - -#if defined(V8_MAJOR_VERSION) && (V8_MAJOR_VERSION > 4 || \ - (V8_MAJOR_VERSION == 4 && defined(V8_MINOR_VERSION) && V8_MINOR_VERSION >= 3)) - - if (from->IsArrayBufferView()) { - v8::Local array = - v8::Local::Cast(from); - - const size_t byte_length = array->ByteLength(); - const ptrdiff_t byte_offset = array->ByteOffset(); - v8::Local buffer = array->Buffer(); - - length = byte_length / sizeof(T); - data = static_cast(buffer->GetContents().Data()) + byte_offset; - } - -#else - - if (from->IsObject() && !from->IsNull()) { - v8::Local array = v8::Local::Cast(from); - - MaybeLocal buffer = Get(array, - New("buffer").ToLocalChecked()); - MaybeLocal byte_length = Get(array, - New("byteLength").ToLocalChecked()); - MaybeLocal byte_offset = Get(array, - New("byteOffset").ToLocalChecked()); - - if (!buffer.IsEmpty() && - !byte_length.IsEmpty() && byte_length.ToLocalChecked()->IsUint32() && - !byte_offset.IsEmpty() && byte_offset.ToLocalChecked()->IsUint32()) { - data = array->GetIndexedPropertiesExternalArrayData(); - if(data) { - length = byte_length.ToLocalChecked()->Uint32Value() / sizeof(T); - } - } - } - -#endif - -#if defined(_MSC_VER) && _MSC_VER >= 1900 || __cplusplus >= 201103L - assert(reinterpret_cast(data) % alignof (T) == 0); -#elif defined(_MSC_VER) && _MSC_VER >= 1600 || defined(__GNUC__) - assert(reinterpret_cast(data) % __alignof(T) == 0); -#else - assert(reinterpret_cast(data) % sizeof (T) == 0); -#endif - - length_ = length; - data_ = static_cast(data); - } - - inline size_t length() const { return length_; } - inline T* operator*() { return data_; } - inline const T* operator*() const { return data_; } - - private: - NAN_DISALLOW_ASSIGN_COPY_MOVE(TypedArrayContents) - - //Disable heap allocation - void *operator new(size_t size); - void operator delete(void *, size_t) { - abort(); - } - - size_t length_; - T* data_; -}; - -#endif // NAN_TYPEDARRAY_CONTENTS_H_ diff --git a/node_modules/websocket/node_modules/nan/nan_weak.h b/node_modules/websocket/node_modules/nan/nan_weak.h deleted file mode 100644 index 7e7ab07..0000000 --- a/node_modules/websocket/node_modules/nan/nan_weak.h +++ /dev/null @@ -1,437 +0,0 @@ -/********************************************************************* - * NAN - Native Abstractions for Node.js - * - * Copyright (c) 2018 NAN contributors - * - * MIT License - ********************************************************************/ - -#ifndef NAN_WEAK_H_ -#define NAN_WEAK_H_ - -static const int kInternalFieldsInWeakCallback = 2; -static const int kNoInternalFieldIndex = -1; - -#if defined(V8_MAJOR_VERSION) && (V8_MAJOR_VERSION > 4 || \ - (V8_MAJOR_VERSION == 4 && defined(V8_MINOR_VERSION) && V8_MINOR_VERSION >= 3)) -# define NAN_WEAK_PARAMETER_CALLBACK_DATA_TYPE_ \ - v8::WeakCallbackInfo > const& -# define NAN_WEAK_TWOFIELD_CALLBACK_DATA_TYPE_ \ - NAN_WEAK_PARAMETER_CALLBACK_DATA_TYPE_ -# define NAN_WEAK_PARAMETER_CALLBACK_SIG_ NAN_WEAK_PARAMETER_CALLBACK_DATA_TYPE_ -# define NAN_WEAK_TWOFIELD_CALLBACK_SIG_ NAN_WEAK_TWOFIELD_CALLBACK_DATA_TYPE_ -#elif NODE_MODULE_VERSION > IOJS_1_1_MODULE_VERSION -# define NAN_WEAK_PARAMETER_CALLBACK_DATA_TYPE_ \ - v8::PhantomCallbackData > const& -# define NAN_WEAK_TWOFIELD_CALLBACK_DATA_TYPE_ \ - NAN_WEAK_PARAMETER_CALLBACK_DATA_TYPE_ -# define NAN_WEAK_PARAMETER_CALLBACK_SIG_ NAN_WEAK_PARAMETER_CALLBACK_DATA_TYPE_ -# define NAN_WEAK_TWOFIELD_CALLBACK_SIG_ NAN_WEAK_TWOFIELD_CALLBACK_DATA_TYPE_ -#elif NODE_MODULE_VERSION > NODE_0_12_MODULE_VERSION -# define NAN_WEAK_PARAMETER_CALLBACK_DATA_TYPE_ \ - v8::PhantomCallbackData > const& -# define NAN_WEAK_TWOFIELD_CALLBACK_DATA_TYPE_ \ - v8::InternalFieldsCallbackData, void> const& -# define NAN_WEAK_PARAMETER_CALLBACK_SIG_ NAN_WEAK_PARAMETER_CALLBACK_DATA_TYPE_ -# define NAN_WEAK_TWOFIELD_CALLBACK_SIG_ NAN_WEAK_TWOFIELD_CALLBACK_DATA_TYPE_ -#elif NODE_MODULE_VERSION > NODE_0_10_MODULE_VERSION -# define NAN_WEAK_CALLBACK_DATA_TYPE_ \ - v8::WeakCallbackData > const& -# define NAN_WEAK_CALLBACK_SIG_ NAN_WEAK_CALLBACK_DATA_TYPE_ -#else -# define NAN_WEAK_CALLBACK_DATA_TYPE_ void * -# define NAN_WEAK_CALLBACK_SIG_ \ - v8::Persistent, NAN_WEAK_CALLBACK_DATA_TYPE_ -#endif - -template -class WeakCallbackInfo { - public: - typedef void (*Callback)(const WeakCallbackInfo& data); - WeakCallbackInfo( - Persistent *persistent - , Callback callback - , void *parameter - , void *field1 = 0 - , void *field2 = 0) : - callback_(callback), isolate_(0), parameter_(parameter) { - std::memcpy(&persistent_, persistent, sizeof (v8::Persistent)); - internal_fields_[0] = field1; - internal_fields_[1] = field2; - } - inline v8::Isolate *GetIsolate() const { return isolate_; } - inline T *GetParameter() const { return static_cast(parameter_); } - inline void *GetInternalField(int index) const { - assert((index == 0 || index == 1) && "internal field index out of bounds"); - if (index == 0) { - return internal_fields_[0]; - } else { - return internal_fields_[1]; - } - } - - private: - NAN_DISALLOW_ASSIGN_COPY_MOVE(WeakCallbackInfo) - Callback callback_; - v8::Isolate *isolate_; - void *parameter_; - void *internal_fields_[kInternalFieldsInWeakCallback]; - v8::Persistent persistent_; - template friend class Persistent; - template friend class PersistentBase; -#if NODE_MODULE_VERSION <= NODE_0_12_MODULE_VERSION -# if NODE_MODULE_VERSION > NODE_0_10_MODULE_VERSION - template - static void invoke(NAN_WEAK_CALLBACK_SIG_ data); - template - static WeakCallbackInfo *unwrap(NAN_WEAK_CALLBACK_DATA_TYPE_ data); -# else - static void invoke(NAN_WEAK_CALLBACK_SIG_ data); - static WeakCallbackInfo *unwrap(NAN_WEAK_CALLBACK_DATA_TYPE_ data); -# endif -#else -# if defined(V8_MAJOR_VERSION) && (V8_MAJOR_VERSION > 4 || \ - (V8_MAJOR_VERSION == 4 && defined(V8_MINOR_VERSION) && V8_MINOR_VERSION >= 3)) - template - static void invokeparameter(NAN_WEAK_PARAMETER_CALLBACK_SIG_ data); - template - static void invoketwofield(NAN_WEAK_TWOFIELD_CALLBACK_SIG_ data); -# else - static void invokeparameter(NAN_WEAK_PARAMETER_CALLBACK_SIG_ data); - static void invoketwofield(NAN_WEAK_TWOFIELD_CALLBACK_SIG_ data); -# endif - static WeakCallbackInfo *unwrapparameter( - NAN_WEAK_PARAMETER_CALLBACK_DATA_TYPE_ data); - static WeakCallbackInfo *unwraptwofield( - NAN_WEAK_TWOFIELD_CALLBACK_DATA_TYPE_ data); -#endif -}; - - -#if defined(V8_MAJOR_VERSION) && (V8_MAJOR_VERSION > 4 || \ - (V8_MAJOR_VERSION == 4 && defined(V8_MINOR_VERSION) && V8_MINOR_VERSION >= 3)) - -template -template -void -WeakCallbackInfo::invokeparameter(NAN_WEAK_PARAMETER_CALLBACK_SIG_ data) { - WeakCallbackInfo *cbinfo = unwrapparameter(data); - if (isFirstPass) { - cbinfo->persistent_.Reset(); - data.SetSecondPassCallback(invokeparameter); - } else { - cbinfo->callback_(*cbinfo); - delete cbinfo; - } -} - -template -template -void -WeakCallbackInfo::invoketwofield(NAN_WEAK_TWOFIELD_CALLBACK_SIG_ data) { - WeakCallbackInfo *cbinfo = unwraptwofield(data); - if (isFirstPass) { - cbinfo->persistent_.Reset(); - data.SetSecondPassCallback(invoketwofield); - } else { - cbinfo->callback_(*cbinfo); - delete cbinfo; - } -} - -template -WeakCallbackInfo *WeakCallbackInfo::unwrapparameter( - NAN_WEAK_PARAMETER_CALLBACK_DATA_TYPE_ data) { - WeakCallbackInfo *cbinfo = - static_cast*>(data.GetParameter()); - cbinfo->isolate_ = data.GetIsolate(); - return cbinfo; -} - -template -WeakCallbackInfo *WeakCallbackInfo::unwraptwofield( - NAN_WEAK_TWOFIELD_CALLBACK_DATA_TYPE_ data) { - WeakCallbackInfo *cbinfo = - static_cast*>(data.GetInternalField(0)); - cbinfo->isolate_ = data.GetIsolate(); - return cbinfo; -} - -#undef NAN_WEAK_PARAMETER_CALLBACK_SIG_ -#undef NAN_WEAK_TWOFIELD_CALLBACK_SIG_ -#undef NAN_WEAK_PARAMETER_CALLBACK_DATA_TYPE_ -#undef NAN_WEAK_TWOFIELD_CALLBACK_DATA_TYPE_ -# elif NODE_MODULE_VERSION > NODE_0_12_MODULE_VERSION - -template -void -WeakCallbackInfo::invokeparameter(NAN_WEAK_PARAMETER_CALLBACK_SIG_ data) { - WeakCallbackInfo *cbinfo = unwrapparameter(data); - cbinfo->persistent_.Reset(); - cbinfo->callback_(*cbinfo); - delete cbinfo; -} - -template -void -WeakCallbackInfo::invoketwofield(NAN_WEAK_TWOFIELD_CALLBACK_SIG_ data) { - WeakCallbackInfo *cbinfo = unwraptwofield(data); - cbinfo->persistent_.Reset(); - cbinfo->callback_(*cbinfo); - delete cbinfo; -} - -template -WeakCallbackInfo *WeakCallbackInfo::unwrapparameter( - NAN_WEAK_PARAMETER_CALLBACK_DATA_TYPE_ data) { - WeakCallbackInfo *cbinfo = - static_cast*>(data.GetParameter()); - cbinfo->isolate_ = data.GetIsolate(); - return cbinfo; -} - -template -WeakCallbackInfo *WeakCallbackInfo::unwraptwofield( - NAN_WEAK_TWOFIELD_CALLBACK_DATA_TYPE_ data) { - WeakCallbackInfo *cbinfo = - static_cast*>(data.GetInternalField1()); - cbinfo->isolate_ = data.GetIsolate(); - return cbinfo; -} - -#undef NAN_WEAK_PARAMETER_CALLBACK_SIG_ -#undef NAN_WEAK_TWOFIELD_CALLBACK_SIG_ -#undef NAN_WEAK_PARAMETER_CALLBACK_DATA_TYPE_ -#undef NAN_WEAK_TWOFIELD_CALLBACK_DATA_TYPE_ -#elif NODE_MODULE_VERSION > NODE_0_10_MODULE_VERSION - -template -template -void WeakCallbackInfo::invoke(NAN_WEAK_CALLBACK_SIG_ data) { - WeakCallbackInfo *cbinfo = unwrap(data); - cbinfo->persistent_.Reset(); - cbinfo->callback_(*cbinfo); - delete cbinfo; -} - -template -template -WeakCallbackInfo *WeakCallbackInfo::unwrap( - NAN_WEAK_CALLBACK_DATA_TYPE_ data) { - void *parameter = data.GetParameter(); - WeakCallbackInfo *cbinfo = - static_cast*>(parameter); - cbinfo->isolate_ = data.GetIsolate(); - return cbinfo; -} - -#undef NAN_WEAK_CALLBACK_SIG_ -#undef NAN_WEAK_CALLBACK_DATA_TYPE_ -#else - -template -void WeakCallbackInfo::invoke(NAN_WEAK_CALLBACK_SIG_ data) { - WeakCallbackInfo *cbinfo = unwrap(data); - cbinfo->persistent_.Dispose(); - cbinfo->persistent_.Clear(); - cbinfo->callback_(*cbinfo); - delete cbinfo; -} - -template -WeakCallbackInfo *WeakCallbackInfo::unwrap( - NAN_WEAK_CALLBACK_DATA_TYPE_ data) { - WeakCallbackInfo *cbinfo = - static_cast*>(data); - cbinfo->isolate_ = v8::Isolate::GetCurrent(); - return cbinfo; -} - -#undef NAN_WEAK_CALLBACK_SIG_ -#undef NAN_WEAK_CALLBACK_DATA_TYPE_ -#endif - -#if defined(V8_MAJOR_VERSION) && (V8_MAJOR_VERSION > 4 || \ - (V8_MAJOR_VERSION == 4 && defined(V8_MINOR_VERSION) && V8_MINOR_VERSION >= 3)) -template -template -inline void Persistent::SetWeak( - P *parameter - , typename WeakCallbackInfo

::Callback callback - , WeakCallbackType type) { - WeakCallbackInfo

*wcbd; - if (type == WeakCallbackType::kParameter) { - wcbd = new WeakCallbackInfo

( - reinterpret_cast*>(this) - , callback - , parameter); - v8::PersistentBase::SetWeak( - wcbd - , WeakCallbackInfo

::template invokeparameter - , type); - } else { - v8::Local* self_v(reinterpret_cast*>(this)); - assert((*self_v)->IsObject()); - v8::Local self((*self_v).As()); - int count = self->InternalFieldCount(); - void *internal_fields[kInternalFieldsInWeakCallback] = {0, 0}; - for (int i = 0; i < count && i < kInternalFieldsInWeakCallback; i++) { - internal_fields[i] = self->GetAlignedPointerFromInternalField(i); - } - wcbd = new WeakCallbackInfo

( - reinterpret_cast*>(this) - , callback - , 0 - , internal_fields[0] - , internal_fields[1]); - self->SetAlignedPointerInInternalField(0, wcbd); - v8::PersistentBase::SetWeak( - static_cast*>(0) - , WeakCallbackInfo

::template invoketwofield - , type); - } -} -#elif NODE_MODULE_VERSION > IOJS_1_1_MODULE_VERSION -template -template -inline void Persistent::SetWeak( - P *parameter - , typename WeakCallbackInfo

::Callback callback - , WeakCallbackType type) { - WeakCallbackInfo

*wcbd; - if (type == WeakCallbackType::kParameter) { - wcbd = new WeakCallbackInfo

( - reinterpret_cast*>(this) - , callback - , parameter); - v8::PersistentBase::SetPhantom( - wcbd - , WeakCallbackInfo

::invokeparameter); - } else { - v8::Local* self_v(reinterpret_cast*>(this)); - assert((*self_v)->IsObject()); - v8::Local self((*self_v).As()); - int count = self->InternalFieldCount(); - void *internal_fields[kInternalFieldsInWeakCallback] = {0, 0}; - for (int i = 0; i < count && i < kInternalFieldsInWeakCallback; i++) { - internal_fields[i] = self->GetAlignedPointerFromInternalField(i); - } - wcbd = new WeakCallbackInfo

( - reinterpret_cast*>(this) - , callback - , 0 - , internal_fields[0] - , internal_fields[1]); - self->SetAlignedPointerInInternalField(0, wcbd); - v8::PersistentBase::SetPhantom( - static_cast*>(0) - , WeakCallbackInfo

::invoketwofield - , 0 - , count > 1 ? 1 : kNoInternalFieldIndex); - } -} -#elif NODE_MODULE_VERSION > NODE_0_12_MODULE_VERSION -template -template -inline void Persistent::SetWeak( - P *parameter - , typename WeakCallbackInfo

::Callback callback - , WeakCallbackType type) { - WeakCallbackInfo

*wcbd; - if (type == WeakCallbackType::kParameter) { - wcbd = new WeakCallbackInfo

( - reinterpret_cast*>(this) - , callback - , parameter); - v8::PersistentBase::SetPhantom( - wcbd - , WeakCallbackInfo

::invokeparameter); - } else { - v8::Local* self_v(reinterpret_cast*>(this)); - assert((*self_v)->IsObject()); - v8::Local self((*self_v).As()); - int count = self->InternalFieldCount(); - void *internal_fields[kInternalFieldsInWeakCallback] = {0, 0}; - for (int i = 0; i < count && i < kInternalFieldsInWeakCallback; i++) { - internal_fields[i] = self->GetAlignedPointerFromInternalField(i); - } - wcbd = new WeakCallbackInfo

( - reinterpret_cast*>(this) - , callback - , 0 - , internal_fields[0] - , internal_fields[1]); - self->SetAlignedPointerInInternalField(0, wcbd); - v8::PersistentBase::SetPhantom( - WeakCallbackInfo

::invoketwofield - , 0 - , count > 1 ? 1 : kNoInternalFieldIndex); - } -} -#elif NODE_MODULE_VERSION > NODE_0_10_MODULE_VERSION -template -template -inline void Persistent::SetWeak( - P *parameter - , typename WeakCallbackInfo

::Callback callback - , WeakCallbackType type) { - WeakCallbackInfo

*wcbd; - if (type == WeakCallbackType::kParameter) { - wcbd = new WeakCallbackInfo

( - reinterpret_cast*>(this) - , callback - , parameter); - v8::PersistentBase::SetWeak(wcbd, WeakCallbackInfo

::invoke); - } else { - v8::Local* self_v(reinterpret_cast*>(this)); - assert((*self_v)->IsObject()); - v8::Local self((*self_v).As()); - int count = self->InternalFieldCount(); - void *internal_fields[kInternalFieldsInWeakCallback] = {0, 0}; - for (int i = 0; i < count && i < kInternalFieldsInWeakCallback; i++) { - internal_fields[i] = self->GetAlignedPointerFromInternalField(i); - } - wcbd = new WeakCallbackInfo

( - reinterpret_cast*>(this) - , callback - , 0 - , internal_fields[0] - , internal_fields[1]); - v8::PersistentBase::SetWeak(wcbd, WeakCallbackInfo

::invoke); - } -} -#else -template -template -inline void PersistentBase::SetWeak( - P *parameter - , typename WeakCallbackInfo

::Callback callback - , WeakCallbackType type) { - WeakCallbackInfo

*wcbd; - if (type == WeakCallbackType::kParameter) { - wcbd = new WeakCallbackInfo

( - reinterpret_cast*>(this) - , callback - , parameter); - persistent.MakeWeak(wcbd, WeakCallbackInfo

::invoke); - } else { - v8::Local* self_v(reinterpret_cast*>(this)); - assert((*self_v)->IsObject()); - v8::Local self((*self_v).As()); - int count = self->InternalFieldCount(); - void *internal_fields[kInternalFieldsInWeakCallback] = {0, 0}; - for (int i = 0; i < count && i < kInternalFieldsInWeakCallback; i++) { - internal_fields[i] = self->GetPointerFromInternalField(i); - } - wcbd = new WeakCallbackInfo

( - reinterpret_cast*>(this) - , callback - , 0 - , internal_fields[0] - , internal_fields[1]); - persistent.MakeWeak(wcbd, WeakCallbackInfo

::invoke); - } -} -#endif - -#endif // NAN_WEAK_H_ diff --git a/node_modules/websocket/node_modules/nan/package.json b/node_modules/websocket/node_modules/nan/package.json deleted file mode 100644 index 31ec84c..0000000 --- a/node_modules/websocket/node_modules/nan/package.json +++ /dev/null @@ -1,108 +0,0 @@ -{ - "name": "nan", - "version": "2.14.0", - "description": "Native Abstractions for Node.js: C++ header for Node 0.8 -> 11 compatibility", - "main": "include_dirs.js", - "repository": { - "type": "git", - "url": "git://github.com/nodejs/nan.git" - }, - "scripts": { - "test": "tap --gc --stderr test/js/*-test.js", - "test:worker": "node --experimental-worker test/tap-as-worker.js --gc --stderr test/js/*-test.js", - "rebuild-tests": "node-gyp rebuild --msvs_version=2015 --directory test", - "docs": "doc/.build.sh" - }, - "contributors": [ - { - "name": "Rod Vagg", - "email": "r@va.gg", - "url": "https://github.com/rvagg" - }, - { - "name": "Benjamin Byholm", - "email": "bbyholm@abo.fi", - "url": "https://github.com/kkoopa/" - }, - { - "name": "Trevor Norris", - "email": "trev.norris@gmail.com", - "url": "https://github.com/trevnorris" - }, - { - "name": "Nathan Rajlich", - "email": "nathan@tootallnate.net", - "url": "https://github.com/TooTallNate" - }, - { - "name": "Brett Lawson", - "email": "brett19@gmail.com", - "url": "https://github.com/brett19" - }, - { - "name": "Ben Noordhuis", - "email": "info@bnoordhuis.nl", - "url": "https://github.com/bnoordhuis" - }, - { - "name": "David Siegel", - "email": "david@artcom.de", - "url": "https://github.com/agnat" - }, - { - "name": "Michael Ira Krufky", - "email": "mkrufky@gmail.com", - "url": "https://github.com/mkrufky" - } - ], - "devDependencies": { - "bindings": "~1.2.1", - "commander": "^2.8.1", - "glob": "^5.0.14", - "request": "=2.81.0", - "node-gyp": "~3.6.2", - "readable-stream": "^2.1.4", - "tap": "~0.7.1", - "xtend": "~4.0.0" - }, - "license": "MIT", - "gitHead": "1dcc61bd06d84e389bfd5311b2b1492a14c74201", - "bugs": { - "url": "https://github.com/nodejs/nan/issues" - }, - "homepage": "https://github.com/nodejs/nan#readme", - "_id": "nan@2.14.0", - "_npmVersion": "5.6.0", - "_nodeVersion": "9.6.0", - "_npmUser": { - "name": "kkoopa", - "email": "bbyholm@abo.fi" - }, - "dist": { - "integrity": "sha512-INOFj37C7k3AfaNTtX8RhsTw7qRy7eLET14cROi9+5HAVbbHuIWUHEauBv5qT4Av2tWasiTY1Jw6puUNqRJXQg==", - "shasum": "7818f722027b2459a86f0295d434d1fc2336c52c", - "tarball": "https://registry.npmjs.org/nan/-/nan-2.14.0.tgz", - "fileCount": 46, - "unpackedSize": 417060, - "npm-signature": "-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJc3bXpCRA9TVsSAnZWagAApycP/2mhtcraLrh5RRziC2xM\nUKDaEjBIznHn7PqDWecW3HW/CGrUfmuxpDCBlE2fBm2cxF26nB/CV6xoD2W1\nkyu4MkRcKiAvNW0h4a5sTwXey0U6xc8JRBhBTWgfiY2aQoA4fIO5akmbIa/w\nyT6tspFQ0BQWKBrxlSOqfQ/lARU4Dzy2eiKu1aWMffQecgqOPTrlb5/QxFsr\nUmfdePyO2odVrjDiiNJsfkHeMh66ED4n7szrRjwkz7FTkoEF0dMOw/bWJU2X\nEYVziHG7rm9B4Blzv6KtqG4Y9Gty8epOG+itSLQcc088H86TXYXJn6y75+lf\n1Lw5E9lxw5XLfVnE7uzr0NVHhcj/M3RaGzXySi7v2AWMbF6wqxtAdebdNaew\nIpc3+NVj2OjA/79bzzhU76MG0PrYURE8UmVugHZHGp9L1PraD/jWqCT1JMGE\n1qGu2dSlsqoyNe9Y1pTs/kc+I4KLjwDqo14NyQQk8quvkyHrQ66oO5lAPN4U\n5ms7vR+FOZYrtX7jQDTAs9N169N0IxhGwgsUH4zRza2RkkdTzsjyEnPhqlrI\n6tIrfYldrudrGtcNmLJqY7fTUA86L3f7SQvlnpfsDPUFagfwQr4Uz9JE8q1k\nhbe8CqTuhbET2AZNFlBxf0ii3ipwNXXJtB/0hIVQCfud1vbdS1IuOibc2/YY\n6ep0\r\n=AZxH\r\n-----END PGP SIGNATURE-----\r\n" - }, - "maintainers": [ - { - "name": "kkoopa", - "email": "bbyholm@abo.fi" - }, - { - "name": "rvagg", - "email": "rod@vagg.org" - } - ], - "directories": {}, - "_npmOperationalInternal": { - "host": "s3://npm-registry-packages", - "tmp": "tmp/nan_2.14.0_1558033896058_0.6879275796293267" - }, - "_hasShrinkwrap": false, - "_shasum": "7818f722027b2459a86f0295d434d1fc2336c52c", - "_from": "nan@^2.14.0", - "_resolved": "https://registry.npmjs.org/nan/-/nan-2.14.0.tgz" -} diff --git a/node_modules/websocket/node_modules/nan/tools/1to2.js b/node_modules/websocket/node_modules/nan/tools/1to2.js deleted file mode 100755 index 337f8bf..0000000 --- a/node_modules/websocket/node_modules/nan/tools/1to2.js +++ /dev/null @@ -1,412 +0,0 @@ -#!/usr/bin/env node -/********************************************************************* - * NAN - Native Abstractions for Node.js - * - * Copyright (c) 2018 NAN contributors - * - * MIT License - ********************************************************************/ - -var commander = require('commander'), - fs = require('fs'), - glob = require('glob'), - groups = [], - total = 0, - warning1 = '/* ERROR: Rewrite using Buffer */\n', - warning2 = '\\/\\* ERROR\\: Rewrite using Buffer \\*\\/\\n', - length, - i; - -fs.readFile(__dirname + '/package.json', 'utf8', function (err, data) { - if (err) { - throw err; - } - - commander - .version(JSON.parse(data).version) - .usage('[options] ') - .parse(process.argv); - - if (!process.argv.slice(2).length) { - commander.outputHelp(); - } -}); - -/* construct strings representing regular expressions - each expression contains a unique group allowing for identification of the match - the index of this key group, relative to the regular expression in question, - is indicated by the first array member */ - -/* simple substistutions, key group is the entire match, 0 */ -groups.push([0, [ - '_NAN_', - 'NODE_SET_METHOD', - 'NODE_SET_PROTOTYPE_METHOD', - 'NanAsciiString', - 'NanEscapeScope', - 'NanReturnValue', - 'NanUcs2String'].join('|')]); - -/* substitutions of parameterless macros, key group is 1 */ -groups.push([1, ['(', [ - 'NanEscapableScope', - 'NanReturnNull', - 'NanReturnUndefined', - 'NanScope'].join('|'), ')\\(\\)'].join('')]); - -/* replace TryCatch with NanTryCatch once, gobbling possible namespace, key group 2 */ -groups.push([2, '(?:(?:v8\\:\\:)?|(Nan)?)(TryCatch)']); - -/* NanNew("string") will likely not fail a ToLocalChecked(), key group 1 */ -groups.push([1, ['(NanNew)', '(\\("[^\\"]*"[^\\)]*\\))(?!\\.ToLocalChecked\\(\\))'].join('')]); - -/* Removed v8 APIs, warn that the code needs rewriting using node::Buffer, key group 2 */ -groups.push([2, ['(', warning2, ')?', '^.*?(', [ - 'GetIndexedPropertiesExternalArrayDataLength', - 'GetIndexedPropertiesExternalArrayData', - 'GetIndexedPropertiesExternalArrayDataType', - 'GetIndexedPropertiesPixelData', - 'GetIndexedPropertiesPixelDataLength', - 'HasIndexedPropertiesInExternalArrayData', - 'HasIndexedPropertiesInPixelData', - 'SetIndexedPropertiesToExternalArrayData', - 'SetIndexedPropertiesToPixelData'].join('|'), ')'].join('')]); - -/* No need for NanScope in V8-exposed methods, key group 2 */ -groups.push([2, ['((', [ - 'NAN_METHOD', - 'NAN_GETTER', - 'NAN_SETTER', - 'NAN_PROPERTY_GETTER', - 'NAN_PROPERTY_SETTER', - 'NAN_PROPERTY_ENUMERATOR', - 'NAN_PROPERTY_DELETER', - 'NAN_PROPERTY_QUERY', - 'NAN_INDEX_GETTER', - 'NAN_INDEX_SETTER', - 'NAN_INDEX_ENUMERATOR', - 'NAN_INDEX_DELETER', - 'NAN_INDEX_QUERY'].join('|'), ')\\([^\\)]*\\)\\s*\\{)\\s*NanScope\\(\\)\\s*;'].join('')]); - -/* v8::Value::ToXXXXXXX returns v8::MaybeLocal, key group 3 */ -groups.push([3, ['([\\s\\(\\)])([^\\s\\(\\)]+)->(', [ - 'Boolean', - 'Number', - 'String', - 'Object', - 'Integer', - 'Uint32', - 'Int32'].join('|'), ')\\('].join('')]); - -/* v8::Value::XXXXXXXValue returns v8::Maybe, key group 3 */ -groups.push([3, ['([\\s\\(\\)])([^\\s\\(\\)]+)->((?:', [ - 'Boolean', - 'Number', - 'Integer', - 'Uint32', - 'Int32'].join('|'), ')Value)\\('].join('')]); - -/* NAN_WEAK_CALLBACK macro was removed, write out callback definition, key group 1 */ -groups.push([1, '(NAN_WEAK_CALLBACK)\\(([^\\s\\)]+)\\)']); - -/* node::ObjectWrap and v8::Persistent have been replaced with Nan implementations, key group 1 */ -groups.push([1, ['(', [ - 'NanDisposePersistent', - 'NanObjectWrapHandle'].join('|'), ')\\s*\\(\\s*([^\\s\\)]+)'].join('')]); - -/* Since NanPersistent there is no need for NanMakeWeakPersistent, key group 1 */ -groups.push([1, '(NanMakeWeakPersistent)\\s*\\(\\s*([^\\s,]+)\\s*,\\s*']); - -/* Many methods of v8::Object and others now return v8::MaybeLocal, key group 3 */ -groups.push([3, ['([\\s])([^\\s]+)->(', [ - 'GetEndColumn', - 'GetFunction', - 'GetLineNumber', - 'NewInstance', - 'GetPropertyNames', - 'GetOwnPropertyNames', - 'GetSourceLine', - 'GetStartColumn', - 'ObjectProtoToString', - 'ToArrayIndex', - 'ToDetailString', - 'CallAsConstructor', - 'CallAsFunction', - 'CloneElementAt', - 'Delete', - 'ForceSet', - 'Get', - 'GetPropertyAttributes', - 'GetRealNamedProperty', - 'GetRealNamedPropertyInPrototypeChain', - 'Has', - 'HasOwnProperty', - 'HasRealIndexedProperty', - 'HasRealNamedCallbackProperty', - 'HasRealNamedProperty', - 'Set', - 'SetAccessor', - 'SetIndexedPropertyHandler', - 'SetNamedPropertyHandler', - 'SetPrototype'].join('|'), ')\\('].join('')]); - -/* You should get an error if any of these fail anyways, - or handle the error better, it is indicated either way, key group 2 */ -groups.push([2, ['NanNew(<(?:v8\\:\\:)?(', ['Date', 'String', 'RegExp'].join('|'), ')>)(\\([^\\)]*\\))(?!\\.ToLocalChecked\\(\\))'].join('')]); - -/* v8::Value::Equals now returns a v8::Maybe, key group 3 */ -groups.push([3, '([\\s\\(\\)])([^\\s\\(\\)]+)->(Equals)\\(([^\\s\\)]+)']); - -/* NanPersistent makes this unnecessary, key group 1 */ -groups.push([1, '(NanAssignPersistent)(?:]+>)?\\(([^,]+),\\s*']); - -/* args has been renamed to info, key group 2 */ -groups.push([2, '(\\W)(args)(\\W)']) - -/* node::ObjectWrap was replaced with NanObjectWrap, key group 2 */ -groups.push([2, '(\\W)(?:node\\:\\:)?(ObjectWrap)(\\W)']); - -/* v8::Persistent was replaced with NanPersistent, key group 2 */ -groups.push([2, '(\\W)(?:v8\\:\\:)?(Persistent)(\\W)']); - -/* counts the number of capturing groups in a well-formed regular expression, - ignoring non-capturing groups and escaped parentheses */ -function groupcount(s) { - var positive = s.match(/\((?!\?)/g), - negative = s.match(/\\\(/g); - return (positive ? positive.length : 0) - (negative ? negative.length : 0); -} - -/* compute the absolute position of each key group in the joined master RegExp */ -for (i = 1, length = groups.length; i < length; i++) { - total += groupcount(groups[i - 1][1]); - groups[i][0] += total; -} - -/* create the master RegExp, whis is the union of all the groups' expressions */ -master = new RegExp(groups.map(function (a) { return a[1]; }).join('|'), 'gm'); - -/* replacement function for String.replace, receives 21 arguments */ -function replace() { - /* simple expressions */ - switch (arguments[groups[0][0]]) { - case '_NAN_': - return 'NAN_'; - case 'NODE_SET_METHOD': - return 'NanSetMethod'; - case 'NODE_SET_PROTOTYPE_METHOD': - return 'NanSetPrototypeMethod'; - case 'NanAsciiString': - return 'NanUtf8String'; - case 'NanEscapeScope': - return 'scope.Escape'; - case 'NanReturnNull': - return 'info.GetReturnValue().SetNull'; - case 'NanReturnValue': - return 'info.GetReturnValue().Set'; - case 'NanUcs2String': - return 'v8::String::Value'; - default: - } - - /* macros without arguments */ - switch (arguments[groups[1][0]]) { - case 'NanEscapableScope': - return 'NanEscapableScope scope' - case 'NanReturnUndefined': - return 'return'; - case 'NanScope': - return 'NanScope scope'; - default: - } - - /* TryCatch, emulate negative backref */ - if (arguments[groups[2][0]] === 'TryCatch') { - return arguments[groups[2][0] - 1] ? arguments[0] : 'NanTryCatch'; - } - - /* NanNew("foo") --> NanNew("foo").ToLocalChecked() */ - if (arguments[groups[3][0]] === 'NanNew') { - return [arguments[0], '.ToLocalChecked()'].join(''); - } - - /* insert warning for removed functions as comment on new line above */ - switch (arguments[groups[4][0]]) { - case 'GetIndexedPropertiesExternalArrayData': - case 'GetIndexedPropertiesExternalArrayDataLength': - case 'GetIndexedPropertiesExternalArrayDataType': - case 'GetIndexedPropertiesPixelData': - case 'GetIndexedPropertiesPixelDataLength': - case 'HasIndexedPropertiesInExternalArrayData': - case 'HasIndexedPropertiesInPixelData': - case 'SetIndexedPropertiesToExternalArrayData': - case 'SetIndexedPropertiesToPixelData': - return arguments[groups[4][0] - 1] ? arguments[0] : [warning1, arguments[0]].join(''); - default: - } - - /* remove unnecessary NanScope() */ - switch (arguments[groups[5][0]]) { - case 'NAN_GETTER': - case 'NAN_METHOD': - case 'NAN_SETTER': - case 'NAN_INDEX_DELETER': - case 'NAN_INDEX_ENUMERATOR': - case 'NAN_INDEX_GETTER': - case 'NAN_INDEX_QUERY': - case 'NAN_INDEX_SETTER': - case 'NAN_PROPERTY_DELETER': - case 'NAN_PROPERTY_ENUMERATOR': - case 'NAN_PROPERTY_GETTER': - case 'NAN_PROPERTY_QUERY': - case 'NAN_PROPERTY_SETTER': - return arguments[groups[5][0] - 1]; - default: - } - - /* Value converstion */ - switch (arguments[groups[6][0]]) { - case 'Boolean': - case 'Int32': - case 'Integer': - case 'Number': - case 'Object': - case 'String': - case 'Uint32': - return [arguments[groups[6][0] - 2], 'NanTo(', arguments[groups[6][0] - 1]].join(''); - default: - } - - /* other value conversion */ - switch (arguments[groups[7][0]]) { - case 'BooleanValue': - return [arguments[groups[7][0] - 2], 'NanTo(', arguments[groups[7][0] - 1]].join(''); - case 'Int32Value': - return [arguments[groups[7][0] - 2], 'NanTo(', arguments[groups[7][0] - 1]].join(''); - case 'IntegerValue': - return [arguments[groups[7][0] - 2], 'NanTo(', arguments[groups[7][0] - 1]].join(''); - case 'Uint32Value': - return [arguments[groups[7][0] - 2], 'NanTo(', arguments[groups[7][0] - 1]].join(''); - default: - } - - /* NAN_WEAK_CALLBACK */ - if (arguments[groups[8][0]] === 'NAN_WEAK_CALLBACK') { - return ['template\nvoid ', - arguments[groups[8][0] + 1], '(const NanWeakCallbackInfo &data)'].join(''); - } - - /* use methods on NAN classes instead */ - switch (arguments[groups[9][0]]) { - case 'NanDisposePersistent': - return [arguments[groups[9][0] + 1], '.Reset('].join(''); - case 'NanObjectWrapHandle': - return [arguments[groups[9][0] + 1], '->handle('].join(''); - default: - } - - /* use method on NanPersistent instead */ - if (arguments[groups[10][0]] === 'NanMakeWeakPersistent') { - return arguments[groups[10][0] + 1] + '.SetWeak('; - } - - /* These return Maybes, the upper ones take no arguments */ - switch (arguments[groups[11][0]]) { - case 'GetEndColumn': - case 'GetFunction': - case 'GetLineNumber': - case 'GetOwnPropertyNames': - case 'GetPropertyNames': - case 'GetSourceLine': - case 'GetStartColumn': - case 'NewInstance': - case 'ObjectProtoToString': - case 'ToArrayIndex': - case 'ToDetailString': - return [arguments[groups[11][0] - 2], 'Nan', arguments[groups[11][0]], '(', arguments[groups[11][0] - 1]].join(''); - case 'CallAsConstructor': - case 'CallAsFunction': - case 'CloneElementAt': - case 'Delete': - case 'ForceSet': - case 'Get': - case 'GetPropertyAttributes': - case 'GetRealNamedProperty': - case 'GetRealNamedPropertyInPrototypeChain': - case 'Has': - case 'HasOwnProperty': - case 'HasRealIndexedProperty': - case 'HasRealNamedCallbackProperty': - case 'HasRealNamedProperty': - case 'Set': - case 'SetAccessor': - case 'SetIndexedPropertyHandler': - case 'SetNamedPropertyHandler': - case 'SetPrototype': - return [arguments[groups[11][0] - 2], 'Nan', arguments[groups[11][0]], '(', arguments[groups[11][0] - 1], ', '].join(''); - default: - } - - /* Automatic ToLocalChecked(), take it or leave it */ - switch (arguments[groups[12][0]]) { - case 'Date': - case 'String': - case 'RegExp': - return ['NanNew', arguments[groups[12][0] - 1], arguments[groups[12][0] + 1], '.ToLocalChecked()'].join(''); - default: - } - - /* NanEquals is now required for uniformity */ - if (arguments[groups[13][0]] === 'Equals') { - return [arguments[groups[13][0] - 1], 'NanEquals(', arguments[groups[13][0] - 1], ', ', arguments[groups[13][0] + 1]].join(''); - } - - /* use method on replacement class instead */ - if (arguments[groups[14][0]] === 'NanAssignPersistent') { - return [arguments[groups[14][0] + 1], '.Reset('].join(''); - } - - /* args --> info */ - if (arguments[groups[15][0]] === 'args') { - return [arguments[groups[15][0] - 1], 'info', arguments[groups[15][0] + 1]].join(''); - } - - /* ObjectWrap --> NanObjectWrap */ - if (arguments[groups[16][0]] === 'ObjectWrap') { - return [arguments[groups[16][0] - 1], 'NanObjectWrap', arguments[groups[16][0] + 1]].join(''); - } - - /* Persistent --> NanPersistent */ - if (arguments[groups[17][0]] === 'Persistent') { - return [arguments[groups[17][0] - 1], 'NanPersistent', arguments[groups[17][0] + 1]].join(''); - } - - /* This should not happen. A switch is probably missing a case if it does. */ - throw 'Unhandled match: ' + arguments[0]; -} - -/* reads a file, runs replacement and writes it back */ -function processFile(file) { - fs.readFile(file, {encoding: 'utf8'}, function (err, data) { - if (err) { - throw err; - } - - /* run replacement twice, might need more runs */ - fs.writeFile(file, data.replace(master, replace).replace(master, replace), function (err) { - if (err) { - throw err; - } - }); - }); -} - -/* process file names from command line and process the identified files */ -for (i = 2, length = process.argv.length; i < length; i++) { - glob(process.argv[i], function (err, matches) { - if (err) { - throw err; - } - matches.forEach(processFile); - }); -} diff --git a/node_modules/websocket/node_modules/nan/tools/README.md b/node_modules/websocket/node_modules/nan/tools/README.md deleted file mode 100644 index 7f07e4b..0000000 --- a/node_modules/websocket/node_modules/nan/tools/README.md +++ /dev/null @@ -1,14 +0,0 @@ -1to2 naively converts source code files from NAN 1 to NAN 2. There will be erroneous conversions, -false positives and missed opportunities. The input files are rewritten in place. Make sure that -you have backups. You will have to manually review the changes afterwards and do some touchups. - -```sh -$ tools/1to2.js - - Usage: 1to2 [options] - - Options: - - -h, --help output usage information - -V, --version output the version number -``` diff --git a/node_modules/websocket/node_modules/nan/tools/package.json b/node_modules/websocket/node_modules/nan/tools/package.json deleted file mode 100644 index 2dcdd78..0000000 --- a/node_modules/websocket/node_modules/nan/tools/package.json +++ /dev/null @@ -1,19 +0,0 @@ -{ - "name": "1to2", - "version": "1.0.0", - "description": "NAN 1 -> 2 Migration Script", - "main": "1to2.js", - "repository": { - "type": "git", - "url": "git://github.com/nodejs/nan.git" - }, - "contributors": [ - "Benjamin Byholm (https://github.com/kkoopa/)", - "Mathias Küsel (https://github.com/mathiask88/)" - ], - "dependencies": { - "glob": "~5.0.10", - "commander": "~2.8.1" - }, - "license": "MIT" -} diff --git a/node_modules/websocket/node_modules/typedarray-to-buffer/.airtap.yml b/node_modules/websocket/node_modules/typedarray-to-buffer/.airtap.yml deleted file mode 100644 index 3417780..0000000 --- a/node_modules/websocket/node_modules/typedarray-to-buffer/.airtap.yml +++ /dev/null @@ -1,15 +0,0 @@ -sauce_connect: true -loopback: airtap.local -browsers: - - name: chrome - version: latest - - name: firefox - version: latest - - name: safari - version: latest - - name: microsoftedge - version: latest - - name: ie - version: latest - - name: iphone - version: latest diff --git a/node_modules/websocket/node_modules/typedarray-to-buffer/.travis.yml b/node_modules/websocket/node_modules/typedarray-to-buffer/.travis.yml deleted file mode 100644 index f25afbd..0000000 --- a/node_modules/websocket/node_modules/typedarray-to-buffer/.travis.yml +++ /dev/null @@ -1,11 +0,0 @@ -language: node_js -node_js: - - lts/* -addons: - sauce_connect: true - hosts: - - airtap.local -env: - global: - - secure: i51rE9rZGHbcZWlL58j3H1qtL23OIV2r0X4TcQKNI3pw2mubdHFJmfPNNO19ItfReu8wwQMxOehKamwaNvqMiKWyHfn/QcThFQysqzgGZ6AgnUbYx9od6XFNDeWd1sVBf7QBAL07y7KWlYGWCwFwWjabSVySzQhEBdisPcskfkI= - - secure: BKq6/5z9LK3KDkTjs7BGeBZ1KsWgz+MsAXZ4P64NSeVGFaBdXU45+ww1mwxXFt5l22/mhyOQZfebQl+kGVqRSZ+DEgQeCymkNZ6CD8c6w6cLuOJXiXwuu/cDM2DD0tfGeu2YZC7yEikP7BqEFwH3D324rRzSGLF2RSAAwkOI7bE= diff --git a/node_modules/websocket/node_modules/typedarray-to-buffer/LICENSE b/node_modules/websocket/node_modules/typedarray-to-buffer/LICENSE deleted file mode 100644 index 0c068ce..0000000 --- a/node_modules/websocket/node_modules/typedarray-to-buffer/LICENSE +++ /dev/null @@ -1,21 +0,0 @@ -The MIT License (MIT) - -Copyright (c) Feross Aboukhadijeh - -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. diff --git a/node_modules/websocket/node_modules/typedarray-to-buffer/README.md b/node_modules/websocket/node_modules/typedarray-to-buffer/README.md deleted file mode 100644 index 35761fb..0000000 --- a/node_modules/websocket/node_modules/typedarray-to-buffer/README.md +++ /dev/null @@ -1,85 +0,0 @@ -# typedarray-to-buffer [![travis][travis-image]][travis-url] [![npm][npm-image]][npm-url] [![downloads][downloads-image]][downloads-url] [![javascript style guide][standard-image]][standard-url] - -[travis-image]: https://img.shields.io/travis/feross/typedarray-to-buffer/master.svg -[travis-url]: https://travis-ci.org/feross/typedarray-to-buffer -[npm-image]: https://img.shields.io/npm/v/typedarray-to-buffer.svg -[npm-url]: https://npmjs.org/package/typedarray-to-buffer -[downloads-image]: https://img.shields.io/npm/dm/typedarray-to-buffer.svg -[downloads-url]: https://npmjs.org/package/typedarray-to-buffer -[standard-image]: https://img.shields.io/badge/code_style-standard-brightgreen.svg -[standard-url]: https://standardjs.com - -#### Convert a typed array to a [Buffer](https://github.com/feross/buffer) without a copy. - -[![saucelabs][saucelabs-image]][saucelabs-url] - -[saucelabs-image]: https://saucelabs.com/browser-matrix/typedarray-to-buffer.svg -[saucelabs-url]: https://saucelabs.com/u/typedarray-to-buffer - -Say you're using the ['buffer'](https://github.com/feross/buffer) module on npm, or -[browserify](http://browserify.org/) and you're working with lots of binary data. - -Unfortunately, sometimes the browser or someone else's API gives you a typed array like -`Uint8Array` to work with and you need to convert it to a `Buffer`. What do you do? - -Of course: `Buffer.from(uint8array)` - -But, alas, every time you do `Buffer.from(uint8array)` **the entire array gets copied**. -The `Buffer` constructor does a copy; this is -defined by the [node docs](http://nodejs.org/api/buffer.html) and the 'buffer' module -matches the node API exactly. - -So, how can we avoid this expensive copy in -[performance critical applications](https://github.com/feross/buffer/issues/22)? - -***Simply use this module, of course!*** - -If you have an `ArrayBuffer`, you don't need this module, because -`Buffer.from(arrayBuffer)` -[is already efficient](https://nodejs.org/api/buffer.html#buffer_class_method_buffer_from_arraybuffer_byteoffset_length). - -## install - -```bash -npm install typedarray-to-buffer -``` - -## usage - -To convert a typed array to a `Buffer` **without a copy**, do this: - -```js -var toBuffer = require('typedarray-to-buffer') - -var arr = new Uint8Array([1, 2, 3]) -arr = toBuffer(arr) - -// arr is a buffer now! - -arr.toString() // '\u0001\u0002\u0003' -arr.readUInt16BE(0) // 258 -``` - -## how it works - -If the browser supports typed arrays, then `toBuffer` will **augment the typed array** you -pass in with the `Buffer` methods and return it. See [how does Buffer -work?](https://github.com/feross/buffer#how-does-it-work) for more about how augmentation -works. - -This module uses the typed array's underlying `ArrayBuffer` to back the new `Buffer`. This -respects the "view" on the `ArrayBuffer`, i.e. `byteOffset` and `byteLength`. In other -words, if you do `toBuffer(new Uint32Array([1, 2, 3]))`, then the new `Buffer` will -contain `[1, 0, 0, 0, 2, 0, 0, 0, 3, 0, 0, 0]`, **not** `[1, 2, 3]`. And it still doesn't -require a copy. - -If the browser doesn't support typed arrays, then `toBuffer` will create a new `Buffer` -object, copy the data into it, and return it. There's no simple performance optimization -we can do for old browsers. Oh well. - -If this module is used in node, then it will just call `Buffer.from`. This is just for -the convenience of modules that work in both node and the browser. - -## license - -MIT. Copyright (C) [Feross Aboukhadijeh](http://feross.org). diff --git a/node_modules/websocket/node_modules/typedarray-to-buffer/index.js b/node_modules/websocket/node_modules/typedarray-to-buffer/index.js deleted file mode 100644 index 5fa394d..0000000 --- a/node_modules/websocket/node_modules/typedarray-to-buffer/index.js +++ /dev/null @@ -1,25 +0,0 @@ -/** - * Convert a typed array to a Buffer without a copy - * - * Author: Feross Aboukhadijeh - * License: MIT - * - * `npm install typedarray-to-buffer` - */ - -var isTypedArray = require('is-typedarray').strict - -module.exports = function typedarrayToBuffer (arr) { - if (isTypedArray(arr)) { - // To avoid a copy, use the typed array's underlying ArrayBuffer to back new Buffer - var buf = Buffer.from(arr.buffer) - if (arr.byteLength !== arr.buffer.byteLength) { - // Respect the "view", i.e. byteOffset and byteLength, without doing a copy - buf = buf.slice(arr.byteOffset, arr.byteOffset + arr.byteLength) - } - return buf - } else { - // Pass through all other types to `Buffer.from` - return Buffer.from(arr) - } -} diff --git a/node_modules/websocket/node_modules/typedarray-to-buffer/node_modules/is-typedarray/LICENSE.md b/node_modules/websocket/node_modules/typedarray-to-buffer/node_modules/is-typedarray/LICENSE.md deleted file mode 100644 index ee27ba4..0000000 --- a/node_modules/websocket/node_modules/typedarray-to-buffer/node_modules/is-typedarray/LICENSE.md +++ /dev/null @@ -1,18 +0,0 @@ -This software is released under the MIT license: - -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. diff --git a/node_modules/websocket/node_modules/typedarray-to-buffer/node_modules/is-typedarray/README.md b/node_modules/websocket/node_modules/typedarray-to-buffer/node_modules/is-typedarray/README.md deleted file mode 100644 index 2752863..0000000 --- a/node_modules/websocket/node_modules/typedarray-to-buffer/node_modules/is-typedarray/README.md +++ /dev/null @@ -1,16 +0,0 @@ -# is-typedarray [![locked](http://badges.github.io/stability-badges/dist/locked.svg)](http://github.com/badges/stability-badges) - -Detect whether or not an object is a -[Typed Array](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Typed_arrays). - -## Usage - -[![NPM](https://nodei.co/npm/is-typedarray.png)](https://nodei.co/npm/is-typedarray/) - -### isTypedArray(array) - -Returns `true` when array is a Typed Array, and `false` when it is not. - -## License - -MIT. See [LICENSE.md](http://github.com/hughsk/is-typedarray/blob/master/LICENSE.md) for details. diff --git a/node_modules/websocket/node_modules/typedarray-to-buffer/node_modules/is-typedarray/index.js b/node_modules/websocket/node_modules/typedarray-to-buffer/node_modules/is-typedarray/index.js deleted file mode 100644 index 5859603..0000000 --- a/node_modules/websocket/node_modules/typedarray-to-buffer/node_modules/is-typedarray/index.js +++ /dev/null @@ -1,41 +0,0 @@ -module.exports = isTypedArray -isTypedArray.strict = isStrictTypedArray -isTypedArray.loose = isLooseTypedArray - -var toString = Object.prototype.toString -var names = { - '[object Int8Array]': true - , '[object Int16Array]': true - , '[object Int32Array]': true - , '[object Uint8Array]': true - , '[object Uint8ClampedArray]': true - , '[object Uint16Array]': true - , '[object Uint32Array]': true - , '[object Float32Array]': true - , '[object Float64Array]': true -} - -function isTypedArray(arr) { - return ( - isStrictTypedArray(arr) - || isLooseTypedArray(arr) - ) -} - -function isStrictTypedArray(arr) { - return ( - arr instanceof Int8Array - || arr instanceof Int16Array - || arr instanceof Int32Array - || arr instanceof Uint8Array - || arr instanceof Uint8ClampedArray - || arr instanceof Uint16Array - || arr instanceof Uint32Array - || arr instanceof Float32Array - || arr instanceof Float64Array - ) -} - -function isLooseTypedArray(arr) { - return names[toString.call(arr)] -} diff --git a/node_modules/websocket/node_modules/typedarray-to-buffer/node_modules/is-typedarray/package.json b/node_modules/websocket/node_modules/typedarray-to-buffer/node_modules/is-typedarray/package.json deleted file mode 100644 index 351cd82..0000000 --- a/node_modules/websocket/node_modules/typedarray-to-buffer/node_modules/is-typedarray/package.json +++ /dev/null @@ -1,56 +0,0 @@ -{ - "name": "is-typedarray", - "version": "1.0.0", - "description": "Detect whether or not an object is a Typed Array", - "main": "index.js", - "scripts": { - "test": "node test" - }, - "author": { - "name": "Hugh Kennedy", - "email": "hughskennedy@gmail.com", - "url": "http://hughsk.io/" - }, - "license": "MIT", - "dependencies": {}, - "devDependencies": { - "tape": "^2.13.1" - }, - "repository": { - "type": "git", - "url": "git://github.com/hughsk/is-typedarray.git" - }, - "keywords": [ - "typed", - "array", - "detect", - "is", - "util" - ], - "bugs": { - "url": "https://github.com/hughsk/is-typedarray/issues" - }, - "homepage": "https://github.com/hughsk/is-typedarray", - "gitHead": "0617cfa871686cf541af62b144f130488f44f6fe", - "_id": "is-typedarray@1.0.0", - "_shasum": "e479c80858df0c1b11ddda6940f96011fcda4a9a", - "_from": "is-typedarray@^1.0.0", - "_npmVersion": "2.7.5", - "_nodeVersion": "0.10.36", - "_npmUser": { - "name": "hughsk", - "email": "hughskennedy@gmail.com" - }, - "dist": { - "shasum": "e479c80858df0c1b11ddda6940f96011fcda4a9a", - "tarball": "https://registry.npmjs.org/is-typedarray/-/is-typedarray-1.0.0.tgz" - }, - "maintainers": [ - { - "name": "hughsk", - "email": "hughskennedy@gmail.com" - } - ], - "directories": {}, - "_resolved": "https://registry.npmjs.org/is-typedarray/-/is-typedarray-1.0.0.tgz" -} diff --git a/node_modules/websocket/node_modules/typedarray-to-buffer/node_modules/is-typedarray/test.js b/node_modules/websocket/node_modules/typedarray-to-buffer/node_modules/is-typedarray/test.js deleted file mode 100644 index b0c176f..0000000 --- a/node_modules/websocket/node_modules/typedarray-to-buffer/node_modules/is-typedarray/test.js +++ /dev/null @@ -1,34 +0,0 @@ -var test = require('tape') -var ista = require('./') - -test('strict', function(t) { - t.ok(ista.strict(new Int8Array), 'Int8Array') - t.ok(ista.strict(new Int16Array), 'Int16Array') - t.ok(ista.strict(new Int32Array), 'Int32Array') - t.ok(ista.strict(new Uint8Array), 'Uint8Array') - t.ok(ista.strict(new Uint16Array), 'Uint16Array') - t.ok(ista.strict(new Uint32Array), 'Uint32Array') - t.ok(ista.strict(new Float32Array), 'Float32Array') - t.ok(ista.strict(new Float64Array), 'Float64Array') - - t.ok(!ista.strict(new Array), 'Array') - t.ok(!ista.strict([]), '[]') - - t.end() -}) - -test('loose', function(t) { - t.ok(ista.loose(new Int8Array), 'Int8Array') - t.ok(ista.loose(new Int16Array), 'Int16Array') - t.ok(ista.loose(new Int32Array), 'Int32Array') - t.ok(ista.loose(new Uint8Array), 'Uint8Array') - t.ok(ista.loose(new Uint16Array), 'Uint16Array') - t.ok(ista.loose(new Uint32Array), 'Uint32Array') - t.ok(ista.loose(new Float32Array), 'Float32Array') - t.ok(ista.loose(new Float64Array), 'Float64Array') - - t.ok(!ista.loose(new Array), 'Array') - t.ok(!ista.loose([]), '[]') - - t.end() -}) diff --git a/node_modules/websocket/node_modules/typedarray-to-buffer/package.json b/node_modules/websocket/node_modules/typedarray-to-buffer/package.json deleted file mode 100644 index c6ea592..0000000 --- a/node_modules/websocket/node_modules/typedarray-to-buffer/package.json +++ /dev/null @@ -1,79 +0,0 @@ -{ - "name": "typedarray-to-buffer", - "description": "Convert a typed array to a Buffer without a copy", - "version": "3.1.5", - "author": { - "name": "Feross Aboukhadijeh", - "email": "feross@feross.org", - "url": "http://feross.org/" - }, - "bugs": { - "url": "https://github.com/feross/typedarray-to-buffer/issues" - }, - "dependencies": { - "is-typedarray": "^1.0.0" - }, - "devDependencies": { - "airtap": "0.0.4", - "standard": "*", - "tape": "^4.0.0" - }, - "homepage": "http://feross.org", - "keywords": [ - "buffer", - "typed array", - "convert", - "no copy", - "uint8array", - "uint16array", - "uint32array", - "int16array", - "int32array", - "float32array", - "float64array", - "browser", - "arraybuffer", - "dataview" - ], - "license": "MIT", - "main": "index.js", - "repository": { - "type": "git", - "url": "git://github.com/feross/typedarray-to-buffer.git" - }, - "scripts": { - "test": "standard && npm run test-node && npm run test-browser", - "test-browser": "airtap -- test/*.js", - "test-browser-local": "airtap --local -- test/*.js", - "test-node": "tape test/*.js" - }, - "gitHead": "328a952e480a143bdc3fc98a2133490e28e2b3a2", - "_id": "typedarray-to-buffer@3.1.5", - "_npmVersion": "5.7.1", - "_nodeVersion": "8.10.0", - "_npmUser": { - "name": "feross", - "email": "feross@feross.org" - }, - "dist": { - "integrity": "sha512-zdu8XMNEDepKKR+XYOXAVPtWui0ly0NtohUscw+UmaHiAWT8hrV1rr//H6V+0DvJ3OQ19S979M0laLfX8rm82Q==", - "shasum": "a97ee7a9ff42691b9f783ff1bc5112fe3fca9080", - "tarball": "https://registry.npmjs.org/typedarray-to-buffer/-/typedarray-to-buffer-3.1.5.tgz", - "fileCount": 7, - "unpackedSize": 8835 - }, - "maintainers": [ - { - "name": "feross", - "email": "feross@feross.org" - } - ], - "directories": {}, - "_npmOperationalInternal": { - "host": "s3://npm-registry-packages", - "tmp": "tmp/typedarray-to-buffer_3.1.5_1520537433687_0.8471076032703442" - }, - "_shasum": "a97ee7a9ff42691b9f783ff1bc5112fe3fca9080", - "_from": "typedarray-to-buffer@^3.1.5", - "_resolved": "https://registry.npmjs.org/typedarray-to-buffer/-/typedarray-to-buffer-3.1.5.tgz" -} diff --git a/node_modules/websocket/node_modules/typedarray-to-buffer/test/basic.js b/node_modules/websocket/node_modules/typedarray-to-buffer/test/basic.js deleted file mode 100644 index 3521096..0000000 --- a/node_modules/websocket/node_modules/typedarray-to-buffer/test/basic.js +++ /dev/null @@ -1,50 +0,0 @@ -var test = require('tape') -var toBuffer = require('../') - -test('convert to buffer from Uint8Array', function (t) { - if (typeof Uint8Array !== 'undefined') { - var arr = new Uint8Array([1, 2, 3]) - arr = toBuffer(arr) - - t.deepEqual(arr, Buffer.from([1, 2, 3]), 'contents equal') - t.ok(Buffer.isBuffer(arr), 'is buffer') - t.equal(arr.readUInt8(0), 1) - t.equal(arr.readUInt8(1), 2) - t.equal(arr.readUInt8(2), 3) - } else { - t.pass('browser lacks Uint8Array support, skip test') - } - t.end() -}) - -test('convert to buffer from another arrayview type (Uint32Array)', function (t) { - if (typeof Uint32Array !== 'undefined' && Buffer.TYPED_ARRAY_SUPPORT !== false) { - var arr = new Uint32Array([1, 2, 3]) - arr = toBuffer(arr) - - t.deepEqual(arr, Buffer.from([1, 0, 0, 0, 2, 0, 0, 0, 3, 0, 0, 0]), 'contents equal') - t.ok(Buffer.isBuffer(arr), 'is buffer') - t.equal(arr.readUInt32LE(0), 1) - t.equal(arr.readUInt32LE(4), 2) - t.equal(arr.readUInt32LE(8), 3) - t.equal(arr instanceof Uint8Array, true) - } else { - t.pass('browser lacks Uint32Array support, skip test') - } - t.end() -}) - -test('convert to buffer from ArrayBuffer', function (t) { - if (typeof Uint32Array !== 'undefined' && Buffer.TYPED_ARRAY_SUPPORT !== false) { - var arr = new Uint32Array([1, 2, 3]).subarray(1, 2) - arr = toBuffer(arr) - - t.deepEqual(arr, Buffer.from([2, 0, 0, 0]), 'contents equal') - t.ok(Buffer.isBuffer(arr), 'is buffer') - t.equal(arr.readUInt32LE(0), 2) - t.equal(arr instanceof Uint8Array, true) - } else { - t.pass('browser lacks ArrayBuffer support, skip test') - } - t.end() -}) diff --git a/node_modules/websocket/node_modules/yaeti/.jscsrc b/node_modules/websocket/node_modules/yaeti/.jscsrc deleted file mode 100644 index a37d119..0000000 --- a/node_modules/websocket/node_modules/yaeti/.jscsrc +++ /dev/null @@ -1,6 +0,0 @@ -{ - "preset": "crockford", - "validateIndentation": "\t", - "disallowKeywords": ["with"], - "disallowDanglingUnderscores": null -} diff --git a/node_modules/websocket/node_modules/yaeti/.jshintrc b/node_modules/websocket/node_modules/yaeti/.jshintrc deleted file mode 100644 index 1cca0fa..0000000 --- a/node_modules/websocket/node_modules/yaeti/.jshintrc +++ /dev/null @@ -1,27 +0,0 @@ -{ - "bitwise": false, - "curly": true, - "eqeqeq": true, - "forin": true, - "freeze": true, - "latedef": "function", - "noarg": true, - "nonbsp": true, - "nonew": true, - "plusplus": false, - "undef": true, - "unused": true, - "strict": false, - "maxparams": 6, - "maxdepth": 4, - "maxstatements": false, - "maxlen": 200, - "browser": true, - "browserify": true, - "devel": true, - "jquery": false, - "mocha": true, - "node": false, - "shelljs": false, - "worker": false -} diff --git a/node_modules/websocket/node_modules/yaeti/.npmignore b/node_modules/websocket/node_modules/yaeti/.npmignore deleted file mode 100644 index 2ccbe46..0000000 --- a/node_modules/websocket/node_modules/yaeti/.npmignore +++ /dev/null @@ -1 +0,0 @@ -/node_modules/ diff --git a/node_modules/websocket/node_modules/yaeti/LICENSE b/node_modules/websocket/node_modules/yaeti/LICENSE deleted file mode 100644 index a64a412..0000000 --- a/node_modules/websocket/node_modules/yaeti/LICENSE +++ /dev/null @@ -1,21 +0,0 @@ -The MIT License (MIT) - -Copyright (c) 2015 Iñaki Baz Castillo, - -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. diff --git a/node_modules/websocket/node_modules/yaeti/README.md b/node_modules/websocket/node_modules/yaeti/README.md deleted file mode 100644 index db253a4..0000000 --- a/node_modules/websocket/node_modules/yaeti/README.md +++ /dev/null @@ -1,98 +0,0 @@ -# yaeti - -Yet Another [EventTarget](https://developer.mozilla.org/es/docs/Web/API/EventTarget) Implementation. - -The library exposes both the [EventTarget](https://developer.mozilla.org/es/docs/Web/API/EventTarget) interface and the [Event](https://developer.mozilla.org/en-US/docs/Web/API/Event) interface. - - -## Installation - -```bash -$ npm install yaeti --save -``` - - -## Usage - -```javascript -var yaeti = require('yaeti'); - - -// Custom class we want to make an EventTarget. -function Foo() { - // Make Foo an EventTarget. - yaeti.EventTarget.call(this); -} - -// Create an instance. -var foo = new Foo(); - -function listener1() { - console.log('listener1'); -} - -function listener2() { - console.log('listener2'); -} - -foo.addEventListener('bar', listener1); -foo.addEventListener('bar', listener2); -foo.removeEventListener('bar', listener1); - -var event = new yaeti.Event('bar'); - -foo.dispatchEvent(event); - - -// Output: -// => "listener2" -``` - - - -## API - - -#### `yaeti.EventTarget` interface - -Implementation of the [EventTarget](https://developer.mozilla.org/es/docs/Web/API/EventTarget) interface. - -* Make a custom class inherit from `EventTarget`: -```javascript -function Foo() { - yaeti.EventTarget.call(this); -} -``` - -* Make an existing object an `EventTarget`: -```javascript -yaeti.EventTarget.call(obj); -``` - -The interface implements the `addEventListener`, `removeEventListener` and `dispatchEvent` methods as defined by the W3C. - - -##### `listeners` read-only property - -Returns an object whose keys are configured event types (String) and whose values are an array of listeners (functions) for those event types. - - -#### `yaeti.Event` interface - -Implementation of the [Event](https://developer.mozilla.org/en-US/docs/Web/API/Event) interface. - -*NOTE:* Just useful in Node (the browser already exposes the native `Event` interface). - -```javascript -var event = new yaeti.Event('bar'); -``` - - -## Author - -[Iñaki Baz Castillo](https://github.com/ibc) - - -## License - -[MIT](./LICENSE) diff --git a/node_modules/websocket/node_modules/yaeti/gulpfile.js b/node_modules/websocket/node_modules/yaeti/gulpfile.js deleted file mode 100644 index 294cd9c..0000000 --- a/node_modules/websocket/node_modules/yaeti/gulpfile.js +++ /dev/null @@ -1,23 +0,0 @@ -var - /** - * Dependencies. - */ - gulp = require('gulp'), - jscs = require('gulp-jscs'), - jshint = require('gulp-jshint'), - stylish = require('gulp-jscs-stylish'); - - -gulp.task('lint', function () { - var src = ['gulpfile.js', 'index.js', 'lib/**/*.js']; - - return gulp.src(src) - .pipe(jshint('.jshintrc')) // Enforce good practics. - .pipe(jscs('.jscsrc')) // Enforce style guide. - .pipe(stylish.combineWithHintResults()) - .pipe(jshint.reporter('jshint-stylish', {verbose: true})) - .pipe(jshint.reporter('fail')); -}); - - -gulp.task('default', gulp.task('lint')); diff --git a/node_modules/websocket/node_modules/yaeti/index.js b/node_modules/websocket/node_modules/yaeti/index.js deleted file mode 100644 index b1e6db4..0000000 --- a/node_modules/websocket/node_modules/yaeti/index.js +++ /dev/null @@ -1,4 +0,0 @@ -module.exports = { - EventTarget : require('./lib/EventTarget'), - Event : require('./lib/Event') -}; diff --git a/node_modules/websocket/node_modules/yaeti/lib/Event.browser.js b/node_modules/websocket/node_modules/yaeti/lib/Event.browser.js deleted file mode 100644 index 0cd5ea6..0000000 --- a/node_modules/websocket/node_modules/yaeti/lib/Event.browser.js +++ /dev/null @@ -1,5 +0,0 @@ -/** - * In browsers export the native Event interface. - */ - -module.exports = global.Event; diff --git a/node_modules/websocket/node_modules/yaeti/lib/Event.js b/node_modules/websocket/node_modules/yaeti/lib/Event.js deleted file mode 100644 index cd245a2..0000000 --- a/node_modules/websocket/node_modules/yaeti/lib/Event.js +++ /dev/null @@ -1,13 +0,0 @@ -/** - * Expose the Event class. - */ -module.exports = _Event; - - -function _Event(type) { - this.type = type; - this.isTrusted = false; - - // Set a flag indicating this is not a DOM Event object - this._yaeti = true; -} diff --git a/node_modules/websocket/node_modules/yaeti/lib/EventTarget.js b/node_modules/websocket/node_modules/yaeti/lib/EventTarget.js deleted file mode 100644 index 403c75b..0000000 --- a/node_modules/websocket/node_modules/yaeti/lib/EventTarget.js +++ /dev/null @@ -1,119 +0,0 @@ -/** - * Expose the _EventTarget class. - */ -module.exports = _EventTarget; - -function _EventTarget() { - // Do nothing if called for a native EventTarget object.. - if (typeof this.addEventListener === 'function') { - return; - } - - this._listeners = {}; - - this.addEventListener = _addEventListener; - this.removeEventListener = _removeEventListener; - this.dispatchEvent = _dispatchEvent; -} - -Object.defineProperties(_EventTarget.prototype, { - listeners: { - get: function () { - return this._listeners; - } - } -}); - -function _addEventListener(type, newListener) { - var - listenersType, - i, listener; - - if (!type || !newListener) { - return; - } - - listenersType = this._listeners[type]; - if (listenersType === undefined) { - this._listeners[type] = listenersType = []; - } - - for (i = 0; !!(listener = listenersType[i]); i++) { - if (listener === newListener) { - return; - } - } - - listenersType.push(newListener); -} - -function _removeEventListener(type, oldListener) { - var - listenersType, - i, listener; - - if (!type || !oldListener) { - return; - } - - listenersType = this._listeners[type]; - if (listenersType === undefined) { - return; - } - - for (i = 0; !!(listener = listenersType[i]); i++) { - if (listener === oldListener) { - listenersType.splice(i, 1); - break; - } - } - - if (listenersType.length === 0) { - delete this._listeners[type]; - } -} - -function _dispatchEvent(event) { - var - type, - listenersType, - dummyListener, - stopImmediatePropagation = false, - i, listener; - - if (!event || typeof event.type !== 'string') { - throw new Error('`event` must have a valid `type` property'); - } - - // Do some stuff to emulate DOM Event behavior (just if this is not a - // DOM Event object) - if (event._yaeti) { - event.target = this; - event.cancelable = true; - } - - // Attempt to override the stopImmediatePropagation() method - try { - event.stopImmediatePropagation = function () { - stopImmediatePropagation = true; - }; - } catch (error) {} - - type = event.type; - listenersType = (this._listeners[type] || []); - - dummyListener = this['on' + type]; - if (typeof dummyListener === 'function') { - dummyListener.call(this, event); - } - - for (i = 0; !!(listener = listenersType[i]); i++) { - if (stopImmediatePropagation) { - break; - } - - listener.call(this, event); - } - - return !event.defaultPrevented; -} diff --git a/node_modules/websocket/node_modules/yaeti/package.json b/node_modules/websocket/node_modules/yaeti/package.json deleted file mode 100644 index 28e168a..0000000 --- a/node_modules/websocket/node_modules/yaeti/package.json +++ /dev/null @@ -1,59 +0,0 @@ -{ - "name": "yaeti", - "version": "0.0.6", - "description": "Yet Another EventTarget Implementation", - "author": { - "name": "Iñaki Baz Castillo", - "email": "ibc@aliax.net" - }, - "license": "MIT", - "main": "index.js", - "browser": { - "./lib/Event.js": "./lib/Event.browser.js" - }, - "repository": { - "type": "git", - "url": "https://github.com/ibc/yaeti.git" - }, - "devDependencies": { - "gulp": "git+https://github.com/gulpjs/gulp.git#4.0", - "gulp-jscs": "^1.6.0", - "gulp-jscs-stylish": "^1.1.0", - "gulp-jshint": "^1.11.2", - "jshint-stylish": "~1.0.2" - }, - "engines": { - "node": ">=0.10.32" - }, - "gitHead": "5b838a23410b9ed0eb1b74bc3a266c1af204b8f2", - "bugs": { - "url": "https://github.com/ibc/yaeti/issues" - }, - "homepage": "https://github.com/ibc/yaeti", - "_id": "yaeti@0.0.6", - "scripts": {}, - "_shasum": "f26f484d72684cf42bedfb76970aa1608fbf9577", - "_from": "yaeti@^0.0.6", - "_npmVersion": "2.5.1", - "_nodeVersion": "0.12.0", - "_npmUser": { - "name": "ibc", - "email": "ibc@aliax.net" - }, - "dist": { - "shasum": "f26f484d72684cf42bedfb76970aa1608fbf9577", - "tarball": "https://registry.npmjs.org/yaeti/-/yaeti-0.0.6.tgz" - }, - "maintainers": [ - { - "name": "ibc", - "email": "ibc@aliax.net" - } - ], - "_npmOperationalInternal": { - "host": "packages-13-west.internal.npmjs.com", - "tmp": "tmp/yaeti-0.0.6.tgz_1458254413403_0.9036164651624858" - }, - "directories": {}, - "_resolved": "https://registry.npmjs.org/yaeti/-/yaeti-0.0.6.tgz" -} diff --git a/node_modules/websocket/package.json b/node_modules/websocket/package.json deleted file mode 100644 index fc162e5..0000000 --- a/node_modules/websocket/package.json +++ /dev/null @@ -1,99 +0,0 @@ -{ - "name": "websocket", - "description": "Websocket Client & Server Library implementing the WebSocket protocol as specified in RFC 6455.", - "keywords": [ - "websocket", - "websockets", - "socket", - "networking", - "comet", - "push", - "RFC-6455", - "realtime", - "server", - "client" - ], - "author": { - "name": "Brian McKelvey", - "email": "theturtle32@gmail.com", - "url": "https://github.com/theturtle32" - }, - "contributors": [ - { - "name": "Iñaki Baz Castillo", - "email": "ibc@aliax.net", - "url": "http://dev.sipdoc.net" - } - ], - "version": "1.0.30", - "repository": { - "type": "git", - "url": "git+https://github.com/theturtle32/WebSocket-Node.git" - }, - "homepage": "https://github.com/theturtle32/WebSocket-Node", - "engines": { - "node": ">=0.10.0" - }, - "dependencies": { - "debug": "^2.2.0", - "nan": "^2.14.0", - "typedarray-to-buffer": "^3.1.5", - "yaeti": "^0.0.6" - }, - "devDependencies": { - "buffer-equal": "^1.0.0", - "faucet": "^0.0.1", - "gulp": "^4.0.2", - "gulp-jshint": "^2.0.4", - "jshint-stylish": "^2.2.1", - "jshint": "^2.0.0", - "tape": "^4.9.1" - }, - "config": { - "verbose": false - }, - "scripts": { - "install": "(node-gyp rebuild 2> builderror.log) || (exit 0)", - "test": "faucet test/unit", - "gulp": "gulp" - }, - "main": "index", - "directories": { - "lib": "./lib" - }, - "browser": "lib/browser.js", - "license": "Apache-2.0", - "gitHead": "7db960ef47f9e87799a17e5a7ef3f46d3b1b9227", - "bugs": { - "url": "https://github.com/theturtle32/WebSocket-Node/issues" - }, - "_id": "websocket@1.0.30", - "_nodeVersion": "12.9.0", - "_npmVersion": "6.10.2", - "dist": { - "integrity": "sha512-aO6klgaTdSMkhfl5VVJzD5fm+Srhh5jLYbS15+OiI1sN6h/RU/XW6WN9J1uVIpUKNmsTvT3Hs35XAFjn9NMfOw==", - "shasum": "91d3bd00c3d43e916f0cf962f8f8c451bb0b2373", - "tarball": "https://registry.npmjs.org/websocket/-/websocket-1.0.30.tgz", - "fileCount": 29, - "unpackedSize": 162651, - "npm-signature": "-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJdeopQCRA9TVsSAnZWagAA8iQP/i7CvxHeOFy4J0UOzOoO\nEY/boKZdf4NuASAKRWujz4vUAoMQp48r7cHG/t+VjXu8saeJiZpASaEEgEem\n79x67cyfFNGPGVvln3cwn79ABZZXv0mJjzw/5ZJuz4A2pzS6nEE56J/H1JxX\nN8DMjku5bG3XzJ/xsNuiTwqNFHYF54SI/UkHAI0Ok9ZuLqITLQ2Ub08Ujq5z\nLaW9ePL66aWzUS5hD8hjtUpMw+/MyDIeLUynyUvZB2gnjsLTZjfASsbIgOSk\npW0E0Mp4GVE1jJ39JohY/KHmV8XF2cl9lJz6HiRuPbZwPqpKHZFlUj7mPcQs\nHS1pHQE5mz2Q/GT+UPCLESO/1TmIECoG0K15WdaXLfEGUDpOVbtNM1riSaBG\nTjz9TAPoBiUwoAT6Rr4teaD0An5aXbwbWjs0qdQjr0Ml8Ckn/zhuLq0k2haG\neSb0loKwMoNQPEOwA4lEnodw+lumurlH5cJjY0G7p+mjWnTEHG2X2WxL8Z23\nfvKzZ4JZQ3/aN4QGkfbos4B85tp5m0lXM/uDyu9v8cqEEbnMNsGZIzDPkAk/\nBCQOi/IkwGQNjoJrkhMTCFzeopjGvUqzMqnAMRhh9fi2XBoP/flPAPT+PUsj\nZKgpmCA/f7UX5THnna2hjocDa+4gKvPOKAipGsSrHqS4gQKg+yTkCfx5WtR4\nbLIC\r\n=nkBA\r\n-----END PGP SIGNATURE-----\r\n" - }, - "maintainers": [ - { - "name": "theturtle32", - "email": "brian@worlize.com" - } - ], - "_npmUser": { - "name": "theturtle32", - "email": "theturtle32@gmail.com" - }, - "_npmOperationalInternal": { - "host": "s3://npm-registry-packages", - "tmp": "tmp/websocket_1.0.30_1568311887357_0.18656696326018363" - }, - "_hasShrinkwrap": false, - "_shasum": "91d3bd00c3d43e916f0cf962f8f8c451bb0b2373", - "_from": "websocket@", - "_resolved": "https://registry.npmjs.org/websocket/-/websocket-1.0.30.tgz" -} diff --git a/node_modules/websocket/src/bufferutil.cc b/node_modules/websocket/src/bufferutil.cc deleted file mode 100644 index a53c246..0000000 --- a/node_modules/websocket/src/bufferutil.cc +++ /dev/null @@ -1,121 +0,0 @@ -/*! - * BufferUtil originally from: - * ws: a node.js websocket client - * Copyright(c) 2015 Einar Otto Stangvik - * MIT Licensed - */ - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include "nan.h" - -using namespace v8; -using namespace node; - -class BufferUtil : public ObjectWrap -{ -public: - - static void Initialize(v8::Local target) - { - Nan::HandleScope scope; - Local t = Nan::New(New); - t->InstanceTemplate()->SetInternalFieldCount(1); - Nan::SetMethod(t, "unmask", BufferUtil::Unmask); - Nan::SetMethod(t, "mask", BufferUtil::Mask); - Nan::SetMethod(t, "merge", BufferUtil::Merge); - Nan::Set(target, Nan::New("BufferUtil").ToLocalChecked(), t->GetFunction()); - } - -protected: - - static NAN_METHOD(New) - { - Nan::HandleScope scope; - BufferUtil* bufferUtil = new BufferUtil(); - bufferUtil->Wrap(info.This()); - info.GetReturnValue().Set(info.This()); - } - - static NAN_METHOD(Merge) - { - Nan::HandleScope scope; - Local bufferObj = info[0]->ToObject(); - char* buffer = Buffer::Data(bufferObj); - Local array = Local::Cast(info[1]); - unsigned int arrayLength = array->Length(); - size_t offset = 0; - unsigned int i; - for (i = 0; i < arrayLength; ++i) { - Local src = array->Get(i)->ToObject(); - size_t length = Buffer::Length(src); - memcpy(buffer + offset, Buffer::Data(src), length); - offset += length; - } - info.GetReturnValue().Set(Nan::True()); - } - - static NAN_METHOD(Unmask) - { - Nan::HandleScope scope; - Local buffer_obj = info[0]->ToObject(); - size_t length = Buffer::Length(buffer_obj); - Local mask_obj = info[1]->ToObject(); - unsigned int *mask = (unsigned int*)Buffer::Data(mask_obj); - unsigned int* from = (unsigned int*)Buffer::Data(buffer_obj); - size_t len32 = length / 4; - unsigned int i; - for (i = 0; i < len32; ++i) *(from + i) ^= *mask; - from += i; - switch (length % 4) { - case 3: *((unsigned char*)from+2) = *((unsigned char*)from+2) ^ ((unsigned char*)mask)[2]; - case 2: *((unsigned char*)from+1) = *((unsigned char*)from+1) ^ ((unsigned char*)mask)[1]; - case 1: *((unsigned char*)from ) = *((unsigned char*)from ) ^ ((unsigned char*)mask)[0]; - case 0:; - } - info.GetReturnValue().Set(Nan::True()); - } - - static NAN_METHOD(Mask) - { - Nan::HandleScope scope; - Local buffer_obj = info[0]->ToObject(); - Local mask_obj = info[1]->ToObject(); - unsigned int *mask = (unsigned int*)Buffer::Data(mask_obj); - Local output_obj = info[2]->ToObject(); - unsigned int dataOffset = info[3]->Int32Value(); - unsigned int length = info[4]->Int32Value(); - unsigned int* to = (unsigned int*)(Buffer::Data(output_obj) + dataOffset); - unsigned int* from = (unsigned int*)Buffer::Data(buffer_obj); - unsigned int len32 = length / 4; - unsigned int i; - for (i = 0; i < len32; ++i) *(to + i) = *(from + i) ^ *mask; - to += i; - from += i; - switch (length % 4) { - case 3: *((unsigned char*)to+2) = *((unsigned char*)from+2) ^ *((unsigned char*)mask+2); - case 2: *((unsigned char*)to+1) = *((unsigned char*)from+1) ^ *((unsigned char*)mask+1); - case 1: *((unsigned char*)to ) = *((unsigned char*)from ) ^ *((unsigned char*)mask); - case 0:; - } - info.GetReturnValue().Set(Nan::True()); - } -}; - -#if !NODE_VERSION_AT_LEAST(0,10,0) -extern "C" -#endif -void init (Local target) -{ - Nan::HandleScope scope; - BufferUtil::Initialize(target); -} - -NODE_MODULE(bufferutil, init) diff --git a/node_modules/websocket/src/validation.cc b/node_modules/websocket/src/validation.cc deleted file mode 100644 index 3db4f65..0000000 --- a/node_modules/websocket/src/validation.cc +++ /dev/null @@ -1,148 +0,0 @@ -/*! - * UTF-8 Validation Code originally from: - * ws: a node.js websocket client - * Copyright(c) 2015 Einar Otto Stangvik - * MIT Licensed - */ - -#include -#include -#include -#include -#include -#include -#include -#include -#include "nan.h" - -using namespace v8; -using namespace node; - -#define UNI_SUR_HIGH_START (uint32_t) 0xD800 -#define UNI_SUR_LOW_END (uint32_t) 0xDFFF -#define UNI_REPLACEMENT_CHAR (uint32_t) 0x0000FFFD -#define UNI_MAX_LEGAL_UTF32 (uint32_t) 0x0010FFFF - -static const uint8_t trailingBytesForUTF8[256] = { - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, - 2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2, 3,3,3,3,3,3,3,3,4,4,4,4,5,5,5,5 -}; - -static const uint32_t offsetsFromUTF8[6] = { - 0x00000000, 0x00003080, 0x000E2080, - 0x03C82080, 0xFA082080, 0x82082080 -}; - -static int isLegalUTF8(const uint8_t *source, const int length) -{ - uint8_t a; - const uint8_t *srcptr = source+length; - switch (length) { - default: return 0; - /* Everything else falls through when "true"... */ - /* RFC3629 makes 5 & 6 bytes UTF-8 illegal - case 6: if ((a = (*--srcptr)) < 0x80 || a > 0xBF) return 0; - case 5: if ((a = (*--srcptr)) < 0x80 || a > 0xBF) return 0; */ - case 4: if ((a = (*--srcptr)) < 0x80 || a > 0xBF) return 0; - case 3: if ((a = (*--srcptr)) < 0x80 || a > 0xBF) return 0; - case 2: if ((a = (*--srcptr)) > 0xBF) return 0; - switch (*source) { - /* no fall-through in this inner switch */ - case 0xE0: if (a < 0xA0) return 0; break; - case 0xED: if (a > 0x9F) return 0; break; - case 0xF0: if (a < 0x90) return 0; break; - case 0xF4: if (a > 0x8F) return 0; break; - default: if (a < 0x80) return 0; - } - - case 1: if (*source >= 0x80 && *source < 0xC2) return 0; - } - if (*source > 0xF4) return 0; - return 1; -} - -int is_valid_utf8 (size_t len, char *value) -{ - /* is the string valid UTF-8? */ - for (unsigned int i = 0; i < len; i++) { - uint32_t ch = 0; - uint8_t extrabytes = trailingBytesForUTF8[(uint8_t) value[i]]; - - if (extrabytes + i >= len) - return 0; - - if (isLegalUTF8 ((uint8_t *) (value + i), extrabytes + 1) == 0) return 0; - - switch (extrabytes) { - case 5 : ch += (uint8_t) value[i++]; ch <<= 6; - case 4 : ch += (uint8_t) value[i++]; ch <<= 6; - case 3 : ch += (uint8_t) value[i++]; ch <<= 6; - case 2 : ch += (uint8_t) value[i++]; ch <<= 6; - case 1 : ch += (uint8_t) value[i++]; ch <<= 6; - case 0 : ch += (uint8_t) value[i]; - } - - ch -= offsetsFromUTF8[extrabytes]; - - if (ch <= UNI_MAX_LEGAL_UTF32) { - if (ch >= UNI_SUR_HIGH_START && ch <= UNI_SUR_LOW_END) - return 0; - } else { - return 0; - } - } - - return 1; -} - -class Validation : public ObjectWrap -{ -public: - - static void Initialize(v8::Local target) - { - Nan::HandleScope scope; - Local t = Nan::New(New); - t->InstanceTemplate()->SetInternalFieldCount(1); - Nan::SetMethod(t, "isValidUTF8", Validation::IsValidUTF8); - Nan::Set(target, Nan::New("Validation").ToLocalChecked(), t->GetFunction()); - } - -protected: - - static NAN_METHOD(New) - { - Nan::HandleScope scope; - Validation* validation = new Validation(); - validation->Wrap(info.This()); - info.GetReturnValue().Set(info.This()); - } - - static NAN_METHOD(IsValidUTF8) - { - Nan::HandleScope scope; - if (!Buffer::HasInstance(info[0])) { - return Nan::ThrowTypeError("First argument needs to be a buffer"); - } - Local buffer_obj = info[0]->ToObject(); - char *buffer_data = Buffer::Data(buffer_obj); - size_t buffer_length = Buffer::Length(buffer_obj); - info.GetReturnValue().Set(is_valid_utf8(buffer_length, buffer_data) == 1 ? Nan::True() : Nan::False()); - } -}; -#if !NODE_VERSION_AT_LEAST(0,10,0) -extern "C" -#endif -void init (Local target) -{ - Nan::HandleScope scope; - Validation::Initialize(target); -} - -NODE_MODULE(validation, init) diff --git a/node_modules/websocket/vendor/FastBufferList.js b/node_modules/websocket/vendor/FastBufferList.js deleted file mode 100644 index c2d965e..0000000 --- a/node_modules/websocket/vendor/FastBufferList.js +++ /dev/null @@ -1,191 +0,0 @@ -// This file was copied from https://github.com/substack/node-bufferlist -// and modified to be able to copy bytes from the bufferlist directly into -// a pre-existing fixed-size buffer without an additional memory allocation. - -// bufferlist.js -// Treat a linked list of buffers as a single variable-size buffer. -var Buffer = require('buffer').Buffer; -var EventEmitter = require('events').EventEmitter; -var bufferAllocUnsafe = require('../lib/utils').bufferAllocUnsafe; - -module.exports = BufferList; -module.exports.BufferList = BufferList; // backwards compatibility - -function BufferList(opts) { - if (!(this instanceof BufferList)) return new BufferList(opts); - EventEmitter.call(this); - var self = this; - - if (typeof(opts) == 'undefined') opts = {}; - - // default encoding to use for take(). Leaving as 'undefined' - // makes take() return a Buffer instead. - self.encoding = opts.encoding; - - var head = { next : null, buffer : null }; - var last = { next : null, buffer : null }; - - // length can get negative when advanced past the end - // and this is the desired behavior - var length = 0; - self.__defineGetter__('length', function () { - return length; - }); - - // keep an offset of the head to decide when to head = head.next - var offset = 0; - - // Write to the bufferlist. Emits 'write'. Always returns true. - self.write = function (buf) { - if (!head.buffer) { - head.buffer = buf; - last = head; - } - else { - last.next = { next : null, buffer : buf }; - last = last.next; - } - length += buf.length; - self.emit('write', buf); - return true; - }; - - self.end = function (buf) { - if (Buffer.isBuffer(buf)) self.write(buf); - }; - - // Push buffers to the end of the linked list. (deprecated) - // Return this (self). - self.push = function () { - var args = [].concat.apply([], arguments); - args.forEach(self.write); - return self; - }; - - // For each buffer, perform some action. - // If fn's result is a true value, cut out early. - // Returns this (self). - self.forEach = function (fn) { - if (!head.buffer) return bufferAllocUnsafe(0); - - if (head.buffer.length - offset <= 0) return self; - var firstBuf = head.buffer.slice(offset); - - var b = { buffer : firstBuf, next : head.next }; - - while (b && b.buffer) { - var r = fn(b.buffer); - if (r) break; - b = b.next; - } - - return self; - }; - - // Create a single Buffer out of all the chunks or some subset specified by - // start and one-past the end (like slice) in bytes. - self.join = function (start, end) { - if (!head.buffer) return bufferAllocUnsafe(0); - if (start == undefined) start = 0; - if (end == undefined) end = self.length; - - var big = bufferAllocUnsafe(end - start); - var ix = 0; - self.forEach(function (buffer) { - if (start < (ix + buffer.length) && ix < end) { - // at least partially contained in the range - buffer.copy( - big, - Math.max(0, ix - start), - Math.max(0, start - ix), - Math.min(buffer.length, end - ix) - ); - } - ix += buffer.length; - if (ix > end) return true; // stop processing past end - }); - - return big; - }; - - self.joinInto = function (targetBuffer, targetStart, sourceStart, sourceEnd) { - if (!head.buffer) return new bufferAllocUnsafe(0); - if (sourceStart == undefined) sourceStart = 0; - if (sourceEnd == undefined) sourceEnd = self.length; - - var big = targetBuffer; - if (big.length - targetStart < sourceEnd - sourceStart) { - throw new Error("Insufficient space available in target Buffer."); - } - var ix = 0; - self.forEach(function (buffer) { - if (sourceStart < (ix + buffer.length) && ix < sourceEnd) { - // at least partially contained in the range - buffer.copy( - big, - Math.max(targetStart, targetStart + ix - sourceStart), - Math.max(0, sourceStart - ix), - Math.min(buffer.length, sourceEnd - ix) - ); - } - ix += buffer.length; - if (ix > sourceEnd) return true; // stop processing past end - }); - - return big; - }; - - // Advance the buffer stream by n bytes. - // If n the aggregate advance offset passes the end of the buffer list, - // operations such as .take() will return empty strings until enough data is - // pushed. - // Returns this (self). - self.advance = function (n) { - offset += n; - length -= n; - while (head.buffer && offset >= head.buffer.length) { - offset -= head.buffer.length; - head = head.next - ? head.next - : { buffer : null, next : null } - ; - } - if (head.buffer === null) last = { next : null, buffer : null }; - self.emit('advance', n); - return self; - }; - - // Take n bytes from the start of the buffers. - // Returns a string. - // If there are less than n bytes in all the buffers or n is undefined, - // returns the entire concatenated buffer string. - self.take = function (n, encoding) { - if (n == undefined) n = self.length; - else if (typeof n !== 'number') { - encoding = n; - n = self.length; - } - var b = head; - if (!encoding) encoding = self.encoding; - if (encoding) { - var acc = ''; - self.forEach(function (buffer) { - if (n <= 0) return true; - acc += buffer.toString( - encoding, 0, Math.min(n,buffer.length) - ); - n -= buffer.length; - }); - return acc; - } else { - // If no 'encoding' is specified, then return a Buffer. - return self.join(0, n); - } - }; - - // The entire concatenated buffer as a string. - self.toString = function () { - return self.take('binary'); - }; -} -require('util').inherits(BufferList, EventEmitter); diff --git a/node_modules/wscat/LICENSE.md b/node_modules/wscat/LICENSE.md deleted file mode 100644 index 8fb6c91..0000000 --- a/node_modules/wscat/LICENSE.md +++ /dev/null @@ -1,21 +0,0 @@ -(The MIT License) - -Copyright (c) 2011 Einar Otto Stangvik - -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. diff --git a/node_modules/wscat/README.md b/node_modules/wscat/README.md deleted file mode 100644 index 5b87ead..0000000 --- a/node_modules/wscat/README.md +++ /dev/null @@ -1,26 +0,0 @@ -# wscat - -WebSocket cat. - -## Installation - -This module needs to be installed globally so use the `-g` flag when installing: - -``` -npm install -g wscat -``` - -## Usage - -``` -$ wscat -c ws://echo.websocket.org -connected (press CTRL+C to quit) -> hi there -< hi there -> are you a happy parrot? -< are you a happy parrot? -``` - -## License - -MIT diff --git a/node_modules/wscat/bin/wscat b/node_modules/wscat/bin/wscat deleted file mode 100755 index 48f0889..0000000 --- a/node_modules/wscat/bin/wscat +++ /dev/null @@ -1,367 +0,0 @@ -#!/usr/bin/env node - -/*! - * ws: a node.js websocket client - * Copyright(c) 2011 Einar Otto Stangvik - * MIT Licensed - */ - -const EventEmitter = require('events'); -const fs = require('fs'); -const program = require('commander'); -const read = require('read'); -const readline = require('readline'); -const tty = require('tty'); -const WebSocket = require('ws'); - -/** - * InputReader - processes console input. - * - * @extends EventEmitter - */ -class Console extends EventEmitter { - constructor() { - super(); - - this.stdin = process.stdin; - this.stdout = process.stdout; - - this.readlineInterface = readline.createInterface(this.stdin, this.stdout); - - this.readlineInterface - .on('line', data => { - this.emit('line', data); - }) - .on('close', () => { - this.emit('close'); - }); - - this._resetInput = () => { - this.clear(); - }; - } - - static get Colors() { - return { - Red: '\u001b[31m', - Green: '\u001b[32m', - Yellow: '\u001b[33m', - Blue: '\u001b[34m', - Default: '\u001b[39m' - }; - } - - static get Types() { - return { - Incoming: '< ', - Control: '', - Error: 'error: ' - }; - } - - prompt() { - this.readlineInterface.prompt(); - } - - print(type, msg, color) { - if (tty.isatty(1)) { - this.clear(); - - if (program.execute) color = type = ''; - else if (!program.color) color = ''; - - this.stdout.write(color + type + msg + Console.Colors.Default + '\n'); - this.prompt(); - } else if (type === Console.Types.Incoming) { - this.stdout.write(msg + '\n'); - } else { - // is a control message and we're not in a tty... drop it. - } - } - - clear() { - if (tty.isatty(1)) { - this.stdout.write('\u001b[2K\u001b[3D'); - } - } - - pause() { - this.stdin.on('keypress', this._resetInput); - } - - resume() { - this.stdin.removeListener('keypress', this._resetInput); - } -} - -function collect(val, memo) { - memo.push(val); - return memo; -} - -function noop() {} - -/** - * The actual application - */ -const version = require('../package.json').version; - -program - .version(version) - .usage('[options] (--listen | --connect )') - .option('-l, --listen ', 'listen on port') - .option('-c, --connect ', 'connect to a websocket server') - .option('-p, --protocol ', 'optional protocol version') - .option('-o, --origin ', 'optional origin') - .option('-x, --execute ', 'execute command after connecting') - .option('-w, --wait ', 'wait given seconds after executing command') - .option('--host ', 'optional host') - .option('-s, --subprotocol ', 'optional subprotocol', collect, []) - .option('-n, --no-check', 'Do not check for unauthorized certificates') - .option( - '-H, --header ', - 'Set an HTTP header. Repeat to set multiple. (--connect only)', - collect, - [] - ) - .option( - '--auth ', - 'Add basic HTTP authentication header. (--connect only)' - ) - .option('--ca ', 'Specify a Certificate Authority (--connect only)') - .option('--cert ', 'Specify a Client SSL Certificate (--connect only)') - .option( - '--key ', - "Specify a Client SSL Certificate's key (--connect only)" - ) - .option( - '--passphrase [passphrase]', - "Specify a Client SSL Certificate Key's passphrase (--connect only). " + - "If you don't provide a value, it will be prompted for." - ) - .option('--no-color', 'Run without color') - .option( - '--slash', - 'Enable slash commands for control frames ' + - '(/ping, /pong, /close [code [, reason]])' - ) - .parse(process.argv); - -if (program.listen && program.connect) { - console.error('\u001b[33merror: use either --listen or --connect\u001b[39m'); - process.exit(-1); -} - -if (program.listen) { - const wsConsole = new Console(); - wsConsole.pause(); - - let ws = null; - const wss = new WebSocket.Server({ port: program.listen }, () => { - wsConsole.print( - Console.Types.Control, - `listening on port ${program.listen} (press CTRL+C to quit)`, - Console.Colors.Green - ); - wsConsole.clear(); - }); - - wsConsole.on('close', () => { - if (ws) ws.close(); - process.exit(0); - }); - - wsConsole.on('line', data => { - if (ws) { - ws.send(data); - wsConsole.prompt(); - } - }); - - wss.on('connection', newClient => { - if (ws) return newClient.terminate(); - - ws = newClient; - wsConsole.resume(); - wsConsole.prompt(); - wsConsole.print( - Console.Types.Control, - 'client connected', - Console.Colors.Green - ); - - ws.on('close', code => { - wsConsole.print( - Console.Types.Control, - `disconnected (code: ${code})`, - Console.Colors.Green - ); - wsConsole.clear(); - wsConsole.pause(); - ws = null; - }); - - ws.on('error', err => { - wsConsole.print(Console.Types.Error, err.message, Console.Colors.Yellow); - }); - - ws.on('message', data => { - wsConsole.print(Console.Types.Incoming, data, Console.Colors.Blue); - }); - }); - - wss.on('error', err => { - wsConsole.print(Console.Types.Error, err.message, Console.Colors.Yellow); - process.exit(-1); - }); -} else if (program.connect) { - const options = {}; - const cont = () => { - const wsConsole = new Console(); - - const headers = program.header.reduce((acc, cur) => { - const i = cur.indexOf(':'); - const key = cur.slice(0, i); - const value = cur.slice(i + 1); - acc[key] = value; - return acc; - }, {}); - - if (program.auth) { - headers.Authorization = - 'Basic ' + Buffer.from(program.auth).toString('base64'); - } - if (program.host) headers.Host = program.host; - if (program.protocol) options.protocolVersion = +program.protocol; - if (program.origin) options.origin = program.origin; - if (!program.check) options.rejectUnauthorized = program.check; - if (program.ca) options.ca = fs.readFileSync(program.ca); - if (program.cert) options.cert = fs.readFileSync(program.cert); - if (program.key) options.key = fs.readFileSync(program.key); - - let connectUrl = program.connect; - if (!connectUrl.match(/\w+:\/\/.*$/i)) { - connectUrl = `ws://${connectUrl}`; - } - - options.headers = headers; - const ws = new WebSocket(connectUrl, program.subprotocol, options); - - ws.on('open', () => { - if (program.execute) { - ws.send(program.execute); - setTimeout(() => { - ws.close(); - }, program.wait ? program.wait * 1000 : 2000); - } else { - wsConsole.print( - Console.Types.Control, - 'connected (press CTRL+C to quit)', - Console.Colors.Green - ); - - wsConsole.on('line', data => { - if (program.slash && data[0] === '/') { - const toks = data.split(/\s+/); - switch (toks[0].substr(1)) { - case 'ping': - ws.ping(noop); - break; - case 'pong': - ws.pong(noop); - break; - case 'close': { - let closeStatusCode = 1000; - let closeReason = ''; - if (toks.length >= 2) { - closeStatusCode = parseInt(toks[1]); - } - if (toks.length >= 3) { - closeReason = toks.slice(2).join(' '); - } - if (closeReason.length > 0) { - ws.close(closeStatusCode, closeReason); - } else { - ws.close(closeStatusCode); - } - break; - } - default: - wsConsole.print( - Console.Types.Error, - 'Unrecognized slash command.', - Console.Colors.Yellow - ); - } - } else { - ws.send(data); - } - wsConsole.prompt(); - }); - } - }); - - ws.on('close', code => { - if (!program.execute) { - wsConsole.print( - Console.Types.Control, - `disconnected (code: ${code})`, - Console.Colors.Green - ); - } - wsConsole.clear(); - process.exit(); - }); - - ws.on('error', err => { - wsConsole.print(Console.Types.Error, err.message, Console.Colors.Yellow); - process.exit(-1); - }); - - ws.on('message', data => { - wsConsole.print(Console.Types.Incoming, data, Console.Colors.Blue); - }); - - ws.on('ping', () => { - wsConsole.print( - Console.Types.Incoming, - 'Received ping', - Console.Colors.Blue - ); - }); - - ws.on('pong', () => { - wsConsole.print( - Console.Types.Incoming, - 'Received pong', - Console.Colors.Blue - ); - }); - - wsConsole.on('close', () => { - ws.close(); - process.exit(); - }); - }; - - if (program.passphrase === true) { - read( - { - prompt: 'Passphrase: ', - silent: true, - replace: '*' - }, - (err, passphrase) => { - options.passphrase = passphrase; - cont(); - } - ); - } else if (typeof program.passphrase === 'string') { - options.passphrase = program.passphrase; - cont(); - } else { - cont(); - } -} else { - program.help(); -} diff --git a/node_modules/wscat/node_modules/commander/CHANGELOG.md b/node_modules/wscat/node_modules/commander/CHANGELOG.md deleted file mode 100644 index 5e2f813..0000000 --- a/node_modules/wscat/node_modules/commander/CHANGELOG.md +++ /dev/null @@ -1,356 +0,0 @@ - -2.15.0 / 2018-03-07 -================== - - * Update downloads badge to point to graph of downloads over time instead of duplicating link to npm - * Arguments description - -2.14.1 / 2018-02-07 -================== - - * Fix typing of help function - -2.14.0 / 2018-02-05 -================== - - * only register the option:version event once - * Fixes issue #727: Passing empty string for option on command is set to undefined - * enable eqeqeq rule - * resolves #754 add linter configuration to project - * resolves #560 respect custom name for version option - * document how to override the version flag - * document using options per command - -2.13.0 / 2018-01-09 -================== - - * Do not print default for --no- - * remove trailing spaces in command help - * Update CI's Node.js to LTS and latest version - * typedefs: Command and Option types added to commander namespace - -2.12.2 / 2017-11-28 -================== - - * fix: typings are not shipped - -2.12.1 / 2017-11-23 -================== - - * Move @types/node to dev dependency - -2.12.0 / 2017-11-22 -================== - - * add attributeName() method to Option objects - * Documentation updated for options with --no prefix - * typings: `outputHelp` takes a string as the first parameter - * typings: use overloads - * feat(typings): update to match js api - * Print default value in option help - * Fix translation error - * Fail when using same command and alias (#491) - * feat(typings): add help callback - * fix bug when description is add after command with options (#662) - * Format js code - * Rename History.md to CHANGELOG.md (#668) - * feat(typings): add typings to support TypeScript (#646) - * use current node - -2.11.0 / 2017-07-03 -================== - - * Fix help section order and padding (#652) - * feature: support for signals to subcommands (#632) - * Fixed #37, --help should not display first (#447) - * Fix translation errors. (#570) - * Add package-lock.json - * Remove engines - * Upgrade package version - * Prefix events to prevent conflicts between commands and options (#494) - * Removing dependency on graceful-readlink - * Support setting name in #name function and make it chainable - * Add .vscode directory to .gitignore (Visual Studio Code metadata) - * Updated link to ruby commander in readme files - -2.10.0 / 2017-06-19 -================== - - * Update .travis.yml. drop support for older node.js versions. - * Fix require arguments in README.md - * On SemVer you do not start from 0.0.1 - * Add missing semi colon in readme - * Add save param to npm install - * node v6 travis test - * Update Readme_zh-CN.md - * Allow literal '--' to be passed-through as an argument - * Test subcommand alias help - * link build badge to master branch - * Support the alias of Git style sub-command - * added keyword commander for better search result on npm - * Fix Sub-Subcommands - * test node.js stable - * Fixes TypeError when a command has an option called `--description` - * Update README.md to make it beginner friendly and elaborate on the difference between angled and square brackets. - * Add chinese Readme file - -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 diff --git a/node_modules/wscat/node_modules/commander/LICENSE b/node_modules/wscat/node_modules/commander/LICENSE deleted file mode 100644 index 10f997a..0000000 --- a/node_modules/wscat/node_modules/commander/LICENSE +++ /dev/null @@ -1,22 +0,0 @@ -(The MIT License) - -Copyright (c) 2011 TJ Holowaychuk - -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. diff --git a/node_modules/wscat/node_modules/commander/Readme.md b/node_modules/wscat/node_modules/commander/Readme.md deleted file mode 100644 index a29da40..0000000 --- a/node_modules/wscat/node_modules/commander/Readme.md +++ /dev/null @@ -1,408 +0,0 @@ -# Commander.js - - -[![Build Status](https://api.travis-ci.org/tj/commander.js.svg?branch=master)](http://travis-ci.org/tj/commander.js) -[![NPM Version](http://img.shields.io/npm/v/commander.svg?style=flat)](https://www.npmjs.org/package/commander) -[![NPM Downloads](https://img.shields.io/npm/dm/commander.svg?style=flat)](https://npmcharts.com/compare/commander?minimal=true) -[![Join the chat at https://gitter.im/tj/commander.js](https://badges.gitter.im/Join%20Chat.svg)](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/commander-rb/commander). - [API documentation](http://tj.github.com/commander.js/) - - -## Installation - - $ npm install commander --save - -## 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.1.0') - .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. - -Note that multi-word options starting with `--no` prefix negate the boolean value of the following word. For example, `--no-sauce` sets the value of `program.sauce` to false. - -```js -#!/usr/bin/env node - -/** - * Module dependencies. - */ - -var program = require('commander'); - -program - .option('--no-sauce', 'Remove sauce') - .parse(process.argv); - -console.log('you ordered a pizza'); -if (program.sauce) console.log(' with sauce'); -else console.log(' without sauce'); -``` - -## Version option - -Calling the `version` implicitly adds the `-V` and `--version` options to the command. -When either of these options is present, the command prints the version number and exits. - - $ ./examples/pizza -V - 0.0.1 - -If you want your program to respond to the `-v` option instead of the `-V` option, simply pass custom flags to the `version` method using the same syntax as the `option` method. - -```js -program - .version('0.0.1', '-v, --version') -``` - -The version flags can be named anything, but the long option is required. - -## Command-specific options - -You can attach options to a command. - -```js -#!/usr/bin/env node - -var program = require('commander'); - -program - .command('rm ') - .option('-r, --recursive', 'Remove recursively') - .action(function (dir, cmd) { - console.log('remove ' + dir + (cmd.recursive ? ' recursively' : '')) - }) - -program.parse(process.argv) -``` - -A command's options are validated when the command is used. Any unknown options will be reported as an error. However, if an action-based command does not define an action, then the options are not validated. - -## 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.1.0') - .usage('[options] ') - .option('-i, --integer ', 'An integer argument', parseInt) - .option('-f, --float ', 'A float argument', parseFloat) - .option('-r, --range ..', 'A range', range) - .option('-l, --list ', '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.1.0') - .option('-s --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.1.0') - .command('rmdir [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('commander'); - -program - .version('0.1.0') - .arguments(' [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"); -``` -Angled brackets (e.g. ``) indicate required input. Square brackets (e.g. `[env]`) indicate optional input. - -## Git-style sub-commands - -```js -// file: ./examples/pm -var program = require('commander'); - -program - .version('0.1.0') - .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 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.1.0') - .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.1.0') - .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.1.0') - .option('-C, --chdir ', 'change the working directory') - .option('-c, --config ', '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 ') - .alias('ex') - .description('execute the given remote cmd') - .option("-e, --exec_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 diff --git a/node_modules/wscat/node_modules/commander/index.js b/node_modules/wscat/node_modules/commander/index.js deleted file mode 100644 index fb648be..0000000 --- a/node_modules/wscat/node_modules/commander/index.js +++ /dev/null @@ -1,1231 +0,0 @@ -/** - * Module dependencies. - */ - -var EventEmitter = require('events').EventEmitter; -var spawn = require('child_process').spawn; -var path = require('path'); -var dirname = path.dirname; -var basename = path.basename; -var fs = require('fs'); - -/** - * Inherit `Command` from `EventEmitter.prototype`. - */ - -require('util').inherits(Command, EventEmitter); - -/** - * Expose the root command. - */ - -exports = module.exports = new Command(); - -/** - * Expose `Command`. - */ - -exports.Command = Command; - -/** - * Expose `Option`. - */ - -exports.Option = Option; - -/** - * Initialize a new `Option` with the given `flags` and `description`. - * - * @param {String} flags - * @param {String} description - * @api public - */ - -function Option(flags, description) { - this.flags = flags; - this.required = ~flags.indexOf('<'); - this.optional = ~flags.indexOf('['); - this.bool = !~flags.indexOf('-no-'); - flags = flags.split(/[ ,|]+/); - if (flags.length > 1 && !/^[[<]/.test(flags[1])) this.short = flags.shift(); - this.long = flags.shift(); - this.description = description || ''; -} - -/** - * Return option name. - * - * @return {String} - * @api private - */ - -Option.prototype.name = function() { - return this.long - .replace('--', '') - .replace('no-', ''); -}; - -/** - * Return option name, in a camelcase format that can be used - * as a object attribute key. - * - * @return {String} - * @api private - */ - -Option.prototype.attributeName = function() { - return camelcase(this.name()); -}; - -/** - * Check if `arg` matches the short or long flag. - * - * @param {String} arg - * @return {Boolean} - * @api private - */ - -Option.prototype.is = function(arg) { - return this.short === arg || this.long === arg; -}; - -/** - * Initialize a new `Command`. - * - * @param {String} name - * @api public - */ - -function Command(name) { - this.commands = []; - this.options = []; - this._execs = {}; - this._allowUnknownOption = false; - this._args = []; - this._name = name || ''; -} - -/** - * Add command `name`. - * - * The `.action()` callback is invoked when the - * command `name` is specified via __ARGV__, - * and the remaining arguments are applied to the - * function for access. - * - * When the `name` is "*" an un-matched command - * will be passed as the first arg, followed by - * the rest of __ARGV__ remaining. - * - * Examples: - * - * program - * .version('0.0.1') - * .option('-C, --chdir ', 'change the working directory') - * .option('-c, --config ', 'set config path. defaults to ./deploy.conf') - * .option('-T, --no-tests', 'ignore test hook') - * - * program - * .command('setup') - * .description('run remote setup commands') - * .action(function() { - * console.log('setup'); - * }); - * - * program - * .command('exec ') - * .description('run the given remote command') - * .action(function(cmd) { - * console.log('exec "%s"', cmd); - * }); - * - * program - * .command('teardown [otherDirs...]') - * .description('run teardown commands') - * .action(function(dir, otherDirs) { - * console.log('dir "%s"', dir); - * if (otherDirs) { - * otherDirs.forEach(function (oDir) { - * console.log('dir "%s"', oDir); - * }); - * } - * }); - * - * program - * .command('*') - * .description('deploy the given env') - * .action(function(env) { - * console.log('deploying "%s"', env); - * }); - * - * program.parse(process.argv); - * - * @param {String} name - * @param {String} [desc] for git-style sub-commands - * @return {Command} the new command - * @api public - */ - -Command.prototype.command = function(name, desc, opts) { - if (typeof desc === 'object' && desc !== null) { - opts = desc; - desc = null; - } - opts = opts || {}; - var args = name.split(/ +/); - var cmd = new Command(args.shift()); - - if (desc) { - cmd.description(desc); - this.executables = true; - this._execs[cmd._name] = true; - if (opts.isDefault) this.defaultExecutable = cmd._name; - } - cmd._noHelp = !!opts.noHelp; - this.commands.push(cmd); - cmd.parseExpectedArgs(args); - cmd.parent = this; - - if (desc) return this; - return cmd; -}; - -/** - * Define argument syntax for the top-level command. - * - * @api public - */ - -Command.prototype.arguments = function(desc) { - return this.parseExpectedArgs(desc.split(/ +/)); -}; - -/** - * Add an implicit `help [cmd]` subcommand - * which invokes `--help` for the given command. - * - * @api private - */ - -Command.prototype.addImplicitHelpCommand = function() { - this.command('help [cmd]', 'display help for [cmd]'); -}; - -/** - * Parse expected `args`. - * - * For example `["[type]"]` becomes `[{ required: false, name: 'type' }]`. - * - * @param {Array} args - * @return {Command} for chaining - * @api public - */ - -Command.prototype.parseExpectedArgs = function(args) { - if (!args.length) return; - var self = this; - args.forEach(function(arg) { - var argDetails = { - required: false, - name: '', - variadic: false - }; - - switch (arg[0]) { - case '<': - argDetails.required = true; - argDetails.name = arg.slice(1, -1); - break; - case '[': - argDetails.name = arg.slice(1, -1); - break; - } - - if (argDetails.name.length > 3 && argDetails.name.slice(-3) === '...') { - argDetails.variadic = true; - argDetails.name = argDetails.name.slice(0, -3); - } - if (argDetails.name) { - self._args.push(argDetails); - } - }); - return this; -}; - -/** - * Register callback `fn` for the command. - * - * Examples: - * - * program - * .command('help') - * .description('display verbose help') - * .action(function() { - * // output help here - * }); - * - * @param {Function} fn - * @return {Command} for chaining - * @api public - */ - -Command.prototype.action = function(fn) { - var self = this; - var listener = function(args, unknown) { - // Parse any so-far unknown options - args = args || []; - unknown = unknown || []; - - var parsed = self.parseOptions(unknown); - - // Output help if necessary - outputHelpIfNecessary(self, parsed.unknown); - - // If there are still any unknown options, then we simply - // die, unless someone asked for help, in which case we give it - // to them, and then we die. - if (parsed.unknown.length > 0) { - self.unknownOption(parsed.unknown[0]); - } - - // Leftover arguments need to be pushed back. Fixes issue #56 - if (parsed.args.length) args = parsed.args.concat(args); - - self._args.forEach(function(arg, i) { - if (arg.required && args[i] == null) { - self.missingArgument(arg.name); - } else if (arg.variadic) { - if (i !== self._args.length - 1) { - self.variadicArgNotLast(arg.name); - } - - args[i] = args.splice(i); - } - }); - - // Always append ourselves to the end of the arguments, - // to make sure we match the number of arguments the user - // expects - if (self._args.length) { - args[self._args.length] = self; - } else { - args.push(self); - } - - fn.apply(self, args); - }; - var parent = this.parent || this; - var name = parent === this ? '*' : this._name; - parent.on('command:' + name, listener); - if (this._alias) parent.on('command:' + this._alias, listener); - return this; -}; - -/** - * Define option with `flags`, `description` and optional - * coercion `fn`. - * - * The `flags` string should contain both the short and long flags, - * separated by comma, a pipe or space. The following are all valid - * all will output this way when `--help` is used. - * - * "-p, --pepper" - * "-p|--pepper" - * "-p --pepper" - * - * Examples: - * - * // simple boolean defaulting to false - * program.option('-p, --pepper', 'add pepper'); - * - * --pepper - * program.pepper - * // => Boolean - * - * // simple boolean defaulting to true - * program.option('-C, --no-cheese', 'remove cheese'); - * - * program.cheese - * // => true - * - * --no-cheese - * program.cheese - * // => false - * - * // required argument - * program.option('-C, --chdir ', 'change the working directory'); - * - * --chdir /tmp - * program.chdir - * // => "/tmp" - * - * // optional argument - * program.option('-c, --cheese [type]', 'add cheese [marble]'); - * - * @param {String} flags - * @param {String} description - * @param {Function|*} [fn] or default - * @param {*} [defaultValue] - * @return {Command} for chaining - * @api public - */ - -Command.prototype.option = function(flags, description, fn, defaultValue) { - var self = this, - option = new Option(flags, description), - oname = option.name(), - name = option.attributeName(); - - // default as 3rd arg - if (typeof fn !== 'function') { - if (fn instanceof RegExp) { - var regex = fn; - fn = function(val, def) { - var m = regex.exec(val); - return m ? m[0] : def; - }; - } else { - defaultValue = fn; - fn = null; - } - } - - // preassign default value only for --no-*, [optional], or - if (!option.bool || option.optional || option.required) { - // when --no-* we make sure default is true - if (!option.bool) defaultValue = true; - // preassign only if we have a default - if (defaultValue !== undefined) { - self[name] = defaultValue; - option.defaultValue = defaultValue; - } - } - - // register the option - this.options.push(option); - - // when it's passed assign the value - // and conditionally invoke the callback - this.on('option:' + oname, function(val) { - // coercion - if (val !== null && fn) { - val = fn(val, self[name] === undefined ? defaultValue : self[name]); - } - - // unassigned or bool - if (typeof self[name] === 'boolean' || typeof self[name] === 'undefined') { - // if no value, bool true, and we have a default, then use it! - if (val == null) { - self[name] = option.bool - ? defaultValue || true - : false; - } else { - self[name] = val; - } - } else if (val !== null) { - // reassign - self[name] = val; - } - }); - - return this; -}; - -/** - * Allow unknown options on the command line. - * - * @param {Boolean} arg if `true` or omitted, no error will be thrown - * for unknown options. - * @api public - */ -Command.prototype.allowUnknownOption = function(arg) { - this._allowUnknownOption = arguments.length === 0 || arg; - return this; -}; - -/** - * Parse `argv`, settings options and invoking commands when defined. - * - * @param {Array} argv - * @return {Command} for chaining - * @api public - */ - -Command.prototype.parse = function(argv) { - // implicit help - if (this.executables) this.addImplicitHelpCommand(); - - // store raw args - this.rawArgs = argv; - - // guess name - this._name = this._name || basename(argv[1], '.js'); - - // github-style sub-commands with no sub-command - if (this.executables && argv.length < 3 && !this.defaultExecutable) { - // this user needs help - argv.push('--help'); - } - - // process argv - var parsed = this.parseOptions(this.normalize(argv.slice(2))); - var args = this.args = parsed.args; - - var result = this.parseArgs(this.args, parsed.unknown); - - // executable sub-commands - var name = result.args[0]; - - var aliasCommand = null; - // check alias of sub commands - if (name) { - aliasCommand = this.commands.filter(function(command) { - return command.alias() === name; - })[0]; - } - - if (this._execs[name] && typeof this._execs[name] !== 'function') { - return this.executeSubCommand(argv, args, parsed.unknown); - } else if (aliasCommand) { - // is alias of a subCommand - args[0] = aliasCommand._name; - return this.executeSubCommand(argv, args, parsed.unknown); - } else if (this.defaultExecutable) { - // use the default subcommand - args.unshift(this.defaultExecutable); - return this.executeSubCommand(argv, args, parsed.unknown); - } - - return result; -}; - -/** - * Execute a sub-command executable. - * - * @param {Array} argv - * @param {Array} args - * @param {Array} unknown - * @api private - */ - -Command.prototype.executeSubCommand = function(argv, args, unknown) { - args = args.concat(unknown); - - if (!args.length) this.help(); - if (args[0] === 'help' && args.length === 1) this.help(); - - // --help - if (args[0] === 'help') { - args[0] = args[1]; - args[1] = '--help'; - } - - // executable - var f = argv[1]; - // name of the subcommand, link `pm-install` - var bin = basename(f, '.js') + '-' + args[0]; - - // In case of globally installed, get the base dir where executable - // subcommand file should be located at - var baseDir, - link = fs.lstatSync(f).isSymbolicLink() ? fs.readlinkSync(f) : f; - - // when symbolink is relative path - if (link !== f && link.charAt(0) !== '/') { - link = path.join(dirname(f), link); - } - baseDir = dirname(link); - - // prefer local `./` to bin in the $PATH - var localBin = path.join(baseDir, bin); - - // whether bin file is a js script with explicit `.js` extension - var isExplicitJS = false; - if (exists(localBin + '.js')) { - bin = localBin + '.js'; - isExplicitJS = true; - } else if (exists(localBin)) { - bin = localBin; - } - - args = args.slice(1); - - var proc; - if (process.platform !== 'win32') { - if (isExplicitJS) { - args.unshift(bin); - // add executable arguments to spawn - args = (process.execArgv || []).concat(args); - - proc = spawn(process.argv[0], args, { stdio: 'inherit', customFds: [0, 1, 2] }); - } else { - proc = spawn(bin, args, { stdio: 'inherit', customFds: [0, 1, 2] }); - } - } else { - args.unshift(bin); - proc = spawn(process.execPath, args, { stdio: 'inherit' }); - } - - var signals = ['SIGUSR1', 'SIGUSR2', 'SIGTERM', 'SIGINT', 'SIGHUP']; - signals.forEach(function(signal) { - process.on(signal, function() { - if (proc.killed === false && proc.exitCode === null) { - proc.kill(signal); - } - }); - }); - proc.on('close', process.exit.bind(process)); - proc.on('error', function(err) { - if (err.code === 'ENOENT') { - console.error('\n %s(1) does not exist, try --help\n', bin); - } else if (err.code === 'EACCES') { - console.error('\n %s(1) not executable. try chmod or run with root\n', bin); - } - process.exit(1); - }); - - // Store the reference to the child process - this.runningCommand = proc; -}; - -/** - * Normalize `args`, splitting joined short flags. For example - * the arg "-abc" is equivalent to "-a -b -c". - * This also normalizes equal sign and splits "--abc=def" into "--abc def". - * - * @param {Array} args - * @return {Array} - * @api private - */ - -Command.prototype.normalize = function(args) { - var ret = [], - arg, - lastOpt, - index; - - for (var i = 0, len = args.length; i < len; ++i) { - arg = args[i]; - if (i > 0) { - lastOpt = this.optionFor(args[i - 1]); - } - - if (arg === '--') { - // Honor option terminator - ret = ret.concat(args.slice(i)); - break; - } else if (lastOpt && lastOpt.required) { - ret.push(arg); - } else if (arg.length > 1 && arg[0] === '-' && arg[1] !== '-') { - arg.slice(1).split('').forEach(function(c) { - ret.push('-' + c); - }); - } else if (/^--/.test(arg) && ~(index = arg.indexOf('='))) { - ret.push(arg.slice(0, index), arg.slice(index + 1)); - } else { - ret.push(arg); - } - } - - return ret; -}; - -/** - * Parse command `args`. - * - * When listener(s) are available those - * callbacks are invoked, otherwise the "*" - * event is emitted and those actions are invoked. - * - * @param {Array} args - * @return {Command} for chaining - * @api private - */ - -Command.prototype.parseArgs = function(args, unknown) { - var name; - - if (args.length) { - name = args[0]; - if (this.listeners('command:' + name).length) { - this.emit('command:' + args.shift(), args, unknown); - } else { - this.emit('command:*', args); - } - } else { - outputHelpIfNecessary(this, unknown); - - // If there were no args and we have unknown options, - // then they are extraneous and we need to error. - if (unknown.length > 0) { - this.unknownOption(unknown[0]); - } - } - - return this; -}; - -/** - * Return an option matching `arg` if any. - * - * @param {String} arg - * @return {Option} - * @api private - */ - -Command.prototype.optionFor = function(arg) { - for (var i = 0, len = this.options.length; i < len; ++i) { - if (this.options[i].is(arg)) { - return this.options[i]; - } - } -}; - -/** - * Parse options from `argv` returning `argv` - * void of these options. - * - * @param {Array} argv - * @return {Array} - * @api public - */ - -Command.prototype.parseOptions = function(argv) { - var args = [], - len = argv.length, - literal, - option, - arg; - - var unknownOptions = []; - - // parse options - for (var i = 0; i < len; ++i) { - arg = argv[i]; - - // literal args after -- - if (literal) { - args.push(arg); - continue; - } - - if (arg === '--') { - literal = true; - continue; - } - - // find matching Option - option = this.optionFor(arg); - - // option is defined - if (option) { - // requires arg - if (option.required) { - arg = argv[++i]; - if (arg == null) return this.optionMissingArgument(option); - this.emit('option:' + option.name(), arg); - // optional arg - } else if (option.optional) { - arg = argv[i + 1]; - if (arg == null || (arg[0] === '-' && arg !== '-')) { - arg = null; - } else { - ++i; - } - this.emit('option:' + option.name(), arg); - // bool - } else { - this.emit('option:' + option.name()); - } - continue; - } - - // looks like an option - if (arg.length > 1 && arg[0] === '-') { - unknownOptions.push(arg); - - // If the next argument looks like it might be - // an argument for this option, we pass it on. - // If it isn't, then it'll simply be ignored - if ((i + 1) < argv.length && argv[i + 1][0] !== '-') { - unknownOptions.push(argv[++i]); - } - continue; - } - - // arg - args.push(arg); - } - - return { args: args, unknown: unknownOptions }; -}; - -/** - * Return an object containing options as key-value pairs - * - * @return {Object} - * @api public - */ -Command.prototype.opts = function() { - var result = {}, - len = this.options.length; - - for (var i = 0; i < len; i++) { - var key = this.options[i].attributeName(); - result[key] = key === this._versionOptionName ? this._version : this[key]; - } - return result; -}; - -/** - * Argument `name` is missing. - * - * @param {String} name - * @api private - */ - -Command.prototype.missingArgument = function(name) { - console.error(); - console.error(" error: missing required argument `%s'", name); - console.error(); - process.exit(1); -}; - -/** - * `Option` is missing an argument, but received `flag` or nothing. - * - * @param {String} option - * @param {String} flag - * @api private - */ - -Command.prototype.optionMissingArgument = function(option, flag) { - console.error(); - if (flag) { - console.error(" error: option `%s' argument missing, got `%s'", option.flags, flag); - } else { - console.error(" error: option `%s' argument missing", option.flags); - } - console.error(); - process.exit(1); -}; - -/** - * Unknown option `flag`. - * - * @param {String} flag - * @api private - */ - -Command.prototype.unknownOption = function(flag) { - if (this._allowUnknownOption) return; - console.error(); - console.error(" error: unknown option `%s'", flag); - console.error(); - process.exit(1); -}; - -/** - * Variadic argument with `name` is not the last argument as required. - * - * @param {String} name - * @api private - */ - -Command.prototype.variadicArgNotLast = function(name) { - console.error(); - console.error(" error: variadic arguments must be last `%s'", name); - console.error(); - process.exit(1); -}; - -/** - * Set the program version to `str`. - * - * This method auto-registers the "-V, --version" flag - * which will print the version number when passed. - * - * @param {String} str - * @param {String} [flags] - * @return {Command} for chaining - * @api public - */ - -Command.prototype.version = function(str, flags) { - if (arguments.length === 0) return this._version; - this._version = str; - flags = flags || '-V, --version'; - var versionOption = new Option(flags, 'output the version number'); - this._versionOptionName = versionOption.long.substr(2) || 'version'; - this.options.push(versionOption); - this.on('option:' + this._versionOptionName, function() { - process.stdout.write(str + '\n'); - process.exit(0); - }); - return this; -}; - -/** - * Set the description to `str`. - * - * @param {String} str - * @param {Object} argsDescription - * @return {String|Command} - * @api public - */ - -Command.prototype.description = function(str, argsDescription) { - if (arguments.length === 0) return this._description; - this._description = str; - this._argsDescription = argsDescription; - return this; -}; - -/** - * Set an alias for the command - * - * @param {String} alias - * @return {String|Command} - * @api public - */ - -Command.prototype.alias = function(alias) { - var command = this; - if (this.commands.length !== 0) { - command = this.commands[this.commands.length - 1]; - } - - if (arguments.length === 0) return command._alias; - - if (alias === command._name) throw new Error('Command alias can\'t be the same as its name'); - - command._alias = alias; - return this; -}; - -/** - * Set / get the command usage `str`. - * - * @param {String} str - * @return {String|Command} - * @api public - */ - -Command.prototype.usage = function(str) { - var args = this._args.map(function(arg) { - return humanReadableArgName(arg); - }); - - var usage = '[options]' + - (this.commands.length ? ' [command]' : '') + - (this._args.length ? ' ' + args.join(' ') : ''); - - if (arguments.length === 0) return this._usage || usage; - this._usage = str; - - return this; -}; - -/** - * Get or set the name of the command - * - * @param {String} str - * @return {String|Command} - * @api public - */ - -Command.prototype.name = function(str) { - if (arguments.length === 0) return this._name; - this._name = str; - return this; -}; - -/** - * Return prepared commands. - * - * @return {Array} - * @api private - */ - -Command.prototype.prepareCommands = function() { - return this.commands.filter(function(cmd) { - return !cmd._noHelp; - }).map(function(cmd) { - var args = cmd._args.map(function(arg) { - return humanReadableArgName(arg); - }).join(' '); - - return [ - cmd._name + - (cmd._alias ? '|' + cmd._alias : '') + - (cmd.options.length ? ' [options]' : '') + - (args ? ' ' + args : ''), - cmd._description - ]; - }); -}; - -/** - * Return the largest command length. - * - * @return {Number} - * @api private - */ - -Command.prototype.largestCommandLength = function() { - var commands = this.prepareCommands(); - return commands.reduce(function(max, command) { - return Math.max(max, command[0].length); - }, 0); -}; - -/** - * Return the largest option length. - * - * @return {Number} - * @api private - */ - -Command.prototype.largestOptionLength = function() { - var options = [].slice.call(this.options); - options.push({ - flags: '-h, --help' - }); - return options.reduce(function(max, option) { - return Math.max(max, option.flags.length); - }, 0); -}; - -/** - * Return the largest arg length. - * - * @return {Number} - * @api private - */ - -Command.prototype.largestArgLength = function() { - return this._args.reduce(function(max, arg) { - return Math.max(max, arg.name.length); - }, 0); -}; - -/** - * Return the pad width. - * - * @return {Number} - * @api private - */ - -Command.prototype.padWidth = function() { - var width = this.largestOptionLength(); - if (this._argsDescription && this._args.length) { - if (this.largestArgLength() > width) { - width = this.largestArgLength(); - } - } - - if (this.commands && this.commands.length) { - if (this.largestCommandLength() > width) { - width = this.largestCommandLength(); - } - } - - return width; -}; - -/** - * Return help for options. - * - * @return {String} - * @api private - */ - -Command.prototype.optionHelp = function() { - var width = this.padWidth(); - - // Append the help information - return this.options.map(function(option) { - return pad(option.flags, width) + ' ' + option.description + - ((option.bool && option.defaultValue !== undefined) ? ' (default: ' + option.defaultValue + ')' : ''); - }).concat([pad('-h, --help', width) + ' ' + 'output usage information']) - .join('\n'); -}; - -/** - * Return command help documentation. - * - * @return {String} - * @api private - */ - -Command.prototype.commandHelp = function() { - if (!this.commands.length) return ''; - - var commands = this.prepareCommands(); - var width = this.padWidth(); - - return [ - ' Commands:', - '', - commands.map(function(cmd) { - var desc = cmd[1] ? ' ' + cmd[1] : ''; - return (desc ? pad(cmd[0], width) : cmd[0]) + desc; - }).join('\n').replace(/^/gm, ' '), - '' - ].join('\n'); -}; - -/** - * Return program help documentation. - * - * @return {String} - * @api private - */ - -Command.prototype.helpInformation = function() { - var desc = []; - if (this._description) { - desc = [ - ' ' + this._description, - '' - ]; - - var argsDescription = this._argsDescription; - if (argsDescription && this._args.length) { - var width = this.padWidth(); - desc.push(' Arguments:'); - desc.push(''); - this._args.forEach(function(arg) { - desc.push(' ' + pad(arg.name, width) + ' ' + argsDescription[arg.name]); - }); - desc.push(''); - } - } - - var cmdName = this._name; - if (this._alias) { - cmdName = cmdName + '|' + this._alias; - } - var usage = [ - '', - ' Usage: ' + cmdName + ' ' + this.usage(), - '' - ]; - - var cmds = []; - var commandHelp = this.commandHelp(); - if (commandHelp) cmds = [commandHelp]; - - var options = [ - ' Options:', - '', - '' + this.optionHelp().replace(/^/gm, ' '), - '' - ]; - - return usage - .concat(desc) - .concat(options) - .concat(cmds) - .join('\n'); -}; - -/** - * Output help information for this command - * - * @api public - */ - -Command.prototype.outputHelp = function(cb) { - if (!cb) { - cb = function(passthru) { - return passthru; - }; - } - process.stdout.write(cb(this.helpInformation())); - this.emit('--help'); -}; - -/** - * Output help information and exit. - * - * @api public - */ - -Command.prototype.help = function(cb) { - this.outputHelp(cb); - process.exit(); -}; - -/** - * Camel-case the given `flag` - * - * @param {String} flag - * @return {String} - * @api private - */ - -function camelcase(flag) { - return flag.split('-').reduce(function(str, word) { - return str + word[0].toUpperCase() + word.slice(1); - }); -} - -/** - * Pad `str` to `width`. - * - * @param {String} str - * @param {Number} width - * @return {String} - * @api private - */ - -function pad(str, width) { - var len = Math.max(0, width - str.length); - return str + Array(len + 1).join(' '); -} - -/** - * Output help information if necessary - * - * @param {Command} command to output help for - * @param {Array} array of options to search for -h or --help - * @api private - */ - -function outputHelpIfNecessary(cmd, options) { - options = options || []; - for (var i = 0; i < options.length; i++) { - if (options[i] === '--help' || options[i] === '-h') { - cmd.outputHelp(); - process.exit(0); - } - } -} - -/** - * Takes an argument an returns its human readable equivalent for help usage. - * - * @param {Object} arg - * @return {String} - * @api private - */ - -function humanReadableArgName(arg) { - var nameOutput = arg.name + (arg.variadic === true ? '...' : ''); - - return arg.required - ? '<' + nameOutput + '>' - : '[' + nameOutput + ']'; -} - -// for versions before node v0.8 when there weren't `fs.existsSync` -function exists(file) { - try { - if (fs.statSync(file).isFile()) { - return true; - } - } catch (e) { - return false; - } -} diff --git a/node_modules/wscat/node_modules/commander/package.json b/node_modules/wscat/node_modules/commander/package.json deleted file mode 100644 index f97a11c..0000000 --- a/node_modules/wscat/node_modules/commander/package.json +++ /dev/null @@ -1,90 +0,0 @@ -{ - "name": "commander", - "version": "2.15.1", - "description": "the complete solution for node.js command-line programs", - "keywords": [ - "commander", - "command", - "option", - "parser" - ], - "author": { - "name": "TJ Holowaychuk", - "email": "tj@vision-media.ca" - }, - "license": "MIT", - "repository": { - "type": "git", - "url": "git+https://github.com/tj/commander.js.git" - }, - "scripts": { - "lint": "eslint index.js", - "test": "make test && npm run test-typings", - "test-typings": "node_modules/typescript/bin/tsc -p tsconfig.json" - }, - "main": "index", - "files": [ - "index.js", - "typings/index.d.ts" - ], - "dependencies": {}, - "devDependencies": { - "@types/node": "^7.0.55", - "eslint": "^3.19.0", - "should": "^11.2.1", - "sinon": "^2.4.1", - "standard": "^10.0.3", - "typescript": "^2.7.2" - }, - "typings": "typings/index.d.ts", - "gitHead": "649eaef336ddc7224eb5c73e4a958685e24de25e", - "bugs": { - "url": "https://github.com/tj/commander.js/issues" - }, - "homepage": "https://github.com/tj/commander.js#readme", - "_id": "commander@2.15.1", - "_npmVersion": "5.6.0", - "_nodeVersion": "9.8.0", - "_npmUser": { - "name": "abetomo", - "email": "abe@enzou.tokyo" - }, - "dist": { - "integrity": "sha512-VlfT9F3V0v+jr4yxPc5gg9s62/fIVWsd2Bk2iD435um1NlGMYdVCq+MjcXnhYq2icNOizHr1kK+5TI6H0Hy0ag==", - "shasum": "df46e867d0fc2aec66a34662b406a9ccafff5b0f", - "tarball": "https://registry.npmjs.org/commander/-/commander-2.15.1.tgz", - "fileCount": 6, - "unpackedSize": 59781 - }, - "maintainers": [ - { - "email": "abe@enzou.tokyo", - "name": "abetomo" - }, - { - "email": "rkoutnik@gmail.com", - "name": "somekittens" - }, - { - "email": "tj@vision-media.ca", - "name": "tjholowaychuk" - }, - { - "email": "romain.vanesyan@gmail.com", - "name": "vanesyan" - }, - { - "email": "zhiyelee@gmail.com", - "name": "zhiyelee" - } - ], - "directories": {}, - "_npmOperationalInternal": { - "host": "s3://npm-registry-packages", - "tmp": "tmp/commander_2.15.1_1521510442790_0.20361588610282877" - }, - "_hasShrinkwrap": false, - "_shasum": "df46e867d0fc2aec66a34662b406a9ccafff5b0f", - "_from": "commander@~2.15.0", - "_resolved": "https://registry.npmjs.org/commander/-/commander-2.15.1.tgz" -} diff --git a/node_modules/wscat/node_modules/commander/typings/index.d.ts b/node_modules/wscat/node_modules/commander/typings/index.d.ts deleted file mode 100644 index 4830767..0000000 --- a/node_modules/wscat/node_modules/commander/typings/index.d.ts +++ /dev/null @@ -1,309 +0,0 @@ -// Type definitions for commander 2.11 -// Project: https://github.com/visionmedia/commander.js -// Definitions by: Alan Agius , Marcelo Dezem , vvakame , Jules Randolph -// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped - -declare namespace local { - - class Option { - flags: string; - required: boolean; - optional: boolean; - bool: boolean; - short?: string; - long: string; - description: string; - - /** - * Initialize a new `Option` with the given `flags` and `description`. - * - * @param {string} flags - * @param {string} [description] - */ - constructor(flags: string, description?: string); - } - - class Command extends NodeJS.EventEmitter { - [key: string]: any; - - args: string[]; - - /** - * Initialize a new `Command`. - * - * @param {string} [name] - */ - constructor(name?: string); - - /** - * Set the program version to `str`. - * - * This method auto-registers the "-V, --version" flag - * which will print the version number when passed. - * - * @param {string} str - * @param {string} [flags] - * @returns {Command} for chaining - */ - version(str: string, flags?: string): Command; - - /** - * Add command `name`. - * - * The `.action()` callback is invoked when the - * command `name` is specified via __ARGV__, - * and the remaining arguments are applied to the - * function for access. - * - * When the `name` is "*" an un-matched command - * will be passed as the first arg, followed by - * the rest of __ARGV__ remaining. - * - * @example - * program - * .version('0.0.1') - * .option('-C, --chdir ', 'change the working directory') - * .option('-c, --config ', 'set config path. defaults to ./deploy.conf') - * .option('-T, --no-tests', 'ignore test hook') - * - * program - * .command('setup') - * .description('run remote setup commands') - * .action(function() { - * console.log('setup'); - * }); - * - * program - * .command('exec ') - * .description('run the given remote command') - * .action(function(cmd) { - * console.log('exec "%s"', cmd); - * }); - * - * program - * .command('teardown [otherDirs...]') - * .description('run teardown commands') - * .action(function(dir, otherDirs) { - * console.log('dir "%s"', dir); - * if (otherDirs) { - * otherDirs.forEach(function (oDir) { - * console.log('dir "%s"', oDir); - * }); - * } - * }); - * - * program - * .command('*') - * .description('deploy the given env') - * .action(function(env) { - * console.log('deploying "%s"', env); - * }); - * - * program.parse(process.argv); - * - * @param {string} name - * @param {string} [desc] for git-style sub-commands - * @param {CommandOptions} [opts] command options - * @returns {Command} the new command - */ - command(name: string, desc?: string, opts?: commander.CommandOptions): Command; - - /** - * Define argument syntax for the top-level command. - * - * @param {string} desc - * @returns {Command} for chaining - */ - arguments(desc: string): Command; - - /** - * Parse expected `args`. - * - * For example `["[type]"]` becomes `[{ required: false, name: 'type' }]`. - * - * @param {string[]} args - * @returns {Command} for chaining - */ - parseExpectedArgs(args: string[]): Command; - - /** - * Register callback `fn` for the command. - * - * @example - * program - * .command('help') - * .description('display verbose help') - * .action(function() { - * // output help here - * }); - * - * @param {(...args: any[]) => void} fn - * @returns {Command} for chaining - */ - action(fn: (...args: any[]) => void): Command; - - /** - * Define option with `flags`, `description` and optional - * coercion `fn`. - * - * The `flags` string should contain both the short and long flags, - * separated by comma, a pipe or space. The following are all valid - * all will output this way when `--help` is used. - * - * "-p, --pepper" - * "-p|--pepper" - * "-p --pepper" - * - * @example - * // simple boolean defaulting to false - * program.option('-p, --pepper', 'add pepper'); - * - * --pepper - * program.pepper - * // => Boolean - * - * // simple boolean defaulting to true - * program.option('-C, --no-cheese', 'remove cheese'); - * - * program.cheese - * // => true - * - * --no-cheese - * program.cheese - * // => false - * - * // required argument - * program.option('-C, --chdir ', 'change the working directory'); - * - * --chdir /tmp - * program.chdir - * // => "/tmp" - * - * // optional argument - * program.option('-c, --cheese [type]', 'add cheese [marble]'); - * - * @param {string} flags - * @param {string} [description] - * @param {((arg1: any, arg2: any) => void) | RegExp} [fn] function or default - * @param {*} [defaultValue] - * @returns {Command} for chaining - */ - option(flags: string, description?: string, fn?: ((arg1: any, arg2: any) => void) | RegExp, defaultValue?: any): Command; - option(flags: string, description?: string, defaultValue?: any): Command; - - /** - * Allow unknown options on the command line. - * - * @param {boolean} [arg] if `true` or omitted, no error will be thrown for unknown options. - * @returns {Command} for chaining - */ - allowUnknownOption(arg?: boolean): Command; - - /** - * Parse `argv`, settings options and invoking commands when defined. - * - * @param {string[]} argv - * @returns {Command} for chaining - */ - parse(argv: string[]): Command; - - /** - * Parse options from `argv` returning `argv` void of these options. - * - * @param {string[]} argv - * @returns {ParseOptionsResult} - */ - parseOptions(argv: string[]): commander.ParseOptionsResult; - - /** - * Return an object containing options as key-value pairs - * - * @returns {{[key: string]: string}} - */ - opts(): { [key: string]: string }; - - /** - * Set the description to `str`. - * - * @param {string} str - * @return {(Command | string)} - */ - description(str: string): Command; - description(): string; - - /** - * Set an alias for the command. - * - * @param {string} alias - * @return {(Command | string)} - */ - alias(alias: string): Command; - alias(): string; - - /** - * Set or get the command usage. - * - * @param {string} str - * @return {(Command | string)} - */ - usage(str: string): Command; - usage(): string; - - /** - * Set the name of the command. - * - * @param {string} str - * @return {Command} - */ - name(str: string): Command; - - /** - * Get the name of the command. - * - * @return {string} - */ - name(): string; - - /** - * Output help information for this command. - * - * @param {(str: string) => string} [cb] - */ - outputHelp(cb?: (str: string) => string): void; - - /** Output help information and exit. - * - * @param {(str: string) => string} [cb] - */ - help(cb?: (str: string) => string): void; - } - -} - -declare namespace commander { - - type Command = local.Command - - type Option = local.Option - - interface CommandOptions { - noHelp?: boolean; - isDefault?: boolean; - } - - interface ParseOptionsResult { - args: string[]; - unknown: string[]; - } - - interface CommanderStatic extends Command { - Command: typeof local.Command; - Option: typeof local.Option; - CommandOptions: CommandOptions; - ParseOptionsResult: ParseOptionsResult; - } - -} - -declare const commander: commander.CommanderStatic; -export = commander; diff --git a/node_modules/wscat/node_modules/read/LICENSE b/node_modules/wscat/node_modules/read/LICENSE deleted file mode 100644 index 19129e3..0000000 --- a/node_modules/wscat/node_modules/read/LICENSE +++ /dev/null @@ -1,15 +0,0 @@ -The ISC License - -Copyright (c) Isaac Z. Schlueter and Contributors - -Permission to use, copy, modify, and/or distribute this software for any -purpose with or without fee is hereby granted, provided that the above -copyright notice and this permission notice appear in all copies. - -THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES -WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF -MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR -ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES -WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN -ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR -IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. diff --git a/node_modules/wscat/node_modules/read/README.md b/node_modules/wscat/node_modules/read/README.md deleted file mode 100644 index 5967fad..0000000 --- a/node_modules/wscat/node_modules/read/README.md +++ /dev/null @@ -1,53 +0,0 @@ -## read - -For reading user input from stdin. - -Similar to the `readline` builtin's `question()` method, but with a -few more features. - -## USAGE - -```javascript -var read = require("read") -read(options, callback) -``` - -The callback gets called with either the user input, or the default -specified, or an error, as `callback(error, result, isDefault)` -node style. - -## OPTIONS - -Every option is optional. - -* `prompt` What to write to stdout before reading input. -* `silent` Don't echo the output as the user types it. -* `replace` Replace silenced characters with the supplied character value. -* `timeout` Number of ms to wait for user input before giving up. -* `default` The default value if the user enters nothing. -* `edit` Allow the user to edit the default value. -* `terminal` Treat the output as a TTY, whether it is or not. -* `input` Readable stream to get input data from. (default `process.stdin`) -* `output` Writeable stream to write prompts to. (default: `process.stdout`) - -If silent is true, and the input is a TTY, then read will set raw -mode, and read character by character. - -## COMPATIBILITY - -This module works sort of with node 0.6. It does not work with node -versions less than 0.6. It is best on node 0.8. - -On node version 0.6, it will remove all listeners on the input -stream's `data` and `keypress` events, because the readline module did -not fully clean up after itself in that version of node, and did not -make it possible to clean up after it in a way that has no potential -for side effects. - -Additionally, some of the readline options (like `terminal`) will not -function in versions of node before 0.8, because they were not -implemented in the builtin readline module. - -## CONTRIBUTING - -Patches welcome. diff --git a/node_modules/wscat/node_modules/read/lib/read.js b/node_modules/wscat/node_modules/read/lib/read.js deleted file mode 100644 index a93d1b3..0000000 --- a/node_modules/wscat/node_modules/read/lib/read.js +++ /dev/null @@ -1,113 +0,0 @@ - -module.exports = read - -var readline = require('readline') -var Mute = require('mute-stream') - -function read (opts, cb) { - if (opts.num) { - throw new Error('read() no longer accepts a char number limit') - } - - if (typeof opts.default !== 'undefined' && - typeof opts.default !== 'string' && - typeof opts.default !== 'number') { - throw new Error('default value must be string or number') - } - - var input = opts.input || process.stdin - var output = opts.output || process.stdout - var prompt = (opts.prompt || '').trim() + ' ' - var silent = opts.silent - var editDef = false - var timeout = opts.timeout - - var def = opts.default || '' - if (def) { - if (silent) { - prompt += '(