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,374 @@
1
+ # Define the main object
2
+ ipaddr = {}
3
+
4
+ root = this
5
+
6
+ # Export for both the CommonJS and browser-like environment
7
+ if module? && module.exports
8
+ module.exports = ipaddr
9
+ else
10
+ root['ipaddr'] = ipaddr
11
+
12
+ # A generic CIDR (Classless Inter-Domain Routing) RFC1518 range matcher.
13
+ matchCIDR = (first, second, partSize, cidrBits) ->
14
+ if first.length != second.length
15
+ throw new Error "ipaddr: cannot match CIDR for objects with different lengths"
16
+
17
+ part = 0
18
+ while cidrBits > 0
19
+ shift = partSize - cidrBits
20
+ shift = 0 if shift < 0
21
+
22
+ if first[part] >> shift != second[part] >> shift
23
+ return false
24
+
25
+ cidrBits -= partSize
26
+ part += 1
27
+
28
+ return true
29
+
30
+ # An utility function to ease named range matching. See examples below.
31
+ ipaddr.subnetMatch = (address, rangeList, defaultName='unicast') ->
32
+ for rangeName, rangeSubnets of rangeList
33
+ # ECMA5 Array.isArray isn't available everywhere
34
+ if toString.call(rangeSubnets[0]) != '[object Array]'
35
+ rangeSubnets = [ rangeSubnets ]
36
+
37
+ for subnet in rangeSubnets
38
+ return rangeName if address.match.apply(address, subnet)
39
+
40
+ return defaultName
41
+
42
+ # An IPv4 address (RFC791).
43
+ class ipaddr.IPv4
44
+ # Constructs a new IPv4 address from an array of four octets.
45
+ # Verifies the input.
46
+ constructor: (octets) ->
47
+ if octets.length != 4
48
+ throw new Error "ipaddr: ipv4 octet count should be 4"
49
+
50
+ for octet in octets
51
+ if !(0 <= octet <= 255)
52
+ throw new Error "ipaddr: ipv4 octet is a byte"
53
+
54
+ @octets = octets
55
+
56
+ # The 'kind' method exists on both IPv4 and IPv6 classes.
57
+ kind: ->
58
+ return 'ipv4'
59
+
60
+ # Returns the address in convenient, decimal-dotted format.
61
+ toString: ->
62
+ return @octets.join "."
63
+
64
+ # Returns an array of byte-sized values in network order
65
+ toByteArray: ->
66
+ return @octets.slice(0) # octets.clone
67
+
68
+ # Checks if this address matches other one within given CIDR range.
69
+ match: (other, cidrRange) ->
70
+ if cidrRange == undefined
71
+ [other, cidrRange] = other
72
+
73
+ if other.kind() != 'ipv4'
74
+ throw new Error "ipaddr: cannot match ipv4 address with non-ipv4 one"
75
+
76
+ return matchCIDR(this.octets, other.octets, 8, cidrRange)
77
+
78
+ # Special IPv4 address ranges.
79
+ SpecialRanges:
80
+ unspecified: [
81
+ [ new IPv4([0, 0, 0, 0]), 8 ]
82
+ ]
83
+ broadcast: [
84
+ [ new IPv4([255, 255, 255, 255]), 32 ]
85
+ ]
86
+ multicast: [ # RFC3171
87
+ [ new IPv4([224, 0, 0, 0]), 4 ]
88
+ ]
89
+ linkLocal: [ # RFC3927
90
+ [ new IPv4([169, 254, 0, 0]), 16 ]
91
+ ]
92
+ loopback: [ # RFC5735
93
+ [ new IPv4([127, 0, 0, 0]), 8 ]
94
+ ]
95
+ private: [ # RFC1918
96
+ [ new IPv4([10, 0, 0, 0]), 8 ]
97
+ [ new IPv4([172, 16, 0, 0]), 12 ]
98
+ [ new IPv4([192, 168, 0, 0]), 16 ]
99
+ ]
100
+ reserved: [ # Reserved and testing-only ranges; RFCs 5735, 5737, 2544, 1700
101
+ [ new IPv4([192, 0, 0, 0]), 24 ]
102
+ [ new IPv4([192, 0, 2, 0]), 24 ]
103
+ [ new IPv4([192, 88, 99, 0]), 24 ]
104
+ [ new IPv4([198, 51, 100, 0]), 24 ]
105
+ [ new IPv4([203, 0, 113, 0]), 24 ]
106
+ [ new IPv4([240, 0, 0, 0]), 4 ]
107
+ ]
108
+
109
+ # Checks if the address corresponds to one of the special ranges.
110
+ range: ->
111
+ return ipaddr.subnetMatch(this, @SpecialRanges)
112
+
113
+ # Convrets this IPv4 address to an IPv4-mapped IPv6 address.
114
+ toIPv4MappedAddress: ->
115
+ return ipaddr.IPv6.parse "::ffff:#{@toString()}"
116
+
117
+ # A list of regular expressions that match arbitrary IPv4 addresses,
118
+ # for which a number of weird notations exist.
119
+ # Note that an address like 0010.0xa5.1.1 is considered legal.
120
+ ipv4Part = "(0?\\d+|0x[a-f0-9]+)"
121
+ ipv4Regexes =
122
+ fourOctet: new RegExp "^#{ipv4Part}\\.#{ipv4Part}\\.#{ipv4Part}\\.#{ipv4Part}$", 'i'
123
+ longValue: new RegExp "^#{ipv4Part}$", 'i'
124
+
125
+ # Classful variants (like a.b, where a is an octet, and b is a 24-bit
126
+ # value representing last three octets; this corresponds to a class C
127
+ # address) are omitted due to classless nature of modern Internet.
128
+ ipaddr.IPv4.parser = (string) ->
129
+ parseIntAuto = (string) ->
130
+ if string[0] == "0" && string[1] != "x"
131
+ parseInt(string, 8)
132
+ else
133
+ parseInt(string)
134
+
135
+ # parseInt recognizes all that octal & hexadecimal weirdness for us
136
+ if match = string.match(ipv4Regexes.fourOctet)
137
+ return (parseIntAuto(part) for part in match[1..5])
138
+ else if match = string.match(ipv4Regexes.longValue)
139
+ value = parseIntAuto(match[1])
140
+ if value > 0xffffffff || value < 0
141
+ throw new Error "ipaddr: address outside defined range"
142
+ return ((value >> shift) & 0xff for shift in [0..24] by 8).reverse()
143
+ else
144
+ return null
145
+
146
+ # An IPv6 address (RFC2460)
147
+ class ipaddr.IPv6
148
+ # Constructs an IPv6 address from an array of eight 16-bit parts.
149
+ # Throws an error if the input is invalid.
150
+ constructor: (parts) ->
151
+ if parts.length != 8
152
+ throw new Error "ipaddr: ipv6 part count should be 8"
153
+
154
+ for part in parts
155
+ if !(0 <= part <= 0xffff)
156
+ throw new Error "ipaddr: ipv6 part should fit to two octets"
157
+
158
+ @parts = parts
159
+
160
+ # The 'kind' method exists on both IPv4 and IPv6 classes.
161
+ kind: ->
162
+ return 'ipv6'
163
+
164
+ # Returns the address in compact, human-readable format like
165
+ # 2001:db8:8:66::1
166
+ toString: ->
167
+ stringParts = (part.toString(16) for part in @parts)
168
+
169
+ compactStringParts = []
170
+ pushPart = (part) -> compactStringParts.push part
171
+
172
+ state = 0
173
+ for part in stringParts
174
+ switch state
175
+ when 0
176
+ if part == '0'
177
+ pushPart('')
178
+ else
179
+ pushPart(part)
180
+
181
+ state = 1
182
+ when 1
183
+ if part == '0'
184
+ state = 2
185
+ else
186
+ pushPart(part)
187
+ when 2
188
+ unless part == '0'
189
+ pushPart('')
190
+ pushPart(part)
191
+ state = 3
192
+ when 3
193
+ pushPart(part)
194
+
195
+ if state == 2
196
+ pushPart('')
197
+ pushPart('')
198
+
199
+ return compactStringParts.join ":"
200
+
201
+ # Returns an array of byte-sized values in network order
202
+ toByteArray: ->
203
+ bytes = []
204
+ for part in @parts
205
+ bytes.push(part >> 8)
206
+ bytes.push(part & 0xff)
207
+
208
+ return bytes
209
+
210
+ # Returns the address in expanded format with all zeroes included, like
211
+ # 2001:db8:8:66:0:0:0:1
212
+ toNormalizedString: ->
213
+ return (part.toString(16) for part in @parts).join ":"
214
+
215
+ # Checks if this address matches other one within given CIDR range.
216
+ match: (other, cidrRange) ->
217
+ if cidrRange == undefined
218
+ [other, cidrRange] = other
219
+
220
+ if other.kind() != 'ipv6'
221
+ throw new Error "ipaddr: cannot match ipv6 address with non-ipv6 one"
222
+
223
+ return matchCIDR(this.parts, other.parts, 16, cidrRange)
224
+
225
+ # Special IPv6 ranges
226
+ SpecialRanges:
227
+ unspecified: [ new IPv6([0, 0, 0, 0, 0, 0, 0, 0]), 128 ] # RFC4291, here and after
228
+ linkLocal: [ new IPv6([0xfe80, 0, 0, 0, 0, 0, 0, 0]), 10 ]
229
+ multicast: [ new IPv6([0xff00, 0, 0, 0, 0, 0, 0, 0]), 8 ]
230
+ loopback: [ new IPv6([0, 0, 0, 0, 0, 0, 0, 1]), 128 ]
231
+ uniqueLocal: [ new IPv6([0xfc00, 0, 0, 0, 0, 0, 0, 0]), 7 ]
232
+ ipv4Mapped: [ new IPv6([0, 0, 0, 0, 0, 0xffff, 0, 0]), 96 ]
233
+ rfc6145: [ new IPv6([0, 0, 0, 0, 0xffff, 0, 0, 0]), 96 ] # RFC6145
234
+ rfc6052: [ new IPv6([0x64, 0xff9b, 0, 0, 0, 0, 0, 0]), 96 ] # RFC6052
235
+ '6to4': [ new IPv6([0x2002, 0, 0, 0, 0, 0, 0, 0]), 16 ] # RFC3056
236
+ teredo: [ new IPv6([0x2001, 0, 0, 0, 0, 0, 0, 0]), 32 ] # RFC6052, RFC6146
237
+ reserved: [
238
+ [ new IPv6([ 0x2001, 0xdb8, 0, 0, 0, 0, 0, 0]), 32 ] # RFC4291
239
+ ]
240
+
241
+ # Checks if the address corresponds to one of the special ranges.
242
+ range: ->
243
+ return ipaddr.subnetMatch(this, @SpecialRanges)
244
+
245
+ # Checks if this address is an IPv4-mapped IPv6 address.
246
+ isIPv4MappedAddress: ->
247
+ return @range() == 'ipv4Mapped'
248
+
249
+ # Converts this address to IPv4 address if it is an IPv4-mapped IPv6 address.
250
+ # Throws an error otherwise.
251
+ toIPv4Address: ->
252
+ unless @isIPv4MappedAddress()
253
+ throw new Error "ipaddr: trying to convert a generic ipv6 address to ipv4"
254
+
255
+ [high, low] = @parts[-2..-1]
256
+
257
+ return new ipaddr.IPv4([high >> 8, high & 0xff, low >> 8, low & 0xff])
258
+
259
+ # IPv6-matching regular expressions.
260
+ # For IPv6, the task is simpler: it is enough to match the colon-delimited
261
+ # hexadecimal IPv6 and a transitional variant with dotted-decimal IPv4 at
262
+ # the end.
263
+ ipv6Part = "(?:[0-9a-f]+::?)+"
264
+ ipv6Regexes =
265
+ native: new RegExp "^(::)?(#{ipv6Part})?([0-9a-f]+)?(::)?$", 'i'
266
+ transitional: new RegExp "^((?:#{ipv6Part})|(?:::)(?:#{ipv6Part})?)" +
267
+ "#{ipv4Part}\\.#{ipv4Part}\\.#{ipv4Part}\\.#{ipv4Part}$", 'i'
268
+
269
+ # Expand :: in an IPv6 address or address part consisting of `parts` groups.
270
+ expandIPv6 = (string, parts) ->
271
+ # More than one '::' means invalid adddress
272
+ if string.indexOf('::') != string.lastIndexOf('::')
273
+ return null
274
+
275
+ # How many parts do we already have?
276
+ colonCount = 0
277
+ lastColon = -1
278
+ while (lastColon = string.indexOf(':', lastColon + 1)) >= 0
279
+ colonCount++
280
+
281
+ # 0::0 is two parts more than ::
282
+ colonCount-- if string[0] == ':'
283
+ colonCount-- if string[string.length-1] == ':'
284
+
285
+ # The following loop would hang if colonCount > parts
286
+ if colonCount > parts
287
+ return null
288
+
289
+ # replacement = ':' + '0:' * (parts - colonCount)
290
+ replacementCount = parts - colonCount
291
+ replacement = ':'
292
+ while replacementCount--
293
+ replacement += '0:'
294
+
295
+ # Insert the missing zeroes
296
+ string = string.replace('::', replacement)
297
+
298
+ # Trim any garbage which may be hanging around if :: was at the edge in
299
+ # the source string
300
+ string = string[1..-1] if string[0] == ':'
301
+ string = string[0..-2] if string[string.length-1] == ':'
302
+
303
+ return (parseInt(part, 16) for part in string.split(":"))
304
+
305
+ # Parse an IPv6 address.
306
+ ipaddr.IPv6.parser = (string) ->
307
+ if string.match(ipv6Regexes['native'])
308
+ return expandIPv6(string, 8)
309
+
310
+ else if match = string.match(ipv6Regexes['transitional'])
311
+ parts = expandIPv6(match[1][0..-2], 6)
312
+ if parts
313
+ parts.push(parseInt(match[2]) << 8 | parseInt(match[3]))
314
+ parts.push(parseInt(match[4]) << 8 | parseInt(match[5]))
315
+ return parts
316
+
317
+ return null
318
+
319
+ # Checks if a given string is formatted like IPv4/IPv6 address.
320
+ ipaddr.IPv4.isIPv4 = ipaddr.IPv6.isIPv6 = (string) ->
321
+ return @parser(string) != null
322
+
323
+ # Checks if a given string is a valid IPv4/IPv6 address.
324
+ ipaddr.IPv4.isValid = ipaddr.IPv6.isValid = (string) ->
325
+ try
326
+ new this(@parser(string))
327
+ return true
328
+ catch e
329
+ return false
330
+
331
+ # Tries to parse and validate a string with IPv4/IPv6 address.
332
+ # Throws an error if it fails.
333
+ ipaddr.IPv4.parse = ipaddr.IPv6.parse = (string) ->
334
+ parts = @parser(string)
335
+ if parts == null
336
+ throw new Error "ipaddr: string is not formatted like ip address"
337
+
338
+ return new this(parts)
339
+
340
+ ipaddr.IPv4.parseCIDR = ipaddr.IPv6.parseCIDR = (string) ->
341
+ if match = string.match(/^(.+)\/(\d+)$/)
342
+ return [@parse(match[1]), parseInt(match[2])]
343
+
344
+ throw new Error "ipaddr: string is not formatted like a CIDR range"
345
+
346
+ # Checks if the address is valid IP address
347
+ ipaddr.isValid = (string) ->
348
+ return ipaddr.IPv6.isValid(string) || ipaddr.IPv4.isValid(string)
349
+
350
+ # Try to parse an address and throw an error if it is impossible
351
+ ipaddr.parse = (string) ->
352
+ if ipaddr.IPv6.isValid(string)
353
+ return ipaddr.IPv6.parse(string)
354
+ else if ipaddr.IPv4.isValid(string)
355
+ return ipaddr.IPv4.parse(string)
356
+ else
357
+ throw new Error "ipaddr: the address has neither IPv6 nor IPv4 format"
358
+
359
+ ipaddr.parseCIDR = (string) ->
360
+ try
361
+ return ipaddr.IPv6.parseCIDR(string)
362
+ catch e
363
+ try
364
+ return ipaddr.IPv4.parseCIDR(string)
365
+ catch e
366
+ throw new Error "ipaddr: the address has neither IPv6 nor IPv4 CIDR format"
367
+
368
+ # Parse an address and return plain IPv4 address if it is an IPv4-mapped address
369
+ ipaddr.process = (string) ->
370
+ addr = @parse(string)
371
+ if addr.kind() == 'ipv6' && addr.isIPv4MappedAddress()
372
+ return addr.toIPv4Address()
373
+ else
374
+ return addr
@@ -0,0 +1,262 @@
1
+ ipaddr = require '../lib/ipaddr'
2
+
3
+ module.exports =
4
+ 'should define main classes': (test) ->
5
+ test.ok(ipaddr.IPv4?, 'defines IPv4 class')
6
+ test.ok(ipaddr.IPv6?, 'defines IPv6 class')
7
+ test.done()
8
+
9
+ 'can construct IPv4 from octets': (test) ->
10
+ test.doesNotThrow ->
11
+ new ipaddr.IPv4([192, 168, 1, 2])
12
+ test.done()
13
+
14
+ 'refuses to construct invalid IPv4': (test) ->
15
+ test.throws ->
16
+ new ipaddr.IPv4([300, 1, 2, 3])
17
+ test.throws ->
18
+ new ipaddr.IPv4([8, 8, 8])
19
+ test.done()
20
+
21
+ 'converts IPv4 to string correctly': (test) ->
22
+ addr = new ipaddr.IPv4([192, 168, 1, 1])
23
+ test.equal(addr.toString(), '192.168.1.1')
24
+ test.done()
25
+
26
+ 'returns correct kind for IPv4': (test) ->
27
+ addr = new ipaddr.IPv4([1, 2, 3, 4])
28
+ test.equal(addr.kind(), 'ipv4')
29
+ test.done()
30
+
31
+ 'allows to access IPv4 octets': (test) ->
32
+ addr = new ipaddr.IPv4([42, 0, 0, 0])
33
+ test.equal(addr.octets[0], 42)
34
+ test.done()
35
+
36
+ 'checks IPv4 address format': (test) ->
37
+ test.equal(ipaddr.IPv4.isIPv4('192.168.007.0xa'), true)
38
+ test.equal(ipaddr.IPv4.isIPv4('1024.0.0.1'), true)
39
+ test.equal(ipaddr.IPv4.isIPv4('8.0xa.wtf.6'), false)
40
+ test.done()
41
+
42
+ 'validates IPv4 addresses': (test) ->
43
+ test.equal(ipaddr.IPv4.isValid('192.168.007.0xa'), true)
44
+ test.equal(ipaddr.IPv4.isValid('1024.0.0.1'), false)
45
+ test.equal(ipaddr.IPv4.isValid('8.0xa.wtf.6'), false)
46
+ test.done()
47
+
48
+ 'parses IPv4 in several weird formats': (test) ->
49
+ test.deepEqual(ipaddr.IPv4.parse('192.168.1.1').octets, [192, 168, 1, 1])
50
+ test.deepEqual(ipaddr.IPv4.parse('0xc0.168.1.1').octets, [192, 168, 1, 1])
51
+ test.deepEqual(ipaddr.IPv4.parse('192.0250.1.1').octets, [192, 168, 1, 1])
52
+ test.deepEqual(ipaddr.IPv4.parse('0xc0a80101').octets, [192, 168, 1, 1])
53
+ test.deepEqual(ipaddr.IPv4.parse('030052000401').octets, [192, 168, 1, 1])
54
+ test.deepEqual(ipaddr.IPv4.parse('3232235777').octets, [192, 168, 1, 1])
55
+ test.done()
56
+
57
+ 'barfs at invalid IPv4': (test) ->
58
+ test.throws ->
59
+ ipaddr.IPv4.parse('10.0.0.wtf')
60
+ test.done()
61
+
62
+ 'matches IPv4 CIDR correctly': (test) ->
63
+ addr = new ipaddr.IPv4([10, 5, 0, 1])
64
+ test.equal(addr.match(ipaddr.IPv4.parse('0.0.0.0'), 0), true)
65
+ test.equal(addr.match(ipaddr.IPv4.parse('11.0.0.0'), 8), false)
66
+ test.equal(addr.match(ipaddr.IPv4.parse('10.0.0.0'), 8), true)
67
+ test.equal(addr.match(ipaddr.IPv4.parse('10.0.0.1'), 8), true)
68
+ test.equal(addr.match(ipaddr.IPv4.parse('10.0.0.10'), 8), true)
69
+ test.equal(addr.match(ipaddr.IPv4.parse('10.5.5.0'), 16), true)
70
+ test.equal(addr.match(ipaddr.IPv4.parse('10.4.5.0'), 16), false)
71
+ test.equal(addr.match(ipaddr.IPv4.parse('10.4.5.0'), 15), true)
72
+ test.equal(addr.match(ipaddr.IPv4.parse('10.5.0.2'), 32), false)
73
+ test.equal(addr.match(addr, 32), true)
74
+ test.done()
75
+
76
+ 'parses IPv4 CIDR correctly': (test) ->
77
+ addr = new ipaddr.IPv4([10, 5, 0, 1])
78
+ test.equal(addr.match(ipaddr.IPv4.parseCIDR('0.0.0.0/0')), true)
79
+ test.equal(addr.match(ipaddr.IPv4.parseCIDR('11.0.0.0/8')), false)
80
+ test.equal(addr.match(ipaddr.IPv4.parseCIDR('10.0.0.0/8')), true)
81
+ test.equal(addr.match(ipaddr.IPv4.parseCIDR('10.0.0.1/8')), true)
82
+ test.equal(addr.match(ipaddr.IPv4.parseCIDR('10.0.0.10/8')), true)
83
+ test.equal(addr.match(ipaddr.IPv4.parseCIDR('10.5.5.0/16')), true)
84
+ test.equal(addr.match(ipaddr.IPv4.parseCIDR('10.4.5.0/16')), false)
85
+ test.equal(addr.match(ipaddr.IPv4.parseCIDR('10.4.5.0/15')), true)
86
+ test.equal(addr.match(ipaddr.IPv4.parseCIDR('10.5.0.2/32')), false)
87
+ test.equal(addr.match(ipaddr.IPv4.parseCIDR('10.5.0.1/32')), true)
88
+ test.throws ->
89
+ ipaddr.IPv4.parseCIDR('10.5.0.1')
90
+ test.done()
91
+
92
+ 'detects reserved IPv4 networks': (test) ->
93
+ test.equal(ipaddr.IPv4.parse('0.0.0.0').range(), 'unspecified')
94
+ test.equal(ipaddr.IPv4.parse('0.1.0.0').range(), 'unspecified')
95
+ test.equal(ipaddr.IPv4.parse('10.1.0.1').range(), 'private')
96
+ test.equal(ipaddr.IPv4.parse('192.168.2.1').range(), 'private')
97
+ test.equal(ipaddr.IPv4.parse('224.100.0.1').range(), 'multicast')
98
+ test.equal(ipaddr.IPv4.parse('169.254.15.0').range(), 'linkLocal')
99
+ test.equal(ipaddr.IPv4.parse('127.1.1.1').range(), 'loopback')
100
+ test.equal(ipaddr.IPv4.parse('255.255.255.255').range(), 'broadcast')
101
+ test.equal(ipaddr.IPv4.parse('240.1.2.3').range(), 'reserved')
102
+ test.equal(ipaddr.IPv4.parse('8.8.8.8').range(), 'unicast')
103
+ test.done()
104
+
105
+ 'can construct IPv6 from parts': (test) ->
106
+ test.doesNotThrow ->
107
+ new ipaddr.IPv6([0x2001, 0xdb8, 0xf53a, 0, 0, 0, 0, 1])
108
+ test.done()
109
+
110
+ 'refuses to construct invalid IPv6': (test) ->
111
+ test.throws ->
112
+ new ipaddr.IPv6([0xfffff, 0, 0, 0, 0, 0, 0, 1])
113
+ test.throws ->
114
+ new ipaddr.IPv6([0xfffff, 0, 0, 0, 0, 0, 1])
115
+ test.done()
116
+
117
+ 'converts IPv6 to string correctly': (test) ->
118
+ addr = new ipaddr.IPv6([0x2001, 0xdb8, 0xf53a, 0, 0, 0, 0, 1])
119
+ test.equal(addr.toNormalizedString(), '2001:db8:f53a:0:0:0:0:1')
120
+ test.equal(addr.toString(), '2001:db8:f53a::1')
121
+ test.equal(new ipaddr.IPv6([0, 0, 0, 0, 0, 0, 0, 1]).toString(), '::1')
122
+ test.equal(new ipaddr.IPv6([0x2001, 0xdb8, 0, 0, 0, 0, 0, 0]).toString(), '2001:db8::')
123
+ test.done()
124
+
125
+ 'returns correct kind for IPv6': (test) ->
126
+ addr = new ipaddr.IPv6([0x2001, 0xdb8, 0xf53a, 0, 0, 0, 0, 1])
127
+ test.equal(addr.kind(), 'ipv6')
128
+ test.done()
129
+
130
+ 'allows to access IPv6 address parts': (test) ->
131
+ addr = new ipaddr.IPv6([0x2001, 0xdb8, 0xf53a, 0, 0, 42, 0, 1])
132
+ test.equal(addr.parts[5], 42)
133
+ test.done()
134
+
135
+ 'checks IPv6 address format': (test) ->
136
+ test.equal(ipaddr.IPv6.isIPv6('2001:db8:F53A::1'), true)
137
+ test.equal(ipaddr.IPv6.isIPv6('200001::1'), true)
138
+ test.equal(ipaddr.IPv6.isIPv6('::ffff:192.168.1.1'), true)
139
+ test.equal(ipaddr.IPv6.isIPv6('::ffff:300.168.1.1'), true)
140
+ test.equal(ipaddr.IPv6.isIPv6('::ffff:300.168.1.1:0'), false)
141
+ test.equal(ipaddr.IPv6.isIPv6('fe80::wtf'), false)
142
+ test.done()
143
+
144
+ 'validates IPv6 addresses': (test) ->
145
+ test.equal(ipaddr.IPv6.isValid('2001:db8:F53A::1'), true)
146
+ test.equal(ipaddr.IPv6.isValid('200001::1'), false)
147
+ test.equal(ipaddr.IPv6.isValid('::ffff:192.168.1.1'), true)
148
+ test.equal(ipaddr.IPv6.isValid('::ffff:300.168.1.1'), false)
149
+ test.equal(ipaddr.IPv6.isValid('::ffff:300.168.1.1:0'), false)
150
+ test.equal(ipaddr.IPv6.isValid('2001:db8::F53A::1'), false)
151
+ test.equal(ipaddr.IPv6.isValid('fe80::wtf'), false)
152
+ test.done()
153
+
154
+ 'parses IPv6 in different formats': (test) ->
155
+ test.deepEqual(ipaddr.IPv6.parse('2001:db8:F53A:0:0:0:0:1').parts, [0x2001, 0xdb8, 0xf53a, 0, 0, 0, 0, 1])
156
+ test.deepEqual(ipaddr.IPv6.parse('fe80::10').parts, [0xfe80, 0, 0, 0, 0, 0, 0, 0x10])
157
+ test.deepEqual(ipaddr.IPv6.parse('2001:db8:F53A::').parts, [0x2001, 0xdb8, 0xf53a, 0, 0, 0, 0, 0])
158
+ test.deepEqual(ipaddr.IPv6.parse('::1').parts, [0, 0, 0, 0, 0, 0, 0, 1])
159
+ test.deepEqual(ipaddr.IPv6.parse('::').parts, [0, 0, 0, 0, 0, 0, 0, 0])
160
+ test.done()
161
+
162
+ 'barfs at invalid IPv6': (test) ->
163
+ test.throws ->
164
+ ipaddr.IPv6.parse('fe80::0::1')
165
+ test.done()
166
+
167
+ 'matches IPv6 CIDR correctly': (test) ->
168
+ addr = ipaddr.IPv6.parse('2001:db8:f53a::1')
169
+ test.equal(addr.match(ipaddr.IPv6.parse('::'), 0), true)
170
+ test.equal(addr.match(ipaddr.IPv6.parse('2001:db8:f53a::1:1'), 64), true)
171
+ test.equal(addr.match(ipaddr.IPv6.parse('2001:db8:f53b::1:1'), 48), false)
172
+ test.equal(addr.match(ipaddr.IPv6.parse('2001:db8:f531::1:1'), 44), true)
173
+ test.equal(addr.match(ipaddr.IPv6.parse('2001:db8:f500::1'), 40), true)
174
+ test.equal(addr.match(ipaddr.IPv6.parse('2001:db9:f500::1'), 40), false)
175
+ test.equal(addr.match(addr, 128), true)
176
+ test.done()
177
+
178
+ 'parses IPv6 CIDR correctly': (test) ->
179
+ addr = ipaddr.IPv6.parse('2001:db8:f53a::1')
180
+ test.equal(addr.match(ipaddr.IPv6.parseCIDR('::/0')), true)
181
+ test.equal(addr.match(ipaddr.IPv6.parseCIDR('2001:db8:f53a::1:1/64')), true)
182
+ test.equal(addr.match(ipaddr.IPv6.parseCIDR('2001:db8:f53b::1:1/48')), false)
183
+ test.equal(addr.match(ipaddr.IPv6.parseCIDR('2001:db8:f531::1:1/44')), true)
184
+ test.equal(addr.match(ipaddr.IPv6.parseCIDR('2001:db8:f500::1/40')), true)
185
+ test.equal(addr.match(ipaddr.IPv6.parseCIDR('2001:db9:f500::1/40')), false)
186
+ test.equal(addr.match(ipaddr.IPv6.parseCIDR('2001:db8:f53a::1/128')), true)
187
+ test.throws ->
188
+ ipaddr.IPv6.parseCIDR('2001:db8:f53a::1')
189
+ test.done()
190
+
191
+ 'converts between IPv4-mapped IPv6 addresses and IPv4 addresses': (test) ->
192
+ addr = ipaddr.IPv4.parse('77.88.21.11')
193
+ mapped = addr.toIPv4MappedAddress()
194
+ test.deepEqual(mapped.parts, [0, 0, 0, 0, 0, 0xffff, 0x4d58, 0x150b])
195
+ test.deepEqual(mapped.toIPv4Address().octets, addr.octets)
196
+ test.done()
197
+
198
+ 'refuses to convert non-IPv4-mapped IPv6 address to IPv4 address': (test) ->
199
+ test.throws ->
200
+ ipaddr.IPv6.parse('2001:db8::1').toIPv4Address()
201
+ test.done()
202
+
203
+ 'detects reserved IPv6 networks': (test) ->
204
+ test.equal(ipaddr.IPv6.parse('::').range(), 'unspecified')
205
+ test.equal(ipaddr.IPv6.parse('fe80::1234:5678:abcd:0123').range(), 'linkLocal')
206
+ test.equal(ipaddr.IPv6.parse('ff00::1234').range(), 'multicast')
207
+ test.equal(ipaddr.IPv6.parse('::1').range(), 'loopback')
208
+ test.equal(ipaddr.IPv6.parse('fc00::').range(), 'uniqueLocal')
209
+ test.equal(ipaddr.IPv6.parse('::ffff:192.168.1.10').range(), 'ipv4Mapped')
210
+ test.equal(ipaddr.IPv6.parse('::ffff:0:192.168.1.10').range(), 'rfc6145')
211
+ test.equal(ipaddr.IPv6.parse('64:ff9b::1234').range(), 'rfc6052')
212
+ test.equal(ipaddr.IPv6.parse('2002:1f63:45e8::1').range(), '6to4')
213
+ test.equal(ipaddr.IPv6.parse('2001::4242').range(), 'teredo')
214
+ test.equal(ipaddr.IPv6.parse('2001:db8::3210').range(), 'reserved')
215
+ test.equal(ipaddr.IPv6.parse('2001:470:8:66::1').range(), 'unicast')
216
+ test.done()
217
+
218
+ 'is able to determine IP address type': (test) ->
219
+ test.equal(ipaddr.parse('8.8.8.8').kind(), 'ipv4')
220
+ test.equal(ipaddr.parse('2001:db8:3312::1').kind(), 'ipv6')
221
+ test.done()
222
+
223
+ 'throws an error if tried to parse an invalid address': (test) ->
224
+ test.throws ->
225
+ ipaddr.parse('::some.nonsense')
226
+ test.done()
227
+
228
+ 'correctly processes IPv4-mapped addresses': (test) ->
229
+ test.equal(ipaddr.process('8.8.8.8').kind(), 'ipv4')
230
+ test.equal(ipaddr.process('2001:db8:3312::1').kind(), 'ipv6')
231
+ test.equal(ipaddr.process('::ffff:192.168.1.1').kind(), 'ipv4')
232
+ test.done()
233
+
234
+ 'correctly converts IPv6 and IPv4 addresses to byte arrays': (test) ->
235
+ test.deepEqual(ipaddr.parse('1.2.3.4').toByteArray(),
236
+ [0x1, 0x2, 0x3, 0x4]);
237
+ # Fuck yeah. The first byte of Google's IPv6 address is 42. 42!
238
+ test.deepEqual(ipaddr.parse('2a00:1450:8007::68').toByteArray(),
239
+ [42, 0x00, 0x14, 0x50, 0x80, 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x68 ])
240
+ test.done()
241
+
242
+ 'correctly parses 1 as an IPv4 address': (test) ->
243
+ test.equal(ipaddr.IPv6.isValid('1'), false)
244
+ test.equal(ipaddr.IPv4.isValid('1'), true)
245
+ test.deepEqual(new ipaddr.IPv4([0, 0, 0, 1]), ipaddr.parse('1'))
246
+ test.done()
247
+
248
+ 'correctly detects IPv4 and IPv6 CIDR addresses': (test) ->
249
+ test.deepEqual([ipaddr.IPv6.parse('fc00::'), 64],
250
+ ipaddr.parseCIDR('fc00::/64'))
251
+ test.deepEqual([ipaddr.IPv4.parse('1.2.3.4'), 5],
252
+ ipaddr.parseCIDR('1.2.3.4/5'))
253
+ test.done()
254
+
255
+ 'does not consider a very large or very small number a valid IP address': (test) ->
256
+ test.equal(ipaddr.isValid('4999999999'), false)
257
+ test.equal(ipaddr.isValid('-1'), false)
258
+ test.done()
259
+
260
+ 'does not hang on ::8:8:8:8:8:8:8:8:8': (test) ->
261
+ test.equal(ipaddr.IPv6.isValid('::8:8:8:8:8:8:8:8:8'), false)
262
+ test.done()