passenger 5.0.21 → 5.0.22

Sign up to get free protection for your applications and to get access to all the features.

Potentially problematic release.


This version of passenger might be problematic. Click here for more details.

Files changed (203) hide show
  1. checksums.yaml +8 -8
  2. checksums.yaml.gz.asc +7 -7
  3. data.tar.gz.asc +7 -7
  4. data/CHANGELOG +38 -2
  5. data/CONTRIBUTORS +3 -0
  6. data/README.md +5 -1
  7. data/bin/passenger-status +2 -7
  8. data/build/agent.rb +2 -0
  9. data/build/cxx_dependency_map.rb +1464 -162
  10. data/build/node_tests.rb +1 -1
  11. data/build/packaging.rb +1 -1
  12. data/dev/ci/run_travis.sh +1 -1
  13. data/dev/vagrant/provision.sh +1 -1
  14. data/npm-shrinkwrap.json +635 -125
  15. data/package.json +1 -1
  16. data/resources/templates/standalone/config.erb +33 -161
  17. data/resources/templates/standalone/global.erb +15 -0
  18. data/resources/templates/standalone/http.erb +40 -0
  19. data/resources/templates/standalone/mass_deployment_default_server.erb +11 -0
  20. data/resources/templates/standalone/rails_asset_pipeline.erb +22 -0
  21. data/resources/templates/standalone/server.erb +58 -0
  22. data/src/agent/Core/ApiServer.h +37 -32
  23. data/src/agent/Core/ApplicationPool/BasicGroupInfo.h +1 -1
  24. data/src/agent/Core/ApplicationPool/BasicProcessInfo.h +6 -0
  25. data/src/agent/Core/ApplicationPool/Common.h +1 -1
  26. data/src/agent/Core/ApplicationPool/Group/OutOfBandWork.cpp +1 -1
  27. data/src/agent/Core/ApplicationPool/Group/ProcessListManagement.cpp +4 -0
  28. data/src/agent/Core/ApplicationPool/Implementation.cpp +2 -2
  29. data/src/agent/Core/ApplicationPool/Options.h +18 -1
  30. data/src/agent/Core/ApplicationPool/Pool.h +1 -1
  31. data/src/agent/Core/ApplicationPool/Pool/AnalyticsCollection.cpp +6 -6
  32. data/src/agent/Core/ApplicationPool/Pool/GeneralUtils.cpp +3 -3
  33. data/src/agent/Core/ApplicationPool/Pool/InitializationAndShutdown.cpp +1 -1
  34. data/src/agent/Core/ApplicationPool/Pool/Miscellaneous.cpp +6 -0
  35. data/src/agent/Core/ApplicationPool/Process.h +6 -1
  36. data/src/agent/Core/ApplicationPool/Socket.h +9 -12
  37. data/src/agent/Core/Controller.h +422 -0
  38. data/src/agent/Core/{RequestHandler → Controller}/AppResponse.h +2 -0
  39. data/src/agent/Core/{RequestHandler → Controller}/BufferBody.cpp +27 -5
  40. data/src/agent/Core/{RequestHandler → Controller}/CheckoutSession.cpp +61 -31
  41. data/src/agent/Core/{RequestHandler → Controller}/Client.h +5 -2
  42. data/src/agent/Core/{RequestHandler → Controller}/ForwardResponse.cpp +93 -42
  43. data/src/agent/Core/{RequestHandler → Controller}/Hooks.cpp +107 -60
  44. data/src/agent/Core/Controller/Implementation.cpp +38 -0
  45. data/src/agent/Core/{RequestHandler → Controller}/InitRequest.cpp +134 -80
  46. data/src/agent/Core/Controller/InitializationAndShutdown.cpp +165 -0
  47. data/src/agent/Core/{RequestHandler/Utils.cpp → Controller/InternalUtils.cpp} +49 -32
  48. data/src/agent/Core/Controller/Miscellaneous.cpp +116 -0
  49. data/src/agent/Core/{RequestHandler → Controller}/Request.h +6 -4
  50. data/src/agent/Core/{RequestHandler → Controller}/SendRequest.cpp +205 -130
  51. data/src/agent/Core/Controller/StateInspectionAndConfiguration.cpp +161 -0
  52. data/src/agent/Core/{RequestHandler → Controller}/TurboCaching.h +3 -0
  53. data/src/agent/Core/CoreMain.cpp +62 -51
  54. data/src/agent/Core/OptionParser.h +24 -0
  55. data/src/agent/Core/ResponseCache.h +5 -5
  56. data/src/agent/Core/SpawningKit/Config.h +2 -2
  57. data/src/agent/Core/SpawningKit/SmartSpawner.h +1 -1
  58. data/src/agent/Core/UnionStation/{Core.h → Context.h} +14 -18
  59. data/src/agent/Core/UnionStation/StopwatchLog.h +3 -2
  60. data/src/agent/Core/UnionStation/Transaction.h +7 -7
  61. data/src/agent/Shared/ApiServerUtils.h +9 -1
  62. data/src/agent/UstRouter/ApiServer.h +5 -2
  63. data/src/agent/UstRouter/Controller.h +27 -9
  64. data/src/agent/UstRouter/UstRouterMain.cpp +1 -0
  65. data/src/agent/Watchdog/ApiServer.h +5 -2
  66. data/src/apache2_module/ConfigurationCommands.cpp +7 -0
  67. data/src/apache2_module/ConfigurationFields.hpp +2 -0
  68. data/src/apache2_module/ConfigurationSetters.cpp +24 -0
  69. data/src/apache2_module/CreateDirConfig.cpp +1 -0
  70. data/src/apache2_module/Hooks.cpp +6 -5
  71. data/src/apache2_module/MergeDirConfig.cpp +7 -0
  72. data/src/apache2_module/SetHeaders.cpp +5 -0
  73. data/src/cxx_supportlib/Constants.h +5 -3
  74. data/src/cxx_supportlib/SafeLibev.h +2 -1
  75. data/src/cxx_supportlib/UnionStationFilterSupport.h +2 -1
  76. data/src/cxx_supportlib/Utils/ReleaseableScopedPointer.h +70 -0
  77. data/src/cxx_supportlib/vendor-modified/boost/libs/regex/src/regex_raw_buffer.cpp +6 -6
  78. data/src/helper-scripts/node-loader.js +59 -0
  79. data/src/nginx_module/CacheLocationConfig.c +48 -0
  80. data/src/nginx_module/ConfigurationCommands.c +20 -0
  81. data/src/nginx_module/ConfigurationFields.h +4 -0
  82. data/src/nginx_module/CreateLocationConfig.c +8 -0
  83. data/src/nginx_module/MergeLocationConfig.c +12 -0
  84. data/src/nodejs_supportlib/phusion_passenger/log_express.js +106 -0
  85. data/src/nodejs_supportlib/phusion_passenger/log_mongodb.js +203 -0
  86. data/src/nodejs_supportlib/phusion_passenger/ustreporter.js +227 -0
  87. data/src/nodejs_supportlib/phusion_passenger/ustrouter_connector.js +446 -0
  88. data/src/nodejs_supportlib/vendor-copy/codify/codify.js +44 -0
  89. data/src/nodejs_supportlib/vendor-copy/codify/package.json +29 -0
  90. data/src/nodejs_supportlib/vendor-copy/continuation-local-storage/context.js +200 -0
  91. data/src/nodejs_supportlib/vendor-copy/continuation-local-storage/node_modules/async-listener/glue.js +488 -0
  92. data/src/nodejs_supportlib/vendor-copy/continuation-local-storage/node_modules/async-listener/index.js +407 -0
  93. data/src/nodejs_supportlib/vendor-copy/continuation-local-storage/node_modules/async-listener/node_modules/shimmer/index.js +90 -0
  94. data/src/nodejs_supportlib/vendor-copy/continuation-local-storage/node_modules/async-listener/node_modules/shimmer/package.json +40 -0
  95. data/src/nodejs_supportlib/vendor-copy/continuation-local-storage/node_modules/async-listener/package.json +54 -0
  96. data/src/nodejs_supportlib/vendor-copy/continuation-local-storage/node_modules/emitter-listener/listener.js +160 -0
  97. data/src/nodejs_supportlib/vendor-copy/continuation-local-storage/node_modules/emitter-listener/node_modules/shimmer/index.js +90 -0
  98. data/src/nodejs_supportlib/vendor-copy/continuation-local-storage/node_modules/emitter-listener/node_modules/shimmer/package.json +40 -0
  99. data/src/nodejs_supportlib/vendor-copy/continuation-local-storage/node_modules/emitter-listener/package.json +46 -0
  100. data/src/nodejs_supportlib/vendor-copy/continuation-local-storage/package.json +56 -0
  101. data/src/nodejs_supportlib/vendor-copy/network-byte-order/lib/index.js +102 -0
  102. data/src/nodejs_supportlib/vendor-copy/network-byte-order/package.json +51 -0
  103. data/src/nodejs_supportlib/vendor-copy/winston/LICENSE +19 -0
  104. data/src/nodejs_supportlib/vendor-copy/winston/lib/winston.js +165 -0
  105. data/src/nodejs_supportlib/vendor-copy/winston/lib/winston/common.js +483 -0
  106. data/src/nodejs_supportlib/vendor-copy/winston/lib/winston/config.js +62 -0
  107. data/src/nodejs_supportlib/vendor-copy/winston/lib/winston/config/cli-config.js +35 -0
  108. data/src/nodejs_supportlib/vendor-copy/winston/lib/winston/config/npm-config.js +27 -0
  109. data/src/nodejs_supportlib/vendor-copy/winston/lib/winston/config/syslog-config.js +31 -0
  110. data/src/nodejs_supportlib/vendor-copy/winston/lib/winston/container.js +127 -0
  111. data/src/nodejs_supportlib/vendor-copy/winston/lib/winston/exception.js +56 -0
  112. data/src/nodejs_supportlib/vendor-copy/winston/lib/winston/logger.js +701 -0
  113. data/src/nodejs_supportlib/vendor-copy/winston/lib/winston/transports.js +34 -0
  114. data/src/nodejs_supportlib/vendor-copy/winston/lib/winston/transports/console.js +128 -0
  115. data/src/nodejs_supportlib/vendor-copy/winston/lib/winston/transports/daily-rotate-file.js +601 -0
  116. data/src/nodejs_supportlib/vendor-copy/winston/lib/winston/transports/file.js +675 -0
  117. data/src/nodejs_supportlib/vendor-copy/winston/lib/winston/transports/http.js +232 -0
  118. data/src/nodejs_supportlib/vendor-copy/winston/lib/winston/transports/memory.js +89 -0
  119. data/src/nodejs_supportlib/vendor-copy/winston/lib/winston/transports/transport.js +135 -0
  120. data/src/nodejs_supportlib/vendor-copy/winston/lib/winston/transports/webhook.js +146 -0
  121. data/src/nodejs_supportlib/vendor-copy/winston/node_modules/async/LICENSE +19 -0
  122. data/src/nodejs_supportlib/vendor-copy/winston/node_modules/async/lib/async.js +1283 -0
  123. data/src/nodejs_supportlib/vendor-copy/winston/node_modules/async/package.json +66 -0
  124. data/src/nodejs_supportlib/vendor-copy/winston/node_modules/async/support/sync-package-managers.js +53 -0
  125. data/src/nodejs_supportlib/vendor-copy/winston/node_modules/colors/MIT-LICENSE.txt +23 -0
  126. data/src/nodejs_supportlib/vendor-copy/winston/node_modules/colors/lib/colors.js +176 -0
  127. data/src/nodejs_supportlib/vendor-copy/winston/node_modules/colors/lib/custom/trap.js +45 -0
  128. data/src/nodejs_supportlib/vendor-copy/winston/node_modules/colors/lib/custom/zalgo.js +104 -0
  129. data/src/nodejs_supportlib/vendor-copy/winston/node_modules/colors/lib/extendStringPrototype.js +118 -0
  130. data/src/nodejs_supportlib/vendor-copy/winston/node_modules/colors/lib/index.js +12 -0
  131. data/src/nodejs_supportlib/vendor-copy/winston/node_modules/colors/lib/maps/america.js +12 -0
  132. data/src/nodejs_supportlib/vendor-copy/winston/node_modules/colors/lib/maps/rainbow.js +13 -0
  133. data/src/nodejs_supportlib/vendor-copy/winston/node_modules/colors/lib/maps/random.js +8 -0
  134. data/src/nodejs_supportlib/vendor-copy/winston/node_modules/colors/lib/maps/zebra.js +5 -0
  135. data/src/nodejs_supportlib/vendor-copy/winston/node_modules/colors/lib/styles.js +77 -0
  136. data/src/nodejs_supportlib/vendor-copy/winston/node_modules/colors/lib/system/supports-colors.js +61 -0
  137. data/src/nodejs_supportlib/vendor-copy/winston/node_modules/colors/package.json +35 -0
  138. data/src/nodejs_supportlib/vendor-copy/winston/node_modules/colors/safe.js +9 -0
  139. data/src/nodejs_supportlib/vendor-copy/winston/node_modules/colors/themes/generic-logging.js +12 -0
  140. data/src/nodejs_supportlib/vendor-copy/winston/node_modules/cycle/cycle.js +170 -0
  141. data/src/nodejs_supportlib/vendor-copy/winston/node_modules/cycle/package.json +30 -0
  142. data/src/nodejs_supportlib/vendor-copy/winston/node_modules/eyes/LICENSE +20 -0
  143. data/src/nodejs_supportlib/vendor-copy/winston/node_modules/eyes/lib/eyes.js +236 -0
  144. data/src/nodejs_supportlib/vendor-copy/winston/node_modules/eyes/package.json +42 -0
  145. data/src/nodejs_supportlib/vendor-copy/winston/node_modules/isstream/LICENSE.md +11 -0
  146. data/src/nodejs_supportlib/vendor-copy/winston/node_modules/isstream/isstream.js +27 -0
  147. data/src/nodejs_supportlib/vendor-copy/winston/node_modules/isstream/package.json +42 -0
  148. data/src/nodejs_supportlib/vendor-copy/winston/node_modules/pkginfo/LICENSE +19 -0
  149. data/src/nodejs_supportlib/vendor-copy/winston/node_modules/pkginfo/lib/pkginfo.js +136 -0
  150. data/src/nodejs_supportlib/vendor-copy/winston/node_modules/pkginfo/package.json +56 -0
  151. data/src/nodejs_supportlib/vendor-copy/winston/node_modules/stack-trace/License +19 -0
  152. data/src/nodejs_supportlib/vendor-copy/winston/node_modules/stack-trace/lib/stack-trace.js +111 -0
  153. data/src/nodejs_supportlib/vendor-copy/winston/node_modules/stack-trace/package.json +33 -0
  154. data/src/nodejs_supportlib/vendor-copy/winston/package.json +87 -0
  155. data/src/ruby_supportlib/phusion_passenger.rb +3 -4
  156. data/src/ruby_supportlib/phusion_passenger/admin_tools/instance.rb +19 -2
  157. data/src/ruby_supportlib/phusion_passenger/apache2/config_options.rb +8 -0
  158. data/src/ruby_supportlib/phusion_passenger/config/list_instances_command.rb +2 -6
  159. data/src/ruby_supportlib/phusion_passenger/config/reopen_logs_command.rb +13 -0
  160. data/src/ruby_supportlib/phusion_passenger/config/restart_app_command.rb +3 -0
  161. data/src/ruby_supportlib/phusion_passenger/config/utils.rb +9 -7
  162. data/src/ruby_supportlib/phusion_passenger/config/validate_install_command.rb +8 -1
  163. data/src/ruby_supportlib/phusion_passenger/constants.rb +3 -1
  164. data/src/ruby_supportlib/phusion_passenger/native_support.rb +20 -4
  165. data/src/ruby_supportlib/phusion_passenger/nginx/config_options.rb +8 -0
  166. data/src/ruby_supportlib/phusion_passenger/packaging.rb +1 -0
  167. data/src/ruby_supportlib/phusion_passenger/platform_info/apache_detector.rb +1 -1
  168. data/src/ruby_supportlib/phusion_passenger/platform_info/operating_system.rb +11 -4
  169. data/src/ruby_supportlib/phusion_passenger/rack/thread_handler_extension.rb +1 -1
  170. data/src/ruby_supportlib/phusion_passenger/standalone/config_options_list.rb +647 -0
  171. data/src/ruby_supportlib/phusion_passenger/standalone/config_utils.rb +229 -15
  172. data/src/ruby_supportlib/phusion_passenger/standalone/start_command.rb +35 -323
  173. data/src/ruby_supportlib/phusion_passenger/standalone/start_command/builtin_engine.rb +36 -12
  174. data/src/ruby_supportlib/phusion_passenger/standalone/start_command/nginx_engine.rb +123 -14
  175. data/src/ruby_supportlib/phusion_passenger/standalone/status_command.rb +32 -17
  176. data/src/ruby_supportlib/phusion_passenger/standalone/stop_command.rb +32 -21
  177. data/src/ruby_supportlib/phusion_passenger/standalone/version_command.rb +5 -5
  178. data/src/ruby_supportlib/phusion_passenger/vendor/union_station_hooks_core/README.md +2 -2
  179. data/src/ruby_supportlib/phusion_passenger/vendor/union_station_hooks_core/Rakefile +5 -1
  180. data/src/ruby_supportlib/phusion_passenger/vendor/union_station_hooks_core/lib/union_station_hooks_core.rb +68 -24
  181. data/src/ruby_supportlib/phusion_passenger/vendor/union_station_hooks_core/lib/union_station_hooks_core/api.rb +9 -1
  182. data/src/ruby_supportlib/phusion_passenger/vendor/union_station_hooks_core/lib/union_station_hooks_core/context.rb +9 -7
  183. data/src/ruby_supportlib/phusion_passenger/vendor/union_station_hooks_core/lib/union_station_hooks_core/request_reporter.rb +3 -2
  184. data/src/ruby_supportlib/phusion_passenger/vendor/union_station_hooks_core/lib/union_station_hooks_core/request_reporter/basics.rb +8 -5
  185. data/src/ruby_supportlib/phusion_passenger/vendor/union_station_hooks_core/lib/union_station_hooks_core/simple_json.rb +395 -0
  186. data/src/ruby_supportlib/phusion_passenger/vendor/union_station_hooks_core/lib/union_station_hooks_core/transaction.rb +10 -7
  187. data/src/ruby_supportlib/phusion_passenger/vendor/union_station_hooks_core/lib/union_station_hooks_core/utils.rb +14 -0
  188. data/src/ruby_supportlib/phusion_passenger/vendor/union_station_hooks_core/lib/union_station_hooks_core/version_data.rb +2 -2
  189. data/src/ruby_supportlib/phusion_passenger/vendor/union_station_hooks_core/ruby_versions.yml +4 -2
  190. data/src/ruby_supportlib/phusion_passenger/vendor/union_station_hooks_core/ruby_versions.yml.example +2 -2
  191. data/src/ruby_supportlib/phusion_passenger/vendor/union_station_hooks_core/ruby_versions.yml.travis +2 -2
  192. data/src/ruby_supportlib/phusion_passenger/vendor/union_station_hooks_core/ruby_versions.yml.travis-with-sudo +16 -0
  193. data/src/ruby_supportlib/phusion_passenger/vendor/union_station_hooks_rails/Gemfile +1 -1
  194. data/src/ruby_supportlib/phusion_passenger/vendor/union_station_hooks_rails/Gemfile.lock +2 -2
  195. data/src/ruby_supportlib/phusion_passenger/vendor/union_station_hooks_rails/README.md +1 -1
  196. data/src/ruby_supportlib/phusion_passenger/vendor/union_station_hooks_rails/lib/union_station_hooks_rails.rb +44 -17
  197. data/src/ruby_supportlib/phusion_passenger/vendor/union_station_hooks_rails/lib/union_station_hooks_rails/active_support_cache_subscriber.rb +16 -7
  198. data/src/ruby_supportlib/phusion_passenger/vendor/union_station_hooks_rails/lib/union_station_hooks_rails/version_data.rb +2 -2
  199. data/src/ruby_supportlib/phusion_passenger/vendor/union_station_hooks_rails/union_station_hooks_rails.gemspec +1 -1
  200. metadata +99 -16
  201. metadata.gz.asc +7 -7
  202. data/resources/oss-binaries.phusionpassenger.com.crt +0 -248
  203. data/src/agent/Core/RequestHandler.h +0 -471
@@ -0,0 +1,30 @@
1
+ {
2
+ "name": "cycle",
3
+ "description": "decycle your json",
4
+ "author": "",
5
+ "version": "1.0.3",
6
+ "main": "./cycle.js",
7
+ "homepage": "https://github.com/douglascrockford/JSON-js",
8
+ "repository": {
9
+ "type": "git",
10
+ "url": "git+ssh://git@github.com/dscape/cycle.git"
11
+ },
12
+ "bugs": {
13
+ "url": "http://github.com/douglascrockford/JSON-js/issues"
14
+ },
15
+ "keywords": [
16
+ "json",
17
+ "cycle",
18
+ "stringify",
19
+ "parse"
20
+ ],
21
+ "engines": {
22
+ "node": ">=0.4.0"
23
+ },
24
+ "readme": "Fork of https://github.com/douglascrockford/JSON-js, maintained in npm as `cycle`.\n\n# Contributors\n\n* Douglas Crockford\n* Nuno Job\n* Justin Warkentin\n\n# JSON in JavaScript\n\nDouglas Crockford\ndouglas@crockford.com\n\n2010-11-18\n\n\nJSON is a light-weight, language independent, data interchange format.\nSee http://www.JSON.org/\n\nThe files in this collection implement JSON encoders/decoders in JavaScript.\n\nJSON became a built-in feature of JavaScript when the ECMAScript Programming\nLanguage Standard - Fifth Edition was adopted by the ECMA General Assembly\nin December 2009. Most of the files in this collection are for applications\nthat are expected to run in obsolete web browsers. For most purposes, json2.js\nis the best choice.\n\n\njson2.js: This file creates a JSON property in the global object, if there\nisn't already one, setting its value to an object containing a stringify\nmethod and a parse method. The parse method uses the eval method to do the\nparsing, guarding it with several regular expressions to defend against\naccidental code execution hazards. On current browsers, this file does nothing,\nprefering the built-in JSON object.\n\njson.js: This file does everything that json2.js does. It also adds a\ntoJSONString method and a parseJSON method to Object.prototype. Use of this\nfile is not recommended.\n\njson_parse.js: This file contains an alternative JSON parse function that\nuses recursive descent instead of eval.\n\njson_parse_state.js: This files contains an alternative JSON parse function that\nuses a state machine instead of eval.\n\ncycle.js: This file contains two functions, JSON.decycle and JSON.retrocycle,\nwhich make it possible to encode cyclical structures and dags in JSON, and to\nthen recover them. JSONPath is used to represent the links.\nhttp://GOESSNER.net/articles/JsonPath/\n",
25
+ "readmeFilename": "README.md",
26
+ "_id": "cycle@1.0.3",
27
+ "_shasum": "21e80b2be8580f98b468f379430662b046c34ad2",
28
+ "_from": "cycle@1.0.x",
29
+ "_resolved": "https://registry.npmjs.org/cycle/-/cycle-1.0.3.tgz"
30
+ }
@@ -0,0 +1,20 @@
1
+ Copyright (c) 2009 cloudhead
2
+
3
+ Permission is hereby granted, free of charge, to any person obtaining
4
+ a copy of this software and associated documentation files (the
5
+ "Software"), to deal in the Software without restriction, including
6
+ without limitation the rights to use, copy, modify, merge, publish,
7
+ distribute, sublicense, and/or sell copies of the Software, and to
8
+ permit persons to whom the Software is furnished to do so, subject to
9
+ the following conditions:
10
+
11
+ The above copyright notice and this permission notice shall be
12
+ included in all copies or substantial portions of the Software.
13
+
14
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
15
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
17
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
18
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
19
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
20
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
@@ -0,0 +1,236 @@
1
+ //
2
+ // Eyes.js - a customizable value inspector for Node.js
3
+ //
4
+ // usage:
5
+ //
6
+ // var inspect = require('eyes').inspector({styles: {all: 'magenta'}});
7
+ // inspect(something); // inspect with the settings passed to `inspector`
8
+ //
9
+ // or
10
+ //
11
+ // var eyes = require('eyes');
12
+ // eyes.inspect(something); // inspect with the default settings
13
+ //
14
+ var eyes = exports,
15
+ stack = [];
16
+
17
+ eyes.defaults = {
18
+ styles: { // Styles applied to stdout
19
+ all: 'cyan', // Overall style applied to everything
20
+ label: 'underline', // Inspection labels, like 'array' in `array: [1, 2, 3]`
21
+ other: 'inverted', // Objects which don't have a literal representation, such as functions
22
+ key: 'bold', // The keys in object literals, like 'a' in `{a: 1}`
23
+ special: 'grey', // null, undefined...
24
+ string: 'green',
25
+ number: 'magenta',
26
+ bool: 'blue', // true false
27
+ regexp: 'green', // /\d+/
28
+ },
29
+ pretty: true, // Indent object literals
30
+ hideFunctions: false,
31
+ showHidden: false,
32
+ stream: process.stdout,
33
+ maxLength: 2048 // Truncate output if longer
34
+ };
35
+
36
+ // Return a curried inspect() function, with the `options` argument filled in.
37
+ eyes.inspector = function (options) {
38
+ var that = this;
39
+ return function (obj, label, opts) {
40
+ return that.inspect.call(that, obj, label,
41
+ merge(options || {}, opts || {}));
42
+ };
43
+ };
44
+
45
+ // If we have a `stream` defined, use it to print a styled string,
46
+ // if not, we just return the stringified object.
47
+ eyes.inspect = function (obj, label, options) {
48
+ options = merge(this.defaults, options || {});
49
+
50
+ if (options.stream) {
51
+ return this.print(stringify(obj, options), label, options);
52
+ } else {
53
+ return stringify(obj, options) + (options.styles ? '\033[39m' : '');
54
+ }
55
+ };
56
+
57
+ // Output using the 'stream', and an optional label
58
+ // Loop through `str`, and truncate it after `options.maxLength` has been reached.
59
+ // Because escape sequences are, at this point embeded within
60
+ // the output string, we can't measure the length of the string
61
+ // in a useful way, without separating what is an escape sequence,
62
+ // versus a printable character (`c`). So we resort to counting the
63
+ // length manually.
64
+ eyes.print = function (str, label, options) {
65
+ for (var c = 0, i = 0; i < str.length; i++) {
66
+ if (str.charAt(i) === '\033') { i += 4 } // `4` because '\033[25m'.length + 1 == 5
67
+ else if (c === options.maxLength) {
68
+ str = str.slice(0, i - 1) + '…';
69
+ break;
70
+ } else { c++ }
71
+ }
72
+ return options.stream.write.call(options.stream, (label ?
73
+ this.stylize(label, options.styles.label, options.styles) + ': ' : '') +
74
+ this.stylize(str, options.styles.all, options.styles) + '\033[0m' + "\n");
75
+ };
76
+
77
+ // Apply a style to a string, eventually,
78
+ // I'd like this to support passing multiple
79
+ // styles.
80
+ eyes.stylize = function (str, style, styles) {
81
+ var codes = {
82
+ 'bold' : [1, 22],
83
+ 'underline' : [4, 24],
84
+ 'inverse' : [7, 27],
85
+ 'cyan' : [36, 39],
86
+ 'magenta' : [35, 39],
87
+ 'blue' : [34, 39],
88
+ 'yellow' : [33, 39],
89
+ 'green' : [32, 39],
90
+ 'red' : [31, 39],
91
+ 'grey' : [90, 39]
92
+ }, endCode;
93
+
94
+ if (style && codes[style]) {
95
+ endCode = (codes[style][1] === 39 && styles.all) ? codes[styles.all][0]
96
+ : codes[style][1];
97
+ return '\033[' + codes[style][0] + 'm' + str +
98
+ '\033[' + endCode + 'm';
99
+ } else { return str }
100
+ };
101
+
102
+ // Convert any object to a string, ready for output.
103
+ // When an 'array' or an 'object' are encountered, they are
104
+ // passed to specialized functions, which can then recursively call
105
+ // stringify().
106
+ function stringify(obj, options) {
107
+ var that = this, stylize = function (str, style) {
108
+ return eyes.stylize(str, options.styles[style], options.styles)
109
+ }, index, result;
110
+
111
+ if ((index = stack.indexOf(obj)) !== -1) {
112
+ return stylize(new(Array)(stack.length - index + 1).join('.'), 'special');
113
+ }
114
+ stack.push(obj);
115
+
116
+ result = (function (obj) {
117
+ switch (typeOf(obj)) {
118
+ case "string" : obj = stringifyString(obj.indexOf("'") === -1 ? "'" + obj + "'"
119
+ : '"' + obj + '"');
120
+ return stylize(obj, 'string');
121
+ case "regexp" : return stylize('/' + obj.source + '/', 'regexp');
122
+ case "number" : return stylize(obj + '', 'number');
123
+ case "function" : return options.stream ? stylize("Function", 'other') : '[Function]';
124
+ case "null" : return stylize("null", 'special');
125
+ case "undefined": return stylize("undefined", 'special');
126
+ case "boolean" : return stylize(obj + '', 'bool');
127
+ case "date" : return stylize(obj.toUTCString());
128
+ case "array" : return stringifyArray(obj, options, stack.length);
129
+ case "object" : return stringifyObject(obj, options, stack.length);
130
+ }
131
+ })(obj);
132
+
133
+ stack.pop();
134
+ return result;
135
+ };
136
+
137
+ // Escape invisible characters in a string
138
+ function stringifyString (str, options) {
139
+ return str.replace(/\\/g, '\\\\')
140
+ .replace(/\n/g, '\\n')
141
+ .replace(/[\u0001-\u001F]/g, function (match) {
142
+ return '\\0' + match[0].charCodeAt(0).toString(8);
143
+ });
144
+ }
145
+
146
+ // Convert an array to a string, such as [1, 2, 3].
147
+ // This function calls stringify() for each of the elements
148
+ // in the array.
149
+ function stringifyArray(ary, options, level) {
150
+ var out = [];
151
+ var pretty = options.pretty && (ary.length > 4 || ary.some(function (o) {
152
+ return (o !== null && typeof(o) === 'object' && Object.keys(o).length > 0) ||
153
+ (Array.isArray(o) && o.length > 0);
154
+ }));
155
+ var ws = pretty ? '\n' + new(Array)(level * 4 + 1).join(' ') : ' ';
156
+
157
+ for (var i = 0; i < ary.length; i++) {
158
+ out.push(stringify(ary[i], options));
159
+ }
160
+
161
+ if (out.length === 0) {
162
+ return '[]';
163
+ } else {
164
+ return '[' + ws
165
+ + out.join(',' + (pretty ? ws : ' '))
166
+ + (pretty ? ws.slice(0, -4) : ws) +
167
+ ']';
168
+ }
169
+ };
170
+
171
+ // Convert an object to a string, such as {a: 1}.
172
+ // This function calls stringify() for each of its values,
173
+ // and does not output functions or prototype values.
174
+ function stringifyObject(obj, options, level) {
175
+ var out = [];
176
+ var pretty = options.pretty && (Object.keys(obj).length > 2 ||
177
+ Object.keys(obj).some(function (k) { return typeof(obj[k]) === 'object' }));
178
+ var ws = pretty ? '\n' + new(Array)(level * 4 + 1).join(' ') : ' ';
179
+
180
+ var keys = options.showHidden ? Object.keys(obj) : Object.getOwnPropertyNames(obj);
181
+ keys.forEach(function (k) {
182
+ if (Object.prototype.hasOwnProperty.call(obj, k)
183
+ && !(obj[k] instanceof Function && options.hideFunctions)) {
184
+ out.push(eyes.stylize(k, options.styles.key, options.styles) + ': ' +
185
+ stringify(obj[k], options));
186
+ }
187
+ });
188
+
189
+ if (out.length === 0) {
190
+ return '{}';
191
+ } else {
192
+ return "{" + ws
193
+ + out.join(',' + (pretty ? ws : ' '))
194
+ + (pretty ? ws.slice(0, -4) : ws) +
195
+ "}";
196
+ }
197
+ };
198
+
199
+ // A better `typeof`
200
+ function typeOf(value) {
201
+ var s = typeof(value),
202
+ types = [Object, Array, String, RegExp, Number, Function, Boolean, Date];
203
+
204
+ if (s === 'object' || s === 'function') {
205
+ if (value) {
206
+ types.forEach(function (t) {
207
+ if (value instanceof t) { s = t.name.toLowerCase() }
208
+ });
209
+ } else { s = 'null' }
210
+ }
211
+ return s;
212
+ }
213
+
214
+ function merge(/* variable args */) {
215
+ var objs = Array.prototype.slice.call(arguments);
216
+ var target = {};
217
+
218
+ objs.forEach(function (o) {
219
+ Object.keys(o).forEach(function (k) {
220
+ if (k === 'styles') {
221
+ if (! o.styles) {
222
+ target.styles = false;
223
+ } else {
224
+ target.styles = {}
225
+ for (var s in o.styles) {
226
+ target.styles[s] = o.styles[s];
227
+ }
228
+ }
229
+ } else {
230
+ target[k] = o[k];
231
+ }
232
+ });
233
+ });
234
+ return target;
235
+ }
236
+
@@ -0,0 +1,42 @@
1
+ {
2
+ "name": "eyes",
3
+ "description": "a customizable value inspector",
4
+ "url": "http://github.com/cloudhead/eyes.js",
5
+ "keywords": [
6
+ "inspector",
7
+ "debug",
8
+ "inspect",
9
+ "print"
10
+ ],
11
+ "author": {
12
+ "name": "Alexis Sellier",
13
+ "email": "self@cloudhead.net"
14
+ },
15
+ "contributors": [
16
+ {
17
+ "name": "Charlie Robbins",
18
+ "email": "charlie@nodejitsu.com"
19
+ }
20
+ ],
21
+ "licenses": [
22
+ "MIT"
23
+ ],
24
+ "main": "./lib/eyes",
25
+ "version": "0.1.8",
26
+ "scripts": {
27
+ "test": "node test/*-test.js"
28
+ },
29
+ "directories": {
30
+ "lib": "./lib",
31
+ "test": "./test"
32
+ },
33
+ "engines": {
34
+ "node": "> 0.1.90"
35
+ },
36
+ "readme": "eyes\n====\n\na customizable value inspector for Node.js\n\nsynopsis\n--------\n\nI was tired of looking at cluttered output in the console -- something needed to be done,\n`sys.inspect()` didn't display regexps correctly, and was too verbose, and I had an hour or two to spare. \nSo I decided to have some fun. _eyes_ were born.\n\n![eyes-ss](http://dl.dropbox.com/u/251849/eyes-js-ss.gif)\n\n_example of the output of a user-customized eyes.js inspector_\n\n*eyes* also deals with circular objects in an intelligent way, and can pretty-print object literals.\n\nusage\n-----\n\n var inspect = require('eyes').inspector({styles: {all: 'magenta'}});\n\n inspect(something); // inspect with the settings passed to `inspector`\n\nor\n\n var eyes = require('eyes');\n\n eyes.inspect(something); // inspect with the default settings\n\nyou can pass a _label_ to `inspect()`, to keep track of your inspections:\n\n eyes.inspect(something, \"a random value\");\n\nIf you want to return the output of eyes without printing it, you can set it up this way:\n\n var inspect = require('eyes').inspector({ stream: null });\n\n sys.puts(inspect({ something: 42 }));\n\ncustomization\n-------------\n\nThese are the default styles and settings used by _eyes_.\n\n styles: { // Styles applied to stdout\n all: 'cyan', // Overall style applied to everything\n label: 'underline', // Inspection labels, like 'array' in `array: [1, 2, 3]`\n other: 'inverted', // Objects which don't have a literal representation, such as functions\n key: 'bold', // The keys in object literals, like 'a' in `{a: 1}`\n special: 'grey', // null, undefined...\n string: 'green',\n number: 'magenta',\n bool: 'blue', // true false\n regexp: 'green', // /\\d+/\n },\n \n pretty: true, // Indent object literals\n hideFunctions: false, // Don't output functions at all\n stream: process.stdout, // Stream to write to, or null\n maxLength: 2048 // Truncate output if longer\n\nYou can overwrite them with your own, by passing a similar object to `inspector()` or `inspect()`.\n\n var inspect = require('eyes').inspector({\n styles: {\n all: 'magenta',\n special: 'bold'\n },\n maxLength: 512\n });\n\n",
37
+ "readmeFilename": "README.md",
38
+ "_id": "eyes@0.1.8",
39
+ "_shasum": "62cf120234c683785d902348a800ef3e0cc20bc0",
40
+ "_from": "eyes@0.1.x",
41
+ "_resolved": "https://registry.npmjs.org/eyes/-/eyes-0.1.8.tgz"
42
+ }
@@ -0,0 +1,11 @@
1
+ The MIT License (MIT)
2
+ =====================
3
+
4
+ Copyright (c) 2015 Rod Vagg
5
+ ---------------------------
6
+
7
+ 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:
8
+
9
+ The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
10
+
11
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
@@ -0,0 +1,27 @@
1
+ var stream = require('stream')
2
+
3
+
4
+ function isStream (obj) {
5
+ return obj instanceof stream.Stream
6
+ }
7
+
8
+
9
+ function isReadable (obj) {
10
+ return isStream(obj) && typeof obj._read == 'function' && typeof obj._readableState == 'object'
11
+ }
12
+
13
+
14
+ function isWritable (obj) {
15
+ return isStream(obj) && typeof obj._write == 'function' && typeof obj._writableState == 'object'
16
+ }
17
+
18
+
19
+ function isDuplex (obj) {
20
+ return isReadable(obj) && isWritable(obj)
21
+ }
22
+
23
+
24
+ module.exports = isStream
25
+ module.exports.isReadable = isReadable
26
+ module.exports.isWritable = isWritable
27
+ module.exports.isDuplex = isDuplex
@@ -0,0 +1,42 @@
1
+ {
2
+ "name": "isstream",
3
+ "version": "0.1.2",
4
+ "description": "Determine if an object is a Stream",
5
+ "main": "isstream.js",
6
+ "scripts": {
7
+ "test": "tar --xform 's/^package/readable-stream-1.0/' -zxf readable-stream-1.0.*.tgz && tar --xform 's/^package/readable-stream-1.1/' -zxf readable-stream-1.1.*.tgz && node test.js; rm -rf readable-stream-1.?/"
8
+ },
9
+ "repository": {
10
+ "type": "git",
11
+ "url": "git+https://github.com/rvagg/isstream.git"
12
+ },
13
+ "keywords": [
14
+ "stream",
15
+ "type",
16
+ "streams",
17
+ "readable-stream",
18
+ "hippo"
19
+ ],
20
+ "devDependencies": {
21
+ "tape": "~2.12.3",
22
+ "core-util-is": "~1.0.0",
23
+ "isarray": "0.0.1",
24
+ "string_decoder": "~0.10.x",
25
+ "inherits": "~2.0.1"
26
+ },
27
+ "author": {
28
+ "name": "Rod Vagg",
29
+ "email": "rod@vagg.org"
30
+ },
31
+ "license": "MIT",
32
+ "bugs": {
33
+ "url": "https://github.com/rvagg/isstream/issues"
34
+ },
35
+ "homepage": "https://github.com/rvagg/isstream",
36
+ "readme": "# isStream\n\n[![Build Status](https://secure.travis-ci.org/rvagg/isstream.png)](http://travis-ci.org/rvagg/isstream)\n\n**Test if an object is a `Stream`**\n\n[![NPM](https://nodei.co/npm/isstream.svg)](https://nodei.co/npm/isstream/)\n\nThe missing `Stream.isStream(obj)`: determine if an object is standard Node.js `Stream`. Works for Node-core `Stream` objects (for 0.8, 0.10, 0.11, and in theory, older and newer versions) and all versions of **[readable-stream](https://github.com/isaacs/readable-stream)**.\n\n## Usage:\n\n```js\nvar isStream = require('isstream')\nvar Stream = require('stream')\n\nisStream(new Stream()) // true\n\nisStream({}) // false\n\nisStream(new Stream.Readable()) // true\nisStream(new Stream.Writable()) // true\nisStream(new Stream.Duplex()) // true\nisStream(new Stream.Transform()) // true\nisStream(new Stream.PassThrough()) // true\n```\n\n## But wait! There's more!\n\nYou can also test for `isReadable(obj)`, `isWritable(obj)` and `isDuplex(obj)` to test for implementations of Streams2 (and Streams3) base classes.\n\n```js\nvar isReadable = require('isstream').isReadable\nvar isWritable = require('isstream').isWritable\nvar isDuplex = require('isstream').isDuplex\nvar Stream = require('stream')\n\nisReadable(new Stream()) // false\nisWritable(new Stream()) // false\nisDuplex(new Stream()) // false\n\nisReadable(new Stream.Readable()) // true\nisReadable(new Stream.Writable()) // false\nisReadable(new Stream.Duplex()) // true\nisReadable(new Stream.Transform()) // true\nisReadable(new Stream.PassThrough()) // true\n\nisWritable(new Stream.Readable()) // false\nisWritable(new Stream.Writable()) // true\nisWritable(new Stream.Duplex()) // true\nisWritable(new Stream.Transform()) // true\nisWritable(new Stream.PassThrough()) // true\n\nisDuplex(new Stream.Readable()) // false\nisDuplex(new Stream.Writable()) // false\nisDuplex(new Stream.Duplex()) // true\nisDuplex(new Stream.Transform()) // true\nisDuplex(new Stream.PassThrough()) // true\n```\n\n*Reminder: when implementing your own streams, please [use **readable-stream** rather than core streams](http://r.va.gg/2014/06/why-i-dont-use-nodes-core-stream-module.html).*\n\n\n## License\n\n**isStream** is Copyright (c) 2015 Rod Vagg [@rvagg](https://twitter.com/rvagg) and licenced under the MIT licence. All rights not explicitly granted in the MIT license are reserved. See the included LICENSE.md file for more details.\n",
37
+ "readmeFilename": "README.md",
38
+ "_id": "isstream@0.1.2",
39
+ "_shasum": "47e63f7af55afa6f92e1500e690eb8b8529c099a",
40
+ "_from": "isstream@0.1.x",
41
+ "_resolved": "https://registry.npmjs.org/isstream/-/isstream-0.1.2.tgz"
42
+ }
@@ -0,0 +1,19 @@
1
+ Copyright (c) 2010 Charlie Robbins.
2
+
3
+ Permission is hereby granted, free of charge, to any person obtaining a copy
4
+ of this software and associated documentation files (the "Software"), to deal
5
+ in the Software without restriction, including without limitation the rights
6
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
7
+ copies of the Software, and to permit persons to whom the Software is
8
+ furnished to do so, subject to the following conditions:
9
+
10
+ The above copyright notice and this permission notice shall be included in
11
+ all copies or substantial portions of the Software.
12
+
13
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
19
+ THE SOFTWARE.
@@ -0,0 +1,136 @@
1
+ /*
2
+ * pkginfo.js: Top-level include for the pkginfo module
3
+ *
4
+ * (C) 2011, Charlie Robbins
5
+ *
6
+ */
7
+
8
+ var fs = require('fs'),
9
+ path = require('path');
10
+
11
+ //
12
+ // ### function pkginfo ([options, 'property', 'property' ..])
13
+ // #### @pmodule {Module} Parent module to read from.
14
+ // #### @options {Object|Array|string} **Optional** Options used when exposing properties.
15
+ // #### @arguments {string...} **Optional** Specified properties to expose.
16
+ // Exposes properties from the package.json file for the parent module on
17
+ // it's exports. Valid usage:
18
+ //
19
+ // `require('pkginfo')()`
20
+ //
21
+ // `require('pkginfo')('version', 'author');`
22
+ //
23
+ // `require('pkginfo')(['version', 'author']);`
24
+ //
25
+ // `require('pkginfo')({ include: ['version', 'author'] });`
26
+ //
27
+ var pkginfo = module.exports = function (pmodule, options) {
28
+ var args = [].slice.call(arguments, 2).filter(function (arg) {
29
+ return typeof arg === 'string';
30
+ });
31
+
32
+ //
33
+ // **Parse variable arguments**
34
+ //
35
+ if (Array.isArray(options)) {
36
+ //
37
+ // If the options passed in is an Array assume that
38
+ // it is the Array of properties to expose from the
39
+ // on the package.json file on the parent module.
40
+ //
41
+ options = { include: options };
42
+ }
43
+ else if (typeof options === 'string') {
44
+ //
45
+ // Otherwise if the first argument is a string, then
46
+ // assume that it is the first property to expose from
47
+ // the package.json file on the parent module.
48
+ //
49
+ options = { include: [options] };
50
+ }
51
+
52
+ //
53
+ // **Setup default options**
54
+ //
55
+ options = options || {};
56
+
57
+ // ensure that includes have been defined
58
+ options.include = options.include || [];
59
+
60
+ if (args.length > 0) {
61
+ //
62
+ // If additional string arguments have been passed in
63
+ // then add them to the properties to expose on the
64
+ // parent module.
65
+ //
66
+ options.include = options.include.concat(args);
67
+ }
68
+
69
+ var pkg = pkginfo.read(pmodule, options.dir).package;
70
+ Object.keys(pkg).forEach(function (key) {
71
+ if (options.include.length > 0 && !~options.include.indexOf(key)) {
72
+ return;
73
+ }
74
+
75
+ if (!pmodule.exports[key]) {
76
+ pmodule.exports[key] = pkg[key];
77
+ }
78
+ });
79
+
80
+ return pkginfo;
81
+ };
82
+
83
+ //
84
+ // ### function find (dir)
85
+ // #### @pmodule {Module} Parent module to read from.
86
+ // #### @dir {string} **Optional** Directory to start search from.
87
+ // Searches up the directory tree from `dir` until it finds a directory
88
+ // which contains a `package.json` file.
89
+ //
90
+ pkginfo.find = function (pmodule, dir) {
91
+ if (! dir) {
92
+ dir = path.dirname(pmodule.filename);
93
+ }
94
+
95
+ var files = fs.readdirSync(dir);
96
+
97
+ if (~files.indexOf('package.json')) {
98
+ return path.join(dir, 'package.json');
99
+ }
100
+
101
+ if (dir === '/') {
102
+ throw new Error('Could not find package.json up from: ' + dir);
103
+ }
104
+ else if (!dir || dir === '.') {
105
+ throw new Error('Cannot find package.json from unspecified directory');
106
+ }
107
+
108
+ return pkginfo.find(pmodule, path.dirname(dir));
109
+ };
110
+
111
+ //
112
+ // ### function read (pmodule, dir)
113
+ // #### @pmodule {Module} Parent module to read from.
114
+ // #### @dir {string} **Optional** Directory to start search from.
115
+ // Searches up the directory tree from `dir` until it finds a directory
116
+ // which contains a `package.json` file and returns the package information.
117
+ //
118
+ pkginfo.read = function (pmodule, dir) {
119
+ dir = pkginfo.find(pmodule, dir);
120
+
121
+ var data = fs.readFileSync(dir).toString();
122
+
123
+ return {
124
+ dir: dir,
125
+ package: JSON.parse(data)
126
+ };
127
+ };
128
+
129
+ //
130
+ // Call `pkginfo` on this module and expose version.
131
+ //
132
+ pkginfo(module, {
133
+ dir: __dirname,
134
+ include: ['version'],
135
+ target: pkginfo
136
+ });