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,643 @@
|
|
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 finalhandler = require('finalhandler');
|
17
|
+
var Router = require('./router');
|
18
|
+
var methods = require('methods');
|
19
|
+
var middleware = require('./middleware/init');
|
20
|
+
var query = require('./middleware/query');
|
21
|
+
var debug = require('debug')('express:application');
|
22
|
+
var View = require('./view');
|
23
|
+
var http = require('http');
|
24
|
+
var compileETag = require('./utils').compileETag;
|
25
|
+
var compileQueryParser = require('./utils').compileQueryParser;
|
26
|
+
var compileTrust = require('./utils').compileTrust;
|
27
|
+
var deprecate = require('depd')('express');
|
28
|
+
var flatten = require('array-flatten');
|
29
|
+
var merge = require('utils-merge');
|
30
|
+
var resolve = require('path').resolve;
|
31
|
+
var slice = Array.prototype.slice;
|
32
|
+
|
33
|
+
/**
|
34
|
+
* Application prototype.
|
35
|
+
*/
|
36
|
+
|
37
|
+
var app = exports = module.exports = {};
|
38
|
+
|
39
|
+
/**
|
40
|
+
* Variable for trust proxy inheritance back-compat
|
41
|
+
* @private
|
42
|
+
*/
|
43
|
+
|
44
|
+
var trustProxyDefaultSymbol = '@@symbol:trust_proxy_default';
|
45
|
+
|
46
|
+
/**
|
47
|
+
* Initialize the server.
|
48
|
+
*
|
49
|
+
* - setup default configuration
|
50
|
+
* - setup default middleware
|
51
|
+
* - setup route reflection methods
|
52
|
+
*
|
53
|
+
* @private
|
54
|
+
*/
|
55
|
+
|
56
|
+
app.init = function init() {
|
57
|
+
this.cache = {};
|
58
|
+
this.engines = {};
|
59
|
+
this.settings = {};
|
60
|
+
|
61
|
+
this.defaultConfiguration();
|
62
|
+
};
|
63
|
+
|
64
|
+
/**
|
65
|
+
* Initialize application configuration.
|
66
|
+
* @private
|
67
|
+
*/
|
68
|
+
|
69
|
+
app.defaultConfiguration = function defaultConfiguration() {
|
70
|
+
var env = process.env.NODE_ENV || 'development';
|
71
|
+
|
72
|
+
// default settings
|
73
|
+
this.enable('x-powered-by');
|
74
|
+
this.set('etag', 'weak');
|
75
|
+
this.set('env', env);
|
76
|
+
this.set('query parser', 'extended');
|
77
|
+
this.set('subdomain offset', 2);
|
78
|
+
this.set('trust proxy', false);
|
79
|
+
|
80
|
+
// trust proxy inherit back-compat
|
81
|
+
Object.defineProperty(this.settings, trustProxyDefaultSymbol, {
|
82
|
+
configurable: true,
|
83
|
+
value: true
|
84
|
+
});
|
85
|
+
|
86
|
+
debug('booting in %s mode', env);
|
87
|
+
|
88
|
+
this.on('mount', function onmount(parent) {
|
89
|
+
// inherit trust proxy
|
90
|
+
if (this.settings[trustProxyDefaultSymbol] === true
|
91
|
+
&& typeof parent.settings['trust proxy fn'] === 'function') {
|
92
|
+
delete this.settings['trust proxy'];
|
93
|
+
delete this.settings['trust proxy fn'];
|
94
|
+
}
|
95
|
+
|
96
|
+
// inherit protos
|
97
|
+
this.request.__proto__ = parent.request;
|
98
|
+
this.response.__proto__ = parent.response;
|
99
|
+
this.engines.__proto__ = parent.engines;
|
100
|
+
this.settings.__proto__ = parent.settings;
|
101
|
+
});
|
102
|
+
|
103
|
+
// setup locals
|
104
|
+
this.locals = Object.create(null);
|
105
|
+
|
106
|
+
// top-most app is mounted at /
|
107
|
+
this.mountpath = '/';
|
108
|
+
|
109
|
+
// default locals
|
110
|
+
this.locals.settings = this.settings;
|
111
|
+
|
112
|
+
// default configuration
|
113
|
+
this.set('view', View);
|
114
|
+
this.set('views', resolve('views'));
|
115
|
+
this.set('jsonp callback name', 'callback');
|
116
|
+
|
117
|
+
if (env === 'production') {
|
118
|
+
this.enable('view cache');
|
119
|
+
}
|
120
|
+
|
121
|
+
Object.defineProperty(this, 'router', {
|
122
|
+
get: function() {
|
123
|
+
throw new Error('\'app.router\' is deprecated!\nPlease see the 3.x to 4.x migration guide for details on how to update your app.');
|
124
|
+
}
|
125
|
+
});
|
126
|
+
};
|
127
|
+
|
128
|
+
/**
|
129
|
+
* lazily adds the base router if it has not yet been added.
|
130
|
+
*
|
131
|
+
* We cannot add the base router in the defaultConfiguration because
|
132
|
+
* it reads app settings which might be set after that has run.
|
133
|
+
*
|
134
|
+
* @private
|
135
|
+
*/
|
136
|
+
app.lazyrouter = function lazyrouter() {
|
137
|
+
if (!this._router) {
|
138
|
+
this._router = new Router({
|
139
|
+
caseSensitive: this.enabled('case sensitive routing'),
|
140
|
+
strict: this.enabled('strict routing')
|
141
|
+
});
|
142
|
+
|
143
|
+
this._router.use(query(this.get('query parser fn')));
|
144
|
+
this._router.use(middleware.init(this));
|
145
|
+
}
|
146
|
+
};
|
147
|
+
|
148
|
+
/**
|
149
|
+
* Dispatch a req, res pair into the application. Starts pipeline processing.
|
150
|
+
*
|
151
|
+
* If no callback is provided, then default error handlers will respond
|
152
|
+
* in the event of an error bubbling through the stack.
|
153
|
+
*
|
154
|
+
* @private
|
155
|
+
*/
|
156
|
+
|
157
|
+
app.handle = function handle(req, res, callback) {
|
158
|
+
var router = this._router;
|
159
|
+
|
160
|
+
// final handler
|
161
|
+
var done = callback || finalhandler(req, res, {
|
162
|
+
env: this.get('env'),
|
163
|
+
onerror: logerror.bind(this)
|
164
|
+
});
|
165
|
+
|
166
|
+
// no routes
|
167
|
+
if (!router) {
|
168
|
+
debug('no routes defined on app');
|
169
|
+
done();
|
170
|
+
return;
|
171
|
+
}
|
172
|
+
|
173
|
+
router.handle(req, res, done);
|
174
|
+
};
|
175
|
+
|
176
|
+
/**
|
177
|
+
* Proxy `Router#use()` to add middleware to the app router.
|
178
|
+
* See Router#use() documentation for details.
|
179
|
+
*
|
180
|
+
* If the _fn_ parameter is an express app, then it will be
|
181
|
+
* mounted at the _route_ specified.
|
182
|
+
*
|
183
|
+
* @public
|
184
|
+
*/
|
185
|
+
|
186
|
+
app.use = function use(fn) {
|
187
|
+
var offset = 0;
|
188
|
+
var path = '/';
|
189
|
+
|
190
|
+
// default path to '/'
|
191
|
+
// disambiguate app.use([fn])
|
192
|
+
if (typeof fn !== 'function') {
|
193
|
+
var arg = fn;
|
194
|
+
|
195
|
+
while (Array.isArray(arg) && arg.length !== 0) {
|
196
|
+
arg = arg[0];
|
197
|
+
}
|
198
|
+
|
199
|
+
// first arg is the path
|
200
|
+
if (typeof arg !== 'function') {
|
201
|
+
offset = 1;
|
202
|
+
path = fn;
|
203
|
+
}
|
204
|
+
}
|
205
|
+
|
206
|
+
var fns = flatten(slice.call(arguments, offset));
|
207
|
+
|
208
|
+
if (fns.length === 0) {
|
209
|
+
throw new TypeError('app.use() requires middleware functions');
|
210
|
+
}
|
211
|
+
|
212
|
+
// setup router
|
213
|
+
this.lazyrouter();
|
214
|
+
var router = this._router;
|
215
|
+
|
216
|
+
fns.forEach(function (fn) {
|
217
|
+
// non-express app
|
218
|
+
if (!fn || !fn.handle || !fn.set) {
|
219
|
+
return router.use(path, fn);
|
220
|
+
}
|
221
|
+
|
222
|
+
debug('.use app under %s', path);
|
223
|
+
fn.mountpath = path;
|
224
|
+
fn.parent = this;
|
225
|
+
|
226
|
+
// restore .app property on req and res
|
227
|
+
router.use(path, function mounted_app(req, res, next) {
|
228
|
+
var orig = req.app;
|
229
|
+
fn.handle(req, res, function (err) {
|
230
|
+
req.__proto__ = orig.request;
|
231
|
+
res.__proto__ = orig.response;
|
232
|
+
next(err);
|
233
|
+
});
|
234
|
+
});
|
235
|
+
|
236
|
+
// mounted an app
|
237
|
+
fn.emit('mount', this);
|
238
|
+
}, this);
|
239
|
+
|
240
|
+
return this;
|
241
|
+
};
|
242
|
+
|
243
|
+
/**
|
244
|
+
* Proxy to the app `Router#route()`
|
245
|
+
* Returns a new `Route` instance for the _path_.
|
246
|
+
*
|
247
|
+
* Routes are isolated middleware stacks for specific paths.
|
248
|
+
* See the Route api docs for details.
|
249
|
+
*
|
250
|
+
* @public
|
251
|
+
*/
|
252
|
+
|
253
|
+
app.route = function route(path) {
|
254
|
+
this.lazyrouter();
|
255
|
+
return this._router.route(path);
|
256
|
+
};
|
257
|
+
|
258
|
+
/**
|
259
|
+
* Register the given template engine callback `fn`
|
260
|
+
* as `ext`.
|
261
|
+
*
|
262
|
+
* By default will `require()` the engine based on the
|
263
|
+
* file extension. For example if you try to render
|
264
|
+
* a "foo.jade" file Express will invoke the following internally:
|
265
|
+
*
|
266
|
+
* app.engine('jade', require('jade').__express);
|
267
|
+
*
|
268
|
+
* For engines that do not provide `.__express` out of the box,
|
269
|
+
* or if you wish to "map" a different extension to the template engine
|
270
|
+
* you may use this method. For example mapping the EJS template engine to
|
271
|
+
* ".html" files:
|
272
|
+
*
|
273
|
+
* app.engine('html', require('ejs').renderFile);
|
274
|
+
*
|
275
|
+
* In this case EJS provides a `.renderFile()` method with
|
276
|
+
* the same signature that Express expects: `(path, options, callback)`,
|
277
|
+
* though note that it aliases this method as `ejs.__express` internally
|
278
|
+
* so if you're using ".ejs" extensions you dont need to do anything.
|
279
|
+
*
|
280
|
+
* Some template engines do not follow this convention, the
|
281
|
+
* [Consolidate.js](https://github.com/tj/consolidate.js)
|
282
|
+
* library was created to map all of node's popular template
|
283
|
+
* engines to follow this convention, thus allowing them to
|
284
|
+
* work seamlessly within Express.
|
285
|
+
*
|
286
|
+
* @param {String} ext
|
287
|
+
* @param {Function} fn
|
288
|
+
* @return {app} for chaining
|
289
|
+
* @public
|
290
|
+
*/
|
291
|
+
|
292
|
+
app.engine = function engine(ext, fn) {
|
293
|
+
if (typeof fn !== 'function') {
|
294
|
+
throw new Error('callback function required');
|
295
|
+
}
|
296
|
+
|
297
|
+
// get file extension
|
298
|
+
var extension = ext[0] !== '.'
|
299
|
+
? '.' + ext
|
300
|
+
: ext;
|
301
|
+
|
302
|
+
// store engine
|
303
|
+
this.engines[extension] = fn;
|
304
|
+
|
305
|
+
return this;
|
306
|
+
};
|
307
|
+
|
308
|
+
/**
|
309
|
+
* Proxy to `Router#param()` with one added api feature. The _name_ parameter
|
310
|
+
* can be an array of names.
|
311
|
+
*
|
312
|
+
* See the Router#param() docs for more details.
|
313
|
+
*
|
314
|
+
* @param {String|Array} name
|
315
|
+
* @param {Function} fn
|
316
|
+
* @return {app} for chaining
|
317
|
+
* @public
|
318
|
+
*/
|
319
|
+
|
320
|
+
app.param = function param(name, fn) {
|
321
|
+
this.lazyrouter();
|
322
|
+
|
323
|
+
if (Array.isArray(name)) {
|
324
|
+
for (var i = 0; i < name.length; i++) {
|
325
|
+
this.param(name[i], fn);
|
326
|
+
}
|
327
|
+
|
328
|
+
return this;
|
329
|
+
}
|
330
|
+
|
331
|
+
this._router.param(name, fn);
|
332
|
+
|
333
|
+
return this;
|
334
|
+
};
|
335
|
+
|
336
|
+
/**
|
337
|
+
* Assign `setting` to `val`, or return `setting`'s value.
|
338
|
+
*
|
339
|
+
* app.set('foo', 'bar');
|
340
|
+
* app.get('foo');
|
341
|
+
* // => "bar"
|
342
|
+
*
|
343
|
+
* Mounted servers inherit their parent server's settings.
|
344
|
+
*
|
345
|
+
* @param {String} setting
|
346
|
+
* @param {*} [val]
|
347
|
+
* @return {Server} for chaining
|
348
|
+
* @public
|
349
|
+
*/
|
350
|
+
|
351
|
+
app.set = function set(setting, val) {
|
352
|
+
if (arguments.length === 1) {
|
353
|
+
// app.get(setting)
|
354
|
+
return this.settings[setting];
|
355
|
+
}
|
356
|
+
|
357
|
+
debug('set "%s" to %o', setting, val);
|
358
|
+
|
359
|
+
// set value
|
360
|
+
this.settings[setting] = val;
|
361
|
+
|
362
|
+
// trigger matched settings
|
363
|
+
switch (setting) {
|
364
|
+
case 'etag':
|
365
|
+
this.set('etag fn', compileETag(val));
|
366
|
+
break;
|
367
|
+
case 'query parser':
|
368
|
+
this.set('query parser fn', compileQueryParser(val));
|
369
|
+
break;
|
370
|
+
case 'trust proxy':
|
371
|
+
this.set('trust proxy fn', compileTrust(val));
|
372
|
+
|
373
|
+
// trust proxy inherit back-compat
|
374
|
+
Object.defineProperty(this.settings, trustProxyDefaultSymbol, {
|
375
|
+
configurable: true,
|
376
|
+
value: false
|
377
|
+
});
|
378
|
+
|
379
|
+
break;
|
380
|
+
}
|
381
|
+
|
382
|
+
return this;
|
383
|
+
};
|
384
|
+
|
385
|
+
/**
|
386
|
+
* Return the app's absolute pathname
|
387
|
+
* based on the parent(s) that have
|
388
|
+
* mounted it.
|
389
|
+
*
|
390
|
+
* For example if the application was
|
391
|
+
* mounted as "/admin", which itself
|
392
|
+
* was mounted as "/blog" then the
|
393
|
+
* return value would be "/blog/admin".
|
394
|
+
*
|
395
|
+
* @return {String}
|
396
|
+
* @private
|
397
|
+
*/
|
398
|
+
|
399
|
+
app.path = function path() {
|
400
|
+
return this.parent
|
401
|
+
? this.parent.path() + this.mountpath
|
402
|
+
: '';
|
403
|
+
};
|
404
|
+
|
405
|
+
/**
|
406
|
+
* Check if `setting` is enabled (truthy).
|
407
|
+
*
|
408
|
+
* app.enabled('foo')
|
409
|
+
* // => false
|
410
|
+
*
|
411
|
+
* app.enable('foo')
|
412
|
+
* app.enabled('foo')
|
413
|
+
* // => true
|
414
|
+
*
|
415
|
+
* @param {String} setting
|
416
|
+
* @return {Boolean}
|
417
|
+
* @public
|
418
|
+
*/
|
419
|
+
|
420
|
+
app.enabled = function enabled(setting) {
|
421
|
+
return Boolean(this.set(setting));
|
422
|
+
};
|
423
|
+
|
424
|
+
/**
|
425
|
+
* Check if `setting` is disabled.
|
426
|
+
*
|
427
|
+
* app.disabled('foo')
|
428
|
+
* // => true
|
429
|
+
*
|
430
|
+
* app.enable('foo')
|
431
|
+
* app.disabled('foo')
|
432
|
+
* // => false
|
433
|
+
*
|
434
|
+
* @param {String} setting
|
435
|
+
* @return {Boolean}
|
436
|
+
* @public
|
437
|
+
*/
|
438
|
+
|
439
|
+
app.disabled = function disabled(setting) {
|
440
|
+
return !this.set(setting);
|
441
|
+
};
|
442
|
+
|
443
|
+
/**
|
444
|
+
* Enable `setting`.
|
445
|
+
*
|
446
|
+
* @param {String} setting
|
447
|
+
* @return {app} for chaining
|
448
|
+
* @public
|
449
|
+
*/
|
450
|
+
|
451
|
+
app.enable = function enable(setting) {
|
452
|
+
return this.set(setting, true);
|
453
|
+
};
|
454
|
+
|
455
|
+
/**
|
456
|
+
* Disable `setting`.
|
457
|
+
*
|
458
|
+
* @param {String} setting
|
459
|
+
* @return {app} for chaining
|
460
|
+
* @public
|
461
|
+
*/
|
462
|
+
|
463
|
+
app.disable = function disable(setting) {
|
464
|
+
return this.set(setting, false);
|
465
|
+
};
|
466
|
+
|
467
|
+
/**
|
468
|
+
* Delegate `.VERB(...)` calls to `router.VERB(...)`.
|
469
|
+
*/
|
470
|
+
|
471
|
+
methods.forEach(function(method){
|
472
|
+
app[method] = function(path){
|
473
|
+
if (method === 'get' && arguments.length === 1) {
|
474
|
+
// app.get(setting)
|
475
|
+
return this.set(path);
|
476
|
+
}
|
477
|
+
|
478
|
+
this.lazyrouter();
|
479
|
+
|
480
|
+
var route = this._router.route(path);
|
481
|
+
route[method].apply(route, slice.call(arguments, 1));
|
482
|
+
return this;
|
483
|
+
};
|
484
|
+
});
|
485
|
+
|
486
|
+
/**
|
487
|
+
* Special-cased "all" method, applying the given route `path`,
|
488
|
+
* middleware, and callback to _every_ HTTP method.
|
489
|
+
*
|
490
|
+
* @param {String} path
|
491
|
+
* @param {Function} ...
|
492
|
+
* @return {app} for chaining
|
493
|
+
* @public
|
494
|
+
*/
|
495
|
+
|
496
|
+
app.all = function all(path) {
|
497
|
+
this.lazyrouter();
|
498
|
+
|
499
|
+
var route = this._router.route(path);
|
500
|
+
var args = slice.call(arguments, 1);
|
501
|
+
|
502
|
+
for (var i = 0; i < methods.length; i++) {
|
503
|
+
route[methods[i]].apply(route, args);
|
504
|
+
}
|
505
|
+
|
506
|
+
return this;
|
507
|
+
};
|
508
|
+
|
509
|
+
// del -> delete alias
|
510
|
+
|
511
|
+
app.del = deprecate.function(app.delete, 'app.del: Use app.delete instead');
|
512
|
+
|
513
|
+
/**
|
514
|
+
* Render the given view `name` name with `options`
|
515
|
+
* and a callback accepting an error and the
|
516
|
+
* rendered template string.
|
517
|
+
*
|
518
|
+
* Example:
|
519
|
+
*
|
520
|
+
* app.render('email', { name: 'Tobi' }, function(err, html){
|
521
|
+
* // ...
|
522
|
+
* })
|
523
|
+
*
|
524
|
+
* @param {String} name
|
525
|
+
* @param {String|Function} options or fn
|
526
|
+
* @param {Function} callback
|
527
|
+
* @public
|
528
|
+
*/
|
529
|
+
|
530
|
+
app.render = function render(name, options, callback) {
|
531
|
+
var cache = this.cache;
|
532
|
+
var done = callback;
|
533
|
+
var engines = this.engines;
|
534
|
+
var opts = options;
|
535
|
+
var renderOptions = {};
|
536
|
+
var view;
|
537
|
+
|
538
|
+
// support callback function as second arg
|
539
|
+
if (typeof options === 'function') {
|
540
|
+
done = options;
|
541
|
+
opts = {};
|
542
|
+
}
|
543
|
+
|
544
|
+
// merge app.locals
|
545
|
+
merge(renderOptions, this.locals);
|
546
|
+
|
547
|
+
// merge options._locals
|
548
|
+
if (opts._locals) {
|
549
|
+
merge(renderOptions, opts._locals);
|
550
|
+
}
|
551
|
+
|
552
|
+
// merge options
|
553
|
+
merge(renderOptions, opts);
|
554
|
+
|
555
|
+
// set .cache unless explicitly provided
|
556
|
+
if (renderOptions.cache == null) {
|
557
|
+
renderOptions.cache = this.enabled('view cache');
|
558
|
+
}
|
559
|
+
|
560
|
+
// primed cache
|
561
|
+
if (renderOptions.cache) {
|
562
|
+
view = cache[name];
|
563
|
+
}
|
564
|
+
|
565
|
+
// view
|
566
|
+
if (!view) {
|
567
|
+
var View = this.get('view');
|
568
|
+
|
569
|
+
view = new View(name, {
|
570
|
+
defaultEngine: this.get('view engine'),
|
571
|
+
root: this.get('views'),
|
572
|
+
engines: engines
|
573
|
+
});
|
574
|
+
|
575
|
+
if (!view.path) {
|
576
|
+
var dirs = Array.isArray(view.root) && view.root.length > 1
|
577
|
+
? 'directories "' + view.root.slice(0, -1).join('", "') + '" or "' + view.root[view.root.length - 1] + '"'
|
578
|
+
: 'directory "' + view.root + '"'
|
579
|
+
var err = new Error('Failed to lookup view "' + name + '" in views ' + dirs);
|
580
|
+
err.view = view;
|
581
|
+
return done(err);
|
582
|
+
}
|
583
|
+
|
584
|
+
// prime the cache
|
585
|
+
if (renderOptions.cache) {
|
586
|
+
cache[name] = view;
|
587
|
+
}
|
588
|
+
}
|
589
|
+
|
590
|
+
// render
|
591
|
+
tryRender(view, renderOptions, done);
|
592
|
+
};
|
593
|
+
|
594
|
+
/**
|
595
|
+
* Listen for connections.
|
596
|
+
*
|
597
|
+
* A node `http.Server` is returned, with this
|
598
|
+
* application (which is a `Function`) as its
|
599
|
+
* callback. If you wish to create both an HTTP
|
600
|
+
* and HTTPS server you may do so with the "http"
|
601
|
+
* and "https" modules as shown here:
|
602
|
+
*
|
603
|
+
* var http = require('http')
|
604
|
+
* , https = require('https')
|
605
|
+
* , express = require('express')
|
606
|
+
* , app = express();
|
607
|
+
*
|
608
|
+
* http.createServer(app).listen(80);
|
609
|
+
* https.createServer({ ... }, app).listen(443);
|
610
|
+
*
|
611
|
+
* @return {http.Server}
|
612
|
+
* @public
|
613
|
+
*/
|
614
|
+
|
615
|
+
app.listen = function listen() {
|
616
|
+
var server = http.createServer(this);
|
617
|
+
return server.listen.apply(server, arguments);
|
618
|
+
};
|
619
|
+
|
620
|
+
/**
|
621
|
+
* Log error using console.error.
|
622
|
+
*
|
623
|
+
* @param {Error} err
|
624
|
+
* @private
|
625
|
+
*/
|
626
|
+
|
627
|
+
function logerror(err) {
|
628
|
+
/* istanbul ignore next */
|
629
|
+
if (this.get('env') !== 'test') console.error(err.stack || err.toString());
|
630
|
+
}
|
631
|
+
|
632
|
+
/**
|
633
|
+
* Try rendering a view.
|
634
|
+
* @private
|
635
|
+
*/
|
636
|
+
|
637
|
+
function tryRender(view, options, callback) {
|
638
|
+
try {
|
639
|
+
view.render(options, callback);
|
640
|
+
} catch (err) {
|
641
|
+
callback(err);
|
642
|
+
}
|
643
|
+
}
|