vulcan 0.6.1 → 0.7.0
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/vulcan/cli.rb +20 -10
- data/lib/vulcan/version.rb +1 -1
- data/server/Procfile +1 -1
- data/server/bin/web +10 -0
- data/server/lib/cloudant.coffee +20 -0
- data/server/lib/logger.coffee +17 -0
- data/server/lib/on.coffee +10 -0
- data/server/lib/spawner.coffee +65 -0
- data/server/node_modules/coffee-script/CNAME +1 -0
- data/server/node_modules/coffee-script/LICENSE +22 -0
- data/server/node_modules/coffee-script/README +51 -0
- data/server/node_modules/coffee-script/Rakefile +78 -0
- data/server/node_modules/coffee-script/bin/cake +7 -0
- data/server/node_modules/coffee-script/bin/coffee +7 -0
- data/server/node_modules/coffee-script/extras/jsl.conf +44 -0
- data/server/node_modules/coffee-script/lib/coffee-script/browser.js +92 -0
- data/server/node_modules/coffee-script/lib/coffee-script/cake.js +111 -0
- data/server/node_modules/coffee-script/lib/coffee-script/coffee-script.js +167 -0
- data/server/node_modules/coffee-script/lib/coffee-script/command.js +500 -0
- data/server/node_modules/coffee-script/lib/coffee-script/grammar.js +606 -0
- data/server/node_modules/coffee-script/lib/coffee-script/helpers.js +77 -0
- data/server/node_modules/coffee-script/lib/coffee-script/index.js +11 -0
- data/server/node_modules/coffee-script/lib/coffee-script/lexer.js +788 -0
- data/server/node_modules/coffee-script/lib/coffee-script/nodes.js +2986 -0
- data/server/node_modules/coffee-script/lib/coffee-script/optparse.js +138 -0
- data/server/node_modules/coffee-script/lib/coffee-script/parser.js +683 -0
- data/server/node_modules/coffee-script/lib/coffee-script/repl.js +261 -0
- data/server/node_modules/coffee-script/lib/coffee-script/rewriter.js +349 -0
- data/server/node_modules/coffee-script/lib/coffee-script/scope.js +146 -0
- data/server/node_modules/coffee-script/package.json +55 -0
- data/server/node_modules/connect-form/History.md +0 -6
- data/server/node_modules/connect-form/lib/connect-form.js +2 -4
- data/server/node_modules/connect-form/node_modules/formidable/Readme.md +64 -36
- data/server/node_modules/connect-form/node_modules/formidable/lib/incoming_form.js +5 -1
- data/server/node_modules/connect-form/node_modules/formidable/package.json +20 -6
- data/server/node_modules/connect-form/node_modules/formidable/test/common.js +5 -6
- data/server/node_modules/connect-form/node_modules/formidable/test/fixture/file/funkyfilename.txt +1 -0
- data/server/node_modules/connect-form/node_modules/formidable/test/fixture/js/special-chars-in-filename.js +1 -1
- data/server/node_modules/connect-form/node_modules/formidable/test/{slow → integration}/test-fixtures.js +38 -33
- data/server/node_modules/connect-form/node_modules/formidable/test/legacy/simple/test-incoming-form.js +11 -0
- data/server/node_modules/connect-form/node_modules/formidable/test/run.js +1 -6
- data/server/node_modules/connect-form/node_modules/formidable/test/unit/test-incoming-form.js +63 -0
- data/server/node_modules/connect-form/package.json +27 -5
- data/server/node_modules/cradle/README.md +10 -10
- data/server/node_modules/cradle/lib/cradle.js +117 -523
- data/server/node_modules/cradle/lib/cradle/database/attachments.js +120 -0
- data/server/node_modules/cradle/lib/cradle/database/changes.js +56 -0
- data/server/node_modules/cradle/lib/cradle/database/documents.js +215 -0
- data/server/node_modules/cradle/lib/cradle/database/index.js +65 -0
- data/server/node_modules/cradle/lib/cradle/database/views.js +125 -0
- data/server/node_modules/cradle/node_modules/follow/LICENSE +202 -0
- data/server/node_modules/cradle/node_modules/follow/README.md +164 -0
- data/server/node_modules/cradle/node_modules/follow/Rakefile +54 -0
- data/server/node_modules/cradle/node_modules/follow/api.js +35 -0
- data/server/node_modules/cradle/node_modules/follow/browser/eventemitter2.js +453 -0
- data/server/node_modules/cradle/node_modules/follow/browser/export.js +78 -0
- data/server/node_modules/cradle/node_modules/follow/browser/index.html +14 -0
- data/server/node_modules/cradle/node_modules/follow/browser/jquery-1.6.1.min.js +18 -0
- data/server/node_modules/cradle/node_modules/follow/browser/log4js.js +46 -0
- data/server/node_modules/cradle/node_modules/follow/browser/main.js +92 -0
- data/server/node_modules/cradle/node_modules/follow/browser/querystring.js +28 -0
- data/server/node_modules/cradle/node_modules/follow/browser/request.jquery.js +237 -0
- data/server/node_modules/cradle/node_modules/follow/browser/require.js +33 -0
- data/server/node_modules/cradle/node_modules/follow/browser/util.js +28 -0
- data/server/node_modules/cradle/node_modules/follow/cli.js +101 -0
- data/server/node_modules/cradle/node_modules/follow/lib/feed.js +556 -0
- data/server/node_modules/cradle/node_modules/follow/lib/index.js +66 -0
- data/server/node_modules/cradle/node_modules/follow/lib/stream.js +305 -0
- data/server/node_modules/cradle/node_modules/follow/node_modules/request/LICENSE +55 -0
- data/server/node_modules/cradle/node_modules/follow/node_modules/request/README.md +285 -0
- data/server/node_modules/cradle/node_modules/follow/node_modules/request/main.js +618 -0
- data/server/node_modules/cradle/node_modules/follow/node_modules/request/mimetypes.js +146 -0
- data/server/node_modules/cradle/node_modules/follow/node_modules/request/oauth.js +34 -0
- data/server/node_modules/cradle/node_modules/follow/node_modules/request/package.json +42 -0
- data/server/node_modules/cradle/node_modules/follow/node_modules/request/tests/googledoodle.png +0 -0
- data/server/node_modules/cradle/node_modules/follow/node_modules/request/tests/run.sh +6 -0
- data/server/node_modules/cradle/node_modules/follow/node_modules/request/tests/server.js +57 -0
- data/server/node_modules/cradle/node_modules/follow/node_modules/request/tests/test-body.js +90 -0
- data/server/node_modules/cradle/node_modules/follow/node_modules/request/tests/test-cookie.js +29 -0
- data/server/node_modules/cradle/node_modules/follow/node_modules/request/tests/test-cookiejar.js +90 -0
- data/server/node_modules/cradle/node_modules/follow/node_modules/request/tests/test-errors.js +30 -0
- data/server/node_modules/cradle/node_modules/follow/node_modules/request/tests/test-oauth.js +109 -0
- data/server/node_modules/cradle/node_modules/follow/node_modules/request/tests/test-pipes.js +167 -0
- data/server/node_modules/cradle/node_modules/follow/node_modules/request/tests/test-proxy.js +39 -0
- data/server/node_modules/cradle/node_modules/follow/node_modules/request/tests/test-timeout.js +87 -0
- data/server/node_modules/cradle/node_modules/follow/node_modules/request/uuid.js +19 -0
- data/server/node_modules/cradle/node_modules/follow/node_modules/request/vendor/cookie/index.js +55 -0
- data/server/node_modules/cradle/node_modules/follow/node_modules/request/vendor/cookie/jar.js +72 -0
- data/server/node_modules/cradle/node_modules/follow/package.json +45 -0
- data/server/node_modules/cradle/node_modules/follow/test/couch.js +153 -0
- data/server/node_modules/cradle/node_modules/follow/test/follow.js +136 -0
- data/server/node_modules/cradle/node_modules/follow/test/issues.js +178 -0
- data/server/node_modules/cradle/node_modules/follow/test/issues/10.js +24 -0
- data/server/node_modules/cradle/node_modules/follow/test/stream.js +493 -0
- data/server/node_modules/cradle/node_modules/request/LICENSE +55 -0
- data/server/node_modules/cradle/node_modules/request/README.md +287 -0
- data/server/node_modules/cradle/node_modules/request/forever.js +103 -0
- data/server/node_modules/cradle/node_modules/request/main.js +913 -0
- data/server/node_modules/cradle/node_modules/request/mimetypes.js +152 -0
- data/server/node_modules/cradle/node_modules/request/oauth.js +34 -0
- data/server/node_modules/cradle/node_modules/request/package.json +42 -0
- data/server/node_modules/cradle/node_modules/request/tests/googledoodle.png +0 -0
- data/server/node_modules/cradle/node_modules/request/tests/run.js +38 -0
- data/server/node_modules/cradle/node_modules/request/tests/server.js +82 -0
- data/server/node_modules/cradle/node_modules/request/tests/squid.conf +77 -0
- data/server/node_modules/cradle/node_modules/request/tests/ssl/ca/ca.cnf +20 -0
- data/server/node_modules/cradle/node_modules/request/tests/ssl/ca/ca.crl +0 -0
- data/server/node_modules/cradle/node_modules/request/tests/ssl/ca/ca.crt +17 -0
- data/server/node_modules/cradle/node_modules/request/tests/ssl/ca/ca.csr +13 -0
- data/server/node_modules/cradle/node_modules/request/tests/ssl/ca/ca.key +18 -0
- data/server/node_modules/cradle/node_modules/request/tests/ssl/ca/ca.srl +1 -0
- data/server/node_modules/cradle/node_modules/request/tests/ssl/ca/server.cnf +19 -0
- data/server/node_modules/cradle/node_modules/request/tests/ssl/ca/server.crt +16 -0
- data/server/node_modules/cradle/node_modules/request/tests/ssl/ca/server.csr +11 -0
- data/server/node_modules/cradle/node_modules/request/tests/ssl/ca/server.js +28 -0
- data/server/node_modules/cradle/node_modules/request/tests/ssl/ca/server.key +9 -0
- data/server/node_modules/cradle/node_modules/request/tests/ssl/npm-ca.crt +16 -0
- data/server/node_modules/cradle/node_modules/request/tests/ssl/test.crt +15 -0
- data/server/node_modules/cradle/node_modules/request/tests/ssl/test.key +15 -0
- data/server/node_modules/cradle/node_modules/request/tests/test-body.js +95 -0
- data/server/node_modules/cradle/node_modules/request/tests/test-cookie.js +29 -0
- data/server/node_modules/cradle/node_modules/request/tests/test-cookiejar.js +90 -0
- data/server/node_modules/cradle/node_modules/request/tests/test-defaults.js +68 -0
- data/server/node_modules/cradle/node_modules/request/tests/test-errors.js +37 -0
- data/server/node_modules/cradle/node_modules/request/tests/test-headers.js +52 -0
- data/server/node_modules/cradle/node_modules/request/tests/test-httpModule.js +94 -0
- data/server/node_modules/cradle/node_modules/request/tests/test-https-strict.js +97 -0
- data/server/node_modules/cradle/node_modules/request/tests/test-https.js +86 -0
- data/server/node_modules/cradle/node_modules/request/tests/test-oauth.js +117 -0
- data/server/node_modules/cradle/node_modules/request/tests/test-params.js +92 -0
- data/server/node_modules/cradle/node_modules/request/tests/test-pipes.js +202 -0
- data/server/node_modules/cradle/node_modules/request/tests/test-proxy.js +39 -0
- data/server/node_modules/cradle/node_modules/request/tests/test-qs.js +28 -0
- data/server/node_modules/cradle/node_modules/request/tests/test-redirect.js +154 -0
- data/server/node_modules/cradle/node_modules/request/tests/test-timeout.js +87 -0
- data/server/node_modules/cradle/node_modules/request/tests/test-toJSON.js +14 -0
- data/server/node_modules/cradle/node_modules/request/tests/test-tunnel.js +61 -0
- data/server/node_modules/cradle/node_modules/request/tunnel.js +229 -0
- data/server/node_modules/cradle/node_modules/request/uuid.js +19 -0
- data/server/node_modules/cradle/node_modules/request/vendor/cookie/index.js +65 -0
- data/server/node_modules/cradle/node_modules/request/vendor/cookie/jar.js +72 -0
- data/server/node_modules/cradle/node_modules/vargs/package.json +33 -10
- data/server/node_modules/cradle/package.json +50 -12
- data/server/node_modules/cradle/test/cache-test.js +1 -4
- data/server/node_modules/cradle/test/connection-test.js +179 -0
- data/server/node_modules/cradle/test/database-attachment-test.js +344 -0
- data/server/node_modules/cradle/test/database-cache-test.js +132 -0
- data/server/node_modules/cradle/test/database-test.js +219 -0
- data/server/node_modules/cradle/test/database-view-test.js +141 -0
- data/server/node_modules/cradle/test/fixtures/databases.json +28 -1
- data/server/node_modules/cradle/test/helpers/seed.js +14 -5
- data/server/node_modules/cradle/test/response-test.js +1 -1
- data/server/node_modules/express/History.md +16 -0
- data/server/node_modules/express/bin/express +7 -6
- data/server/node_modules/express/lib-cov/application.js +510 -0
- data/server/node_modules/express/lib-cov/express.js +65 -0
- data/server/node_modules/express/lib-cov/middleware.js +54 -0
- data/server/node_modules/express/lib-cov/request.js +225 -0
- data/server/node_modules/express/lib-cov/response.js +611 -0
- data/server/node_modules/express/lib-cov/router/collection.js +40 -0
- data/server/node_modules/express/lib-cov/router/index.js +515 -0
- data/server/node_modules/express/lib-cov/router/methods.js +9 -0
- data/server/node_modules/express/lib-cov/router/route.js +68 -0
- data/server/node_modules/express/lib-cov/utils.js +151 -0
- data/server/node_modules/express/lib-cov/view.js +81 -0
- data/server/node_modules/express/lib/express.js +1 -1
- data/server/node_modules/express/lib/http.js +1 -2
- data/server/node_modules/express/lib/request.js +2 -2
- data/server/node_modules/express/lib/router/methods.js +10 -1
- data/server/node_modules/express/node_modules/connect/lib/connect.js +1 -1
- data/server/node_modules/express/node_modules/connect/lib/http.js +3 -2
- data/server/node_modules/express/node_modules/connect/lib/middleware/limit.js +0 -2
- data/server/node_modules/express/node_modules/connect/lib/middleware/session.js +1 -2
- data/server/node_modules/express/node_modules/connect/node_modules/formidable/Readme.md +42 -25
- data/server/node_modules/express/node_modules/connect/node_modules/formidable/lib/incoming_form.js +1 -0
- data/server/node_modules/express/node_modules/connect/node_modules/formidable/package.json +14 -3
- data/server/node_modules/express/node_modules/connect/node_modules/formidable/test/legacy/simple/test-incoming-form.js +11 -0
- data/server/node_modules/express/node_modules/connect/package.json +35 -7
- data/server/node_modules/express/node_modules/mime/package.json +30 -8
- data/server/node_modules/express/node_modules/mkdirp/README.markdown +35 -2
- data/server/node_modules/express/node_modules/mkdirp/examples/pow.js +1 -1
- data/server/node_modules/express/node_modules/mkdirp/index.js +72 -13
- data/server/node_modules/express/node_modules/mkdirp/package.json +39 -21
- data/server/node_modules/express/node_modules/mkdirp/test/chmod.js +38 -0
- data/server/node_modules/express/node_modules/mkdirp/test/clobber.js +37 -0
- data/server/node_modules/express/node_modules/mkdirp/test/perm.js +32 -0
- data/server/node_modules/express/node_modules/mkdirp/test/perm_sync.js +39 -0
- data/server/node_modules/express/node_modules/mkdirp/test/sync.js +27 -0
- data/server/node_modules/express/node_modules/mkdirp/test/umask.js +28 -0
- data/server/node_modules/express/node_modules/mkdirp/test/umask_sync.js +27 -0
- data/server/node_modules/express/node_modules/qs/History.md +10 -0
- data/server/node_modules/express/node_modules/qs/Readme.md +9 -2
- data/server/node_modules/express/node_modules/qs/examples.js +3 -0
- data/server/node_modules/express/node_modules/qs/lib/querystring.js +8 -6
- data/server/node_modules/express/node_modules/qs/package.json +26 -8
- data/server/node_modules/express/node_modules/qs/test/parse.js +13 -1
- data/server/node_modules/express/node_modules/qs/test/stringify.js +45 -37
- data/server/node_modules/express/package.json +55 -16
- data/server/node_modules/express/test.js +41 -0
- data/server/node_modules/knox/package.json +26 -4
- data/server/node_modules/node-uuid/package.json +40 -11
- data/server/node_modules/node-uuid/test/test.js +1 -1
- data/server/node_modules/nodemon/README.md +120 -0
- data/server/node_modules/nodemon/nodemon.js +518 -0
- data/server/node_modules/nodemon/nodemonignore.example +11 -0
- data/server/node_modules/nodemon/package.json +49 -0
- data/server/node_modules/restler/README.md +144 -94
- data/server/node_modules/restler/lib/multipartform.js +2 -0
- data/server/node_modules/restler/lib/restler.js +218 -61
- data/server/node_modules/restler/package.json +35 -8
- data/server/node_modules/restler/test/all.js +6 -1
- data/server/node_modules/restler/test/restler.js +624 -118
- data/server/package.json +14 -10
- data/server/web.coffee +64 -0
- data/server/web.js +15 -3
- metadata +170 -57
- data/server/index.js +0 -14
- data/server/node_modules/connect-form/LICENSE +0 -22
- data/server/node_modules/connect-form/index.js +0 -100
- data/server/node_modules/connect-form/node_modules/formidable/test/fast/test-incoming-form.js +0 -45
- data/server/node_modules/connect-form/node_modules/formidable/test/fixture/http/no-filename/generic.http +0 -13
- data/server/node_modules/connect-form/node_modules/formidable/test/fixture/http/special-chars-in-filename/osx-chrome-13.http +0 -26
- data/server/node_modules/connect-form/node_modules/formidable/test/fixture/http/special-chars-in-filename/osx-firefox-3.6.http +0 -24
- data/server/node_modules/connect-form/node_modules/formidable/test/fixture/http/special-chars-in-filename/osx-safari-5.http +0 -23
- data/server/node_modules/connect-form/node_modules/formidable/test/fixture/http/special-chars-in-filename/xp-chrome-12.http +0 -24
- data/server/node_modules/connect-form/node_modules/formidable/test/fixture/http/special-chars-in-filename/xp-ie-7.http +0 -22
- data/server/node_modules/connect-form/node_modules/formidable/test/fixture/http/special-chars-in-filename/xp-ie-8.http +0 -22
- data/server/node_modules/connect-form/node_modules/formidable/test/fixture/http/special-chars-in-filename/xp-safari-5.http +0 -22
- data/server/node_modules/connect-form/node_modules/formidable/test/fixture/multi_video.upload +0 -0
- data/server/node_modules/cradle/Makefile +0 -10
- data/server/node_modules/cradle/test/cradle-test.js +0 -650
- data/server/node_modules/express/node_modules/connect/node_modules/formidable/test/fixture/http/no-filename/generic.http +0 -13
- data/server/node_modules/express/node_modules/connect/node_modules/formidable/test/fixture/http/special-chars-in-filename/osx-chrome-13.http +0 -26
- data/server/node_modules/express/node_modules/connect/node_modules/formidable/test/fixture/http/special-chars-in-filename/osx-firefox-3.6.http +0 -24
- data/server/node_modules/express/node_modules/connect/node_modules/formidable/test/fixture/http/special-chars-in-filename/osx-safari-5.http +0 -23
- data/server/node_modules/express/node_modules/connect/node_modules/formidable/test/fixture/http/special-chars-in-filename/xp-chrome-12.http +0 -24
- data/server/node_modules/express/node_modules/connect/node_modules/formidable/test/fixture/http/special-chars-in-filename/xp-ie-7.http +0 -22
- data/server/node_modules/express/node_modules/connect/node_modules/formidable/test/fixture/http/special-chars-in-filename/xp-ie-8.http +0 -22
- data/server/node_modules/express/node_modules/connect/node_modules/formidable/test/fixture/http/special-chars-in-filename/xp-safari-5.http +0 -22
- data/server/node_modules/express/node_modules/connect/node_modules/formidable/test/fixture/multi_video.upload +0 -0
- data/server/node_modules/express/node_modules/connect/test.js +0 -52
- data/server/node_modules/express/testing/foo/app.js +0 -35
- data/server/node_modules/express/testing/foo/package.json +0 -9
- data/server/node_modules/express/testing/foo/public/stylesheets/style.css +0 -8
- data/server/node_modules/express/testing/foo/routes/index.js +0 -10
- data/server/node_modules/express/testing/foo/views/index.jade +0 -2
- data/server/node_modules/express/testing/foo/views/layout.jade +0 -6
- data/server/node_modules/express/testing/index.js +0 -43
- data/server/node_modules/express/testing/public/test.txt +0 -2971
- data/server/node_modules/express/testing/views/page.html +0 -1
- data/server/node_modules/express/testing/views/page.jade +0 -3
- data/server/node_modules/express/testing/views/test.md +0 -1
- data/server/node_modules/express/testing/views/user/index.jade +0 -1
- data/server/node_modules/express/testing/views/user/list.jade +0 -1
- data/server/node_modules/knox/lib/knox/mime/index.js +0 -308
- data/server/node_modules/knox/lib/knox/mime/test.js +0 -59
- data/server/node_modules/node-uuid/test/benchmark-native +0 -0
- data/server/node_modules/on/index.js +0 -13
- data/server/node_modules/restler/test/test_helper.js +0 -163
- data/server/node_modules/spawner/index.js +0 -106
@@ -0,0 +1,40 @@
|
|
1
|
+
/* automatically generated by JSCoverage - do not edit */
|
2
|
+
if (typeof _$jscoverage === 'undefined') _$jscoverage = {};
|
3
|
+
if (! _$jscoverage['router/collection.js']) {
|
4
|
+
_$jscoverage['router/collection.js'] = [];
|
5
|
+
_$jscoverage['router/collection.js'][12] = 0;
|
6
|
+
_$jscoverage['router/collection.js'][22] = 0;
|
7
|
+
_$jscoverage['router/collection.js'][23] = 0;
|
8
|
+
_$jscoverage['router/collection.js'][30] = 0;
|
9
|
+
_$jscoverage['router/collection.js'][39] = 0;
|
10
|
+
_$jscoverage['router/collection.js'][40] = 0;
|
11
|
+
_$jscoverage['router/collection.js'][44] = 0;
|
12
|
+
_$jscoverage['router/collection.js'][45] = 0;
|
13
|
+
_$jscoverage['router/collection.js'][46] = 0;
|
14
|
+
_$jscoverage['router/collection.js'][50] = 0;
|
15
|
+
}
|
16
|
+
_$jscoverage['router/collection.js'][12]++;
|
17
|
+
module.exports = Collection;
|
18
|
+
_$jscoverage['router/collection.js'][22]++;
|
19
|
+
function Collection(router) {
|
20
|
+
_$jscoverage['router/collection.js'][23]++;
|
21
|
+
Object.defineProperty(this, "router", {value: router});
|
22
|
+
}
|
23
|
+
_$jscoverage['router/collection.js'][30]++;
|
24
|
+
Collection.prototype.__proto__ = Array.prototype;
|
25
|
+
_$jscoverage['router/collection.js'][39]++;
|
26
|
+
Collection.prototype.remove = (function () {
|
27
|
+
_$jscoverage['router/collection.js'][40]++;
|
28
|
+
var router = this.router, len = this.length, ret = new Collection(this.router);
|
29
|
+
_$jscoverage['router/collection.js'][44]++;
|
30
|
+
for (var i = 0; i < len; ++i) {
|
31
|
+
_$jscoverage['router/collection.js'][45]++;
|
32
|
+
if (router.remove(this[i])) {
|
33
|
+
_$jscoverage['router/collection.js'][46]++;
|
34
|
+
ret.push(this[i]);
|
35
|
+
}
|
36
|
+
}
|
37
|
+
_$jscoverage['router/collection.js'][50]++;
|
38
|
+
return ret;
|
39
|
+
});
|
40
|
+
_$jscoverage['router/collection.js'].source = ["","/*!"," * Express - router - Collection"," * Copyright(c) 2010 TJ Holowaychuk <tj@vision-media.ca>"," * MIT Licensed"," */","","/**"," * Expose `Collection`."," */","","module.exports = Collection;","","/**"," * Initialize a new route `Collection`"," * with the given `router`."," * "," * @param {Router} router"," * @api private"," */","","function Collection(router) {"," Object.defineProperty(this, 'router', { value: router });","}","","/**"," * Inherit from `Array.prototype`."," */","","Collection.prototype.__proto__ = Array.prototype;","","/**"," * Remove the routes in this collection."," *"," * @return {Collection} of routes removed"," * @api public"," */","","Collection.prototype.remove = function(){"," var router = this.router"," , len = this.length"," , ret = new Collection(this.router);",""," for (var i = 0; i < len; ++i) {"," if (router.remove(this[i])) {"," ret.push(this[i]);"," }"," }",""," return ret;","};",""];
|
@@ -0,0 +1,515 @@
|
|
1
|
+
/* automatically generated by JSCoverage - do not edit */
|
2
|
+
if (typeof _$jscoverage === 'undefined') _$jscoverage = {};
|
3
|
+
if (! _$jscoverage['router/index.js']) {
|
4
|
+
_$jscoverage['router/index.js'] = [];
|
5
|
+
_$jscoverage['router/index.js'][11] = 0;
|
6
|
+
_$jscoverage['router/index.js'][21] = 0;
|
7
|
+
_$jscoverage['router/index.js'][27] = 0;
|
8
|
+
_$jscoverage['router/index.js'][36] = 0;
|
9
|
+
_$jscoverage['router/index.js'][37] = 0;
|
10
|
+
_$jscoverage['router/index.js'][38] = 0;
|
11
|
+
_$jscoverage['router/index.js'][39] = 0;
|
12
|
+
_$jscoverage['router/index.js'][40] = 0;
|
13
|
+
_$jscoverage['router/index.js'][41] = 0;
|
14
|
+
_$jscoverage['router/index.js'][42] = 0;
|
15
|
+
_$jscoverage['router/index.js'][43] = 0;
|
16
|
+
_$jscoverage['router/index.js'][44] = 0;
|
17
|
+
_$jscoverage['router/index.js'][46] = 0;
|
18
|
+
_$jscoverage['router/index.js'][47] = 0;
|
19
|
+
_$jscoverage['router/index.js'][60] = 0;
|
20
|
+
_$jscoverage['router/index.js'][62] = 0;
|
21
|
+
_$jscoverage['router/index.js'][63] = 0;
|
22
|
+
_$jscoverage['router/index.js'][64] = 0;
|
23
|
+
_$jscoverage['router/index.js'][68] = 0;
|
24
|
+
_$jscoverage['router/index.js'][72] = 0;
|
25
|
+
_$jscoverage['router/index.js'][73] = 0;
|
26
|
+
_$jscoverage['router/index.js'][74] = 0;
|
27
|
+
_$jscoverage['router/index.js'][80] = 0;
|
28
|
+
_$jscoverage['router/index.js'][81] = 0;
|
29
|
+
_$jscoverage['router/index.js'][84] = 0;
|
30
|
+
_$jscoverage['router/index.js'][85] = 0;
|
31
|
+
_$jscoverage['router/index.js'][95] = 0;
|
32
|
+
_$jscoverage['router/index.js'][96] = 0;
|
33
|
+
_$jscoverage['router/index.js'][97] = 0;
|
34
|
+
_$jscoverage['router/index.js'][111] = 0;
|
35
|
+
_$jscoverage['router/index.js'][112] = 0;
|
36
|
+
_$jscoverage['router/index.js'][116] = 0;
|
37
|
+
_$jscoverage['router/index.js'][117] = 0;
|
38
|
+
_$jscoverage['router/index.js'][120] = 0;
|
39
|
+
_$jscoverage['router/index.js'][121] = 0;
|
40
|
+
_$jscoverage['router/index.js'][122] = 0;
|
41
|
+
_$jscoverage['router/index.js'][123] = 0;
|
42
|
+
_$jscoverage['router/index.js'][137] = 0;
|
43
|
+
_$jscoverage['router/index.js'][138] = 0;
|
44
|
+
_$jscoverage['router/index.js'][139] = 0;
|
45
|
+
_$jscoverage['router/index.js'][171] = 0;
|
46
|
+
_$jscoverage['router/index.js'][172] = 0;
|
47
|
+
_$jscoverage['router/index.js'][178] = 0;
|
48
|
+
_$jscoverage['router/index.js'][179] = 0;
|
49
|
+
_$jscoverage['router/index.js'][180] = 0;
|
50
|
+
_$jscoverage['router/index.js'][181] = 0;
|
51
|
+
_$jscoverage['router/index.js'][182] = 0;
|
52
|
+
_$jscoverage['router/index.js'][183] = 0;
|
53
|
+
_$jscoverage['router/index.js'][184] = 0;
|
54
|
+
_$jscoverage['router/index.js'][188] = 0;
|
55
|
+
_$jscoverage['router/index.js'][200] = 0;
|
56
|
+
_$jscoverage['router/index.js'][201] = 0;
|
57
|
+
_$jscoverage['router/index.js'][204] = 0;
|
58
|
+
_$jscoverage['router/index.js'][207] = 0;
|
59
|
+
_$jscoverage['router/index.js'][208] = 0;
|
60
|
+
_$jscoverage['router/index.js'][217] = 0;
|
61
|
+
_$jscoverage['router/index.js'][218] = 0;
|
62
|
+
_$jscoverage['router/index.js'][222] = 0;
|
63
|
+
_$jscoverage['router/index.js'][225] = 0;
|
64
|
+
_$jscoverage['router/index.js'][228] = 0;
|
65
|
+
_$jscoverage['router/index.js'][229] = 0;
|
66
|
+
_$jscoverage['router/index.js'][233] = 0;
|
67
|
+
_$jscoverage['router/index.js'][234] = 0;
|
68
|
+
_$jscoverage['router/index.js'][235] = 0;
|
69
|
+
_$jscoverage['router/index.js'][238] = 0;
|
70
|
+
_$jscoverage['router/index.js'][239] = 0;
|
71
|
+
_$jscoverage['router/index.js'][240] = 0;
|
72
|
+
_$jscoverage['router/index.js'][241] = 0;
|
73
|
+
_$jscoverage['router/index.js'][242] = 0;
|
74
|
+
_$jscoverage['router/index.js'][244] = 0;
|
75
|
+
_$jscoverage['router/index.js'][245] = 0;
|
76
|
+
_$jscoverage['router/index.js'][246] = 0;
|
77
|
+
_$jscoverage['router/index.js'][247] = 0;
|
78
|
+
_$jscoverage['router/index.js'][248] = 0;
|
79
|
+
_$jscoverage['router/index.js'][249] = 0;
|
80
|
+
_$jscoverage['router/index.js'][250] = 0;
|
81
|
+
_$jscoverage['router/index.js'][251] = 0;
|
82
|
+
_$jscoverage['router/index.js'][252] = 0;
|
83
|
+
_$jscoverage['router/index.js'][253] = 0;
|
84
|
+
_$jscoverage['router/index.js'][255] = 0;
|
85
|
+
_$jscoverage['router/index.js'][256] = 0;
|
86
|
+
_$jscoverage['router/index.js'][259] = 0;
|
87
|
+
_$jscoverage['router/index.js'][261] = 0;
|
88
|
+
_$jscoverage['router/index.js'][263] = 0;
|
89
|
+
_$jscoverage['router/index.js'][266] = 0;
|
90
|
+
_$jscoverage['router/index.js'][267] = 0;
|
91
|
+
_$jscoverage['router/index.js'][268] = 0;
|
92
|
+
_$jscoverage['router/index.js'][269] = 0;
|
93
|
+
_$jscoverage['router/index.js'][273] = 0;
|
94
|
+
_$jscoverage['router/index.js'][274] = 0;
|
95
|
+
_$jscoverage['router/index.js'][275] = 0;
|
96
|
+
_$jscoverage['router/index.js'][276] = 0;
|
97
|
+
_$jscoverage['router/index.js'][277] = 0;
|
98
|
+
_$jscoverage['router/index.js'][278] = 0;
|
99
|
+
_$jscoverage['router/index.js'][279] = 0;
|
100
|
+
_$jscoverage['router/index.js'][280] = 0;
|
101
|
+
_$jscoverage['router/index.js'][281] = 0;
|
102
|
+
_$jscoverage['router/index.js'][282] = 0;
|
103
|
+
_$jscoverage['router/index.js'][284] = 0;
|
104
|
+
_$jscoverage['router/index.js'][287] = 0;
|
105
|
+
_$jscoverage['router/index.js'][301] = 0;
|
106
|
+
_$jscoverage['router/index.js'][302] = 0;
|
107
|
+
_$jscoverage['router/index.js'][304] = 0;
|
108
|
+
_$jscoverage['router/index.js'][315] = 0;
|
109
|
+
_$jscoverage['router/index.js'][316] = 0;
|
110
|
+
_$jscoverage['router/index.js'][317] = 0;
|
111
|
+
_$jscoverage['router/index.js'][318] = 0;
|
112
|
+
_$jscoverage['router/index.js'][319] = 0;
|
113
|
+
_$jscoverage['router/index.js'][320] = 0;
|
114
|
+
_$jscoverage['router/index.js'][321] = 0;
|
115
|
+
_$jscoverage['router/index.js'][324] = 0;
|
116
|
+
_$jscoverage['router/index.js'][339] = 0;
|
117
|
+
_$jscoverage['router/index.js'][340] = 0;
|
118
|
+
_$jscoverage['router/index.js'][351] = 0;
|
119
|
+
_$jscoverage['router/index.js'][353] = 0;
|
120
|
+
_$jscoverage['router/index.js'][354] = 0;
|
121
|
+
_$jscoverage['router/index.js'][358] = 0;
|
122
|
+
_$jscoverage['router/index.js'][362] = 0;
|
123
|
+
_$jscoverage['router/index.js'][365] = 0;
|
124
|
+
_$jscoverage['router/index.js'][366] = 0;
|
125
|
+
_$jscoverage['router/index.js'][367] = 0;
|
126
|
+
_$jscoverage['router/index.js'][368] = 0;
|
127
|
+
_$jscoverage['router/index.js'][369] = 0;
|
128
|
+
_$jscoverage['router/index.js'][372] = 0;
|
129
|
+
_$jscoverage['router/index.js'][373] = 0;
|
130
|
+
_$jscoverage['router/index.js'][377] = 0;
|
131
|
+
_$jscoverage['router/index.js'][378] = 0;
|
132
|
+
_$jscoverage['router/index.js'][380] = 0;
|
133
|
+
_$jscoverage['router/index.js'][385] = 0;
|
134
|
+
_$jscoverage['router/index.js'][386] = 0;
|
135
|
+
_$jscoverage['router/index.js'][402] = 0;
|
136
|
+
_$jscoverage['router/index.js'][403] = 0;
|
137
|
+
_$jscoverage['router/index.js'][408] = 0;
|
138
|
+
_$jscoverage['router/index.js'][411] = 0;
|
139
|
+
_$jscoverage['router/index.js'][412] = 0;
|
140
|
+
_$jscoverage['router/index.js'][418] = 0;
|
141
|
+
_$jscoverage['router/index.js'][419] = 0;
|
142
|
+
_$jscoverage['router/index.js'][420] = 0;
|
143
|
+
}
|
144
|
+
_$jscoverage['router/index.js'][11]++;
|
145
|
+
var Route = require("./route"), Collection = require("./collection"), utils = require("../utils"), debug = require("debug")("express:router"), parse = require("url").parse;
|
146
|
+
_$jscoverage['router/index.js'][21]++;
|
147
|
+
exports = module.exports = Router;
|
148
|
+
_$jscoverage['router/index.js'][27]++;
|
149
|
+
var methods = exports.methods = require("./methods");
|
150
|
+
_$jscoverage['router/index.js'][36]++;
|
151
|
+
function Router(options) {
|
152
|
+
_$jscoverage['router/index.js'][37]++;
|
153
|
+
options = options || {};
|
154
|
+
_$jscoverage['router/index.js'][38]++;
|
155
|
+
var self = this;
|
156
|
+
_$jscoverage['router/index.js'][39]++;
|
157
|
+
this.routes = new Collection();
|
158
|
+
_$jscoverage['router/index.js'][40]++;
|
159
|
+
this.map = {};
|
160
|
+
_$jscoverage['router/index.js'][41]++;
|
161
|
+
this.params = {};
|
162
|
+
_$jscoverage['router/index.js'][42]++;
|
163
|
+
this._params = [];
|
164
|
+
_$jscoverage['router/index.js'][43]++;
|
165
|
+
this.caseSensitive = options.caseSensitive;
|
166
|
+
_$jscoverage['router/index.js'][44]++;
|
167
|
+
this.strict = options.strict;
|
168
|
+
_$jscoverage['router/index.js'][46]++;
|
169
|
+
this.middleware = (function router(req, res, next) {
|
170
|
+
_$jscoverage['router/index.js'][47]++;
|
171
|
+
self._dispatch(req, res, next);
|
172
|
+
});
|
173
|
+
}
|
174
|
+
_$jscoverage['router/index.js'][60]++;
|
175
|
+
Router.prototype.param = (function (name, fn) {
|
176
|
+
_$jscoverage['router/index.js'][62]++;
|
177
|
+
if ("function" == typeof name) {
|
178
|
+
_$jscoverage['router/index.js'][63]++;
|
179
|
+
this._params.push(name);
|
180
|
+
_$jscoverage['router/index.js'][64]++;
|
181
|
+
return;
|
182
|
+
}
|
183
|
+
_$jscoverage['router/index.js'][68]++;
|
184
|
+
var params = this._params, len = params.length, ret;
|
185
|
+
_$jscoverage['router/index.js'][72]++;
|
186
|
+
for (var i = 0; i < len; ++i) {
|
187
|
+
_$jscoverage['router/index.js'][73]++;
|
188
|
+
if (ret = params[i](name, fn)) {
|
189
|
+
_$jscoverage['router/index.js'][74]++;
|
190
|
+
fn = ret;
|
191
|
+
}
|
192
|
+
}
|
193
|
+
_$jscoverage['router/index.js'][80]++;
|
194
|
+
if ("function" != typeof fn) {
|
195
|
+
_$jscoverage['router/index.js'][81]++;
|
196
|
+
throw new Error("invalid param() call for " + name + ", got " + fn);
|
197
|
+
}
|
198
|
+
_$jscoverage['router/index.js'][84]++;
|
199
|
+
(this.params[name] = this.params[name] || []).push(fn);
|
200
|
+
_$jscoverage['router/index.js'][85]++;
|
201
|
+
return this;
|
202
|
+
});
|
203
|
+
_$jscoverage['router/index.js'][95]++;
|
204
|
+
Router.prototype.all = (function () {
|
205
|
+
_$jscoverage['router/index.js'][96]++;
|
206
|
+
return this.find((function () {
|
207
|
+
_$jscoverage['router/index.js'][97]++;
|
208
|
+
return true;
|
209
|
+
}));
|
210
|
+
});
|
211
|
+
_$jscoverage['router/index.js'][111]++;
|
212
|
+
Router.prototype.remove = (function (route) {
|
213
|
+
_$jscoverage['router/index.js'][112]++;
|
214
|
+
var routes = this.map[route.method], len = routes.length;
|
215
|
+
_$jscoverage['router/index.js'][116]++;
|
216
|
+
var i = this.routes.indexOf(route);
|
217
|
+
_$jscoverage['router/index.js'][117]++;
|
218
|
+
this.routes.splice(i, 1);
|
219
|
+
_$jscoverage['router/index.js'][120]++;
|
220
|
+
for (var i = 0; i < len; ++i) {
|
221
|
+
_$jscoverage['router/index.js'][121]++;
|
222
|
+
if (route == routes[i]) {
|
223
|
+
_$jscoverage['router/index.js'][122]++;
|
224
|
+
routes.splice(i, 1);
|
225
|
+
_$jscoverage['router/index.js'][123]++;
|
226
|
+
return true;
|
227
|
+
}
|
228
|
+
}
|
229
|
+
});
|
230
|
+
_$jscoverage['router/index.js'][137]++;
|
231
|
+
Router.prototype.lookup = (function (method, path) {
|
232
|
+
_$jscoverage['router/index.js'][138]++;
|
233
|
+
return this.find((function (route) {
|
234
|
+
_$jscoverage['router/index.js'][139]++;
|
235
|
+
return path == route.path && (route.method == method || method == "all");
|
236
|
+
}));
|
237
|
+
});
|
238
|
+
_$jscoverage['router/index.js'][171]++;
|
239
|
+
Router.prototype.find = (function (fn) {
|
240
|
+
_$jscoverage['router/index.js'][172]++;
|
241
|
+
var len = methods.length, ret = new Collection(this), method, routes, route;
|
242
|
+
_$jscoverage['router/index.js'][178]++;
|
243
|
+
for (var i = 0; i < len; ++i) {
|
244
|
+
_$jscoverage['router/index.js'][179]++;
|
245
|
+
method = methods[i];
|
246
|
+
_$jscoverage['router/index.js'][180]++;
|
247
|
+
routes = this.map[method];
|
248
|
+
_$jscoverage['router/index.js'][181]++;
|
249
|
+
if (! routes) {
|
250
|
+
_$jscoverage['router/index.js'][181]++;
|
251
|
+
continue;
|
252
|
+
}
|
253
|
+
_$jscoverage['router/index.js'][182]++;
|
254
|
+
for (var j = 0, jlen = routes.length; j < jlen; ++j) {
|
255
|
+
_$jscoverage['router/index.js'][183]++;
|
256
|
+
route = routes[j];
|
257
|
+
_$jscoverage['router/index.js'][184]++;
|
258
|
+
if (fn(route)) {
|
259
|
+
_$jscoverage['router/index.js'][184]++;
|
260
|
+
ret.push(route);
|
261
|
+
}
|
262
|
+
}
|
263
|
+
}
|
264
|
+
_$jscoverage['router/index.js'][188]++;
|
265
|
+
return ret;
|
266
|
+
});
|
267
|
+
_$jscoverage['router/index.js'][200]++;
|
268
|
+
Router.prototype._dispatch = (function (req, res, next) {
|
269
|
+
_$jscoverage['router/index.js'][201]++;
|
270
|
+
var params = this.params, self = this;
|
271
|
+
_$jscoverage['router/index.js'][204]++;
|
272
|
+
debug("dispatching %s %s", req.method, req.url);
|
273
|
+
_$jscoverage['router/index.js'][207]++;
|
274
|
+
(function pass(i, err) {
|
275
|
+
_$jscoverage['router/index.js'][208]++;
|
276
|
+
var paramCallbacks, paramIndex = 0, paramVal, route, keys, key, ret;
|
277
|
+
_$jscoverage['router/index.js'][217]++;
|
278
|
+
function nextRoute(err) {
|
279
|
+
_$jscoverage['router/index.js'][218]++;
|
280
|
+
pass(req._route_index + 1, err);
|
281
|
+
}
|
282
|
+
_$jscoverage['router/index.js'][222]++;
|
283
|
+
req.route = route = self.match(req, i);
|
284
|
+
_$jscoverage['router/index.js'][225]++;
|
285
|
+
if (! route && "OPTIONS" == req.method) {
|
286
|
+
_$jscoverage['router/index.js'][225]++;
|
287
|
+
return self._options(req, res);
|
288
|
+
}
|
289
|
+
_$jscoverage['router/index.js'][228]++;
|
290
|
+
if (! route) {
|
291
|
+
_$jscoverage['router/index.js'][228]++;
|
292
|
+
return next(err);
|
293
|
+
}
|
294
|
+
_$jscoverage['router/index.js'][229]++;
|
295
|
+
debug("matched %s %s", route.method, route.path);
|
296
|
+
_$jscoverage['router/index.js'][233]++;
|
297
|
+
req.params = route.params;
|
298
|
+
_$jscoverage['router/index.js'][234]++;
|
299
|
+
keys = route.keys;
|
300
|
+
_$jscoverage['router/index.js'][235]++;
|
301
|
+
i = 0;
|
302
|
+
_$jscoverage['router/index.js'][238]++;
|
303
|
+
function param(err) {
|
304
|
+
_$jscoverage['router/index.js'][239]++;
|
305
|
+
paramIndex = 0;
|
306
|
+
_$jscoverage['router/index.js'][240]++;
|
307
|
+
key = keys[i++];
|
308
|
+
_$jscoverage['router/index.js'][241]++;
|
309
|
+
paramVal = key && req.params[key.name];
|
310
|
+
_$jscoverage['router/index.js'][242]++;
|
311
|
+
paramCallbacks = key && params[key.name];
|
312
|
+
_$jscoverage['router/index.js'][244]++;
|
313
|
+
try {
|
314
|
+
_$jscoverage['router/index.js'][245]++;
|
315
|
+
if ("route" == err) {
|
316
|
+
_$jscoverage['router/index.js'][246]++;
|
317
|
+
nextRoute();
|
318
|
+
}
|
319
|
+
else {
|
320
|
+
_$jscoverage['router/index.js'][247]++;
|
321
|
+
if (err) {
|
322
|
+
_$jscoverage['router/index.js'][248]++;
|
323
|
+
i = 0;
|
324
|
+
_$jscoverage['router/index.js'][249]++;
|
325
|
+
callbacks(err);
|
326
|
+
}
|
327
|
+
else {
|
328
|
+
_$jscoverage['router/index.js'][250]++;
|
329
|
+
if (paramCallbacks && undefined !== paramVal) {
|
330
|
+
_$jscoverage['router/index.js'][251]++;
|
331
|
+
paramCallback();
|
332
|
+
}
|
333
|
+
else {
|
334
|
+
_$jscoverage['router/index.js'][252]++;
|
335
|
+
if (key) {
|
336
|
+
_$jscoverage['router/index.js'][253]++;
|
337
|
+
param();
|
338
|
+
}
|
339
|
+
else {
|
340
|
+
_$jscoverage['router/index.js'][255]++;
|
341
|
+
i = 0;
|
342
|
+
_$jscoverage['router/index.js'][256]++;
|
343
|
+
callbacks();
|
344
|
+
}
|
345
|
+
}
|
346
|
+
}
|
347
|
+
}
|
348
|
+
}
|
349
|
+
catch (err) {
|
350
|
+
_$jscoverage['router/index.js'][259]++;
|
351
|
+
param(err);
|
352
|
+
}
|
353
|
+
}
|
354
|
+
_$jscoverage['router/index.js'][261]++;
|
355
|
+
;
|
356
|
+
_$jscoverage['router/index.js'][263]++;
|
357
|
+
param(err);
|
358
|
+
_$jscoverage['router/index.js'][266]++;
|
359
|
+
function paramCallback(err) {
|
360
|
+
_$jscoverage['router/index.js'][267]++;
|
361
|
+
var fn = paramCallbacks[paramIndex++];
|
362
|
+
_$jscoverage['router/index.js'][268]++;
|
363
|
+
if (err || ! fn) {
|
364
|
+
_$jscoverage['router/index.js'][268]++;
|
365
|
+
return param(err);
|
366
|
+
}
|
367
|
+
_$jscoverage['router/index.js'][269]++;
|
368
|
+
fn(req, res, paramCallback, paramVal, key.name);
|
369
|
+
}
|
370
|
+
_$jscoverage['router/index.js'][273]++;
|
371
|
+
function callbacks(err) {
|
372
|
+
_$jscoverage['router/index.js'][274]++;
|
373
|
+
var fn = route.callbacks[i++];
|
374
|
+
_$jscoverage['router/index.js'][275]++;
|
375
|
+
try {
|
376
|
+
_$jscoverage['router/index.js'][276]++;
|
377
|
+
if ("route" == err) {
|
378
|
+
_$jscoverage['router/index.js'][277]++;
|
379
|
+
nextRoute();
|
380
|
+
}
|
381
|
+
else {
|
382
|
+
_$jscoverage['router/index.js'][278]++;
|
383
|
+
if (err && fn) {
|
384
|
+
_$jscoverage['router/index.js'][279]++;
|
385
|
+
if (fn.length < 4) {
|
386
|
+
_$jscoverage['router/index.js'][279]++;
|
387
|
+
return callbacks(err);
|
388
|
+
}
|
389
|
+
_$jscoverage['router/index.js'][280]++;
|
390
|
+
fn(err, req, res, callbacks);
|
391
|
+
}
|
392
|
+
else {
|
393
|
+
_$jscoverage['router/index.js'][281]++;
|
394
|
+
if (fn) {
|
395
|
+
_$jscoverage['router/index.js'][282]++;
|
396
|
+
fn(req, res, callbacks);
|
397
|
+
}
|
398
|
+
else {
|
399
|
+
_$jscoverage['router/index.js'][284]++;
|
400
|
+
nextRoute(err);
|
401
|
+
}
|
402
|
+
}
|
403
|
+
}
|
404
|
+
}
|
405
|
+
catch (err) {
|
406
|
+
_$jscoverage['router/index.js'][287]++;
|
407
|
+
callbacks(err);
|
408
|
+
}
|
409
|
+
}
|
410
|
+
})(0);
|
411
|
+
});
|
412
|
+
_$jscoverage['router/index.js'][301]++;
|
413
|
+
Router.prototype._options = (function (req, res) {
|
414
|
+
_$jscoverage['router/index.js'][302]++;
|
415
|
+
var path = parse(req.url).pathname, body = this._optionsFor(path).join(",");
|
416
|
+
_$jscoverage['router/index.js'][304]++;
|
417
|
+
res.set("Allow", body).send(body);
|
418
|
+
});
|
419
|
+
_$jscoverage['router/index.js'][315]++;
|
420
|
+
Router.prototype._optionsFor = (function (path) {
|
421
|
+
_$jscoverage['router/index.js'][316]++;
|
422
|
+
var self = this;
|
423
|
+
_$jscoverage['router/index.js'][317]++;
|
424
|
+
return methods.filter((function (method) {
|
425
|
+
_$jscoverage['router/index.js'][318]++;
|
426
|
+
var routes = self.map[method];
|
427
|
+
_$jscoverage['router/index.js'][319]++;
|
428
|
+
if (! routes || "options" == method) {
|
429
|
+
_$jscoverage['router/index.js'][319]++;
|
430
|
+
return;
|
431
|
+
}
|
432
|
+
_$jscoverage['router/index.js'][320]++;
|
433
|
+
for (var i = 0, len = routes.length; i < len; ++i) {
|
434
|
+
_$jscoverage['router/index.js'][321]++;
|
435
|
+
if (routes[i].match(path)) {
|
436
|
+
_$jscoverage['router/index.js'][321]++;
|
437
|
+
return true;
|
438
|
+
}
|
439
|
+
}
|
440
|
+
})).map((function (method) {
|
441
|
+
_$jscoverage['router/index.js'][324]++;
|
442
|
+
return method.toUpperCase();
|
443
|
+
}));
|
444
|
+
});
|
445
|
+
_$jscoverage['router/index.js'][339]++;
|
446
|
+
Router.prototype.match = (function (req, i, head) {
|
447
|
+
_$jscoverage['router/index.js'][340]++;
|
448
|
+
var method = req.method.toLowerCase(), url = parse(req.url), path = url.pathname, routes = this.map, i = i || 0, captures, route, keys;
|
449
|
+
_$jscoverage['router/index.js'][351]++;
|
450
|
+
if (! head && "head" == method) {
|
451
|
+
_$jscoverage['router/index.js'][353]++;
|
452
|
+
route = this.match(req, i, true);
|
453
|
+
_$jscoverage['router/index.js'][354]++;
|
454
|
+
if (route) {
|
455
|
+
_$jscoverage['router/index.js'][354]++;
|
456
|
+
return route;
|
457
|
+
}
|
458
|
+
_$jscoverage['router/index.js'][358]++;
|
459
|
+
method = "get";
|
460
|
+
}
|
461
|
+
_$jscoverage['router/index.js'][362]++;
|
462
|
+
if (routes = routes[method]) {
|
463
|
+
_$jscoverage['router/index.js'][365]++;
|
464
|
+
for (var len = routes.length; i < len; ++i) {
|
465
|
+
_$jscoverage['router/index.js'][366]++;
|
466
|
+
route = routes[i];
|
467
|
+
_$jscoverage['router/index.js'][367]++;
|
468
|
+
if (captures = route.match(path)) {
|
469
|
+
_$jscoverage['router/index.js'][368]++;
|
470
|
+
keys = route.keys;
|
471
|
+
_$jscoverage['router/index.js'][369]++;
|
472
|
+
route.params = [];
|
473
|
+
_$jscoverage['router/index.js'][372]++;
|
474
|
+
for (var j = 1, jlen = captures.length; j < jlen; ++j) {
|
475
|
+
_$jscoverage['router/index.js'][373]++;
|
476
|
+
var key = keys[j - 1], val = "string" == typeof captures[j]? decodeURIComponent(captures[j]): captures[j];
|
477
|
+
_$jscoverage['router/index.js'][377]++;
|
478
|
+
if (key) {
|
479
|
+
_$jscoverage['router/index.js'][378]++;
|
480
|
+
route.params[key.name] = val;
|
481
|
+
}
|
482
|
+
else {
|
483
|
+
_$jscoverage['router/index.js'][380]++;
|
484
|
+
route.params.push(val);
|
485
|
+
}
|
486
|
+
}
|
487
|
+
_$jscoverage['router/index.js'][385]++;
|
488
|
+
req._route_index = i;
|
489
|
+
_$jscoverage['router/index.js'][386]++;
|
490
|
+
return route;
|
491
|
+
}
|
492
|
+
}
|
493
|
+
}
|
494
|
+
});
|
495
|
+
_$jscoverage['router/index.js'][402]++;
|
496
|
+
Router.prototype.route = (function (method, path, callbacks) {
|
497
|
+
_$jscoverage['router/index.js'][403]++;
|
498
|
+
var app = this.app, method = method.toLowerCase(), callbacks = utils.flatten([].slice.call(arguments, 2));
|
499
|
+
_$jscoverage['router/index.js'][408]++;
|
500
|
+
if (! path) {
|
501
|
+
_$jscoverage['router/index.js'][408]++;
|
502
|
+
throw new Error("Router#" + method + "() requires a path");
|
503
|
+
}
|
504
|
+
_$jscoverage['router/index.js'][411]++;
|
505
|
+
debug("defined %s %s", method, path);
|
506
|
+
_$jscoverage['router/index.js'][412]++;
|
507
|
+
var route = new Route(method, path, callbacks, {sensitive: this.caseSensitive, strict: this.strict});
|
508
|
+
_$jscoverage['router/index.js'][418]++;
|
509
|
+
(this.map[method] = this.map[method] || []).push(route);
|
510
|
+
_$jscoverage['router/index.js'][419]++;
|
511
|
+
this.routes.push(route);
|
512
|
+
_$jscoverage['router/index.js'][420]++;
|
513
|
+
return this;
|
514
|
+
});
|
515
|
+
_$jscoverage['router/index.js'].source = ["/*!"," * Express - Router"," * Copyright(c) 2010 TJ Holowaychuk <tj@vision-media.ca>"," * MIT Licensed"," */","","/**"," * Module dependencies."," */","","var Route = require('./route')"," , Collection = require('./collection')"," , utils = require('../utils')"," , debug = require('debug')('express:router')"," , parse = require('url').parse;","","/**"," * Expose `Router` constructor."," */","","exports = module.exports = Router;","","/**"," * Expose HTTP methods."," */","","var methods = exports.methods = require('./methods');","","/**"," * Initialize a new `Router` with the given `options`."," * "," * @param {Object} options"," * @api private"," */","","function Router(options) {"," options = options || {};"," var self = this;"," this.routes = new Collection;"," this.map = {};"," this.params = {};"," this._params = [];"," this.caseSensitive = options.caseSensitive;"," this.strict = options.strict;",""," this.middleware = function router(req, res, next){"," self._dispatch(req, res, next);"," };","}","","/**"," * Register a param callback `fn` for the given `name`."," *"," * @param {String|Function} name"," * @param {Function} fn"," * @return {Router} for chaining"," * @api public"," */","","Router.prototype.param = function(name, fn){"," // param logic"," if ('function' == typeof name) {"," this._params.push(name);"," return;"," }",""," // apply param functions"," var params = this._params"," , len = params.length"," , ret;",""," for (var i = 0; i < len; ++i) {"," if (ret = params[i](name, fn)) {"," fn = ret;"," }"," }",""," // ensure we end up with a"," // middleware function"," if ('function' != typeof fn) {"," throw new Error('invalid param() call for ' + name + ', got ' + fn);"," }",""," (this.params[name] = this.params[name] || []).push(fn);"," return this;","};","","/**"," * Return a `Collection` of all routes defined."," *"," * @return {Collection}"," * @api public"," */","","Router.prototype.all = function(){"," return this.find(function(){"," return true;"," });","};","","/**"," * Remove the given `route`, returns"," * a bool indicating if the route was present"," * or not."," *"," * @param {Route} route"," * @return {Boolean}"," * @api public"," */","","Router.prototype.remove = function(route){"," var routes = this.map[route.method]"," , len = routes.length;",""," // remove from array"," var i = this.routes.indexOf(route);"," this.routes.splice(i, 1);",""," // remove from map"," for (var i = 0; i < len; ++i) {"," if (route == routes[i]) {"," routes.splice(i, 1);"," return true;"," }"," }","};","","/**"," * Return routes with route paths matching `path`."," *"," * @param {String} method"," * @param {String} path"," * @return {Collection}"," * @api public"," */","","Router.prototype.lookup = function(method, path){"," return this.find(function(route){"," return path == route.path"," && (route.method == method"," || method == 'all');"," });","};","","// /**","// * Return routes with regexps that match the given `url`.","// *","// * @param {String} method","// * @param {String} url","// * @return {Collection}","// * @api public","// */","// ","// Router.prototype.match = function(method, url){","// return this.find(function(route){","// return route.match(url)","// && (route.method == method","// || method == 'all');","// });","// };","","/**"," * Find routes based on the return value of `fn`"," * which is invoked once per route."," *"," * @param {Function} fn"," * @return {Collection}"," * @api public"," */","","Router.prototype.find = function(fn){"," var len = methods.length"," , ret = new Collection(this)"," , method"," , routes"," , route;",""," for (var i = 0; i < len; ++i) {"," method = methods[i];"," routes = this.map[method];"," if (!routes) continue;"," for (var j = 0, jlen = routes.length; j < jlen; ++j) {"," route = routes[j];"," if (fn(route)) ret.push(route);"," }"," }",""," return ret;","};","","/**"," * Route dispatcher aka the route \"middleware\"."," *"," * @param {IncomingMessage} req"," * @param {ServerResponse} res"," * @param {Function} next"," * @api private"," */","","Router.prototype._dispatch = function(req, res, next){"," var params = this.params"," , self = this;",""," debug('dispatching %s %s', req.method, req.url);",""," // route dispatch"," (function pass(i, err){"," var paramCallbacks"," , paramIndex = 0"," , paramVal"," , route"," , keys"," , key"," , ret;",""," // match next route"," function nextRoute(err) {"," pass(req._route_index + 1, err);"," }",""," // match route"," req.route = route = self.match(req, i);",""," // implied OPTIONS"," if (!route && 'OPTIONS' == req.method) return self._options(req, res);",""," // no route"," if (!route) return next(err);"," debug('matched %s %s', route.method, route.path);",""," // we have a route"," // start at param 0"," req.params = route.params;"," keys = route.keys;"," i = 0;",""," // param callbacks"," function param(err) {"," paramIndex = 0;"," key = keys[i++];"," paramVal = key && req.params[key.name];"," paramCallbacks = key && params[key.name];",""," try {"," if ('route' == err) {"," nextRoute();"," } else if (err) {"," i = 0;"," callbacks(err);"," } else if (paramCallbacks && undefined !== paramVal) {"," paramCallback();"," } else if (key) {"," param();"," } else {"," i = 0;"," callbacks();"," }"," } catch (err) {"," param(err);"," }"," };",""," param(err);"," "," // single param callbacks"," function paramCallback(err) {"," var fn = paramCallbacks[paramIndex++];"," if (err || !fn) return param(err);"," fn(req, res, paramCallback, paramVal, key.name);"," }",""," // invoke route callbacks"," function callbacks(err) {"," var fn = route.callbacks[i++];"," try {"," if ('route' == err) {"," nextRoute();"," } else if (err && fn) {"," if (fn.length < 4) return callbacks(err);"," fn(err, req, res, callbacks);"," } else if (fn) {"," fn(req, res, callbacks);"," } else {"," nextRoute(err);"," }"," } catch (err) {"," callbacks(err);"," }"," }"," })(0);","};","","/**"," * Respond to __OPTIONS__ method."," *"," * @param {IncomingMessage} req"," * @param {ServerResponse} res"," * @api private"," */","","Router.prototype._options = function(req, res){"," var path = parse(req.url).pathname"," , body = this._optionsFor(path).join(',');"," res.set('Allow', body).send(body);","};","","/**"," * Return an array of HTTP verbs or \"options\" for `path`."," *"," * @param {String} path"," * @return {Array}"," * @api private"," */","","Router.prototype._optionsFor = function(path){"," var self = this;"," return methods.filter(function(method){"," var routes = self.map[method];"," if (!routes || 'options' == method) return;"," for (var i = 0, len = routes.length; i < len; ++i) {"," if (routes[i].match(path)) return true;"," }"," }).map(function(method){"," return method.toUpperCase();"," });","};","","/**"," * Attempt to match a route for `req`"," * with optional starting index of `i`"," * defaulting to 0."," *"," * @param {IncomingMessage} req"," * @param {Number} i"," * @return {Route}"," * @api private"," */","","Router.prototype.match = function(req, i, head){"," var method = req.method.toLowerCase()"," , url = parse(req.url)"," , path = url.pathname"," , routes = this.map"," , i = i || 0"," , captures"," , route"," , keys;",""," // HEAD support"," // TODO: clean this up"," if (!head && 'head' == method) {"," // attempt lookup"," route = this.match(req, i, true);"," if (route) return route;",""," // default to GET as res.render() / res.send()"," // etc support HEAD"," method = 'get';"," }",""," // routes for this method"," if (routes = routes[method]) {",""," // matching routes"," for (var len = routes.length; i < len; ++i) {"," route = routes[i];"," if (captures = route.match(path)) {"," keys = route.keys;"," route.params = [];",""," // params from capture groups"," for (var j = 1, jlen = captures.length; j < jlen; ++j) {"," var key = keys[j-1]"," , val = 'string' == typeof captures[j]"," ? decodeURIComponent(captures[j])"," : captures[j];"," if (key) {"," route.params[key.name] = val;"," } else {"," route.params.push(val);"," }"," }",""," // all done"," req._route_index = i;"," return route;"," }"," }"," }","};","","/**"," * Route `method`, `path`, and one or more callbacks."," *"," * @param {String} method"," * @param {String} path"," * @param {Function} callback..."," * @return {Router} for chaining"," * @api private"," */","","Router.prototype.route = function(method, path, callbacks){"," var app = this.app"," , method = method.toLowerCase()"," , callbacks = utils.flatten([].slice.call(arguments, 2));",""," // ensure path was given"," if (!path) throw new Error('Router#' + method + '() requires a path');",""," // create the route"," debug('defined %s %s', method, path);"," var route = new Route(method, path, callbacks, {"," sensitive: this.caseSensitive"," , strict: this.strict"," });",""," // add it"," (this.map[method] = this.map[method] || []).push(route);"," this.routes.push(route);"," return this;","};"];
|