webpack_rails 0.3.0 → 1.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (353) hide show
  1. checksums.yaml +4 -4
  2. data/lib/webpack_rails/ErrorMessagePlugin.js +37 -0
  3. data/lib/webpack_rails/engine.rb +6 -5
  4. data/lib/webpack_rails/node_modules/cors/CONTRIBUTING.md +35 -0
  5. data/lib/webpack_rails/node_modules/cors/LICENSE +9 -0
  6. data/lib/webpack_rails/node_modules/cors/README.md +192 -0
  7. data/lib/webpack_rails/node_modules/cors/lib/index.js +242 -0
  8. data/lib/webpack_rails/node_modules/cors/node_modules/vary/HISTORY.md +29 -0
  9. data/lib/webpack_rails/node_modules/cors/node_modules/vary/LICENSE +22 -0
  10. data/lib/webpack_rails/node_modules/cors/node_modules/vary/README.md +91 -0
  11. data/lib/webpack_rails/node_modules/cors/node_modules/vary/index.js +124 -0
  12. data/lib/webpack_rails/node_modules/cors/node_modules/vary/package.json +72 -0
  13. data/lib/webpack_rails/node_modules/cors/package.json +79 -0
  14. data/lib/webpack_rails/node_modules/cors/test/basic-auth.js +40 -0
  15. data/lib/webpack_rails/node_modules/cors/test/body-events.js +81 -0
  16. data/lib/webpack_rails/node_modules/cors/test/cors.js +652 -0
  17. data/lib/webpack_rails/node_modules/cors/test/error-response.js +77 -0
  18. data/lib/webpack_rails/node_modules/cors/test/example-app.js +98 -0
  19. data/lib/webpack_rails/node_modules/cors/test/issue-2.js +56 -0
  20. data/lib/webpack_rails/node_modules/cors/test/issue-31.js +58 -0
  21. data/lib/webpack_rails/node_modules/cors/test/mocha.opts +3 -0
  22. data/lib/webpack_rails/node_modules/express/History.md +3025 -0
  23. data/lib/webpack_rails/node_modules/express/LICENSE +24 -0
  24. data/lib/webpack_rails/node_modules/express/Readme.md +138 -0
  25. data/lib/webpack_rails/node_modules/express/index.js +11 -0
  26. data/lib/webpack_rails/node_modules/express/lib/application.js +643 -0
  27. data/lib/webpack_rails/node_modules/express/lib/express.js +103 -0
  28. data/lib/webpack_rails/node_modules/express/lib/middleware/init.js +36 -0
  29. data/lib/webpack_rails/node_modules/express/lib/middleware/query.js +51 -0
  30. data/lib/webpack_rails/node_modules/express/lib/request.js +489 -0
  31. data/lib/webpack_rails/node_modules/express/lib/response.js +1053 -0
  32. data/lib/webpack_rails/node_modules/express/lib/router/index.js +645 -0
  33. data/lib/webpack_rails/node_modules/express/lib/router/layer.js +176 -0
  34. data/lib/webpack_rails/node_modules/express/lib/router/route.js +210 -0
  35. data/lib/webpack_rails/node_modules/express/lib/utils.js +300 -0
  36. data/lib/webpack_rails/node_modules/express/lib/view.js +173 -0
  37. data/lib/webpack_rails/node_modules/express/node_modules/accepts/HISTORY.md +170 -0
  38. data/lib/webpack_rails/node_modules/express/node_modules/accepts/LICENSE +23 -0
  39. data/lib/webpack_rails/node_modules/express/node_modules/accepts/README.md +135 -0
  40. data/lib/webpack_rails/node_modules/express/node_modules/accepts/index.js +231 -0
  41. data/lib/webpack_rails/node_modules/express/node_modules/accepts/node_modules/mime-types/HISTORY.md +171 -0
  42. data/lib/webpack_rails/node_modules/express/node_modules/accepts/node_modules/mime-types/LICENSE +23 -0
  43. data/lib/webpack_rails/node_modules/express/node_modules/accepts/node_modules/mime-types/README.md +103 -0
  44. data/lib/webpack_rails/node_modules/express/node_modules/accepts/node_modules/mime-types/index.js +188 -0
  45. data/lib/webpack_rails/node_modules/express/node_modules/accepts/node_modules/mime-types/node_modules/mime-db/HISTORY.md +274 -0
  46. data/lib/webpack_rails/node_modules/express/node_modules/accepts/node_modules/mime-types/node_modules/mime-db/LICENSE +22 -0
  47. data/lib/webpack_rails/node_modules/express/node_modules/accepts/node_modules/mime-types/node_modules/mime-db/README.md +82 -0
  48. data/lib/webpack_rails/node_modules/express/node_modules/accepts/node_modules/mime-types/node_modules/mime-db/db.json +6474 -0
  49. data/lib/webpack_rails/node_modules/express/node_modules/accepts/node_modules/mime-types/node_modules/mime-db/index.js +11 -0
  50. data/lib/webpack_rails/node_modules/express/node_modules/accepts/node_modules/mime-types/node_modules/mime-db/package.json +94 -0
  51. data/lib/webpack_rails/node_modules/express/node_modules/accepts/node_modules/mime-types/package.json +84 -0
  52. data/lib/webpack_rails/node_modules/express/node_modules/accepts/node_modules/negotiator/HISTORY.md +76 -0
  53. data/lib/webpack_rails/node_modules/express/node_modules/accepts/node_modules/negotiator/LICENSE +24 -0
  54. data/lib/webpack_rails/node_modules/express/node_modules/accepts/node_modules/negotiator/README.md +203 -0
  55. data/lib/webpack_rails/node_modules/express/node_modules/accepts/node_modules/negotiator/index.js +62 -0
  56. data/lib/webpack_rails/node_modules/express/node_modules/accepts/node_modules/negotiator/lib/charset.js +102 -0
  57. data/lib/webpack_rails/node_modules/express/node_modules/accepts/node_modules/negotiator/lib/encoding.js +118 -0
  58. data/lib/webpack_rails/node_modules/express/node_modules/accepts/node_modules/negotiator/lib/language.js +112 -0
  59. data/lib/webpack_rails/node_modules/express/node_modules/accepts/node_modules/negotiator/lib/mediaType.js +179 -0
  60. data/lib/webpack_rails/node_modules/express/node_modules/accepts/node_modules/negotiator/package.json +86 -0
  61. data/lib/webpack_rails/node_modules/express/node_modules/accepts/package.json +98 -0
  62. data/lib/webpack_rails/node_modules/express/node_modules/array-flatten/LICENSE +21 -0
  63. data/lib/webpack_rails/node_modules/express/node_modules/array-flatten/README.md +43 -0
  64. data/lib/webpack_rails/node_modules/express/node_modules/array-flatten/array-flatten.js +64 -0
  65. data/lib/webpack_rails/node_modules/express/node_modules/array-flatten/package.json +62 -0
  66. data/lib/webpack_rails/node_modules/express/node_modules/content-disposition/HISTORY.md +40 -0
  67. data/lib/webpack_rails/node_modules/express/node_modules/content-disposition/LICENSE +22 -0
  68. data/lib/webpack_rails/node_modules/express/node_modules/content-disposition/README.md +141 -0
  69. data/lib/webpack_rails/node_modules/express/node_modules/content-disposition/index.js +443 -0
  70. data/lib/webpack_rails/node_modules/express/node_modules/content-disposition/package.json +66 -0
  71. data/lib/webpack_rails/node_modules/express/node_modules/content-type/HISTORY.md +9 -0
  72. data/lib/webpack_rails/node_modules/express/node_modules/content-type/LICENSE +22 -0
  73. data/lib/webpack_rails/node_modules/express/node_modules/content-type/README.md +92 -0
  74. data/lib/webpack_rails/node_modules/express/node_modules/content-type/index.js +214 -0
  75. data/lib/webpack_rails/node_modules/express/node_modules/content-type/package.json +65 -0
  76. data/lib/webpack_rails/node_modules/express/node_modules/cookie/LICENSE +23 -0
  77. data/lib/webpack_rails/node_modules/express/node_modules/cookie/README.md +64 -0
  78. data/lib/webpack_rails/node_modules/express/node_modules/cookie/index.js +116 -0
  79. data/lib/webpack_rails/node_modules/express/node_modules/cookie/package.json +68 -0
  80. data/lib/webpack_rails/node_modules/express/node_modules/cookie-signature/History.md +38 -0
  81. data/lib/webpack_rails/node_modules/express/node_modules/cookie-signature/Readme.md +42 -0
  82. data/lib/webpack_rails/node_modules/express/node_modules/cookie-signature/index.js +51 -0
  83. data/lib/webpack_rails/node_modules/express/node_modules/cookie-signature/package.json +59 -0
  84. data/lib/webpack_rails/node_modules/express/node_modules/debug/History.md +195 -0
  85. data/lib/webpack_rails/node_modules/express/node_modules/debug/Makefile +36 -0
  86. data/lib/webpack_rails/node_modules/express/node_modules/debug/Readme.md +188 -0
  87. data/lib/webpack_rails/node_modules/express/node_modules/debug/bower.json +28 -0
  88. data/lib/webpack_rails/node_modules/express/node_modules/debug/browser.js +168 -0
  89. data/lib/webpack_rails/node_modules/express/node_modules/debug/component.json +19 -0
  90. data/lib/webpack_rails/node_modules/express/node_modules/debug/debug.js +197 -0
  91. data/lib/webpack_rails/node_modules/express/node_modules/debug/node.js +209 -0
  92. data/lib/webpack_rails/node_modules/express/node_modules/debug/node_modules/ms/History.md +66 -0
  93. data/lib/webpack_rails/node_modules/express/node_modules/debug/node_modules/ms/LICENSE +20 -0
  94. data/lib/webpack_rails/node_modules/express/node_modules/debug/node_modules/ms/README.md +35 -0
  95. data/lib/webpack_rails/node_modules/express/node_modules/debug/node_modules/ms/index.js +125 -0
  96. data/lib/webpack_rails/node_modules/express/node_modules/debug/node_modules/ms/package.json +47 -0
  97. data/lib/webpack_rails/node_modules/express/node_modules/debug/package.json +73 -0
  98. data/lib/webpack_rails/node_modules/express/node_modules/depd/History.md +75 -0
  99. data/lib/webpack_rails/node_modules/express/node_modules/depd/LICENSE +22 -0
  100. data/lib/webpack_rails/node_modules/express/node_modules/depd/Readme.md +274 -0
  101. data/lib/webpack_rails/node_modules/express/node_modules/depd/index.js +529 -0
  102. data/lib/webpack_rails/node_modules/express/node_modules/depd/lib/compat/buffer-concat.js +33 -0
  103. data/lib/webpack_rails/node_modules/express/node_modules/depd/lib/compat/callsite-tostring.js +101 -0
  104. data/lib/webpack_rails/node_modules/express/node_modules/depd/lib/compat/index.js +69 -0
  105. data/lib/webpack_rails/node_modules/express/node_modules/depd/package.json +66 -0
  106. data/lib/webpack_rails/node_modules/express/node_modules/escape-html/LICENSE +22 -0
  107. data/lib/webpack_rails/node_modules/express/node_modules/escape-html/Readme.md +15 -0
  108. data/lib/webpack_rails/node_modules/express/node_modules/escape-html/index.js +29 -0
  109. data/lib/webpack_rails/node_modules/express/node_modules/escape-html/package.json +51 -0
  110. data/lib/webpack_rails/node_modules/express/node_modules/etag/HISTORY.md +71 -0
  111. data/lib/webpack_rails/node_modules/express/node_modules/etag/LICENSE +22 -0
  112. data/lib/webpack_rails/node_modules/express/node_modules/etag/README.md +165 -0
  113. data/lib/webpack_rails/node_modules/express/node_modules/etag/index.js +132 -0
  114. data/lib/webpack_rails/node_modules/express/node_modules/etag/package.json +73 -0
  115. data/lib/webpack_rails/node_modules/express/node_modules/finalhandler/HISTORY.md +90 -0
  116. data/lib/webpack_rails/node_modules/express/node_modules/finalhandler/LICENSE +22 -0
  117. data/lib/webpack_rails/node_modules/express/node_modules/finalhandler/README.md +133 -0
  118. data/lib/webpack_rails/node_modules/express/node_modules/finalhandler/index.js +151 -0
  119. data/lib/webpack_rails/node_modules/express/node_modules/finalhandler/node_modules/unpipe/HISTORY.md +4 -0
  120. data/lib/webpack_rails/node_modules/express/node_modules/finalhandler/node_modules/unpipe/LICENSE +22 -0
  121. data/lib/webpack_rails/node_modules/express/node_modules/finalhandler/node_modules/unpipe/README.md +43 -0
  122. data/lib/webpack_rails/node_modules/express/node_modules/finalhandler/node_modules/unpipe/index.js +69 -0
  123. data/lib/webpack_rails/node_modules/express/node_modules/finalhandler/node_modules/unpipe/package.json +59 -0
  124. data/lib/webpack_rails/node_modules/express/node_modules/finalhandler/package.json +81 -0
  125. data/lib/webpack_rails/node_modules/express/node_modules/fresh/HISTORY.md +38 -0
  126. data/lib/webpack_rails/node_modules/express/node_modules/fresh/LICENSE +22 -0
  127. data/lib/webpack_rails/node_modules/express/node_modules/fresh/README.md +58 -0
  128. data/lib/webpack_rails/node_modules/express/node_modules/fresh/index.js +57 -0
  129. data/lib/webpack_rails/node_modules/express/node_modules/fresh/package.json +87 -0
  130. data/lib/webpack_rails/node_modules/express/node_modules/merge-descriptors/LICENSE +22 -0
  131. data/lib/webpack_rails/node_modules/express/node_modules/merge-descriptors/README.md +34 -0
  132. data/lib/webpack_rails/node_modules/express/node_modules/merge-descriptors/index.js +57 -0
  133. data/lib/webpack_rails/node_modules/express/node_modules/merge-descriptors/package.json +125 -0
  134. data/lib/webpack_rails/node_modules/express/node_modules/methods/HISTORY.md +24 -0
  135. data/lib/webpack_rails/node_modules/express/node_modules/methods/LICENSE +23 -0
  136. data/lib/webpack_rails/node_modules/express/node_modules/methods/README.md +41 -0
  137. data/lib/webpack_rails/node_modules/express/node_modules/methods/index.js +42 -0
  138. data/lib/webpack_rails/node_modules/express/node_modules/methods/package.json +88 -0
  139. data/lib/webpack_rails/node_modules/express/node_modules/on-finished/HISTORY.md +88 -0
  140. data/lib/webpack_rails/node_modules/express/node_modules/on-finished/LICENSE +23 -0
  141. data/lib/webpack_rails/node_modules/express/node_modules/on-finished/README.md +154 -0
  142. data/lib/webpack_rails/node_modules/express/node_modules/on-finished/index.js +196 -0
  143. data/lib/webpack_rails/node_modules/express/node_modules/on-finished/node_modules/ee-first/LICENSE +22 -0
  144. data/lib/webpack_rails/node_modules/express/node_modules/on-finished/node_modules/ee-first/README.md +80 -0
  145. data/lib/webpack_rails/node_modules/express/node_modules/on-finished/node_modules/ee-first/index.js +95 -0
  146. data/lib/webpack_rails/node_modules/express/node_modules/on-finished/node_modules/ee-first/package.json +64 -0
  147. data/lib/webpack_rails/node_modules/express/node_modules/on-finished/package.json +71 -0
  148. data/lib/webpack_rails/node_modules/express/node_modules/parseurl/HISTORY.md +42 -0
  149. data/lib/webpack_rails/node_modules/express/node_modules/parseurl/LICENSE +24 -0
  150. data/lib/webpack_rails/node_modules/express/node_modules/parseurl/README.md +107 -0
  151. data/lib/webpack_rails/node_modules/express/node_modules/parseurl/index.js +136 -0
  152. data/lib/webpack_rails/node_modules/express/node_modules/parseurl/package.json +80 -0
  153. data/lib/webpack_rails/node_modules/express/node_modules/path-to-regexp/History.md +36 -0
  154. data/lib/webpack_rails/node_modules/express/node_modules/path-to-regexp/LICENSE +21 -0
  155. data/lib/webpack_rails/node_modules/express/node_modules/path-to-regexp/Readme.md +35 -0
  156. data/lib/webpack_rails/node_modules/express/node_modules/path-to-regexp/index.js +129 -0
  157. data/lib/webpack_rails/node_modules/express/node_modules/path-to-regexp/package.json +184 -0
  158. data/lib/webpack_rails/node_modules/express/node_modules/proxy-addr/HISTORY.md +66 -0
  159. data/lib/webpack_rails/node_modules/express/node_modules/proxy-addr/LICENSE +22 -0
  160. data/lib/webpack_rails/node_modules/express/node_modules/proxy-addr/README.md +137 -0
  161. data/lib/webpack_rails/node_modules/express/node_modules/proxy-addr/index.js +345 -0
  162. data/lib/webpack_rails/node_modules/express/node_modules/proxy-addr/node_modules/forwarded/HISTORY.md +4 -0
  163. data/lib/webpack_rails/node_modules/express/node_modules/proxy-addr/node_modules/forwarded/LICENSE +22 -0
  164. data/lib/webpack_rails/node_modules/express/node_modules/proxy-addr/node_modules/forwarded/README.md +53 -0
  165. data/lib/webpack_rails/node_modules/express/node_modules/proxy-addr/node_modules/forwarded/index.js +35 -0
  166. data/lib/webpack_rails/node_modules/express/node_modules/proxy-addr/node_modules/forwarded/package.json +65 -0
  167. data/lib/webpack_rails/node_modules/express/node_modules/proxy-addr/node_modules/ipaddr.js/Cakefile +18 -0
  168. data/lib/webpack_rails/node_modules/express/node_modules/proxy-addr/node_modules/ipaddr.js/LICENSE +19 -0
  169. data/lib/webpack_rails/node_modules/express/node_modules/proxy-addr/node_modules/ipaddr.js/README.md +161 -0
  170. data/lib/webpack_rails/node_modules/express/node_modules/proxy-addr/node_modules/ipaddr.js/ipaddr.min.js +1 -0
  171. data/lib/webpack_rails/node_modules/express/node_modules/proxy-addr/node_modules/ipaddr.js/lib/ipaddr.js +439 -0
  172. data/lib/webpack_rails/node_modules/express/node_modules/proxy-addr/node_modules/ipaddr.js/package.json +60 -0
  173. data/lib/webpack_rails/node_modules/express/node_modules/proxy-addr/node_modules/ipaddr.js/src/ipaddr.coffee +374 -0
  174. data/lib/webpack_rails/node_modules/express/node_modules/proxy-addr/node_modules/ipaddr.js/test/ipaddr.test.coffee +262 -0
  175. data/lib/webpack_rails/node_modules/express/node_modules/proxy-addr/package.json +90 -0
  176. data/lib/webpack_rails/node_modules/express/node_modules/qs/CHANGELOG.md +88 -0
  177. data/lib/webpack_rails/node_modules/express/node_modules/qs/CONTRIBUTING.md +1 -0
  178. data/lib/webpack_rails/node_modules/express/node_modules/qs/LICENSE +28 -0
  179. data/lib/webpack_rails/node_modules/express/node_modules/qs/README.md +317 -0
  180. data/lib/webpack_rails/node_modules/express/node_modules/qs/bower.json +22 -0
  181. data/lib/webpack_rails/node_modules/express/node_modules/qs/lib/index.js +15 -0
  182. data/lib/webpack_rails/node_modules/express/node_modules/qs/lib/parse.js +186 -0
  183. data/lib/webpack_rails/node_modules/express/node_modules/qs/lib/stringify.js +121 -0
  184. data/lib/webpack_rails/node_modules/express/node_modules/qs/lib/utils.js +190 -0
  185. data/lib/webpack_rails/node_modules/express/node_modules/qs/package.json +56 -0
  186. data/lib/webpack_rails/node_modules/express/node_modules/qs/test/parse.js +478 -0
  187. data/lib/webpack_rails/node_modules/express/node_modules/qs/test/stringify.js +259 -0
  188. data/lib/webpack_rails/node_modules/express/node_modules/qs/test/utils.js +28 -0
  189. data/lib/webpack_rails/node_modules/express/node_modules/range-parser/HISTORY.md +35 -0
  190. data/lib/webpack_rails/node_modules/express/node_modules/range-parser/LICENSE +22 -0
  191. data/lib/webpack_rails/node_modules/express/node_modules/range-parser/README.md +48 -0
  192. data/lib/webpack_rails/node_modules/express/node_modules/range-parser/index.js +49 -0
  193. data/lib/webpack_rails/node_modules/express/node_modules/range-parser/package.json +76 -0
  194. data/lib/webpack_rails/node_modules/express/node_modules/send/HISTORY.md +295 -0
  195. data/lib/webpack_rails/node_modules/express/node_modules/send/LICENSE +23 -0
  196. data/lib/webpack_rails/node_modules/express/node_modules/send/README.md +195 -0
  197. data/lib/webpack_rails/node_modules/express/node_modules/send/index.js +820 -0
  198. data/lib/webpack_rails/node_modules/express/node_modules/send/node_modules/destroy/README.md +38 -0
  199. data/lib/webpack_rails/node_modules/express/node_modules/send/node_modules/destroy/index.js +36 -0
  200. data/lib/webpack_rails/node_modules/express/node_modules/send/node_modules/destroy/package.json +67 -0
  201. data/lib/webpack_rails/node_modules/express/node_modules/send/node_modules/http-errors/HISTORY.md +76 -0
  202. data/lib/webpack_rails/node_modules/express/node_modules/send/node_modules/http-errors/LICENSE +22 -0
  203. data/lib/webpack_rails/node_modules/express/node_modules/send/node_modules/http-errors/README.md +63 -0
  204. data/lib/webpack_rails/node_modules/express/node_modules/send/node_modules/http-errors/index.js +120 -0
  205. data/lib/webpack_rails/node_modules/express/node_modules/send/node_modules/http-errors/node_modules/inherits/LICENSE +16 -0
  206. data/lib/webpack_rails/node_modules/express/node_modules/send/node_modules/http-errors/node_modules/inherits/README.md +42 -0
  207. data/lib/webpack_rails/node_modules/express/node_modules/send/node_modules/http-errors/node_modules/inherits/inherits.js +1 -0
  208. data/lib/webpack_rails/node_modules/express/node_modules/send/node_modules/http-errors/node_modules/inherits/inherits_browser.js +23 -0
  209. data/lib/webpack_rails/node_modules/express/node_modules/send/node_modules/http-errors/node_modules/inherits/package.json +50 -0
  210. data/lib/webpack_rails/node_modules/express/node_modules/send/node_modules/http-errors/node_modules/inherits/test.js +25 -0
  211. data/lib/webpack_rails/node_modules/express/node_modules/send/node_modules/http-errors/package.json +85 -0
  212. data/lib/webpack_rails/node_modules/express/node_modules/send/node_modules/mime/LICENSE +19 -0
  213. data/lib/webpack_rails/node_modules/express/node_modules/send/node_modules/mime/README.md +90 -0
  214. data/lib/webpack_rails/node_modules/express/node_modules/send/node_modules/mime/build/build.js +11 -0
  215. data/lib/webpack_rails/node_modules/express/node_modules/send/node_modules/mime/build/test.js +57 -0
  216. data/lib/webpack_rails/node_modules/express/node_modules/send/node_modules/mime/cli.js +8 -0
  217. data/lib/webpack_rails/node_modules/express/node_modules/send/node_modules/mime/mime.js +108 -0
  218. data/lib/webpack_rails/node_modules/express/node_modules/send/node_modules/mime/package.json +73 -0
  219. data/lib/webpack_rails/node_modules/express/node_modules/send/node_modules/mime/types.json +1 -0
  220. data/lib/webpack_rails/node_modules/express/node_modules/send/node_modules/ms/History.md +66 -0
  221. data/lib/webpack_rails/node_modules/express/node_modules/send/node_modules/ms/LICENSE +20 -0
  222. data/lib/webpack_rails/node_modules/express/node_modules/send/node_modules/ms/README.md +35 -0
  223. data/lib/webpack_rails/node_modules/express/node_modules/send/node_modules/ms/index.js +125 -0
  224. data/lib/webpack_rails/node_modules/express/node_modules/send/node_modules/ms/package.json +47 -0
  225. data/lib/webpack_rails/node_modules/express/node_modules/send/node_modules/statuses/LICENSE +22 -0
  226. data/lib/webpack_rails/node_modules/express/node_modules/send/node_modules/statuses/README.md +114 -0
  227. data/lib/webpack_rails/node_modules/express/node_modules/send/node_modules/statuses/codes.json +64 -0
  228. data/lib/webpack_rails/node_modules/express/node_modules/send/node_modules/statuses/index.js +60 -0
  229. data/lib/webpack_rails/node_modules/express/node_modules/send/node_modules/statuses/package.json +84 -0
  230. data/lib/webpack_rails/node_modules/express/node_modules/send/package.json +89 -0
  231. data/lib/webpack_rails/node_modules/express/node_modules/serve-static/HISTORY.md +284 -0
  232. data/lib/webpack_rails/node_modules/express/node_modules/serve-static/LICENSE +25 -0
  233. data/lib/webpack_rails/node_modules/express/node_modules/serve-static/README.md +235 -0
  234. data/lib/webpack_rails/node_modules/express/node_modules/serve-static/index.js +187 -0
  235. data/lib/webpack_rails/node_modules/express/node_modules/serve-static/package.json +83 -0
  236. data/lib/webpack_rails/node_modules/express/node_modules/type-is/HISTORY.md +180 -0
  237. data/lib/webpack_rails/node_modules/express/node_modules/type-is/LICENSE +23 -0
  238. data/lib/webpack_rails/node_modules/express/node_modules/type-is/README.md +132 -0
  239. data/lib/webpack_rails/node_modules/express/node_modules/type-is/index.js +262 -0
  240. data/lib/webpack_rails/node_modules/express/node_modules/type-is/node_modules/media-typer/HISTORY.md +22 -0
  241. data/lib/webpack_rails/node_modules/express/node_modules/type-is/node_modules/media-typer/LICENSE +22 -0
  242. data/lib/webpack_rails/node_modules/express/node_modules/type-is/node_modules/media-typer/README.md +81 -0
  243. data/lib/webpack_rails/node_modules/express/node_modules/type-is/node_modules/media-typer/index.js +270 -0
  244. data/lib/webpack_rails/node_modules/express/node_modules/type-is/node_modules/media-typer/package.json +58 -0
  245. data/lib/webpack_rails/node_modules/express/node_modules/type-is/node_modules/mime-types/HISTORY.md +171 -0
  246. data/lib/webpack_rails/node_modules/express/node_modules/type-is/node_modules/mime-types/LICENSE +23 -0
  247. data/lib/webpack_rails/node_modules/express/node_modules/type-is/node_modules/mime-types/README.md +103 -0
  248. data/lib/webpack_rails/node_modules/express/node_modules/type-is/node_modules/mime-types/index.js +188 -0
  249. data/lib/webpack_rails/node_modules/express/node_modules/type-is/node_modules/mime-types/node_modules/mime-db/HISTORY.md +274 -0
  250. data/lib/webpack_rails/node_modules/express/node_modules/type-is/node_modules/mime-types/node_modules/mime-db/LICENSE +22 -0
  251. data/lib/webpack_rails/node_modules/express/node_modules/type-is/node_modules/mime-types/node_modules/mime-db/README.md +82 -0
  252. data/lib/webpack_rails/node_modules/express/node_modules/type-is/node_modules/mime-types/node_modules/mime-db/db.json +6474 -0
  253. data/lib/webpack_rails/node_modules/express/node_modules/type-is/node_modules/mime-types/node_modules/mime-db/index.js +11 -0
  254. data/lib/webpack_rails/node_modules/express/node_modules/type-is/node_modules/mime-types/node_modules/mime-db/package.json +94 -0
  255. data/lib/webpack_rails/node_modules/express/node_modules/type-is/node_modules/mime-types/package.json +84 -0
  256. data/lib/webpack_rails/node_modules/express/node_modules/type-is/package.json +93 -0
  257. data/lib/webpack_rails/node_modules/express/node_modules/utils-merge/LICENSE +20 -0
  258. data/lib/webpack_rails/node_modules/express/node_modules/utils-merge/README.md +34 -0
  259. data/lib/webpack_rails/node_modules/express/node_modules/utils-merge/index.js +23 -0
  260. data/lib/webpack_rails/node_modules/express/node_modules/utils-merge/package.json +58 -0
  261. data/lib/webpack_rails/node_modules/express/node_modules/vary/HISTORY.md +23 -0
  262. data/lib/webpack_rails/node_modules/express/node_modules/vary/LICENSE +22 -0
  263. data/lib/webpack_rails/node_modules/express/node_modules/vary/README.md +91 -0
  264. data/lib/webpack_rails/node_modules/express/node_modules/vary/index.js +117 -0
  265. data/lib/webpack_rails/node_modules/express/node_modules/vary/package.json +72 -0
  266. data/lib/webpack_rails/node_modules/express/package.json +167 -0
  267. data/lib/webpack_rails/node_modules/is-array/History.md +11 -0
  268. data/lib/webpack_rails/node_modules/is-array/Makefile +11 -0
  269. data/lib/webpack_rails/node_modules/is-array/Readme.md +27 -0
  270. data/lib/webpack_rails/node_modules/is-array/component.json +13 -0
  271. data/lib/webpack_rails/node_modules/is-array/index.js +33 -0
  272. data/lib/webpack_rails/node_modules/is-array/package.json +41 -0
  273. data/lib/webpack_rails/node_modules/is-array/test/test.html +46 -0
  274. data/lib/webpack_rails/node_modules/is-object/LICENSE +19 -0
  275. data/lib/webpack_rails/node_modules/is-object/README.md +55 -0
  276. data/lib/webpack_rails/node_modules/is-object/index.js +5 -0
  277. data/lib/webpack_rails/node_modules/is-object/package.json +91 -0
  278. data/lib/webpack_rails/node_modules/is-object/test/index.js +23 -0
  279. data/lib/webpack_rails/node_modules/is-string/CHANGELOG.md +19 -0
  280. data/lib/webpack_rails/node_modules/is-string/LICENSE +22 -0
  281. data/lib/webpack_rails/node_modules/is-string/Makefile +61 -0
  282. data/lib/webpack_rails/node_modules/is-string/README.md +57 -0
  283. data/lib/webpack_rails/node_modules/is-string/index.js +20 -0
  284. data/lib/webpack_rails/node_modules/is-string/package.json +93 -0
  285. data/lib/webpack_rails/node_modules/is-string/test.js +36 -0
  286. data/lib/webpack_rails/node_modules/js-string-escape/CHANGELOG.md +9 -0
  287. data/lib/webpack_rails/node_modules/js-string-escape/LICENSE +21 -0
  288. data/lib/webpack_rails/node_modules/js-string-escape/README.md +44 -0
  289. data/lib/webpack_rails/node_modules/js-string-escape/index.js +22 -0
  290. data/lib/webpack_rails/node_modules/js-string-escape/package.json +63 -0
  291. data/lib/webpack_rails/node_modules/js-string-escape/test/test.js +43 -0
  292. data/lib/webpack_rails/node_modules/strip-ansi/index.js +6 -0
  293. data/lib/webpack_rails/node_modules/strip-ansi/license +21 -0
  294. data/lib/webpack_rails/node_modules/strip-ansi/node_modules/ansi-regex/index.js +4 -0
  295. data/lib/webpack_rails/node_modules/strip-ansi/node_modules/ansi-regex/license +21 -0
  296. data/lib/webpack_rails/node_modules/strip-ansi/node_modules/ansi-regex/package.json +86 -0
  297. data/lib/webpack_rails/node_modules/strip-ansi/node_modules/ansi-regex/readme.md +31 -0
  298. data/lib/webpack_rails/node_modules/strip-ansi/package.json +85 -0
  299. data/lib/webpack_rails/node_modules/strip-ansi/readme.md +33 -0
  300. data/lib/webpack_rails/node_modules/webpack-hot-middleware/README.md +109 -0
  301. data/lib/webpack_rails/node_modules/webpack-hot-middleware/client-overlay.js +35 -0
  302. data/lib/webpack_rails/node_modules/webpack-hot-middleware/client.js +131 -0
  303. data/lib/webpack_rails/node_modules/webpack-hot-middleware/example/README.md +15 -0
  304. data/lib/webpack_rails/node_modules/webpack-hot-middleware/example/client.js +30 -0
  305. data/lib/webpack_rails/node_modules/webpack-hot-middleware/example/index.html +18 -0
  306. data/lib/webpack_rails/node_modules/webpack-hot-middleware/example/package.json +14 -0
  307. data/lib/webpack_rails/node_modules/webpack-hot-middleware/example/server.js +41 -0
  308. data/lib/webpack_rails/node_modules/webpack-hot-middleware/example/webpack.config.js +22 -0
  309. data/lib/webpack_rails/node_modules/webpack-hot-middleware/helpers.js +8 -0
  310. data/lib/webpack_rails/node_modules/webpack-hot-middleware/middleware.js +83 -0
  311. data/lib/webpack_rails/node_modules/webpack-hot-middleware/node_modules/querystring/History.md +20 -0
  312. data/lib/webpack_rails/node_modules/webpack-hot-middleware/node_modules/querystring/License.md +19 -0
  313. data/lib/webpack_rails/node_modules/webpack-hot-middleware/node_modules/querystring/Readme.md +15 -0
  314. data/lib/webpack_rails/node_modules/webpack-hot-middleware/node_modules/querystring/decode.js +80 -0
  315. data/lib/webpack_rails/node_modules/webpack-hot-middleware/node_modules/querystring/encode.js +64 -0
  316. data/lib/webpack_rails/node_modules/webpack-hot-middleware/node_modules/querystring/index.js +4 -0
  317. data/lib/webpack_rails/node_modules/webpack-hot-middleware/node_modules/querystring/package.json +96 -0
  318. data/lib/webpack_rails/node_modules/webpack-hot-middleware/node_modules/querystring/test/common-index.js +3 -0
  319. data/lib/webpack_rails/node_modules/webpack-hot-middleware/node_modules/querystring/test/index.js +210 -0
  320. data/lib/webpack_rails/node_modules/webpack-hot-middleware/node_modules/querystring/test/tap-index.js +3 -0
  321. data/lib/webpack_rails/node_modules/webpack-hot-middleware/node_modules/strip-ansi/cli.js +47 -0
  322. data/lib/webpack_rails/node_modules/webpack-hot-middleware/node_modules/strip-ansi/index.js +6 -0
  323. data/lib/webpack_rails/node_modules/webpack-hot-middleware/node_modules/strip-ansi/node_modules/ansi-regex/index.js +4 -0
  324. data/lib/webpack_rails/node_modules/webpack-hot-middleware/node_modules/strip-ansi/node_modules/ansi-regex/license +21 -0
  325. data/lib/webpack_rails/node_modules/webpack-hot-middleware/node_modules/strip-ansi/node_modules/ansi-regex/package.json +86 -0
  326. data/lib/webpack_rails/node_modules/webpack-hot-middleware/node_modules/strip-ansi/node_modules/ansi-regex/readme.md +33 -0
  327. data/lib/webpack_rails/node_modules/webpack-hot-middleware/node_modules/strip-ansi/package.json +89 -0
  328. data/lib/webpack_rails/node_modules/webpack-hot-middleware/node_modules/strip-ansi/readme.md +43 -0
  329. data/lib/webpack_rails/node_modules/webpack-hot-middleware/package.json +58 -0
  330. data/lib/webpack_rails/node_modules/webpack-hot-middleware/process-update.js +105 -0
  331. data/lib/webpack_rails/node_modules/webpack-hot-middleware/test/client-test.js +81 -0
  332. data/lib/webpack_rails/node_modules/webpack-hot-middleware/test/helpers-test.js +22 -0
  333. data/lib/webpack_rails/node_modules/webpack-hot-middleware/test/middleware-test.js +188 -0
  334. data/lib/webpack_rails/node_modules/webpack-hot-middleware/test/mocha.opts +1 -0
  335. data/lib/webpack_rails/node_modules/xtend/LICENCE +19 -0
  336. data/lib/webpack_rails/node_modules/xtend/Makefile +4 -0
  337. data/lib/webpack_rails/node_modules/xtend/README.md +32 -0
  338. data/lib/webpack_rails/node_modules/xtend/immutable.js +17 -0
  339. data/lib/webpack_rails/node_modules/xtend/mutable.js +15 -0
  340. data/lib/webpack_rails/node_modules/xtend/package.json +88 -0
  341. data/lib/webpack_rails/node_modules/xtend/test.js +63 -0
  342. data/lib/webpack_rails/package.json +22 -0
  343. data/lib/webpack_rails/processor.rb +28 -9
  344. data/lib/webpack_rails/require_directive_processor.rb +51 -0
  345. data/lib/webpack_rails/sprockets_environment.rb +45 -0
  346. data/lib/webpack_rails/task.rb +51 -22
  347. data/lib/webpack_rails/webpack-task-dev-server.js +122 -0
  348. data/lib/webpack_rails/{webpack-task.js → webpack-task-watch.js} +0 -0
  349. data/lib/webpack_rails/webpack.rake +5 -5
  350. data/lib/webpack_rails.rb +1 -3
  351. metadata +346 -5
  352. data/lib/webpack_rails/sprockets_base_webpack.rb +0 -14
  353. data/lib/webpack_rails/sprockets_index_webpack.rb +0 -15
@@ -0,0 +1,820 @@
1
+ /*!
2
+ * send
3
+ * Copyright(c) 2012 TJ Holowaychuk
4
+ * Copyright(c) 2014-2015 Douglas Christopher Wilson
5
+ * MIT Licensed
6
+ */
7
+
8
+ 'use strict'
9
+
10
+ /**
11
+ * Module dependencies.
12
+ * @private
13
+ */
14
+
15
+ var createError = require('http-errors')
16
+ var debug = require('debug')('send')
17
+ var deprecate = require('depd')('send')
18
+ var destroy = require('destroy')
19
+ var escapeHtml = require('escape-html')
20
+ , parseRange = require('range-parser')
21
+ , Stream = require('stream')
22
+ , mime = require('mime')
23
+ , fresh = require('fresh')
24
+ , path = require('path')
25
+ , fs = require('fs')
26
+ , normalize = path.normalize
27
+ , join = path.join
28
+ var etag = require('etag')
29
+ var EventEmitter = require('events').EventEmitter;
30
+ var ms = require('ms');
31
+ var onFinished = require('on-finished')
32
+ var statuses = require('statuses')
33
+
34
+ /**
35
+ * Variables.
36
+ */
37
+ var extname = path.extname
38
+ var maxMaxAge = 60 * 60 * 24 * 365 * 1000; // 1 year
39
+ var resolve = path.resolve
40
+ var sep = path.sep
41
+ var toString = Object.prototype.toString
42
+ var upPathRegexp = /(?:^|[\\\/])\.\.(?:[\\\/]|$)/
43
+
44
+ /**
45
+ * Module exports.
46
+ * @public
47
+ */
48
+
49
+ module.exports = send
50
+ module.exports.mime = mime
51
+
52
+ /**
53
+ * Shim EventEmitter.listenerCount for node.js < 0.10
54
+ */
55
+
56
+ /* istanbul ignore next */
57
+ var listenerCount = EventEmitter.listenerCount
58
+ || function(emitter, type){ return emitter.listeners(type).length; };
59
+
60
+ /**
61
+ * Return a `SendStream` for `req` and `path`.
62
+ *
63
+ * @param {object} req
64
+ * @param {string} path
65
+ * @param {object} [options]
66
+ * @return {SendStream}
67
+ * @public
68
+ */
69
+
70
+ function send(req, path, options) {
71
+ return new SendStream(req, path, options);
72
+ }
73
+
74
+ /**
75
+ * Initialize a `SendStream` with the given `path`.
76
+ *
77
+ * @param {Request} req
78
+ * @param {String} path
79
+ * @param {object} [options]
80
+ * @private
81
+ */
82
+
83
+ function SendStream(req, path, options) {
84
+ var opts = options || {}
85
+
86
+ this.options = opts
87
+ this.path = path
88
+ this.req = req
89
+
90
+ this._etag = opts.etag !== undefined
91
+ ? Boolean(opts.etag)
92
+ : true
93
+
94
+ this._dotfiles = opts.dotfiles !== undefined
95
+ ? opts.dotfiles
96
+ : 'ignore'
97
+
98
+ if (this._dotfiles !== 'ignore' && this._dotfiles !== 'allow' && this._dotfiles !== 'deny') {
99
+ throw new TypeError('dotfiles option must be "allow", "deny", or "ignore"')
100
+ }
101
+
102
+ this._hidden = Boolean(opts.hidden)
103
+
104
+ if (opts.hidden !== undefined) {
105
+ deprecate('hidden: use dotfiles: \'' + (this._hidden ? 'allow' : 'ignore') + '\' instead')
106
+ }
107
+
108
+ // legacy support
109
+ if (opts.dotfiles === undefined) {
110
+ this._dotfiles = undefined
111
+ }
112
+
113
+ this._extensions = opts.extensions !== undefined
114
+ ? normalizeList(opts.extensions, 'extensions option')
115
+ : []
116
+
117
+ this._index = opts.index !== undefined
118
+ ? normalizeList(opts.index, 'index option')
119
+ : ['index.html']
120
+
121
+ this._lastModified = opts.lastModified !== undefined
122
+ ? Boolean(opts.lastModified)
123
+ : true
124
+
125
+ this._maxage = opts.maxAge || opts.maxage
126
+ this._maxage = typeof this._maxage === 'string'
127
+ ? ms(this._maxage)
128
+ : Number(this._maxage)
129
+ this._maxage = !isNaN(this._maxage)
130
+ ? Math.min(Math.max(0, this._maxage), maxMaxAge)
131
+ : 0
132
+
133
+ this._root = opts.root
134
+ ? resolve(opts.root)
135
+ : null
136
+
137
+ if (!this._root && opts.from) {
138
+ this.from(opts.from)
139
+ }
140
+ }
141
+
142
+ /**
143
+ * Inherits from `Stream.prototype`.
144
+ */
145
+
146
+ SendStream.prototype.__proto__ = Stream.prototype;
147
+
148
+ /**
149
+ * Enable or disable etag generation.
150
+ *
151
+ * @param {Boolean} val
152
+ * @return {SendStream}
153
+ * @api public
154
+ */
155
+
156
+ SendStream.prototype.etag = deprecate.function(function etag(val) {
157
+ val = Boolean(val);
158
+ debug('etag %s', val);
159
+ this._etag = val;
160
+ return this;
161
+ }, 'send.etag: pass etag as option');
162
+
163
+ /**
164
+ * Enable or disable "hidden" (dot) files.
165
+ *
166
+ * @param {Boolean} path
167
+ * @return {SendStream}
168
+ * @api public
169
+ */
170
+
171
+ SendStream.prototype.hidden = deprecate.function(function hidden(val) {
172
+ val = Boolean(val);
173
+ debug('hidden %s', val);
174
+ this._hidden = val;
175
+ this._dotfiles = undefined
176
+ return this;
177
+ }, 'send.hidden: use dotfiles option');
178
+
179
+ /**
180
+ * Set index `paths`, set to a falsy
181
+ * value to disable index support.
182
+ *
183
+ * @param {String|Boolean|Array} paths
184
+ * @return {SendStream}
185
+ * @api public
186
+ */
187
+
188
+ SendStream.prototype.index = deprecate.function(function index(paths) {
189
+ var index = !paths ? [] : normalizeList(paths, 'paths argument');
190
+ debug('index %o', paths);
191
+ this._index = index;
192
+ return this;
193
+ }, 'send.index: pass index as option');
194
+
195
+ /**
196
+ * Set root `path`.
197
+ *
198
+ * @param {String} path
199
+ * @return {SendStream}
200
+ * @api public
201
+ */
202
+
203
+ SendStream.prototype.root = function(path){
204
+ path = String(path);
205
+ this._root = resolve(path)
206
+ return this;
207
+ };
208
+
209
+ SendStream.prototype.from = deprecate.function(SendStream.prototype.root,
210
+ 'send.from: pass root as option');
211
+
212
+ SendStream.prototype.root = deprecate.function(SendStream.prototype.root,
213
+ 'send.root: pass root as option');
214
+
215
+ /**
216
+ * Set max-age to `maxAge`.
217
+ *
218
+ * @param {Number} maxAge
219
+ * @return {SendStream}
220
+ * @api public
221
+ */
222
+
223
+ SendStream.prototype.maxage = deprecate.function(function maxage(maxAge) {
224
+ maxAge = typeof maxAge === 'string'
225
+ ? ms(maxAge)
226
+ : Number(maxAge);
227
+ if (isNaN(maxAge)) maxAge = 0;
228
+ if (Infinity == maxAge) maxAge = 60 * 60 * 24 * 365 * 1000;
229
+ debug('max-age %d', maxAge);
230
+ this._maxage = maxAge;
231
+ return this;
232
+ }, 'send.maxage: pass maxAge as option');
233
+
234
+ /**
235
+ * Emit error with `status`.
236
+ *
237
+ * @param {number} status
238
+ * @param {Error} [error]
239
+ * @private
240
+ */
241
+
242
+ SendStream.prototype.error = function error(status, error) {
243
+ // emit if listeners instead of responding
244
+ if (listenerCount(this, 'error') !== 0) {
245
+ return this.emit('error', createError(error, status, {
246
+ expose: false
247
+ }))
248
+ }
249
+
250
+ var res = this.res
251
+ var msg = statuses[status]
252
+
253
+ // wipe all existing headers
254
+ res._headers = null
255
+
256
+ // send basic response
257
+ res.statusCode = status
258
+ res.setHeader('Content-Type', 'text/plain; charset=UTF-8')
259
+ res.setHeader('Content-Length', Buffer.byteLength(msg))
260
+ res.setHeader('X-Content-Type-Options', 'nosniff')
261
+ res.end(msg)
262
+ }
263
+
264
+ /**
265
+ * Check if the pathname ends with "/".
266
+ *
267
+ * @return {Boolean}
268
+ * @api private
269
+ */
270
+
271
+ SendStream.prototype.hasTrailingSlash = function(){
272
+ return '/' == this.path[this.path.length - 1];
273
+ };
274
+
275
+ /**
276
+ * Check if this is a conditional GET request.
277
+ *
278
+ * @return {Boolean}
279
+ * @api private
280
+ */
281
+
282
+ SendStream.prototype.isConditionalGET = function(){
283
+ return this.req.headers['if-none-match']
284
+ || this.req.headers['if-modified-since'];
285
+ };
286
+
287
+ /**
288
+ * Strip content-* header fields.
289
+ *
290
+ * @private
291
+ */
292
+
293
+ SendStream.prototype.removeContentHeaderFields = function removeContentHeaderFields() {
294
+ var res = this.res
295
+ var headers = Object.keys(res._headers || {})
296
+
297
+ for (var i = 0; i < headers.length; i++) {
298
+ var header = headers[i]
299
+ if (header.substr(0, 8) === 'content-' && header !== 'content-location') {
300
+ res.removeHeader(header)
301
+ }
302
+ }
303
+ }
304
+
305
+ /**
306
+ * Respond with 304 not modified.
307
+ *
308
+ * @api private
309
+ */
310
+
311
+ SendStream.prototype.notModified = function(){
312
+ var res = this.res;
313
+ debug('not modified');
314
+ this.removeContentHeaderFields();
315
+ res.statusCode = 304;
316
+ res.end();
317
+ };
318
+
319
+ /**
320
+ * Raise error that headers already sent.
321
+ *
322
+ * @api private
323
+ */
324
+
325
+ SendStream.prototype.headersAlreadySent = function headersAlreadySent(){
326
+ var err = new Error('Can\'t set headers after they are sent.');
327
+ debug('headers already sent');
328
+ this.error(500, err);
329
+ };
330
+
331
+ /**
332
+ * Check if the request is cacheable, aka
333
+ * responded with 2xx or 304 (see RFC 2616 section 14.2{5,6}).
334
+ *
335
+ * @return {Boolean}
336
+ * @api private
337
+ */
338
+
339
+ SendStream.prototype.isCachable = function(){
340
+ var res = this.res;
341
+ return (res.statusCode >= 200 && res.statusCode < 300) || 304 == res.statusCode;
342
+ };
343
+
344
+ /**
345
+ * Handle stat() error.
346
+ *
347
+ * @param {Error} error
348
+ * @private
349
+ */
350
+
351
+ SendStream.prototype.onStatError = function onStatError(error) {
352
+ switch (error.code) {
353
+ case 'ENAMETOOLONG':
354
+ case 'ENOENT':
355
+ case 'ENOTDIR':
356
+ this.error(404, error)
357
+ break
358
+ default:
359
+ this.error(500, error)
360
+ break
361
+ }
362
+ }
363
+
364
+ /**
365
+ * Check if the cache is fresh.
366
+ *
367
+ * @return {Boolean}
368
+ * @api private
369
+ */
370
+
371
+ SendStream.prototype.isFresh = function(){
372
+ return fresh(this.req.headers, this.res._headers);
373
+ };
374
+
375
+ /**
376
+ * Check if the range is fresh.
377
+ *
378
+ * @return {Boolean}
379
+ * @api private
380
+ */
381
+
382
+ SendStream.prototype.isRangeFresh = function isRangeFresh(){
383
+ var ifRange = this.req.headers['if-range'];
384
+
385
+ if (!ifRange) return true;
386
+
387
+ return ~ifRange.indexOf('"')
388
+ ? ~ifRange.indexOf(this.res._headers['etag'])
389
+ : Date.parse(this.res._headers['last-modified']) <= Date.parse(ifRange);
390
+ };
391
+
392
+ /**
393
+ * Redirect to path.
394
+ *
395
+ * @param {string} path
396
+ * @private
397
+ */
398
+
399
+ SendStream.prototype.redirect = function redirect(path) {
400
+ if (listenerCount(this, 'directory') !== 0) {
401
+ this.emit('directory')
402
+ return
403
+ }
404
+
405
+ if (this.hasTrailingSlash()) {
406
+ this.error(403)
407
+ return
408
+ }
409
+
410
+ var loc = path + '/'
411
+ var msg = 'Redirecting to <a href="' + escapeHtml(loc) + '">' + escapeHtml(loc) + '</a>\n'
412
+ var res = this.res
413
+
414
+ // redirect
415
+ res.statusCode = 301
416
+ res.setHeader('Content-Type', 'text/html; charset=UTF-8')
417
+ res.setHeader('Content-Length', Buffer.byteLength(msg))
418
+ res.setHeader('X-Content-Type-Options', 'nosniff')
419
+ res.setHeader('Location', loc)
420
+ res.end(msg)
421
+ }
422
+
423
+ /**
424
+ * Pipe to `res.
425
+ *
426
+ * @param {Stream} res
427
+ * @return {Stream} res
428
+ * @api public
429
+ */
430
+
431
+ SendStream.prototype.pipe = function(res){
432
+ var self = this
433
+ , args = arguments
434
+ , root = this._root;
435
+
436
+ // references
437
+ this.res = res;
438
+
439
+ // decode the path
440
+ var path = decode(this.path)
441
+ if (path === -1) return this.error(400)
442
+
443
+ // null byte(s)
444
+ if (~path.indexOf('\0')) return this.error(400);
445
+
446
+ var parts
447
+ if (root !== null) {
448
+ // malicious path
449
+ if (upPathRegexp.test(normalize('.' + sep + path))) {
450
+ debug('malicious path "%s"', path)
451
+ return this.error(403)
452
+ }
453
+
454
+ // join / normalize from optional root dir
455
+ path = normalize(join(root, path))
456
+ root = normalize(root + sep)
457
+
458
+ // explode path parts
459
+ parts = path.substr(root.length).split(sep)
460
+ } else {
461
+ // ".." is malicious without "root"
462
+ if (upPathRegexp.test(path)) {
463
+ debug('malicious path "%s"', path)
464
+ return this.error(403)
465
+ }
466
+
467
+ // explode path parts
468
+ parts = normalize(path).split(sep)
469
+
470
+ // resolve the path
471
+ path = resolve(path)
472
+ }
473
+
474
+ // dotfile handling
475
+ if (containsDotFile(parts)) {
476
+ var access = this._dotfiles
477
+
478
+ // legacy support
479
+ if (access === undefined) {
480
+ access = parts[parts.length - 1][0] === '.'
481
+ ? (this._hidden ? 'allow' : 'ignore')
482
+ : 'allow'
483
+ }
484
+
485
+ debug('%s dotfile "%s"', access, path)
486
+ switch (access) {
487
+ case 'allow':
488
+ break
489
+ case 'deny':
490
+ return this.error(403)
491
+ case 'ignore':
492
+ default:
493
+ return this.error(404)
494
+ }
495
+ }
496
+
497
+ // index file support
498
+ if (this._index.length && this.path[this.path.length - 1] === '/') {
499
+ this.sendIndex(path);
500
+ return res;
501
+ }
502
+
503
+ this.sendFile(path);
504
+ return res;
505
+ };
506
+
507
+ /**
508
+ * Transfer `path`.
509
+ *
510
+ * @param {String} path
511
+ * @api public
512
+ */
513
+
514
+ SendStream.prototype.send = function(path, stat){
515
+ var len = stat.size;
516
+ var options = this.options
517
+ var opts = {}
518
+ var res = this.res;
519
+ var req = this.req;
520
+ var ranges = req.headers.range;
521
+ var offset = options.start || 0;
522
+
523
+ if (res._header) {
524
+ // impossible to send now
525
+ return this.headersAlreadySent();
526
+ }
527
+
528
+ debug('pipe "%s"', path)
529
+
530
+ // set header fields
531
+ this.setHeader(path, stat);
532
+
533
+ // set content-type
534
+ this.type(path);
535
+
536
+ // conditional GET support
537
+ if (this.isConditionalGET()
538
+ && this.isCachable()
539
+ && this.isFresh()) {
540
+ return this.notModified();
541
+ }
542
+
543
+ // adjust len to start/end options
544
+ len = Math.max(0, len - offset);
545
+ if (options.end !== undefined) {
546
+ var bytes = options.end - offset + 1;
547
+ if (len > bytes) len = bytes;
548
+ }
549
+
550
+ // Range support
551
+ if (ranges) {
552
+ ranges = parseRange(len, ranges);
553
+
554
+ // If-Range support
555
+ if (!this.isRangeFresh()) {
556
+ debug('range stale');
557
+ ranges = -2;
558
+ }
559
+
560
+ // unsatisfiable
561
+ if (-1 == ranges) {
562
+ debug('range unsatisfiable');
563
+ res.setHeader('Content-Range', 'bytes */' + stat.size);
564
+ return this.error(416);
565
+ }
566
+
567
+ // valid (syntactically invalid/multiple ranges are treated as a regular response)
568
+ if (-2 != ranges && ranges.length === 1) {
569
+ debug('range %j', ranges);
570
+
571
+ // Content-Range
572
+ res.statusCode = 206;
573
+ res.setHeader('Content-Range', 'bytes '
574
+ + ranges[0].start
575
+ + '-'
576
+ + ranges[0].end
577
+ + '/'
578
+ + len);
579
+
580
+ offset += ranges[0].start;
581
+ len = ranges[0].end - ranges[0].start + 1;
582
+ }
583
+ }
584
+
585
+ // clone options
586
+ for (var prop in options) {
587
+ opts[prop] = options[prop]
588
+ }
589
+
590
+ // set read options
591
+ opts.start = offset
592
+ opts.end = Math.max(offset, offset + len - 1)
593
+
594
+ // content-length
595
+ res.setHeader('Content-Length', len);
596
+
597
+ // HEAD support
598
+ if ('HEAD' == req.method) return res.end();
599
+
600
+ this.stream(path, opts)
601
+ };
602
+
603
+ /**
604
+ * Transfer file for `path`.
605
+ *
606
+ * @param {String} path
607
+ * @api private
608
+ */
609
+ SendStream.prototype.sendFile = function sendFile(path) {
610
+ var i = 0
611
+ var self = this
612
+
613
+ debug('stat "%s"', path);
614
+ fs.stat(path, function onstat(err, stat) {
615
+ if (err && err.code === 'ENOENT'
616
+ && !extname(path)
617
+ && path[path.length - 1] !== sep) {
618
+ // not found, check extensions
619
+ return next(err)
620
+ }
621
+ if (err) return self.onStatError(err)
622
+ if (stat.isDirectory()) return self.redirect(self.path)
623
+ self.emit('file', path, stat)
624
+ self.send(path, stat)
625
+ })
626
+
627
+ function next(err) {
628
+ if (self._extensions.length <= i) {
629
+ return err
630
+ ? self.onStatError(err)
631
+ : self.error(404)
632
+ }
633
+
634
+ var p = path + '.' + self._extensions[i++]
635
+
636
+ debug('stat "%s"', p)
637
+ fs.stat(p, function (err, stat) {
638
+ if (err) return next(err)
639
+ if (stat.isDirectory()) return next()
640
+ self.emit('file', p, stat)
641
+ self.send(p, stat)
642
+ })
643
+ }
644
+ }
645
+
646
+ /**
647
+ * Transfer index for `path`.
648
+ *
649
+ * @param {String} path
650
+ * @api private
651
+ */
652
+ SendStream.prototype.sendIndex = function sendIndex(path){
653
+ var i = -1;
654
+ var self = this;
655
+
656
+ function next(err){
657
+ if (++i >= self._index.length) {
658
+ if (err) return self.onStatError(err);
659
+ return self.error(404);
660
+ }
661
+
662
+ var p = join(path, self._index[i]);
663
+
664
+ debug('stat "%s"', p);
665
+ fs.stat(p, function(err, stat){
666
+ if (err) return next(err);
667
+ if (stat.isDirectory()) return next();
668
+ self.emit('file', p, stat);
669
+ self.send(p, stat);
670
+ });
671
+ }
672
+
673
+ next();
674
+ };
675
+
676
+ /**
677
+ * Stream `path` to the response.
678
+ *
679
+ * @param {String} path
680
+ * @param {Object} options
681
+ * @api private
682
+ */
683
+
684
+ SendStream.prototype.stream = function(path, options){
685
+ // TODO: this is all lame, refactor meeee
686
+ var finished = false;
687
+ var self = this;
688
+ var res = this.res;
689
+ var req = this.req;
690
+
691
+ // pipe
692
+ var stream = fs.createReadStream(path, options);
693
+ this.emit('stream', stream);
694
+ stream.pipe(res);
695
+
696
+ // response finished, done with the fd
697
+ onFinished(res, function onfinished(){
698
+ finished = true;
699
+ destroy(stream);
700
+ });
701
+
702
+ // error handling code-smell
703
+ stream.on('error', function onerror(err){
704
+ // request already finished
705
+ if (finished) return;
706
+
707
+ // clean up stream
708
+ finished = true;
709
+ destroy(stream);
710
+
711
+ // error
712
+ self.onStatError(err);
713
+ });
714
+
715
+ // end
716
+ stream.on('end', function onend(){
717
+ self.emit('end');
718
+ });
719
+ };
720
+
721
+ /**
722
+ * Set content-type based on `path`
723
+ * if it hasn't been explicitly set.
724
+ *
725
+ * @param {String} path
726
+ * @api private
727
+ */
728
+
729
+ SendStream.prototype.type = function(path){
730
+ var res = this.res;
731
+ if (res.getHeader('Content-Type')) return;
732
+ var type = mime.lookup(path);
733
+ var charset = mime.charsets.lookup(type);
734
+ debug('content-type %s', type);
735
+ res.setHeader('Content-Type', type + (charset ? '; charset=' + charset : ''));
736
+ };
737
+
738
+ /**
739
+ * Set response header fields, most
740
+ * fields may be pre-defined.
741
+ *
742
+ * @param {String} path
743
+ * @param {Object} stat
744
+ * @api private
745
+ */
746
+
747
+ SendStream.prototype.setHeader = function setHeader(path, stat){
748
+ var res = this.res;
749
+
750
+ this.emit('headers', res, path, stat);
751
+
752
+ if (!res.getHeader('Accept-Ranges')) res.setHeader('Accept-Ranges', 'bytes');
753
+ if (!res.getHeader('Cache-Control')) res.setHeader('Cache-Control', 'public, max-age=' + Math.floor(this._maxage / 1000));
754
+
755
+ if (this._lastModified && !res.getHeader('Last-Modified')) {
756
+ var modified = stat.mtime.toUTCString()
757
+ debug('modified %s', modified)
758
+ res.setHeader('Last-Modified', modified)
759
+ }
760
+
761
+ if (this._etag && !res.getHeader('ETag')) {
762
+ var val = etag(stat)
763
+ debug('etag %s', val)
764
+ res.setHeader('ETag', val)
765
+ }
766
+ };
767
+
768
+ /**
769
+ * Determine if path parts contain a dotfile.
770
+ *
771
+ * @api private
772
+ */
773
+
774
+ function containsDotFile(parts) {
775
+ for (var i = 0; i < parts.length; i++) {
776
+ if (parts[i][0] === '.') {
777
+ return true
778
+ }
779
+ }
780
+
781
+ return false
782
+ }
783
+
784
+ /**
785
+ * decodeURIComponent.
786
+ *
787
+ * Allows V8 to only deoptimize this fn instead of all
788
+ * of send().
789
+ *
790
+ * @param {String} path
791
+ * @api private
792
+ */
793
+
794
+ function decode(path) {
795
+ try {
796
+ return decodeURIComponent(path)
797
+ } catch (err) {
798
+ return -1
799
+ }
800
+ }
801
+
802
+ /**
803
+ * Normalize the index option into an array.
804
+ *
805
+ * @param {boolean|string|array} val
806
+ * @param {string} name
807
+ * @private
808
+ */
809
+
810
+ function normalizeList(val, name) {
811
+ var list = [].concat(val || [])
812
+
813
+ for (var i = 0; i < list.length; i++) {
814
+ if (typeof list[i] !== 'string') {
815
+ throw new TypeError(name + ' must be array of strings or false')
816
+ }
817
+ }
818
+
819
+ return list
820
+ }