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.
- checksums.yaml +4 -4
- data/lib/webpack_rails/ErrorMessagePlugin.js +37 -0
- data/lib/webpack_rails/engine.rb +6 -5
- data/lib/webpack_rails/node_modules/cors/CONTRIBUTING.md +35 -0
- data/lib/webpack_rails/node_modules/cors/LICENSE +9 -0
- data/lib/webpack_rails/node_modules/cors/README.md +192 -0
- data/lib/webpack_rails/node_modules/cors/lib/index.js +242 -0
- data/lib/webpack_rails/node_modules/cors/node_modules/vary/HISTORY.md +29 -0
- data/lib/webpack_rails/node_modules/cors/node_modules/vary/LICENSE +22 -0
- data/lib/webpack_rails/node_modules/cors/node_modules/vary/README.md +91 -0
- data/lib/webpack_rails/node_modules/cors/node_modules/vary/index.js +124 -0
- data/lib/webpack_rails/node_modules/cors/node_modules/vary/package.json +72 -0
- data/lib/webpack_rails/node_modules/cors/package.json +79 -0
- data/lib/webpack_rails/node_modules/cors/test/basic-auth.js +40 -0
- data/lib/webpack_rails/node_modules/cors/test/body-events.js +81 -0
- data/lib/webpack_rails/node_modules/cors/test/cors.js +652 -0
- data/lib/webpack_rails/node_modules/cors/test/error-response.js +77 -0
- data/lib/webpack_rails/node_modules/cors/test/example-app.js +98 -0
- data/lib/webpack_rails/node_modules/cors/test/issue-2.js +56 -0
- data/lib/webpack_rails/node_modules/cors/test/issue-31.js +58 -0
- data/lib/webpack_rails/node_modules/cors/test/mocha.opts +3 -0
- data/lib/webpack_rails/node_modules/express/History.md +3025 -0
- data/lib/webpack_rails/node_modules/express/LICENSE +24 -0
- data/lib/webpack_rails/node_modules/express/Readme.md +138 -0
- data/lib/webpack_rails/node_modules/express/index.js +11 -0
- data/lib/webpack_rails/node_modules/express/lib/application.js +643 -0
- data/lib/webpack_rails/node_modules/express/lib/express.js +103 -0
- data/lib/webpack_rails/node_modules/express/lib/middleware/init.js +36 -0
- data/lib/webpack_rails/node_modules/express/lib/middleware/query.js +51 -0
- data/lib/webpack_rails/node_modules/express/lib/request.js +489 -0
- data/lib/webpack_rails/node_modules/express/lib/response.js +1053 -0
- data/lib/webpack_rails/node_modules/express/lib/router/index.js +645 -0
- data/lib/webpack_rails/node_modules/express/lib/router/layer.js +176 -0
- data/lib/webpack_rails/node_modules/express/lib/router/route.js +210 -0
- data/lib/webpack_rails/node_modules/express/lib/utils.js +300 -0
- data/lib/webpack_rails/node_modules/express/lib/view.js +173 -0
- data/lib/webpack_rails/node_modules/express/node_modules/accepts/HISTORY.md +170 -0
- data/lib/webpack_rails/node_modules/express/node_modules/accepts/LICENSE +23 -0
- data/lib/webpack_rails/node_modules/express/node_modules/accepts/README.md +135 -0
- data/lib/webpack_rails/node_modules/express/node_modules/accepts/index.js +231 -0
- data/lib/webpack_rails/node_modules/express/node_modules/accepts/node_modules/mime-types/HISTORY.md +171 -0
- data/lib/webpack_rails/node_modules/express/node_modules/accepts/node_modules/mime-types/LICENSE +23 -0
- data/lib/webpack_rails/node_modules/express/node_modules/accepts/node_modules/mime-types/README.md +103 -0
- data/lib/webpack_rails/node_modules/express/node_modules/accepts/node_modules/mime-types/index.js +188 -0
- data/lib/webpack_rails/node_modules/express/node_modules/accepts/node_modules/mime-types/node_modules/mime-db/HISTORY.md +274 -0
- data/lib/webpack_rails/node_modules/express/node_modules/accepts/node_modules/mime-types/node_modules/mime-db/LICENSE +22 -0
- data/lib/webpack_rails/node_modules/express/node_modules/accepts/node_modules/mime-types/node_modules/mime-db/README.md +82 -0
- data/lib/webpack_rails/node_modules/express/node_modules/accepts/node_modules/mime-types/node_modules/mime-db/db.json +6474 -0
- data/lib/webpack_rails/node_modules/express/node_modules/accepts/node_modules/mime-types/node_modules/mime-db/index.js +11 -0
- data/lib/webpack_rails/node_modules/express/node_modules/accepts/node_modules/mime-types/node_modules/mime-db/package.json +94 -0
- data/lib/webpack_rails/node_modules/express/node_modules/accepts/node_modules/mime-types/package.json +84 -0
- data/lib/webpack_rails/node_modules/express/node_modules/accepts/node_modules/negotiator/HISTORY.md +76 -0
- data/lib/webpack_rails/node_modules/express/node_modules/accepts/node_modules/negotiator/LICENSE +24 -0
- data/lib/webpack_rails/node_modules/express/node_modules/accepts/node_modules/negotiator/README.md +203 -0
- data/lib/webpack_rails/node_modules/express/node_modules/accepts/node_modules/negotiator/index.js +62 -0
- data/lib/webpack_rails/node_modules/express/node_modules/accepts/node_modules/negotiator/lib/charset.js +102 -0
- data/lib/webpack_rails/node_modules/express/node_modules/accepts/node_modules/negotiator/lib/encoding.js +118 -0
- data/lib/webpack_rails/node_modules/express/node_modules/accepts/node_modules/negotiator/lib/language.js +112 -0
- data/lib/webpack_rails/node_modules/express/node_modules/accepts/node_modules/negotiator/lib/mediaType.js +179 -0
- data/lib/webpack_rails/node_modules/express/node_modules/accepts/node_modules/negotiator/package.json +86 -0
- data/lib/webpack_rails/node_modules/express/node_modules/accepts/package.json +98 -0
- data/lib/webpack_rails/node_modules/express/node_modules/array-flatten/LICENSE +21 -0
- data/lib/webpack_rails/node_modules/express/node_modules/array-flatten/README.md +43 -0
- data/lib/webpack_rails/node_modules/express/node_modules/array-flatten/array-flatten.js +64 -0
- data/lib/webpack_rails/node_modules/express/node_modules/array-flatten/package.json +62 -0
- data/lib/webpack_rails/node_modules/express/node_modules/content-disposition/HISTORY.md +40 -0
- data/lib/webpack_rails/node_modules/express/node_modules/content-disposition/LICENSE +22 -0
- data/lib/webpack_rails/node_modules/express/node_modules/content-disposition/README.md +141 -0
- data/lib/webpack_rails/node_modules/express/node_modules/content-disposition/index.js +443 -0
- data/lib/webpack_rails/node_modules/express/node_modules/content-disposition/package.json +66 -0
- data/lib/webpack_rails/node_modules/express/node_modules/content-type/HISTORY.md +9 -0
- data/lib/webpack_rails/node_modules/express/node_modules/content-type/LICENSE +22 -0
- data/lib/webpack_rails/node_modules/express/node_modules/content-type/README.md +92 -0
- data/lib/webpack_rails/node_modules/express/node_modules/content-type/index.js +214 -0
- data/lib/webpack_rails/node_modules/express/node_modules/content-type/package.json +65 -0
- data/lib/webpack_rails/node_modules/express/node_modules/cookie/LICENSE +23 -0
- data/lib/webpack_rails/node_modules/express/node_modules/cookie/README.md +64 -0
- data/lib/webpack_rails/node_modules/express/node_modules/cookie/index.js +116 -0
- data/lib/webpack_rails/node_modules/express/node_modules/cookie/package.json +68 -0
- data/lib/webpack_rails/node_modules/express/node_modules/cookie-signature/History.md +38 -0
- data/lib/webpack_rails/node_modules/express/node_modules/cookie-signature/Readme.md +42 -0
- data/lib/webpack_rails/node_modules/express/node_modules/cookie-signature/index.js +51 -0
- data/lib/webpack_rails/node_modules/express/node_modules/cookie-signature/package.json +59 -0
- data/lib/webpack_rails/node_modules/express/node_modules/debug/History.md +195 -0
- data/lib/webpack_rails/node_modules/express/node_modules/debug/Makefile +36 -0
- data/lib/webpack_rails/node_modules/express/node_modules/debug/Readme.md +188 -0
- data/lib/webpack_rails/node_modules/express/node_modules/debug/bower.json +28 -0
- data/lib/webpack_rails/node_modules/express/node_modules/debug/browser.js +168 -0
- data/lib/webpack_rails/node_modules/express/node_modules/debug/component.json +19 -0
- data/lib/webpack_rails/node_modules/express/node_modules/debug/debug.js +197 -0
- data/lib/webpack_rails/node_modules/express/node_modules/debug/node.js +209 -0
- data/lib/webpack_rails/node_modules/express/node_modules/debug/node_modules/ms/History.md +66 -0
- data/lib/webpack_rails/node_modules/express/node_modules/debug/node_modules/ms/LICENSE +20 -0
- data/lib/webpack_rails/node_modules/express/node_modules/debug/node_modules/ms/README.md +35 -0
- data/lib/webpack_rails/node_modules/express/node_modules/debug/node_modules/ms/index.js +125 -0
- data/lib/webpack_rails/node_modules/express/node_modules/debug/node_modules/ms/package.json +47 -0
- data/lib/webpack_rails/node_modules/express/node_modules/debug/package.json +73 -0
- data/lib/webpack_rails/node_modules/express/node_modules/depd/History.md +75 -0
- data/lib/webpack_rails/node_modules/express/node_modules/depd/LICENSE +22 -0
- data/lib/webpack_rails/node_modules/express/node_modules/depd/Readme.md +274 -0
- data/lib/webpack_rails/node_modules/express/node_modules/depd/index.js +529 -0
- data/lib/webpack_rails/node_modules/express/node_modules/depd/lib/compat/buffer-concat.js +33 -0
- data/lib/webpack_rails/node_modules/express/node_modules/depd/lib/compat/callsite-tostring.js +101 -0
- data/lib/webpack_rails/node_modules/express/node_modules/depd/lib/compat/index.js +69 -0
- data/lib/webpack_rails/node_modules/express/node_modules/depd/package.json +66 -0
- data/lib/webpack_rails/node_modules/express/node_modules/escape-html/LICENSE +22 -0
- data/lib/webpack_rails/node_modules/express/node_modules/escape-html/Readme.md +15 -0
- data/lib/webpack_rails/node_modules/express/node_modules/escape-html/index.js +29 -0
- data/lib/webpack_rails/node_modules/express/node_modules/escape-html/package.json +51 -0
- data/lib/webpack_rails/node_modules/express/node_modules/etag/HISTORY.md +71 -0
- data/lib/webpack_rails/node_modules/express/node_modules/etag/LICENSE +22 -0
- data/lib/webpack_rails/node_modules/express/node_modules/etag/README.md +165 -0
- data/lib/webpack_rails/node_modules/express/node_modules/etag/index.js +132 -0
- data/lib/webpack_rails/node_modules/express/node_modules/etag/package.json +73 -0
- data/lib/webpack_rails/node_modules/express/node_modules/finalhandler/HISTORY.md +90 -0
- data/lib/webpack_rails/node_modules/express/node_modules/finalhandler/LICENSE +22 -0
- data/lib/webpack_rails/node_modules/express/node_modules/finalhandler/README.md +133 -0
- data/lib/webpack_rails/node_modules/express/node_modules/finalhandler/index.js +151 -0
- data/lib/webpack_rails/node_modules/express/node_modules/finalhandler/node_modules/unpipe/HISTORY.md +4 -0
- data/lib/webpack_rails/node_modules/express/node_modules/finalhandler/node_modules/unpipe/LICENSE +22 -0
- data/lib/webpack_rails/node_modules/express/node_modules/finalhandler/node_modules/unpipe/README.md +43 -0
- data/lib/webpack_rails/node_modules/express/node_modules/finalhandler/node_modules/unpipe/index.js +69 -0
- data/lib/webpack_rails/node_modules/express/node_modules/finalhandler/node_modules/unpipe/package.json +59 -0
- data/lib/webpack_rails/node_modules/express/node_modules/finalhandler/package.json +81 -0
- data/lib/webpack_rails/node_modules/express/node_modules/fresh/HISTORY.md +38 -0
- data/lib/webpack_rails/node_modules/express/node_modules/fresh/LICENSE +22 -0
- data/lib/webpack_rails/node_modules/express/node_modules/fresh/README.md +58 -0
- data/lib/webpack_rails/node_modules/express/node_modules/fresh/index.js +57 -0
- data/lib/webpack_rails/node_modules/express/node_modules/fresh/package.json +87 -0
- data/lib/webpack_rails/node_modules/express/node_modules/merge-descriptors/LICENSE +22 -0
- data/lib/webpack_rails/node_modules/express/node_modules/merge-descriptors/README.md +34 -0
- data/lib/webpack_rails/node_modules/express/node_modules/merge-descriptors/index.js +57 -0
- data/lib/webpack_rails/node_modules/express/node_modules/merge-descriptors/package.json +125 -0
- data/lib/webpack_rails/node_modules/express/node_modules/methods/HISTORY.md +24 -0
- data/lib/webpack_rails/node_modules/express/node_modules/methods/LICENSE +23 -0
- data/lib/webpack_rails/node_modules/express/node_modules/methods/README.md +41 -0
- data/lib/webpack_rails/node_modules/express/node_modules/methods/index.js +42 -0
- data/lib/webpack_rails/node_modules/express/node_modules/methods/package.json +88 -0
- data/lib/webpack_rails/node_modules/express/node_modules/on-finished/HISTORY.md +88 -0
- data/lib/webpack_rails/node_modules/express/node_modules/on-finished/LICENSE +23 -0
- data/lib/webpack_rails/node_modules/express/node_modules/on-finished/README.md +154 -0
- data/lib/webpack_rails/node_modules/express/node_modules/on-finished/index.js +196 -0
- data/lib/webpack_rails/node_modules/express/node_modules/on-finished/node_modules/ee-first/LICENSE +22 -0
- data/lib/webpack_rails/node_modules/express/node_modules/on-finished/node_modules/ee-first/README.md +80 -0
- data/lib/webpack_rails/node_modules/express/node_modules/on-finished/node_modules/ee-first/index.js +95 -0
- data/lib/webpack_rails/node_modules/express/node_modules/on-finished/node_modules/ee-first/package.json +64 -0
- data/lib/webpack_rails/node_modules/express/node_modules/on-finished/package.json +71 -0
- data/lib/webpack_rails/node_modules/express/node_modules/parseurl/HISTORY.md +42 -0
- data/lib/webpack_rails/node_modules/express/node_modules/parseurl/LICENSE +24 -0
- data/lib/webpack_rails/node_modules/express/node_modules/parseurl/README.md +107 -0
- data/lib/webpack_rails/node_modules/express/node_modules/parseurl/index.js +136 -0
- data/lib/webpack_rails/node_modules/express/node_modules/parseurl/package.json +80 -0
- data/lib/webpack_rails/node_modules/express/node_modules/path-to-regexp/History.md +36 -0
- data/lib/webpack_rails/node_modules/express/node_modules/path-to-regexp/LICENSE +21 -0
- data/lib/webpack_rails/node_modules/express/node_modules/path-to-regexp/Readme.md +35 -0
- data/lib/webpack_rails/node_modules/express/node_modules/path-to-regexp/index.js +129 -0
- data/lib/webpack_rails/node_modules/express/node_modules/path-to-regexp/package.json +184 -0
- data/lib/webpack_rails/node_modules/express/node_modules/proxy-addr/HISTORY.md +66 -0
- data/lib/webpack_rails/node_modules/express/node_modules/proxy-addr/LICENSE +22 -0
- data/lib/webpack_rails/node_modules/express/node_modules/proxy-addr/README.md +137 -0
- data/lib/webpack_rails/node_modules/express/node_modules/proxy-addr/index.js +345 -0
- data/lib/webpack_rails/node_modules/express/node_modules/proxy-addr/node_modules/forwarded/HISTORY.md +4 -0
- data/lib/webpack_rails/node_modules/express/node_modules/proxy-addr/node_modules/forwarded/LICENSE +22 -0
- data/lib/webpack_rails/node_modules/express/node_modules/proxy-addr/node_modules/forwarded/README.md +53 -0
- data/lib/webpack_rails/node_modules/express/node_modules/proxy-addr/node_modules/forwarded/index.js +35 -0
- data/lib/webpack_rails/node_modules/express/node_modules/proxy-addr/node_modules/forwarded/package.json +65 -0
- data/lib/webpack_rails/node_modules/express/node_modules/proxy-addr/node_modules/ipaddr.js/Cakefile +18 -0
- data/lib/webpack_rails/node_modules/express/node_modules/proxy-addr/node_modules/ipaddr.js/LICENSE +19 -0
- data/lib/webpack_rails/node_modules/express/node_modules/proxy-addr/node_modules/ipaddr.js/README.md +161 -0
- data/lib/webpack_rails/node_modules/express/node_modules/proxy-addr/node_modules/ipaddr.js/ipaddr.min.js +1 -0
- data/lib/webpack_rails/node_modules/express/node_modules/proxy-addr/node_modules/ipaddr.js/lib/ipaddr.js +439 -0
- data/lib/webpack_rails/node_modules/express/node_modules/proxy-addr/node_modules/ipaddr.js/package.json +60 -0
- data/lib/webpack_rails/node_modules/express/node_modules/proxy-addr/node_modules/ipaddr.js/src/ipaddr.coffee +374 -0
- data/lib/webpack_rails/node_modules/express/node_modules/proxy-addr/node_modules/ipaddr.js/test/ipaddr.test.coffee +262 -0
- data/lib/webpack_rails/node_modules/express/node_modules/proxy-addr/package.json +90 -0
- data/lib/webpack_rails/node_modules/express/node_modules/qs/CHANGELOG.md +88 -0
- data/lib/webpack_rails/node_modules/express/node_modules/qs/CONTRIBUTING.md +1 -0
- data/lib/webpack_rails/node_modules/express/node_modules/qs/LICENSE +28 -0
- data/lib/webpack_rails/node_modules/express/node_modules/qs/README.md +317 -0
- data/lib/webpack_rails/node_modules/express/node_modules/qs/bower.json +22 -0
- data/lib/webpack_rails/node_modules/express/node_modules/qs/lib/index.js +15 -0
- data/lib/webpack_rails/node_modules/express/node_modules/qs/lib/parse.js +186 -0
- data/lib/webpack_rails/node_modules/express/node_modules/qs/lib/stringify.js +121 -0
- data/lib/webpack_rails/node_modules/express/node_modules/qs/lib/utils.js +190 -0
- data/lib/webpack_rails/node_modules/express/node_modules/qs/package.json +56 -0
- data/lib/webpack_rails/node_modules/express/node_modules/qs/test/parse.js +478 -0
- data/lib/webpack_rails/node_modules/express/node_modules/qs/test/stringify.js +259 -0
- data/lib/webpack_rails/node_modules/express/node_modules/qs/test/utils.js +28 -0
- data/lib/webpack_rails/node_modules/express/node_modules/range-parser/HISTORY.md +35 -0
- data/lib/webpack_rails/node_modules/express/node_modules/range-parser/LICENSE +22 -0
- data/lib/webpack_rails/node_modules/express/node_modules/range-parser/README.md +48 -0
- data/lib/webpack_rails/node_modules/express/node_modules/range-parser/index.js +49 -0
- data/lib/webpack_rails/node_modules/express/node_modules/range-parser/package.json +76 -0
- data/lib/webpack_rails/node_modules/express/node_modules/send/HISTORY.md +295 -0
- data/lib/webpack_rails/node_modules/express/node_modules/send/LICENSE +23 -0
- data/lib/webpack_rails/node_modules/express/node_modules/send/README.md +195 -0
- data/lib/webpack_rails/node_modules/express/node_modules/send/index.js +820 -0
- data/lib/webpack_rails/node_modules/express/node_modules/send/node_modules/destroy/README.md +38 -0
- data/lib/webpack_rails/node_modules/express/node_modules/send/node_modules/destroy/index.js +36 -0
- data/lib/webpack_rails/node_modules/express/node_modules/send/node_modules/destroy/package.json +67 -0
- data/lib/webpack_rails/node_modules/express/node_modules/send/node_modules/http-errors/HISTORY.md +76 -0
- data/lib/webpack_rails/node_modules/express/node_modules/send/node_modules/http-errors/LICENSE +22 -0
- data/lib/webpack_rails/node_modules/express/node_modules/send/node_modules/http-errors/README.md +63 -0
- data/lib/webpack_rails/node_modules/express/node_modules/send/node_modules/http-errors/index.js +120 -0
- data/lib/webpack_rails/node_modules/express/node_modules/send/node_modules/http-errors/node_modules/inherits/LICENSE +16 -0
- data/lib/webpack_rails/node_modules/express/node_modules/send/node_modules/http-errors/node_modules/inherits/README.md +42 -0
- data/lib/webpack_rails/node_modules/express/node_modules/send/node_modules/http-errors/node_modules/inherits/inherits.js +1 -0
- data/lib/webpack_rails/node_modules/express/node_modules/send/node_modules/http-errors/node_modules/inherits/inherits_browser.js +23 -0
- data/lib/webpack_rails/node_modules/express/node_modules/send/node_modules/http-errors/node_modules/inherits/package.json +50 -0
- data/lib/webpack_rails/node_modules/express/node_modules/send/node_modules/http-errors/node_modules/inherits/test.js +25 -0
- data/lib/webpack_rails/node_modules/express/node_modules/send/node_modules/http-errors/package.json +85 -0
- data/lib/webpack_rails/node_modules/express/node_modules/send/node_modules/mime/LICENSE +19 -0
- data/lib/webpack_rails/node_modules/express/node_modules/send/node_modules/mime/README.md +90 -0
- data/lib/webpack_rails/node_modules/express/node_modules/send/node_modules/mime/build/build.js +11 -0
- data/lib/webpack_rails/node_modules/express/node_modules/send/node_modules/mime/build/test.js +57 -0
- data/lib/webpack_rails/node_modules/express/node_modules/send/node_modules/mime/cli.js +8 -0
- data/lib/webpack_rails/node_modules/express/node_modules/send/node_modules/mime/mime.js +108 -0
- data/lib/webpack_rails/node_modules/express/node_modules/send/node_modules/mime/package.json +73 -0
- data/lib/webpack_rails/node_modules/express/node_modules/send/node_modules/mime/types.json +1 -0
- data/lib/webpack_rails/node_modules/express/node_modules/send/node_modules/ms/History.md +66 -0
- data/lib/webpack_rails/node_modules/express/node_modules/send/node_modules/ms/LICENSE +20 -0
- data/lib/webpack_rails/node_modules/express/node_modules/send/node_modules/ms/README.md +35 -0
- data/lib/webpack_rails/node_modules/express/node_modules/send/node_modules/ms/index.js +125 -0
- data/lib/webpack_rails/node_modules/express/node_modules/send/node_modules/ms/package.json +47 -0
- data/lib/webpack_rails/node_modules/express/node_modules/send/node_modules/statuses/LICENSE +22 -0
- data/lib/webpack_rails/node_modules/express/node_modules/send/node_modules/statuses/README.md +114 -0
- data/lib/webpack_rails/node_modules/express/node_modules/send/node_modules/statuses/codes.json +64 -0
- data/lib/webpack_rails/node_modules/express/node_modules/send/node_modules/statuses/index.js +60 -0
- data/lib/webpack_rails/node_modules/express/node_modules/send/node_modules/statuses/package.json +84 -0
- data/lib/webpack_rails/node_modules/express/node_modules/send/package.json +89 -0
- data/lib/webpack_rails/node_modules/express/node_modules/serve-static/HISTORY.md +284 -0
- data/lib/webpack_rails/node_modules/express/node_modules/serve-static/LICENSE +25 -0
- data/lib/webpack_rails/node_modules/express/node_modules/serve-static/README.md +235 -0
- data/lib/webpack_rails/node_modules/express/node_modules/serve-static/index.js +187 -0
- data/lib/webpack_rails/node_modules/express/node_modules/serve-static/package.json +83 -0
- data/lib/webpack_rails/node_modules/express/node_modules/type-is/HISTORY.md +180 -0
- data/lib/webpack_rails/node_modules/express/node_modules/type-is/LICENSE +23 -0
- data/lib/webpack_rails/node_modules/express/node_modules/type-is/README.md +132 -0
- data/lib/webpack_rails/node_modules/express/node_modules/type-is/index.js +262 -0
- data/lib/webpack_rails/node_modules/express/node_modules/type-is/node_modules/media-typer/HISTORY.md +22 -0
- data/lib/webpack_rails/node_modules/express/node_modules/type-is/node_modules/media-typer/LICENSE +22 -0
- data/lib/webpack_rails/node_modules/express/node_modules/type-is/node_modules/media-typer/README.md +81 -0
- data/lib/webpack_rails/node_modules/express/node_modules/type-is/node_modules/media-typer/index.js +270 -0
- data/lib/webpack_rails/node_modules/express/node_modules/type-is/node_modules/media-typer/package.json +58 -0
- data/lib/webpack_rails/node_modules/express/node_modules/type-is/node_modules/mime-types/HISTORY.md +171 -0
- data/lib/webpack_rails/node_modules/express/node_modules/type-is/node_modules/mime-types/LICENSE +23 -0
- data/lib/webpack_rails/node_modules/express/node_modules/type-is/node_modules/mime-types/README.md +103 -0
- data/lib/webpack_rails/node_modules/express/node_modules/type-is/node_modules/mime-types/index.js +188 -0
- data/lib/webpack_rails/node_modules/express/node_modules/type-is/node_modules/mime-types/node_modules/mime-db/HISTORY.md +274 -0
- data/lib/webpack_rails/node_modules/express/node_modules/type-is/node_modules/mime-types/node_modules/mime-db/LICENSE +22 -0
- data/lib/webpack_rails/node_modules/express/node_modules/type-is/node_modules/mime-types/node_modules/mime-db/README.md +82 -0
- data/lib/webpack_rails/node_modules/express/node_modules/type-is/node_modules/mime-types/node_modules/mime-db/db.json +6474 -0
- data/lib/webpack_rails/node_modules/express/node_modules/type-is/node_modules/mime-types/node_modules/mime-db/index.js +11 -0
- data/lib/webpack_rails/node_modules/express/node_modules/type-is/node_modules/mime-types/node_modules/mime-db/package.json +94 -0
- data/lib/webpack_rails/node_modules/express/node_modules/type-is/node_modules/mime-types/package.json +84 -0
- data/lib/webpack_rails/node_modules/express/node_modules/type-is/package.json +93 -0
- data/lib/webpack_rails/node_modules/express/node_modules/utils-merge/LICENSE +20 -0
- data/lib/webpack_rails/node_modules/express/node_modules/utils-merge/README.md +34 -0
- data/lib/webpack_rails/node_modules/express/node_modules/utils-merge/index.js +23 -0
- data/lib/webpack_rails/node_modules/express/node_modules/utils-merge/package.json +58 -0
- data/lib/webpack_rails/node_modules/express/node_modules/vary/HISTORY.md +23 -0
- data/lib/webpack_rails/node_modules/express/node_modules/vary/LICENSE +22 -0
- data/lib/webpack_rails/node_modules/express/node_modules/vary/README.md +91 -0
- data/lib/webpack_rails/node_modules/express/node_modules/vary/index.js +117 -0
- data/lib/webpack_rails/node_modules/express/node_modules/vary/package.json +72 -0
- data/lib/webpack_rails/node_modules/express/package.json +167 -0
- data/lib/webpack_rails/node_modules/is-array/History.md +11 -0
- data/lib/webpack_rails/node_modules/is-array/Makefile +11 -0
- data/lib/webpack_rails/node_modules/is-array/Readme.md +27 -0
- data/lib/webpack_rails/node_modules/is-array/component.json +13 -0
- data/lib/webpack_rails/node_modules/is-array/index.js +33 -0
- data/lib/webpack_rails/node_modules/is-array/package.json +41 -0
- data/lib/webpack_rails/node_modules/is-array/test/test.html +46 -0
- data/lib/webpack_rails/node_modules/is-object/LICENSE +19 -0
- data/lib/webpack_rails/node_modules/is-object/README.md +55 -0
- data/lib/webpack_rails/node_modules/is-object/index.js +5 -0
- data/lib/webpack_rails/node_modules/is-object/package.json +91 -0
- data/lib/webpack_rails/node_modules/is-object/test/index.js +23 -0
- data/lib/webpack_rails/node_modules/is-string/CHANGELOG.md +19 -0
- data/lib/webpack_rails/node_modules/is-string/LICENSE +22 -0
- data/lib/webpack_rails/node_modules/is-string/Makefile +61 -0
- data/lib/webpack_rails/node_modules/is-string/README.md +57 -0
- data/lib/webpack_rails/node_modules/is-string/index.js +20 -0
- data/lib/webpack_rails/node_modules/is-string/package.json +93 -0
- data/lib/webpack_rails/node_modules/is-string/test.js +36 -0
- data/lib/webpack_rails/node_modules/js-string-escape/CHANGELOG.md +9 -0
- data/lib/webpack_rails/node_modules/js-string-escape/LICENSE +21 -0
- data/lib/webpack_rails/node_modules/js-string-escape/README.md +44 -0
- data/lib/webpack_rails/node_modules/js-string-escape/index.js +22 -0
- data/lib/webpack_rails/node_modules/js-string-escape/package.json +63 -0
- data/lib/webpack_rails/node_modules/js-string-escape/test/test.js +43 -0
- data/lib/webpack_rails/node_modules/strip-ansi/index.js +6 -0
- data/lib/webpack_rails/node_modules/strip-ansi/license +21 -0
- data/lib/webpack_rails/node_modules/strip-ansi/node_modules/ansi-regex/index.js +4 -0
- data/lib/webpack_rails/node_modules/strip-ansi/node_modules/ansi-regex/license +21 -0
- data/lib/webpack_rails/node_modules/strip-ansi/node_modules/ansi-regex/package.json +86 -0
- data/lib/webpack_rails/node_modules/strip-ansi/node_modules/ansi-regex/readme.md +31 -0
- data/lib/webpack_rails/node_modules/strip-ansi/package.json +85 -0
- data/lib/webpack_rails/node_modules/strip-ansi/readme.md +33 -0
- data/lib/webpack_rails/node_modules/webpack-hot-middleware/README.md +109 -0
- data/lib/webpack_rails/node_modules/webpack-hot-middleware/client-overlay.js +35 -0
- data/lib/webpack_rails/node_modules/webpack-hot-middleware/client.js +131 -0
- data/lib/webpack_rails/node_modules/webpack-hot-middleware/example/README.md +15 -0
- data/lib/webpack_rails/node_modules/webpack-hot-middleware/example/client.js +30 -0
- data/lib/webpack_rails/node_modules/webpack-hot-middleware/example/index.html +18 -0
- data/lib/webpack_rails/node_modules/webpack-hot-middleware/example/package.json +14 -0
- data/lib/webpack_rails/node_modules/webpack-hot-middleware/example/server.js +41 -0
- data/lib/webpack_rails/node_modules/webpack-hot-middleware/example/webpack.config.js +22 -0
- data/lib/webpack_rails/node_modules/webpack-hot-middleware/helpers.js +8 -0
- data/lib/webpack_rails/node_modules/webpack-hot-middleware/middleware.js +83 -0
- data/lib/webpack_rails/node_modules/webpack-hot-middleware/node_modules/querystring/History.md +20 -0
- data/lib/webpack_rails/node_modules/webpack-hot-middleware/node_modules/querystring/License.md +19 -0
- data/lib/webpack_rails/node_modules/webpack-hot-middleware/node_modules/querystring/Readme.md +15 -0
- data/lib/webpack_rails/node_modules/webpack-hot-middleware/node_modules/querystring/decode.js +80 -0
- data/lib/webpack_rails/node_modules/webpack-hot-middleware/node_modules/querystring/encode.js +64 -0
- data/lib/webpack_rails/node_modules/webpack-hot-middleware/node_modules/querystring/index.js +4 -0
- data/lib/webpack_rails/node_modules/webpack-hot-middleware/node_modules/querystring/package.json +96 -0
- data/lib/webpack_rails/node_modules/webpack-hot-middleware/node_modules/querystring/test/common-index.js +3 -0
- data/lib/webpack_rails/node_modules/webpack-hot-middleware/node_modules/querystring/test/index.js +210 -0
- data/lib/webpack_rails/node_modules/webpack-hot-middleware/node_modules/querystring/test/tap-index.js +3 -0
- data/lib/webpack_rails/node_modules/webpack-hot-middleware/node_modules/strip-ansi/cli.js +47 -0
- data/lib/webpack_rails/node_modules/webpack-hot-middleware/node_modules/strip-ansi/index.js +6 -0
- data/lib/webpack_rails/node_modules/webpack-hot-middleware/node_modules/strip-ansi/node_modules/ansi-regex/index.js +4 -0
- data/lib/webpack_rails/node_modules/webpack-hot-middleware/node_modules/strip-ansi/node_modules/ansi-regex/license +21 -0
- data/lib/webpack_rails/node_modules/webpack-hot-middleware/node_modules/strip-ansi/node_modules/ansi-regex/package.json +86 -0
- data/lib/webpack_rails/node_modules/webpack-hot-middleware/node_modules/strip-ansi/node_modules/ansi-regex/readme.md +33 -0
- data/lib/webpack_rails/node_modules/webpack-hot-middleware/node_modules/strip-ansi/package.json +89 -0
- data/lib/webpack_rails/node_modules/webpack-hot-middleware/node_modules/strip-ansi/readme.md +43 -0
- data/lib/webpack_rails/node_modules/webpack-hot-middleware/package.json +58 -0
- data/lib/webpack_rails/node_modules/webpack-hot-middleware/process-update.js +105 -0
- data/lib/webpack_rails/node_modules/webpack-hot-middleware/test/client-test.js +81 -0
- data/lib/webpack_rails/node_modules/webpack-hot-middleware/test/helpers-test.js +22 -0
- data/lib/webpack_rails/node_modules/webpack-hot-middleware/test/middleware-test.js +188 -0
- data/lib/webpack_rails/node_modules/webpack-hot-middleware/test/mocha.opts +1 -0
- data/lib/webpack_rails/node_modules/xtend/LICENCE +19 -0
- data/lib/webpack_rails/node_modules/xtend/Makefile +4 -0
- data/lib/webpack_rails/node_modules/xtend/README.md +32 -0
- data/lib/webpack_rails/node_modules/xtend/immutable.js +17 -0
- data/lib/webpack_rails/node_modules/xtend/mutable.js +15 -0
- data/lib/webpack_rails/node_modules/xtend/package.json +88 -0
- data/lib/webpack_rails/node_modules/xtend/test.js +63 -0
- data/lib/webpack_rails/package.json +22 -0
- data/lib/webpack_rails/processor.rb +28 -9
- data/lib/webpack_rails/require_directive_processor.rb +51 -0
- data/lib/webpack_rails/sprockets_environment.rb +45 -0
- data/lib/webpack_rails/task.rb +51 -22
- data/lib/webpack_rails/webpack-task-dev-server.js +122 -0
- data/lib/webpack_rails/{webpack-task.js → webpack-task-watch.js} +0 -0
- data/lib/webpack_rails/webpack.rake +5 -5
- data/lib/webpack_rails.rb +1 -3
- metadata +346 -5
- data/lib/webpack_rails/sprockets_base_webpack.rb +0 -14
- data/lib/webpack_rails/sprockets_index_webpack.rb +0 -15
@@ -0,0 +1,173 @@
|
|
1
|
+
/*!
|
2
|
+
* express
|
3
|
+
* Copyright(c) 2009-2013 TJ Holowaychuk
|
4
|
+
* Copyright(c) 2013 Roman Shtylman
|
5
|
+
* Copyright(c) 2014-2015 Douglas Christopher Wilson
|
6
|
+
* MIT Licensed
|
7
|
+
*/
|
8
|
+
|
9
|
+
'use strict';
|
10
|
+
|
11
|
+
/**
|
12
|
+
* Module dependencies.
|
13
|
+
* @private
|
14
|
+
*/
|
15
|
+
|
16
|
+
var debug = require('debug')('express:view');
|
17
|
+
var path = require('path');
|
18
|
+
var fs = require('fs');
|
19
|
+
var utils = require('./utils');
|
20
|
+
|
21
|
+
/**
|
22
|
+
* Module variables.
|
23
|
+
* @private
|
24
|
+
*/
|
25
|
+
|
26
|
+
var dirname = path.dirname;
|
27
|
+
var basename = path.basename;
|
28
|
+
var extname = path.extname;
|
29
|
+
var join = path.join;
|
30
|
+
var resolve = path.resolve;
|
31
|
+
|
32
|
+
/**
|
33
|
+
* Module exports.
|
34
|
+
* @public
|
35
|
+
*/
|
36
|
+
|
37
|
+
module.exports = View;
|
38
|
+
|
39
|
+
/**
|
40
|
+
* Initialize a new `View` with the given `name`.
|
41
|
+
*
|
42
|
+
* Options:
|
43
|
+
*
|
44
|
+
* - `defaultEngine` the default template engine name
|
45
|
+
* - `engines` template engine require() cache
|
46
|
+
* - `root` root path for view lookup
|
47
|
+
*
|
48
|
+
* @param {string} name
|
49
|
+
* @param {object} options
|
50
|
+
* @public
|
51
|
+
*/
|
52
|
+
|
53
|
+
function View(name, options) {
|
54
|
+
var opts = options || {};
|
55
|
+
|
56
|
+
this.defaultEngine = opts.defaultEngine;
|
57
|
+
this.ext = extname(name);
|
58
|
+
this.name = name;
|
59
|
+
this.root = opts.root;
|
60
|
+
|
61
|
+
if (!this.ext && !this.defaultEngine) {
|
62
|
+
throw new Error('No default engine was specified and no extension was provided.');
|
63
|
+
}
|
64
|
+
|
65
|
+
var fileName = name;
|
66
|
+
|
67
|
+
if (!this.ext) {
|
68
|
+
// get extension from default engine name
|
69
|
+
this.ext = this.defaultEngine[0] !== '.'
|
70
|
+
? '.' + this.defaultEngine
|
71
|
+
: this.defaultEngine;
|
72
|
+
|
73
|
+
fileName += this.ext;
|
74
|
+
}
|
75
|
+
|
76
|
+
if (!opts.engines[this.ext]) {
|
77
|
+
// load engine
|
78
|
+
opts.engines[this.ext] = require(this.ext.substr(1)).__express;
|
79
|
+
}
|
80
|
+
|
81
|
+
// store loaded engine
|
82
|
+
this.engine = opts.engines[this.ext];
|
83
|
+
|
84
|
+
// lookup path
|
85
|
+
this.path = this.lookup(fileName);
|
86
|
+
}
|
87
|
+
|
88
|
+
/**
|
89
|
+
* Lookup view by the given `name`
|
90
|
+
*
|
91
|
+
* @param {string} name
|
92
|
+
* @private
|
93
|
+
*/
|
94
|
+
|
95
|
+
View.prototype.lookup = function lookup(name) {
|
96
|
+
var path;
|
97
|
+
var roots = [].concat(this.root);
|
98
|
+
|
99
|
+
debug('lookup "%s"', name);
|
100
|
+
|
101
|
+
for (var i = 0; i < roots.length && !path; i++) {
|
102
|
+
var root = roots[i];
|
103
|
+
|
104
|
+
// resolve the path
|
105
|
+
var loc = resolve(root, name);
|
106
|
+
var dir = dirname(loc);
|
107
|
+
var file = basename(loc);
|
108
|
+
|
109
|
+
// resolve the file
|
110
|
+
path = this.resolve(dir, file);
|
111
|
+
}
|
112
|
+
|
113
|
+
return path;
|
114
|
+
};
|
115
|
+
|
116
|
+
/**
|
117
|
+
* Render with the given options.
|
118
|
+
*
|
119
|
+
* @param {object} options
|
120
|
+
* @param {function} callback
|
121
|
+
* @private
|
122
|
+
*/
|
123
|
+
|
124
|
+
View.prototype.render = function render(options, callback) {
|
125
|
+
debug('render "%s"', this.path);
|
126
|
+
this.engine(this.path, options, callback);
|
127
|
+
};
|
128
|
+
|
129
|
+
/**
|
130
|
+
* Resolve the file within the given directory.
|
131
|
+
*
|
132
|
+
* @param {string} dir
|
133
|
+
* @param {string} file
|
134
|
+
* @private
|
135
|
+
*/
|
136
|
+
|
137
|
+
View.prototype.resolve = function resolve(dir, file) {
|
138
|
+
var ext = this.ext;
|
139
|
+
|
140
|
+
// <path>.<ext>
|
141
|
+
var path = join(dir, file);
|
142
|
+
var stat = tryStat(path);
|
143
|
+
|
144
|
+
if (stat && stat.isFile()) {
|
145
|
+
return path;
|
146
|
+
}
|
147
|
+
|
148
|
+
// <path>/index.<ext>
|
149
|
+
path = join(dir, basename(file, ext), 'index' + ext);
|
150
|
+
stat = tryStat(path);
|
151
|
+
|
152
|
+
if (stat && stat.isFile()) {
|
153
|
+
return path;
|
154
|
+
}
|
155
|
+
};
|
156
|
+
|
157
|
+
/**
|
158
|
+
* Return a stat, maybe.
|
159
|
+
*
|
160
|
+
* @param {string} path
|
161
|
+
* @return {fs.Stats}
|
162
|
+
* @private
|
163
|
+
*/
|
164
|
+
|
165
|
+
function tryStat(path) {
|
166
|
+
debug('stat "%s"', path);
|
167
|
+
|
168
|
+
try {
|
169
|
+
return fs.statSync(path);
|
170
|
+
} catch (e) {
|
171
|
+
return undefined;
|
172
|
+
}
|
173
|
+
}
|
@@ -0,0 +1,170 @@
|
|
1
|
+
1.2.13 / 2015-09-06
|
2
|
+
===================
|
3
|
+
|
4
|
+
* deps: mime-types@~2.1.6
|
5
|
+
- deps: mime-db@~1.18.0
|
6
|
+
|
7
|
+
1.2.12 / 2015-07-30
|
8
|
+
===================
|
9
|
+
|
10
|
+
* deps: mime-types@~2.1.4
|
11
|
+
- deps: mime-db@~1.16.0
|
12
|
+
|
13
|
+
1.2.11 / 2015-07-16
|
14
|
+
===================
|
15
|
+
|
16
|
+
* deps: mime-types@~2.1.3
|
17
|
+
- deps: mime-db@~1.15.0
|
18
|
+
|
19
|
+
1.2.10 / 2015-07-01
|
20
|
+
===================
|
21
|
+
|
22
|
+
* deps: mime-types@~2.1.2
|
23
|
+
- deps: mime-db@~1.14.0
|
24
|
+
|
25
|
+
1.2.9 / 2015-06-08
|
26
|
+
==================
|
27
|
+
|
28
|
+
* deps: mime-types@~2.1.1
|
29
|
+
- perf: fix deopt during mapping
|
30
|
+
|
31
|
+
1.2.8 / 2015-06-07
|
32
|
+
==================
|
33
|
+
|
34
|
+
* deps: mime-types@~2.1.0
|
35
|
+
- deps: mime-db@~1.13.0
|
36
|
+
* perf: avoid argument reassignment & argument slice
|
37
|
+
* perf: avoid negotiator recursive construction
|
38
|
+
* perf: enable strict mode
|
39
|
+
* perf: remove unnecessary bitwise operator
|
40
|
+
|
41
|
+
1.2.7 / 2015-05-10
|
42
|
+
==================
|
43
|
+
|
44
|
+
* deps: negotiator@0.5.3
|
45
|
+
- Fix media type parameter matching to be case-insensitive
|
46
|
+
|
47
|
+
1.2.6 / 2015-05-07
|
48
|
+
==================
|
49
|
+
|
50
|
+
* deps: mime-types@~2.0.11
|
51
|
+
- deps: mime-db@~1.9.1
|
52
|
+
* deps: negotiator@0.5.2
|
53
|
+
- Fix comparing media types with quoted values
|
54
|
+
- Fix splitting media types with quoted commas
|
55
|
+
|
56
|
+
1.2.5 / 2015-03-13
|
57
|
+
==================
|
58
|
+
|
59
|
+
* deps: mime-types@~2.0.10
|
60
|
+
- deps: mime-db@~1.8.0
|
61
|
+
|
62
|
+
1.2.4 / 2015-02-14
|
63
|
+
==================
|
64
|
+
|
65
|
+
* Support Node.js 0.6
|
66
|
+
* deps: mime-types@~2.0.9
|
67
|
+
- deps: mime-db@~1.7.0
|
68
|
+
* deps: negotiator@0.5.1
|
69
|
+
- Fix preference sorting to be stable for long acceptable lists
|
70
|
+
|
71
|
+
1.2.3 / 2015-01-31
|
72
|
+
==================
|
73
|
+
|
74
|
+
* deps: mime-types@~2.0.8
|
75
|
+
- deps: mime-db@~1.6.0
|
76
|
+
|
77
|
+
1.2.2 / 2014-12-30
|
78
|
+
==================
|
79
|
+
|
80
|
+
* deps: mime-types@~2.0.7
|
81
|
+
- deps: mime-db@~1.5.0
|
82
|
+
|
83
|
+
1.2.1 / 2014-12-30
|
84
|
+
==================
|
85
|
+
|
86
|
+
* deps: mime-types@~2.0.5
|
87
|
+
- deps: mime-db@~1.3.1
|
88
|
+
|
89
|
+
1.2.0 / 2014-12-19
|
90
|
+
==================
|
91
|
+
|
92
|
+
* deps: negotiator@0.5.0
|
93
|
+
- Fix list return order when large accepted list
|
94
|
+
- Fix missing identity encoding when q=0 exists
|
95
|
+
- Remove dynamic building of Negotiator class
|
96
|
+
|
97
|
+
1.1.4 / 2014-12-10
|
98
|
+
==================
|
99
|
+
|
100
|
+
* deps: mime-types@~2.0.4
|
101
|
+
- deps: mime-db@~1.3.0
|
102
|
+
|
103
|
+
1.1.3 / 2014-11-09
|
104
|
+
==================
|
105
|
+
|
106
|
+
* deps: mime-types@~2.0.3
|
107
|
+
- deps: mime-db@~1.2.0
|
108
|
+
|
109
|
+
1.1.2 / 2014-10-14
|
110
|
+
==================
|
111
|
+
|
112
|
+
* deps: negotiator@0.4.9
|
113
|
+
- Fix error when media type has invalid parameter
|
114
|
+
|
115
|
+
1.1.1 / 2014-09-28
|
116
|
+
==================
|
117
|
+
|
118
|
+
* deps: mime-types@~2.0.2
|
119
|
+
- deps: mime-db@~1.1.0
|
120
|
+
* deps: negotiator@0.4.8
|
121
|
+
- Fix all negotiations to be case-insensitive
|
122
|
+
- Stable sort preferences of same quality according to client order
|
123
|
+
|
124
|
+
1.1.0 / 2014-09-02
|
125
|
+
==================
|
126
|
+
|
127
|
+
* update `mime-types`
|
128
|
+
|
129
|
+
1.0.7 / 2014-07-04
|
130
|
+
==================
|
131
|
+
|
132
|
+
* Fix wrong type returned from `type` when match after unknown extension
|
133
|
+
|
134
|
+
1.0.6 / 2014-06-24
|
135
|
+
==================
|
136
|
+
|
137
|
+
* deps: negotiator@0.4.7
|
138
|
+
|
139
|
+
1.0.5 / 2014-06-20
|
140
|
+
==================
|
141
|
+
|
142
|
+
* fix crash when unknown extension given
|
143
|
+
|
144
|
+
1.0.4 / 2014-06-19
|
145
|
+
==================
|
146
|
+
|
147
|
+
* use `mime-types`
|
148
|
+
|
149
|
+
1.0.3 / 2014-06-11
|
150
|
+
==================
|
151
|
+
|
152
|
+
* deps: negotiator@0.4.6
|
153
|
+
- Order by specificity when quality is the same
|
154
|
+
|
155
|
+
1.0.2 / 2014-05-29
|
156
|
+
==================
|
157
|
+
|
158
|
+
* Fix interpretation when header not in request
|
159
|
+
* deps: pin negotiator@0.4.5
|
160
|
+
|
161
|
+
1.0.1 / 2014-01-18
|
162
|
+
==================
|
163
|
+
|
164
|
+
* Identity encoding isn't always acceptable
|
165
|
+
* deps: negotiator@~0.4.0
|
166
|
+
|
167
|
+
1.0.0 / 2013-12-27
|
168
|
+
==================
|
169
|
+
|
170
|
+
* Genesis
|
@@ -0,0 +1,23 @@
|
|
1
|
+
(The MIT License)
|
2
|
+
|
3
|
+
Copyright (c) 2014 Jonathan Ong <me@jongleberry.com>
|
4
|
+
Copyright (c) 2015 Douglas Christopher Wilson <doug@somethingdoug.com>
|
5
|
+
|
6
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
7
|
+
a copy of this software and associated documentation files (the
|
8
|
+
'Software'), to deal in the Software without restriction, including
|
9
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
10
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
11
|
+
permit persons to whom the Software is furnished to do so, subject to
|
12
|
+
the following conditions:
|
13
|
+
|
14
|
+
The above copyright notice and this permission notice shall be
|
15
|
+
included in all copies or substantial portions of the Software.
|
16
|
+
|
17
|
+
THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
|
18
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
19
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
20
|
+
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
|
21
|
+
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
|
22
|
+
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
|
23
|
+
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
@@ -0,0 +1,135 @@
|
|
1
|
+
# accepts
|
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
|
+
Higher level content negotiation based on [negotiator](https://www.npmjs.com/package/negotiator). Extracted from [koa](https://www.npmjs.com/package/koa) for general use.
|
10
|
+
|
11
|
+
In addition to negotiator, it allows:
|
12
|
+
|
13
|
+
- Allows types as an array or arguments list, ie `(['text/html', 'application/json'])` as well as `('text/html', 'application/json')`.
|
14
|
+
- Allows type shorthands such as `json`.
|
15
|
+
- Returns `false` when no types match
|
16
|
+
- Treats non-existent headers as `*`
|
17
|
+
|
18
|
+
## Installation
|
19
|
+
|
20
|
+
```sh
|
21
|
+
npm install accepts
|
22
|
+
```
|
23
|
+
|
24
|
+
## API
|
25
|
+
|
26
|
+
```js
|
27
|
+
var accepts = require('accepts')
|
28
|
+
```
|
29
|
+
|
30
|
+
### accepts(req)
|
31
|
+
|
32
|
+
Create a new `Accepts` object for the given `req`.
|
33
|
+
|
34
|
+
#### .charset(charsets)
|
35
|
+
|
36
|
+
Return the first accepted charset. If nothing in `charsets` is accepted,
|
37
|
+
then `false` is returned.
|
38
|
+
|
39
|
+
#### .charsets()
|
40
|
+
|
41
|
+
Return the charsets that the request accepts, in the order of the client's
|
42
|
+
preference (most preferred first).
|
43
|
+
|
44
|
+
#### .encoding(encodings)
|
45
|
+
|
46
|
+
Return the first accepted encoding. If nothing in `encodings` is accepted,
|
47
|
+
then `false` is returned.
|
48
|
+
|
49
|
+
#### .encodings()
|
50
|
+
|
51
|
+
Return the encodings that the request accepts, in the order of the client's
|
52
|
+
preference (most preferred first).
|
53
|
+
|
54
|
+
#### .language(languages)
|
55
|
+
|
56
|
+
Return the first accepted language. If nothing in `languages` is accepted,
|
57
|
+
then `false` is returned.
|
58
|
+
|
59
|
+
#### .languages()
|
60
|
+
|
61
|
+
Return the languages that the request accepts, in the order of the client's
|
62
|
+
preference (most preferred first).
|
63
|
+
|
64
|
+
#### .type(types)
|
65
|
+
|
66
|
+
Return the first accepted type (and it is returned as the same text as what
|
67
|
+
appears in the `types` array). If nothing in `types` is accepted, then `false`
|
68
|
+
is returned.
|
69
|
+
|
70
|
+
The `types` array can contain full MIME types or file extensions. Any value
|
71
|
+
that is not a full MIME types is passed to `require('mime-types').lookup`.
|
72
|
+
|
73
|
+
#### .types()
|
74
|
+
|
75
|
+
Return the types that the request accepts, in the order of the client's
|
76
|
+
preference (most preferred first).
|
77
|
+
|
78
|
+
## Examples
|
79
|
+
|
80
|
+
### Simple type negotiation
|
81
|
+
|
82
|
+
This simple example shows how to use `accepts` to return a different typed
|
83
|
+
respond body based on what the client wants to accept. The server lists it's
|
84
|
+
preferences in order and will get back the best match between the client and
|
85
|
+
server.
|
86
|
+
|
87
|
+
```js
|
88
|
+
var accepts = require('accepts')
|
89
|
+
var http = require('http')
|
90
|
+
|
91
|
+
function app(req, res) {
|
92
|
+
var accept = accepts(req)
|
93
|
+
|
94
|
+
// the order of this list is significant; should be server preferred order
|
95
|
+
switch(accept.type(['json', 'html'])) {
|
96
|
+
case 'json':
|
97
|
+
res.setHeader('Content-Type', 'application/json')
|
98
|
+
res.write('{"hello":"world!"}')
|
99
|
+
break
|
100
|
+
case 'html':
|
101
|
+
res.setHeader('Content-Type', 'text/html')
|
102
|
+
res.write('<b>hello, world!</b>')
|
103
|
+
break
|
104
|
+
default:
|
105
|
+
// the fallback is text/plain, so no need to specify it above
|
106
|
+
res.setHeader('Content-Type', 'text/plain')
|
107
|
+
res.write('hello, world!')
|
108
|
+
break
|
109
|
+
}
|
110
|
+
|
111
|
+
res.end()
|
112
|
+
}
|
113
|
+
|
114
|
+
http.createServer(app).listen(3000)
|
115
|
+
```
|
116
|
+
|
117
|
+
You can test this out with the cURL program:
|
118
|
+
```sh
|
119
|
+
curl -I -H'Accept: text/html' http://localhost:3000/
|
120
|
+
```
|
121
|
+
|
122
|
+
## License
|
123
|
+
|
124
|
+
[MIT](LICENSE)
|
125
|
+
|
126
|
+
[npm-image]: https://img.shields.io/npm/v/accepts.svg
|
127
|
+
[npm-url]: https://npmjs.org/package/accepts
|
128
|
+
[node-version-image]: https://img.shields.io/node/v/accepts.svg
|
129
|
+
[node-version-url]: http://nodejs.org/download/
|
130
|
+
[travis-image]: https://img.shields.io/travis/jshttp/accepts/master.svg
|
131
|
+
[travis-url]: https://travis-ci.org/jshttp/accepts
|
132
|
+
[coveralls-image]: https://img.shields.io/coveralls/jshttp/accepts/master.svg
|
133
|
+
[coveralls-url]: https://coveralls.io/r/jshttp/accepts
|
134
|
+
[downloads-image]: https://img.shields.io/npm/dm/accepts.svg
|
135
|
+
[downloads-url]: https://npmjs.org/package/accepts
|