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,262 @@
1
+ /*!
2
+ * type-is
3
+ * Copyright(c) 2014 Jonathan Ong
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 typer = require('media-typer')
16
+ var mime = require('mime-types')
17
+
18
+ /**
19
+ * Module exports.
20
+ * @public
21
+ */
22
+
23
+ module.exports = typeofrequest
24
+ module.exports.is = typeis
25
+ module.exports.hasBody = hasbody
26
+ module.exports.normalize = normalize
27
+ module.exports.match = mimeMatch
28
+
29
+ /**
30
+ * Compare a `value` content-type with `types`.
31
+ * Each `type` can be an extension like `html`,
32
+ * a special shortcut like `multipart` or `urlencoded`,
33
+ * or a mime type.
34
+ *
35
+ * If no types match, `false` is returned.
36
+ * Otherwise, the first `type` that matches is returned.
37
+ *
38
+ * @param {String} value
39
+ * @param {Array} types
40
+ * @public
41
+ */
42
+
43
+ function typeis(value, types_) {
44
+ var i
45
+ var types = types_
46
+
47
+ // remove parameters and normalize
48
+ var val = tryNormalizeType(value)
49
+
50
+ // no type or invalid
51
+ if (!val) {
52
+ return false
53
+ }
54
+
55
+ // support flattened arguments
56
+ if (types && !Array.isArray(types)) {
57
+ types = new Array(arguments.length - 1)
58
+ for (i = 0; i < types.length; i++) {
59
+ types[i] = arguments[i + 1]
60
+ }
61
+ }
62
+
63
+ // no types, return the content type
64
+ if (!types || !types.length) {
65
+ return val
66
+ }
67
+
68
+ var type
69
+ for (i = 0; i < types.length; i++) {
70
+ if (mimeMatch(normalize(type = types[i]), val)) {
71
+ return type[0] === '+' || type.indexOf('*') !== -1
72
+ ? val
73
+ : type
74
+ }
75
+ }
76
+
77
+ // no matches
78
+ return false
79
+ }
80
+
81
+ /**
82
+ * Check if a request has a request body.
83
+ * A request with a body __must__ either have `transfer-encoding`
84
+ * or `content-length` headers set.
85
+ * http://www.w3.org/Protocols/rfc2616/rfc2616-sec4.html#sec4.3
86
+ *
87
+ * @param {Object} request
88
+ * @return {Boolean}
89
+ * @public
90
+ */
91
+
92
+ function hasbody(req) {
93
+ return req.headers['transfer-encoding'] !== undefined
94
+ || !isNaN(req.headers['content-length'])
95
+ }
96
+
97
+ /**
98
+ * Check if the incoming request contains the "Content-Type"
99
+ * header field, and it contains any of the give mime `type`s.
100
+ * If there is no request body, `null` is returned.
101
+ * If there is no content type, `false` is returned.
102
+ * Otherwise, it returns the first `type` that matches.
103
+ *
104
+ * Examples:
105
+ *
106
+ * // With Content-Type: text/html; charset=utf-8
107
+ * this.is('html'); // => 'html'
108
+ * this.is('text/html'); // => 'text/html'
109
+ * this.is('text/*', 'application/json'); // => 'text/html'
110
+ *
111
+ * // When Content-Type is application/json
112
+ * this.is('json', 'urlencoded'); // => 'json'
113
+ * this.is('application/json'); // => 'application/json'
114
+ * this.is('html', 'application/*'); // => 'application/json'
115
+ *
116
+ * this.is('html'); // => false
117
+ *
118
+ * @param {String|Array} types...
119
+ * @return {String|false|null}
120
+ * @public
121
+ */
122
+
123
+ function typeofrequest(req, types_) {
124
+ var types = types_
125
+
126
+ // no body
127
+ if (!hasbody(req)) {
128
+ return null
129
+ }
130
+
131
+ // support flattened arguments
132
+ if (arguments.length > 2) {
133
+ types = new Array(arguments.length - 1)
134
+ for (var i = 0; i < types.length; i++) {
135
+ types[i] = arguments[i + 1]
136
+ }
137
+ }
138
+
139
+ // request content type
140
+ var value = req.headers['content-type']
141
+
142
+ return typeis(value, types)
143
+ }
144
+
145
+ /**
146
+ * Normalize a mime type.
147
+ * If it's a shorthand, expand it to a valid mime type.
148
+ *
149
+ * In general, you probably want:
150
+ *
151
+ * var type = is(req, ['urlencoded', 'json', 'multipart']);
152
+ *
153
+ * Then use the appropriate body parsers.
154
+ * These three are the most common request body types
155
+ * and are thus ensured to work.
156
+ *
157
+ * @param {String} type
158
+ * @private
159
+ */
160
+
161
+ function normalize(type) {
162
+ if (typeof type !== 'string') {
163
+ // invalid type
164
+ return false
165
+ }
166
+
167
+ switch (type) {
168
+ case 'urlencoded':
169
+ return 'application/x-www-form-urlencoded'
170
+ case 'multipart':
171
+ return 'multipart/*'
172
+ }
173
+
174
+ if (type[0] === '+') {
175
+ // "+json" -> "*/*+json" expando
176
+ return '*/*' + type
177
+ }
178
+
179
+ return type.indexOf('/') === -1
180
+ ? mime.lookup(type)
181
+ : type
182
+ }
183
+
184
+ /**
185
+ * Check if `exected` mime type
186
+ * matches `actual` mime type with
187
+ * wildcard and +suffix support.
188
+ *
189
+ * @param {String} expected
190
+ * @param {String} actual
191
+ * @return {Boolean}
192
+ * @private
193
+ */
194
+
195
+ function mimeMatch(expected, actual) {
196
+ // invalid type
197
+ if (expected === false) {
198
+ return false
199
+ }
200
+
201
+ // split types
202
+ var actualParts = actual.split('/')
203
+ var expectedParts = expected.split('/')
204
+
205
+ // invalid format
206
+ if (actualParts.length !== 2 || expectedParts.length !== 2) {
207
+ return false
208
+ }
209
+
210
+ // validate type
211
+ if (expectedParts[0] !== '*' && expectedParts[0] !== actualParts[0]) {
212
+ return false
213
+ }
214
+
215
+ // validate suffix wildcard
216
+ if (expectedParts[1].substr(0, 2) === '*+') {
217
+ return expectedParts[1].length <= actualParts[1].length + 1
218
+ && expectedParts[1].substr(1) === actualParts[1].substr(1 - expectedParts[1].length)
219
+ }
220
+
221
+ // validate subtype
222
+ if (expectedParts[1] !== '*' && expectedParts[1] !== actualParts[1]) {
223
+ return false
224
+ }
225
+
226
+ return true
227
+ }
228
+
229
+ /**
230
+ * Normalize a type and remove parameters.
231
+ *
232
+ * @param {string} value
233
+ * @return {string}
234
+ * @private
235
+ */
236
+
237
+ function normalizeType(value) {
238
+ // parse the type
239
+ var type = typer.parse(value)
240
+
241
+ // remove the parameters
242
+ type.parameters = undefined
243
+
244
+ // reformat it
245
+ return typer.format(type)
246
+ }
247
+
248
+ /**
249
+ * Try to normalize a type and remove parameters.
250
+ *
251
+ * @param {string} value
252
+ * @return {string}
253
+ * @private
254
+ */
255
+
256
+ function tryNormalizeType(value) {
257
+ try {
258
+ return normalizeType(value)
259
+ } catch (err) {
260
+ return null
261
+ }
262
+ }
@@ -0,0 +1,22 @@
1
+ 0.3.0 / 2014-09-07
2
+ ==================
3
+
4
+ * Support Node.js 0.6
5
+ * Throw error when parameter format invalid on parse
6
+
7
+ 0.2.0 / 2014-06-18
8
+ ==================
9
+
10
+ * Add `typer.format()` to format media types
11
+
12
+ 0.1.0 / 2014-06-17
13
+ ==================
14
+
15
+ * Accept `req` as argument to `parse`
16
+ * Accept `res` as argument to `parse`
17
+ * Parse media type with extra LWS between type and first parameter
18
+
19
+ 0.0.0 / 2014-06-13
20
+ ==================
21
+
22
+ * Initial implementation
@@ -0,0 +1,22 @@
1
+ (The MIT License)
2
+
3
+ Copyright (c) 2014 Douglas Christopher Wilson
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining
6
+ a copy of this software and associated documentation files (the
7
+ 'Software'), to deal in the Software without restriction, including
8
+ without limitation the rights to use, copy, modify, merge, publish,
9
+ distribute, sublicense, and/or sell copies of the Software, and to
10
+ permit persons to whom the Software is furnished to do so, subject to
11
+ the following conditions:
12
+
13
+ The above copyright notice and this permission notice shall be
14
+ included in all copies or substantial portions of the Software.
15
+
16
+ THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
17
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
19
+ IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
20
+ CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
21
+ TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
22
+ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
@@ -0,0 +1,81 @@
1
+ # media-typer
2
+
3
+ [![NPM Version][npm-image]][npm-url]
4
+ [![NPM Downloads][downloads-image]][downloads-url]
5
+ [![Node.js Version][node-version-image]][node-version-url]
6
+ [![Build Status][travis-image]][travis-url]
7
+ [![Test Coverage][coveralls-image]][coveralls-url]
8
+
9
+ Simple RFC 6838 media type parser
10
+
11
+ ## Installation
12
+
13
+ ```sh
14
+ $ npm install media-typer
15
+ ```
16
+
17
+ ## API
18
+
19
+ ```js
20
+ var typer = require('media-typer')
21
+ ```
22
+
23
+ ### typer.parse(string)
24
+
25
+ ```js
26
+ var obj = typer.parse('image/svg+xml; charset=utf-8')
27
+ ```
28
+
29
+ Parse a media type string. This will return an object with the following
30
+ properties (examples are shown for the string `'image/svg+xml; charset=utf-8'`):
31
+
32
+ - `type`: The type of the media type (always lower case). Example: `'image'`
33
+
34
+ - `subtype`: The subtype of the media type (always lower case). Example: `'svg'`
35
+
36
+ - `suffix`: The suffix of the media type (always lower case). Example: `'xml'`
37
+
38
+ - `parameters`: An object of the parameters in the media type (name of parameter always lower case). Example: `{charset: 'utf-8'}`
39
+
40
+ ### typer.parse(req)
41
+
42
+ ```js
43
+ var obj = typer.parse(req)
44
+ ```
45
+
46
+ Parse the `content-type` header from the given `req`. Short-cut for
47
+ `typer.parse(req.headers['content-type'])`.
48
+
49
+ ### typer.parse(res)
50
+
51
+ ```js
52
+ var obj = typer.parse(res)
53
+ ```
54
+
55
+ Parse the `content-type` header set on the given `res`. Short-cut for
56
+ `typer.parse(res.getHeader('content-type'))`.
57
+
58
+ ### typer.format(obj)
59
+
60
+ ```js
61
+ var obj = typer.format({type: 'image', subtype: 'svg', suffix: 'xml'})
62
+ ```
63
+
64
+ Format an object into a media type string. This will return a string of the
65
+ mime type for the given object. For the properties of the object, see the
66
+ documentation for `typer.parse(string)`.
67
+
68
+ ## License
69
+
70
+ [MIT](LICENSE)
71
+
72
+ [npm-image]: https://img.shields.io/npm/v/media-typer.svg?style=flat
73
+ [npm-url]: https://npmjs.org/package/media-typer
74
+ [node-version-image]: https://img.shields.io/badge/node.js-%3E%3D_0.6-brightgreen.svg?style=flat
75
+ [node-version-url]: http://nodejs.org/download/
76
+ [travis-image]: https://img.shields.io/travis/jshttp/media-typer.svg?style=flat
77
+ [travis-url]: https://travis-ci.org/jshttp/media-typer
78
+ [coveralls-image]: https://img.shields.io/coveralls/jshttp/media-typer.svg?style=flat
79
+ [coveralls-url]: https://coveralls.io/r/jshttp/media-typer
80
+ [downloads-image]: https://img.shields.io/npm/dm/media-typer.svg?style=flat
81
+ [downloads-url]: https://npmjs.org/package/media-typer
@@ -0,0 +1,270 @@
1
+ /*!
2
+ * media-typer
3
+ * Copyright(c) 2014 Douglas Christopher Wilson
4
+ * MIT Licensed
5
+ */
6
+
7
+ /**
8
+ * RegExp to match *( ";" parameter ) in RFC 2616 sec 3.7
9
+ *
10
+ * parameter = token "=" ( token | quoted-string )
11
+ * token = 1*<any CHAR except CTLs or separators>
12
+ * separators = "(" | ")" | "<" | ">" | "@"
13
+ * | "," | ";" | ":" | "\" | <">
14
+ * | "/" | "[" | "]" | "?" | "="
15
+ * | "{" | "}" | SP | HT
16
+ * quoted-string = ( <"> *(qdtext | quoted-pair ) <"> )
17
+ * qdtext = <any TEXT except <">>
18
+ * quoted-pair = "\" CHAR
19
+ * CHAR = <any US-ASCII character (octets 0 - 127)>
20
+ * TEXT = <any OCTET except CTLs, but including LWS>
21
+ * LWS = [CRLF] 1*( SP | HT )
22
+ * CRLF = CR LF
23
+ * CR = <US-ASCII CR, carriage return (13)>
24
+ * LF = <US-ASCII LF, linefeed (10)>
25
+ * SP = <US-ASCII SP, space (32)>
26
+ * SHT = <US-ASCII HT, horizontal-tab (9)>
27
+ * CTL = <any US-ASCII control character (octets 0 - 31) and DEL (127)>
28
+ * OCTET = <any 8-bit sequence of data>
29
+ */
30
+ var paramRegExp = /; *([!#$%&'\*\+\-\.0-9A-Z\^_`a-z\|~]+) *= *("(?:[ !\u0023-\u005b\u005d-\u007e\u0080-\u00ff]|\\[\u0020-\u007e])*"|[!#$%&'\*\+\-\.0-9A-Z\^_`a-z\|~]+) */g;
31
+ var textRegExp = /^[\u0020-\u007e\u0080-\u00ff]+$/
32
+ var tokenRegExp = /^[!#$%&'\*\+\-\.0-9A-Z\^_`a-z\|~]+$/
33
+
34
+ /**
35
+ * RegExp to match quoted-pair in RFC 2616
36
+ *
37
+ * quoted-pair = "\" CHAR
38
+ * CHAR = <any US-ASCII character (octets 0 - 127)>
39
+ */
40
+ var qescRegExp = /\\([\u0000-\u007f])/g;
41
+
42
+ /**
43
+ * RegExp to match chars that must be quoted-pair in RFC 2616
44
+ */
45
+ var quoteRegExp = /([\\"])/g;
46
+
47
+ /**
48
+ * RegExp to match type in RFC 6838
49
+ *
50
+ * type-name = restricted-name
51
+ * subtype-name = restricted-name
52
+ * restricted-name = restricted-name-first *126restricted-name-chars
53
+ * restricted-name-first = ALPHA / DIGIT
54
+ * restricted-name-chars = ALPHA / DIGIT / "!" / "#" /
55
+ * "$" / "&" / "-" / "^" / "_"
56
+ * restricted-name-chars =/ "." ; Characters before first dot always
57
+ * ; specify a facet name
58
+ * restricted-name-chars =/ "+" ; Characters after last plus always
59
+ * ; specify a structured syntax suffix
60
+ * ALPHA = %x41-5A / %x61-7A ; A-Z / a-z
61
+ * DIGIT = %x30-39 ; 0-9
62
+ */
63
+ var subtypeNameRegExp = /^[A-Za-z0-9][A-Za-z0-9!#$&^_.-]{0,126}$/
64
+ var typeNameRegExp = /^[A-Za-z0-9][A-Za-z0-9!#$&^_-]{0,126}$/
65
+ var typeRegExp = /^ *([A-Za-z0-9][A-Za-z0-9!#$&^_-]{0,126})\/([A-Za-z0-9][A-Za-z0-9!#$&^_.+-]{0,126}) *$/;
66
+
67
+ /**
68
+ * Module exports.
69
+ */
70
+
71
+ exports.format = format
72
+ exports.parse = parse
73
+
74
+ /**
75
+ * Format object to media type.
76
+ *
77
+ * @param {object} obj
78
+ * @return {string}
79
+ * @api public
80
+ */
81
+
82
+ function format(obj) {
83
+ if (!obj || typeof obj !== 'object') {
84
+ throw new TypeError('argument obj is required')
85
+ }
86
+
87
+ var parameters = obj.parameters
88
+ var subtype = obj.subtype
89
+ var suffix = obj.suffix
90
+ var type = obj.type
91
+
92
+ if (!type || !typeNameRegExp.test(type)) {
93
+ throw new TypeError('invalid type')
94
+ }
95
+
96
+ if (!subtype || !subtypeNameRegExp.test(subtype)) {
97
+ throw new TypeError('invalid subtype')
98
+ }
99
+
100
+ // format as type/subtype
101
+ var string = type + '/' + subtype
102
+
103
+ // append +suffix
104
+ if (suffix) {
105
+ if (!typeNameRegExp.test(suffix)) {
106
+ throw new TypeError('invalid suffix')
107
+ }
108
+
109
+ string += '+' + suffix
110
+ }
111
+
112
+ // append parameters
113
+ if (parameters && typeof parameters === 'object') {
114
+ var param
115
+ var params = Object.keys(parameters).sort()
116
+
117
+ for (var i = 0; i < params.length; i++) {
118
+ param = params[i]
119
+
120
+ if (!tokenRegExp.test(param)) {
121
+ throw new TypeError('invalid parameter name')
122
+ }
123
+
124
+ string += '; ' + param + '=' + qstring(parameters[param])
125
+ }
126
+ }
127
+
128
+ return string
129
+ }
130
+
131
+ /**
132
+ * Parse media type to object.
133
+ *
134
+ * @param {string|object} string
135
+ * @return {Object}
136
+ * @api public
137
+ */
138
+
139
+ function parse(string) {
140
+ if (!string) {
141
+ throw new TypeError('argument string is required')
142
+ }
143
+
144
+ // support req/res-like objects as argument
145
+ if (typeof string === 'object') {
146
+ string = getcontenttype(string)
147
+ }
148
+
149
+ if (typeof string !== 'string') {
150
+ throw new TypeError('argument string is required to be a string')
151
+ }
152
+
153
+ var index = string.indexOf(';')
154
+ var type = index !== -1
155
+ ? string.substr(0, index)
156
+ : string
157
+
158
+ var key
159
+ var match
160
+ var obj = splitType(type)
161
+ var params = {}
162
+ var value
163
+
164
+ paramRegExp.lastIndex = index
165
+
166
+ while (match = paramRegExp.exec(string)) {
167
+ if (match.index !== index) {
168
+ throw new TypeError('invalid parameter format')
169
+ }
170
+
171
+ index += match[0].length
172
+ key = match[1].toLowerCase()
173
+ value = match[2]
174
+
175
+ if (value[0] === '"') {
176
+ // remove quotes and escapes
177
+ value = value
178
+ .substr(1, value.length - 2)
179
+ .replace(qescRegExp, '$1')
180
+ }
181
+
182
+ params[key] = value
183
+ }
184
+
185
+ if (index !== -1 && index !== string.length) {
186
+ throw new TypeError('invalid parameter format')
187
+ }
188
+
189
+ obj.parameters = params
190
+
191
+ return obj
192
+ }
193
+
194
+ /**
195
+ * Get content-type from req/res objects.
196
+ *
197
+ * @param {object}
198
+ * @return {Object}
199
+ * @api private
200
+ */
201
+
202
+ function getcontenttype(obj) {
203
+ if (typeof obj.getHeader === 'function') {
204
+ // res-like
205
+ return obj.getHeader('content-type')
206
+ }
207
+
208
+ if (typeof obj.headers === 'object') {
209
+ // req-like
210
+ return obj.headers && obj.headers['content-type']
211
+ }
212
+ }
213
+
214
+ /**
215
+ * Quote a string if necessary.
216
+ *
217
+ * @param {string} val
218
+ * @return {string}
219
+ * @api private
220
+ */
221
+
222
+ function qstring(val) {
223
+ var str = String(val)
224
+
225
+ // no need to quote tokens
226
+ if (tokenRegExp.test(str)) {
227
+ return str
228
+ }
229
+
230
+ if (str.length > 0 && !textRegExp.test(str)) {
231
+ throw new TypeError('invalid parameter value')
232
+ }
233
+
234
+ return '"' + str.replace(quoteRegExp, '\\$1') + '"'
235
+ }
236
+
237
+ /**
238
+ * Simply "type/subtype+siffx" into parts.
239
+ *
240
+ * @param {string} string
241
+ * @return {Object}
242
+ * @api private
243
+ */
244
+
245
+ function splitType(string) {
246
+ var match = typeRegExp.exec(string.toLowerCase())
247
+
248
+ if (!match) {
249
+ throw new TypeError('invalid media type')
250
+ }
251
+
252
+ var type = match[1]
253
+ var subtype = match[2]
254
+ var suffix
255
+
256
+ // suffix after last +
257
+ var index = subtype.lastIndexOf('+')
258
+ if (index !== -1) {
259
+ suffix = subtype.substr(index + 1)
260
+ subtype = subtype.substr(0, index)
261
+ }
262
+
263
+ var obj = {
264
+ type: type,
265
+ subtype: subtype,
266
+ suffix: suffix
267
+ }
268
+
269
+ return obj
270
+ }