From f385908cca6f3154e51f6508e3e2e4d1694428f3 Mon Sep 17 00:00:00 2001 From: "Stuart P. Bentley" Date: Mon, 25 Feb 2013 01:47:09 -0500 Subject: [PATCH] Update node_modules --- node_modules/async/package.json | 47 +- node_modules/ejs/.gitmodules | 3 - node_modules/ejs/{.gitignore => .npmignore} | 1 + node_modules/ejs/.travis.yml | 4 + node_modules/ejs/History.md | 54 + node_modules/ejs/Makefile | 7 +- node_modules/ejs/Readme.md | 51 +- node_modules/ejs/ejs.js | 581 ++ node_modules/ejs/ejs.min.js | 1 + node_modules/ejs/examples/client.html | 19 + node_modules/ejs/examples/list.js | 4 +- node_modules/ejs/lib/ejs.js | 169 +- node_modules/ejs/package.json | 28 +- node_modules/ejs/support/compile.js | 5 +- node_modules/ejs/support/expresso/.gitignore | 3 - node_modules/ejs/support/expresso/.gitmodules | 3 - node_modules/ejs/support/expresso/History.md | 87 - node_modules/ejs/support/expresso/Makefile | 50 - node_modules/ejs/support/expresso/Readme.md | 39 - .../ejs/support/expresso/bin/expresso | 775 -- .../ejs/support/expresso/docs/api.html | 989 -- .../ejs/support/expresso/docs/index.html | 380 - .../ejs/support/expresso/docs/index.md | 292 - .../support/expresso/docs/layout/foot.html | 3 - .../support/expresso/docs/layout/head.html | 47 - node_modules/ejs/support/expresso/lib/bar.js | 4 - node_modules/ejs/support/expresso/lib/foo.js | 16 - .../ejs/support/expresso/package.json | 9 - .../ejs/support/expresso/test/assert.test.js | 84 - .../ejs/support/expresso/test/async.test.js | 6 - .../ejs/support/expresso/test/bar.test.js | 12 - .../ejs/support/expresso/test/foo.test.js | 13 - .../ejs/support/expresso/test/http.test.js | 76 - node_modules/ejs/test/ejs.js | 213 + node_modules/ejs/test/ejs.test.js | 268 - node_modules/ejs/test/fixtures/backslash.ejs | 1 + node_modules/ejs/test/fixtures/backslash.html | 1 + node_modules/ejs/test/fixtures/comments.ejs | 5 + node_modules/ejs/test/fixtures/comments.html | 4 + .../ejs/test/fixtures/double-quote.ejs | 1 + .../ejs/test/fixtures/double-quote.html | 1 + node_modules/ejs/test/fixtures/error.ejs | 5 + node_modules/ejs/test/fixtures/error.out | 8 + .../ejs/test/fixtures/include.css.ejs | 1 + .../ejs/test/fixtures/include.css.html | 3 + node_modules/ejs/test/fixtures/include.ejs | 5 + node_modules/ejs/test/fixtures/include.html | 9 + .../ejs/test/fixtures/includes/menu-item.ejs | 1 + .../ejs/test/fixtures/includes/menu/item.ejs | 1 + node_modules/ejs/test/fixtures/menu.ejs | 11 + node_modules/ejs/test/fixtures/menu.html | 3 + node_modules/ejs/test/fixtures/messed.ejs | 1 + node_modules/ejs/test/fixtures/messed.html | 1 + node_modules/ejs/test/fixtures/newlines.ejs | 5 + node_modules/ejs/test/fixtures/newlines.html | 9 + .../ejs/test/fixtures/no.newlines.ejs | 5 + .../ejs/test/fixtures/no.newlines.html | 5 + node_modules/ejs/test/fixtures/para.ejs | 1 + node_modules/ejs/test/fixtures/pet.ejs | 1 + .../ejs/test/fixtures/single-quote.ejs | 1 + .../ejs/test/fixtures/single-quote.html | 1 + node_modules/ejs/test/fixtures/style.css | 3 + node_modules/ejs/test/fixtures/user.ejs | 1 + node_modules/express/.npmignore | 2 + node_modules/express/.travis.yml | 3 + node_modules/express/History.md | 308 +- node_modules/express/Makefile | 66 +- node_modules/express/Readme.md | 168 +- node_modules/express/bin/express | 373 +- node_modules/express/client.js | 25 + node_modules/express/index.js | 4 +- node_modules/express/lib/application.js | 532 + node_modules/express/lib/express.js | 87 +- node_modules/express/lib/http.js | 583 -- node_modules/express/lib/https.js | 52 - node_modules/express/lib/middleware.js | 33 + node_modules/express/lib/request.js | 539 +- node_modules/express/lib/response.js | 728 +- node_modules/express/lib/router/collection.js | 53 - node_modules/express/lib/router/index.js | 254 +- node_modules/express/lib/router/methods.js | 70 - node_modules/express/lib/router/route.js | 72 +- node_modules/express/lib/utils.js | 299 +- node_modules/express/lib/view.js | 461 +- node_modules/express/lib/view/partial.js | 40 - node_modules/express/lib/view/view.js | 209 - .../express/node_modules/commander/.npmignore | 4 + .../node_modules/commander/.travis.yml | 4 + .../express/node_modules/commander/History.md | 107 + .../express/node_modules/commander/Makefile | 7 + .../express/node_modules/commander/Readme.md | 262 + .../express/node_modules/commander/index.js | 2 + .../node_modules/commander/lib/commander.js | 1026 ++ .../node_modules/commander/package.json | 34 + .../express/node_modules/connect/.npmignore | 1 + .../express/node_modules/connect/.travis.yml | 4 + .../express/node_modules/connect/Readme.md | 133 + .../express/node_modules/connect/index.js | 4 +- .../express/node_modules/connect/lib/cache.js | 2 +- .../node_modules/connect/lib/connect.js | 109 +- .../express/node_modules/connect/lib/https.js | 47 - .../express/node_modules/connect/lib/index.js | 76 +- .../connect/lib/middleware/basicAuth.js | 48 +- .../connect/lib/middleware/bodyParser.js | 193 +- .../connect/lib/middleware/compiler.js | 163 - .../connect/lib/middleware/compress.js | 147 + .../connect/lib/middleware/cookieParser.js | 41 +- .../connect/lib/middleware/cookieSession.js | 119 + .../connect/lib/middleware/csrf.js | 48 +- .../connect/lib/middleware/directory.js | 21 +- .../connect/lib/middleware/errorHandler.js | 96 +- .../connect/lib/middleware/favicon.js | 33 +- .../connect/lib/middleware/json.js | 80 + .../connect/lib/middleware/limit.js | 59 +- .../connect/lib/middleware/logger.js | 97 +- .../connect/lib/middleware/methodOverride.js | 2 + .../connect/lib/middleware/multipart.js | 131 + .../connect/lib/middleware/profiler.js | 100 - .../connect/lib/middleware/query.js | 28 +- .../connect/lib/middleware/responseTime.js | 12 +- .../connect/lib/middleware/router.js | 379 - .../connect/lib/middleware/session.js | 232 +- .../connect/lib/middleware/session/cookie.js | 10 +- .../connect/lib/middleware/session/memory.js | 4 +- .../connect/lib/middleware/session/session.js | 37 +- .../connect/lib/middleware/session/store.js | 10 +- .../connect/lib/middleware/static.js | 227 +- .../connect/lib/middleware/staticCache.js | 196 +- .../connect/lib/middleware/timeout.js | 56 + .../connect/lib/middleware/urlencoded.js | 76 + .../connect/lib/middleware/vhost.js | 30 +- .../express/node_modules/connect/lib/patch.js | 124 +- .../connect/lib/{http.js => proto.js} | 177 +- .../connect/lib/public/error.html | 4 +- .../connect/lib/public/icons/page.png | Bin .../connect/lib/public/icons/page_add.png | Bin .../connect/lib/public/icons/page_attach.png | Bin .../connect/lib/public/icons/page_code.png | Bin .../connect/lib/public/icons/page_copy.png | Bin .../connect/lib/public/icons/page_delete.png | Bin .../connect/lib/public/icons/page_edit.png | Bin .../connect/lib/public/icons/page_error.png | Bin .../connect/lib/public/icons/page_excel.png | Bin .../connect/lib/public/icons/page_find.png | Bin .../connect/lib/public/icons/page_gear.png | Bin .../connect/lib/public/icons/page_go.png | Bin .../connect/lib/public/icons/page_green.png | Bin .../connect/lib/public/icons/page_key.png | Bin .../lib/public/icons/page_lightning.png | Bin .../connect/lib/public/icons/page_link.png | Bin .../lib/public/icons/page_paintbrush.png | Bin .../connect/lib/public/icons/page_paste.png | Bin .../connect/lib/public/icons/page_red.png | Bin .../connect/lib/public/icons/page_refresh.png | Bin .../connect/lib/public/icons/page_save.png | Bin .../connect/lib/public/icons/page_white.png | Bin .../lib/public/icons/page_white_acrobat.png | Bin .../public/icons/page_white_actionscript.png | Bin .../lib/public/icons/page_white_add.png | Bin .../connect/lib/public/icons/page_white_c.png | Bin .../lib/public/icons/page_white_camera.png | Bin .../lib/public/icons/page_white_cd.png | Bin .../lib/public/icons/page_white_code.png | Bin .../lib/public/icons/page_white_code_red.png | Bin .../public/icons/page_white_coldfusion.png | Bin .../public/icons/page_white_compressed.png | Bin .../lib/public/icons/page_white_copy.png | Bin .../lib/public/icons/page_white_cplusplus.png | Bin .../lib/public/icons/page_white_csharp.png | Bin .../lib/public/icons/page_white_cup.png | Bin .../lib/public/icons/page_white_database.png | Bin .../lib/public/icons/page_white_delete.png | Bin .../lib/public/icons/page_white_dvd.png | Bin .../lib/public/icons/page_white_edit.png | Bin .../lib/public/icons/page_white_error.png | Bin .../lib/public/icons/page_white_excel.png | Bin .../lib/public/icons/page_white_find.png | Bin .../lib/public/icons/page_white_flash.png | Bin .../lib/public/icons/page_white_freehand.png | Bin .../lib/public/icons/page_white_gear.png | Bin .../lib/public/icons/page_white_get.png | Bin .../lib/public/icons/page_white_go.png | Bin .../connect/lib/public/icons/page_white_h.png | Bin .../public/icons/page_white_horizontal.png | Bin .../lib/public/icons/page_white_key.png | Bin .../lib/public/icons/page_white_lightning.png | Bin .../lib/public/icons/page_white_link.png | Bin .../lib/public/icons/page_white_magnify.png | Bin .../lib/public/icons/page_white_medal.png | Bin .../lib/public/icons/page_white_office.png | Bin .../lib/public/icons/page_white_paint.png | Bin .../public/icons/page_white_paintbrush.png | Bin .../lib/public/icons/page_white_paste.png | Bin .../lib/public/icons/page_white_php.png | Bin .../lib/public/icons/page_white_picture.png | Bin .../public/icons/page_white_powerpoint.png | Bin .../lib/public/icons/page_white_put.png | Bin .../lib/public/icons/page_white_ruby.png | Bin .../lib/public/icons/page_white_stack.png | Bin .../lib/public/icons/page_white_star.png | Bin .../lib/public/icons/page_white_swoosh.png | Bin .../lib/public/icons/page_white_text.png | Bin .../public/icons/page_white_text_width.png | Bin .../lib/public/icons/page_white_tux.png | Bin .../lib/public/icons/page_white_vector.png | Bin .../public/icons/page_white_visualstudio.png | Bin .../lib/public/icons/page_white_width.png | Bin .../lib/public/icons/page_white_word.png | Bin .../lib/public/icons/page_white_world.png | Bin .../lib/public/icons/page_white_wrench.png | Bin .../lib/public/icons/page_white_zip.png | Bin .../connect/lib/public/icons/page_word.png | Bin .../connect/lib/public/icons/page_world.png | Bin .../express/node_modules/connect/lib/utils.js | 369 +- .../connect/node_modules/bytes/.npmignore | 1 + .../connect/node_modules/bytes/History.md | 5 + .../connect/node_modules/bytes/Makefile | 7 + .../connect/node_modules/bytes/Readme.md | 51 + .../connect/node_modules/bytes/component.json | 7 + .../connect/node_modules/bytes/index.js | 39 + .../connect/node_modules/bytes/package.json | 24 + .../node_modules/formidable/..travis.yml.un~ | Bin 953 -> 0 bytes .../node_modules/formidable/.Readme.md.un~ | Bin 6414 -> 0 bytes .../node_modules/formidable/.package.json.un~ | Bin 542 -> 0 bytes .../connect/node_modules/formidable/Readme.md | 10 +- .../formidable/lib/.incoming_form.js.un~ | Bin 12289 -> 0 bytes .../node_modules/formidable/lib/file.js | 16 +- .../formidable/lib/incoming_form.js | 20 +- .../formidable/node-gently/Makefile | 4 + .../formidable/node-gently/Readme.md | 167 + .../formidable/node-gently/example/dog.js | 22 + .../node-gently/example/event_emitter.js | 11 + .../formidable/node-gently/index.js | 1 + .../node-gently/lib/gently/gently.js | 184 + .../node-gently/lib/gently/index.js | 1 + .../formidable/node-gently/package.json | 14 + .../formidable/node-gently/test/common.js | 8 + .../node-gently/test/simple/test-gently.js | 348 + .../node_modules/formidable/package.json | 11 +- .../formidable/test/.common.js.un~ | Bin 1666 -> 0 bytes .../node_modules/formidable/test/.run.js.un~ | Bin 541 -> 0 bytes .../http/no-filename/.generic.http.un~ | Bin 641 -> 0 bytes .../test/fixture/js/.no-filename.js.un~ | Bin 1147 -> 0 bytes .../js/.special-chars-in-filename.js.un~ | Bin 2129 -> 0 bytes .../test/integration/.test-fixtures.js.un~ | Bin 30260 -> 0 bytes .../test/legacy/simple/test-incoming-form.js | 5 +- .../legacy/system/test-multi-video-upload.js | 3 + .../test/unit/.test-incoming-form.js.un~ | Bin 61302 -> 0 bytes .../test/unit/test-incoming-form.js | 2 +- .../connect/node_modules/pause/.npmignore | 4 + .../connect/node_modules/pause/History.md | 5 + .../connect/node_modules/pause/Makefile | 7 + .../connect/node_modules/pause/Readme.md | 29 + .../connect/node_modules/pause/index.js | 29 + .../connect/node_modules/pause/package.json | 19 + .../{ => connect/node_modules}/qs/.gitmodules | 0 .../node_modules/qs/.npmignore} | 0 .../{ => connect/node_modules}/qs/.travis.yml | 0 .../{ => connect/node_modules}/qs/History.md | 10 + .../connect/node_modules/qs/Makefile | 12 + .../{ => connect/node_modules}/qs/Readme.md | 6 +- .../node_modules}/qs/benchmark.js | 0 .../connect/node_modules/qs/component.json | 6 + .../{ => connect/node_modules}/qs/examples.js | 0 .../{ => connect/node_modules}/qs/index.js | 0 .../connect/node_modules/qs/lib/head.js | 1 + .../node_modules/qs/lib/querystring.js | 262 + .../connect/node_modules/qs/lib/tail.js | 1 + .../connect/node_modules/qs/package.json | 35 + .../node_modules/qs}/querystring.js | 16 +- .../node_modules/qs/test/browser/expect.js | 1202 +++ .../node_modules/qs/test/browser/index.html | 18 + .../node_modules/qs/test/browser/jquery.js | 8981 +++++++++++++++++ .../node_modules/qs/test/browser/mocha.css | 163 + .../node_modules/qs/test/browser/mocha.js | 4201 ++++++++ .../tmp/.empty => qs/test/browser/qs.css} | 0 .../node_modules/qs/test/browser/qs.js | 351 + .../connect/node_modules/qs/test/parse.js | 147 + .../connect/node_modules/qs/test/stringify.js | 73 + .../express/node_modules/connect/package.json | 58 +- .../express/node_modules/connect/test.js | 58 +- .../node_modules/cookie-signature/.npmignore | 4 + .../node_modules/cookie-signature/History.md | 5 + .../node_modules/cookie-signature/Makefile | 7 + .../node_modules/cookie-signature/Readme.md | 42 + .../node_modules/cookie-signature/index.js | 42 + .../cookie-signature/package.json | 23 + .../express/node_modules/cookie/.npmignore | 1 + .../express/node_modules/cookie/.travis.yml | 3 + .../express/node_modules/cookie/README.md | 44 + .../express/node_modules/cookie/index.js | 57 + .../express/node_modules/cookie/package.json | 32 + .../node_modules/cookie/test/mocha.opts | 1 + .../express/node_modules/cookie/test/parse.js | 25 + .../node_modules/cookie/test/serialize.js | 59 + .../express/node_modules/crc/.gitmodules | 3 + .../express/node_modules/crc/.npmignore | 1 + .../express/node_modules/crc/Makefile | 7 + .../express/node_modules/crc/README.md | 31 + .../express/node_modules/crc/lib/crc.js | 403 + .../express/node_modules/crc/package.json | 24 + .../express/node_modules/crc/test/crc.js | 63 + .../express/node_modules/debug/.npmignore | 4 + .../express/node_modules/debug/History.md | 62 + .../express/node_modules/debug/Readme.md | 115 + .../express/node_modules/debug/component.json | 9 + .../express/node_modules/debug/debug.js | 124 + .../express/node_modules/debug/example/app.js | 19 + .../node_modules/debug/example/browser.html | 24 + .../node_modules/debug/example/wildcards.js | 10 + .../node_modules/debug/example/worker.js | 22 + .../express/node_modules/debug/index.js | 5 + .../express/node_modules/debug/lib/debug.js | 134 + .../express/node_modules/debug/package.json | 36 + .../express/node_modules/fresh/.npmignore | 1 + .../express/node_modules/fresh/Makefile | 7 + .../express/node_modules/fresh/Readme.md | 32 + .../express/node_modules/fresh/index.js | 49 + .../express/node_modules/fresh/package.json | 19 + .../express/node_modules/methods/index.js | 26 + .../express/node_modules/methods/package.json | 20 + .../express/node_modules/mime/mime.js | 93 - .../express/node_modules/mime/package.json | 22 - .../node_modules/mkdirp/.gitignore.orig | 2 + .../node_modules/mkdirp/.gitignore.rej | 5 + .../express/node_modules/mkdirp/.npmignore | 2 + .../express/node_modules/mkdirp/.travis.yml | 4 + .../express/node_modules/mkdirp/LICENSE | 21 + .../node_modules/mkdirp/README.markdown | 61 + .../node_modules/mkdirp/examples/pow.js | 6 + .../node_modules/mkdirp/examples/pow.js.orig | 6 + .../node_modules/mkdirp/examples/pow.js.rej | 19 + .../express/node_modules/mkdirp/index.js | 94 + .../express/node_modules/mkdirp/package.json | 32 + .../express/node_modules/mkdirp/test/chmod.js | 38 + .../node_modules/mkdirp/test/clobber.js | 37 + .../node_modules/mkdirp/test/mkdirp.js | 28 + .../express/node_modules/mkdirp/test/perm.js | 32 + .../node_modules/mkdirp/test/perm_sync.js | 39 + .../express/node_modules/mkdirp/test/race.js | 41 + .../express/node_modules/mkdirp/test/rel.js | 32 + .../node_modules/mkdirp/test/return.js | 25 + .../node_modules/mkdirp/test/return_sync.js | 24 + .../express/node_modules/mkdirp/test/root.js | 18 + .../express/node_modules/mkdirp/test/sync.js | 32 + .../express/node_modules/mkdirp/test/umask.js | 28 + .../node_modules/mkdirp/test/umask_sync.js | 32 + node_modules/express/node_modules/qs/Makefile | 5 - .../express/node_modules/qs/package.json | 16 - .../express/node_modules/qs/test/mocha.opts | 2 - .../express/node_modules/qs/test/parse.js | 167 - .../express/node_modules/qs/test/stringify.js | 103 - .../node_modules/range-parser/.npmignore | 1 + .../node_modules/range-parser/History.md | 15 + .../node_modules/range-parser/Makefile | 7 + .../node_modules/range-parser/Readme.md | 28 + .../node_modules/range-parser/index.js | 49 + .../node_modules/range-parser/package.json | 19 + .../express/node_modules/send/.npmignore | 4 + .../express/node_modules/send/History.md | 25 + .../express/node_modules/send/Makefile | 8 + .../express/node_modules/send/Readme.md | 123 + .../express/node_modules/send/index.js | 2 + .../express/node_modules/send/lib/send.js | 473 + .../express/node_modules/send/lib/utils.js | 47 + .../{ => send/node_modules}/mime/LICENSE | 0 .../{ => send/node_modules}/mime/README.md | 0 .../send/node_modules/mime/mime.js | 104 + .../send/node_modules/mime/package.json | 31 + .../{ => send/node_modules}/mime/test.js | 2 + .../node_modules}/mime/types/mime.types | 0 .../node_modules}/mime/types/node.types | 19 +- .../express/node_modules/send/package.json | 33 + node_modules/express/package.json | 96 +- node_modules/express/test.js | 20 + .../node_modules/b64url/package.json | 16 +- .../node_modules/restler/package.json | 41 +- node_modules/faceplate/package.json | 20 +- node_modules/socket_manager/index.js | 66 - package.json | 3 +- 380 files changed, 26808 insertions(+), 8329 deletions(-) rename node_modules/ejs/{.gitignore => .npmignore} (79%) create mode 100644 node_modules/ejs/.travis.yml create mode 100644 node_modules/ejs/ejs.js create mode 100644 node_modules/ejs/ejs.min.js delete mode 100644 node_modules/ejs/support/expresso/.gitignore delete mode 100644 node_modules/ejs/support/expresso/.gitmodules delete mode 100644 node_modules/ejs/support/expresso/History.md delete mode 100644 node_modules/ejs/support/expresso/Makefile delete mode 100644 node_modules/ejs/support/expresso/Readme.md delete mode 100755 node_modules/ejs/support/expresso/bin/expresso delete mode 100644 node_modules/ejs/support/expresso/docs/api.html delete mode 100644 node_modules/ejs/support/expresso/docs/index.html delete mode 100644 node_modules/ejs/support/expresso/docs/index.md delete mode 100644 node_modules/ejs/support/expresso/docs/layout/foot.html delete mode 100644 node_modules/ejs/support/expresso/docs/layout/head.html delete mode 100644 node_modules/ejs/support/expresso/lib/bar.js delete mode 100644 node_modules/ejs/support/expresso/lib/foo.js delete mode 100644 node_modules/ejs/support/expresso/package.json delete mode 100644 node_modules/ejs/support/expresso/test/assert.test.js delete mode 100644 node_modules/ejs/support/expresso/test/async.test.js delete mode 100644 node_modules/ejs/support/expresso/test/bar.test.js delete mode 100644 node_modules/ejs/support/expresso/test/foo.test.js delete mode 100644 node_modules/ejs/support/expresso/test/http.test.js create mode 100644 node_modules/ejs/test/ejs.js delete mode 100644 node_modules/ejs/test/ejs.test.js create mode 100644 node_modules/ejs/test/fixtures/backslash.ejs create mode 100644 node_modules/ejs/test/fixtures/backslash.html create mode 100644 node_modules/ejs/test/fixtures/comments.ejs create mode 100644 node_modules/ejs/test/fixtures/comments.html create mode 100644 node_modules/ejs/test/fixtures/double-quote.ejs create mode 100644 node_modules/ejs/test/fixtures/double-quote.html create mode 100644 node_modules/ejs/test/fixtures/error.ejs create mode 100644 node_modules/ejs/test/fixtures/error.out create mode 100644 node_modules/ejs/test/fixtures/include.css.ejs create mode 100644 node_modules/ejs/test/fixtures/include.css.html create mode 100644 node_modules/ejs/test/fixtures/include.ejs create mode 100644 node_modules/ejs/test/fixtures/include.html create mode 100644 node_modules/ejs/test/fixtures/includes/menu-item.ejs create mode 100644 node_modules/ejs/test/fixtures/includes/menu/item.ejs create mode 100644 node_modules/ejs/test/fixtures/menu.ejs create mode 100644 node_modules/ejs/test/fixtures/menu.html create mode 100644 node_modules/ejs/test/fixtures/messed.ejs create mode 100644 node_modules/ejs/test/fixtures/messed.html create mode 100644 node_modules/ejs/test/fixtures/newlines.ejs create mode 100644 node_modules/ejs/test/fixtures/newlines.html create mode 100644 node_modules/ejs/test/fixtures/no.newlines.ejs create mode 100644 node_modules/ejs/test/fixtures/no.newlines.html create mode 100644 node_modules/ejs/test/fixtures/para.ejs create mode 100644 node_modules/ejs/test/fixtures/pet.ejs create mode 100644 node_modules/ejs/test/fixtures/single-quote.ejs create mode 100644 node_modules/ejs/test/fixtures/single-quote.html create mode 100644 node_modules/ejs/test/fixtures/style.css create mode 100644 node_modules/ejs/test/fixtures/user.ejs create mode 100644 node_modules/express/.travis.yml create mode 100644 node_modules/express/client.js create mode 100644 node_modules/express/lib/application.js delete mode 100644 node_modules/express/lib/http.js delete mode 100644 node_modules/express/lib/https.js create mode 100644 node_modules/express/lib/middleware.js delete mode 100644 node_modules/express/lib/router/collection.js delete mode 100644 node_modules/express/lib/router/methods.js delete mode 100644 node_modules/express/lib/view/partial.js delete mode 100644 node_modules/express/lib/view/view.js create mode 100644 node_modules/express/node_modules/commander/.npmignore create mode 100644 node_modules/express/node_modules/commander/.travis.yml create mode 100644 node_modules/express/node_modules/commander/History.md create mode 100644 node_modules/express/node_modules/commander/Makefile create mode 100644 node_modules/express/node_modules/commander/Readme.md create mode 100644 node_modules/express/node_modules/commander/index.js create mode 100644 node_modules/express/node_modules/commander/lib/commander.js create mode 100644 node_modules/express/node_modules/commander/package.json create mode 100644 node_modules/express/node_modules/connect/.travis.yml create mode 100644 node_modules/express/node_modules/connect/Readme.md delete mode 100644 node_modules/express/node_modules/connect/lib/https.js delete mode 100644 node_modules/express/node_modules/connect/lib/middleware/compiler.js create mode 100644 node_modules/express/node_modules/connect/lib/middleware/compress.js create mode 100644 node_modules/express/node_modules/connect/lib/middleware/cookieSession.js create mode 100644 node_modules/express/node_modules/connect/lib/middleware/json.js create mode 100644 node_modules/express/node_modules/connect/lib/middleware/multipart.js delete mode 100644 node_modules/express/node_modules/connect/lib/middleware/profiler.js delete mode 100644 node_modules/express/node_modules/connect/lib/middleware/router.js create mode 100644 node_modules/express/node_modules/connect/lib/middleware/timeout.js create mode 100644 node_modules/express/node_modules/connect/lib/middleware/urlencoded.js rename node_modules/express/node_modules/connect/lib/{http.js => proto.js} (51%) mode change 100755 => 100644 node_modules/express/node_modules/connect/lib/public/icons/page.png mode change 100755 => 100644 node_modules/express/node_modules/connect/lib/public/icons/page_add.png mode change 100755 => 100644 node_modules/express/node_modules/connect/lib/public/icons/page_attach.png mode change 100755 => 100644 node_modules/express/node_modules/connect/lib/public/icons/page_code.png mode change 100755 => 100644 node_modules/express/node_modules/connect/lib/public/icons/page_copy.png mode change 100755 => 100644 node_modules/express/node_modules/connect/lib/public/icons/page_delete.png mode change 100755 => 100644 node_modules/express/node_modules/connect/lib/public/icons/page_edit.png mode change 100755 => 100644 node_modules/express/node_modules/connect/lib/public/icons/page_error.png mode change 100755 => 100644 node_modules/express/node_modules/connect/lib/public/icons/page_excel.png mode change 100755 => 100644 node_modules/express/node_modules/connect/lib/public/icons/page_find.png mode change 100755 => 100644 node_modules/express/node_modules/connect/lib/public/icons/page_gear.png mode change 100755 => 100644 node_modules/express/node_modules/connect/lib/public/icons/page_go.png mode change 100755 => 100644 node_modules/express/node_modules/connect/lib/public/icons/page_green.png mode change 100755 => 100644 node_modules/express/node_modules/connect/lib/public/icons/page_key.png mode change 100755 => 100644 node_modules/express/node_modules/connect/lib/public/icons/page_lightning.png mode change 100755 => 100644 node_modules/express/node_modules/connect/lib/public/icons/page_link.png mode change 100755 => 100644 node_modules/express/node_modules/connect/lib/public/icons/page_paintbrush.png mode change 100755 => 100644 node_modules/express/node_modules/connect/lib/public/icons/page_paste.png mode change 100755 => 100644 node_modules/express/node_modules/connect/lib/public/icons/page_red.png mode change 100755 => 100644 node_modules/express/node_modules/connect/lib/public/icons/page_refresh.png mode change 100755 => 100644 node_modules/express/node_modules/connect/lib/public/icons/page_save.png mode change 100755 => 100644 node_modules/express/node_modules/connect/lib/public/icons/page_white.png mode change 100755 => 100644 node_modules/express/node_modules/connect/lib/public/icons/page_white_acrobat.png mode change 100755 => 100644 node_modules/express/node_modules/connect/lib/public/icons/page_white_actionscript.png mode change 100755 => 100644 node_modules/express/node_modules/connect/lib/public/icons/page_white_add.png mode change 100755 => 100644 node_modules/express/node_modules/connect/lib/public/icons/page_white_c.png mode change 100755 => 100644 node_modules/express/node_modules/connect/lib/public/icons/page_white_camera.png mode change 100755 => 100644 node_modules/express/node_modules/connect/lib/public/icons/page_white_cd.png mode change 100755 => 100644 node_modules/express/node_modules/connect/lib/public/icons/page_white_code.png mode change 100755 => 100644 node_modules/express/node_modules/connect/lib/public/icons/page_white_code_red.png mode change 100755 => 100644 node_modules/express/node_modules/connect/lib/public/icons/page_white_coldfusion.png mode change 100755 => 100644 node_modules/express/node_modules/connect/lib/public/icons/page_white_compressed.png mode change 100755 => 100644 node_modules/express/node_modules/connect/lib/public/icons/page_white_copy.png mode change 100755 => 100644 node_modules/express/node_modules/connect/lib/public/icons/page_white_cplusplus.png mode change 100755 => 100644 node_modules/express/node_modules/connect/lib/public/icons/page_white_csharp.png mode change 100755 => 100644 node_modules/express/node_modules/connect/lib/public/icons/page_white_cup.png mode change 100755 => 100644 node_modules/express/node_modules/connect/lib/public/icons/page_white_database.png mode change 100755 => 100644 node_modules/express/node_modules/connect/lib/public/icons/page_white_delete.png mode change 100755 => 100644 node_modules/express/node_modules/connect/lib/public/icons/page_white_dvd.png mode change 100755 => 100644 node_modules/express/node_modules/connect/lib/public/icons/page_white_edit.png mode change 100755 => 100644 node_modules/express/node_modules/connect/lib/public/icons/page_white_error.png mode change 100755 => 100644 node_modules/express/node_modules/connect/lib/public/icons/page_white_excel.png mode change 100755 => 100644 node_modules/express/node_modules/connect/lib/public/icons/page_white_find.png mode change 100755 => 100644 node_modules/express/node_modules/connect/lib/public/icons/page_white_flash.png mode change 100755 => 100644 node_modules/express/node_modules/connect/lib/public/icons/page_white_freehand.png mode change 100755 => 100644 node_modules/express/node_modules/connect/lib/public/icons/page_white_gear.png mode change 100755 => 100644 node_modules/express/node_modules/connect/lib/public/icons/page_white_get.png mode change 100755 => 100644 node_modules/express/node_modules/connect/lib/public/icons/page_white_go.png mode change 100755 => 100644 node_modules/express/node_modules/connect/lib/public/icons/page_white_h.png mode change 100755 => 100644 node_modules/express/node_modules/connect/lib/public/icons/page_white_horizontal.png mode change 100755 => 100644 node_modules/express/node_modules/connect/lib/public/icons/page_white_key.png mode change 100755 => 100644 node_modules/express/node_modules/connect/lib/public/icons/page_white_lightning.png mode change 100755 => 100644 node_modules/express/node_modules/connect/lib/public/icons/page_white_link.png mode change 100755 => 100644 node_modules/express/node_modules/connect/lib/public/icons/page_white_magnify.png mode change 100755 => 100644 node_modules/express/node_modules/connect/lib/public/icons/page_white_medal.png mode change 100755 => 100644 node_modules/express/node_modules/connect/lib/public/icons/page_white_office.png mode change 100755 => 100644 node_modules/express/node_modules/connect/lib/public/icons/page_white_paint.png mode change 100755 => 100644 node_modules/express/node_modules/connect/lib/public/icons/page_white_paintbrush.png mode change 100755 => 100644 node_modules/express/node_modules/connect/lib/public/icons/page_white_paste.png mode change 100755 => 100644 node_modules/express/node_modules/connect/lib/public/icons/page_white_php.png mode change 100755 => 100644 node_modules/express/node_modules/connect/lib/public/icons/page_white_picture.png mode change 100755 => 100644 node_modules/express/node_modules/connect/lib/public/icons/page_white_powerpoint.png mode change 100755 => 100644 node_modules/express/node_modules/connect/lib/public/icons/page_white_put.png mode change 100755 => 100644 node_modules/express/node_modules/connect/lib/public/icons/page_white_ruby.png mode change 100755 => 100644 node_modules/express/node_modules/connect/lib/public/icons/page_white_stack.png mode change 100755 => 100644 node_modules/express/node_modules/connect/lib/public/icons/page_white_star.png mode change 100755 => 100644 node_modules/express/node_modules/connect/lib/public/icons/page_white_swoosh.png mode change 100755 => 100644 node_modules/express/node_modules/connect/lib/public/icons/page_white_text.png mode change 100755 => 100644 node_modules/express/node_modules/connect/lib/public/icons/page_white_text_width.png mode change 100755 => 100644 node_modules/express/node_modules/connect/lib/public/icons/page_white_tux.png mode change 100755 => 100644 node_modules/express/node_modules/connect/lib/public/icons/page_white_vector.png mode change 100755 => 100644 node_modules/express/node_modules/connect/lib/public/icons/page_white_visualstudio.png mode change 100755 => 100644 node_modules/express/node_modules/connect/lib/public/icons/page_white_width.png mode change 100755 => 100644 node_modules/express/node_modules/connect/lib/public/icons/page_white_word.png mode change 100755 => 100644 node_modules/express/node_modules/connect/lib/public/icons/page_white_world.png mode change 100755 => 100644 node_modules/express/node_modules/connect/lib/public/icons/page_white_wrench.png mode change 100755 => 100644 node_modules/express/node_modules/connect/lib/public/icons/page_white_zip.png mode change 100755 => 100644 node_modules/express/node_modules/connect/lib/public/icons/page_word.png mode change 100755 => 100644 node_modules/express/node_modules/connect/lib/public/icons/page_world.png create mode 100644 node_modules/express/node_modules/connect/node_modules/bytes/.npmignore create mode 100644 node_modules/express/node_modules/connect/node_modules/bytes/History.md create mode 100644 node_modules/express/node_modules/connect/node_modules/bytes/Makefile create mode 100644 node_modules/express/node_modules/connect/node_modules/bytes/Readme.md create mode 100644 node_modules/express/node_modules/connect/node_modules/bytes/component.json create mode 100644 node_modules/express/node_modules/connect/node_modules/bytes/index.js create mode 100644 node_modules/express/node_modules/connect/node_modules/bytes/package.json delete mode 100644 node_modules/express/node_modules/connect/node_modules/formidable/..travis.yml.un~ delete mode 100644 node_modules/express/node_modules/connect/node_modules/formidable/.Readme.md.un~ delete mode 100644 node_modules/express/node_modules/connect/node_modules/formidable/.package.json.un~ delete mode 100644 node_modules/express/node_modules/connect/node_modules/formidable/lib/.incoming_form.js.un~ create mode 100644 node_modules/express/node_modules/connect/node_modules/formidable/node-gently/Makefile create mode 100644 node_modules/express/node_modules/connect/node_modules/formidable/node-gently/Readme.md create mode 100644 node_modules/express/node_modules/connect/node_modules/formidable/node-gently/example/dog.js create mode 100644 node_modules/express/node_modules/connect/node_modules/formidable/node-gently/example/event_emitter.js create mode 100644 node_modules/express/node_modules/connect/node_modules/formidable/node-gently/index.js create mode 100644 node_modules/express/node_modules/connect/node_modules/formidable/node-gently/lib/gently/gently.js create mode 100644 node_modules/express/node_modules/connect/node_modules/formidable/node-gently/lib/gently/index.js create mode 100644 node_modules/express/node_modules/connect/node_modules/formidable/node-gently/package.json create mode 100644 node_modules/express/node_modules/connect/node_modules/formidable/node-gently/test/common.js create mode 100644 node_modules/express/node_modules/connect/node_modules/formidable/node-gently/test/simple/test-gently.js delete mode 100644 node_modules/express/node_modules/connect/node_modules/formidable/test/.common.js.un~ delete mode 100755 node_modules/express/node_modules/connect/node_modules/formidable/test/.run.js.un~ delete mode 100644 node_modules/express/node_modules/connect/node_modules/formidable/test/fixture/http/no-filename/.generic.http.un~ delete mode 100644 node_modules/express/node_modules/connect/node_modules/formidable/test/fixture/js/.no-filename.js.un~ delete mode 100644 node_modules/express/node_modules/connect/node_modules/formidable/test/fixture/js/.special-chars-in-filename.js.un~ delete mode 100644 node_modules/express/node_modules/connect/node_modules/formidable/test/integration/.test-fixtures.js.un~ delete mode 100644 node_modules/express/node_modules/connect/node_modules/formidable/test/unit/.test-incoming-form.js.un~ create mode 100644 node_modules/express/node_modules/connect/node_modules/pause/.npmignore create mode 100644 node_modules/express/node_modules/connect/node_modules/pause/History.md create mode 100644 node_modules/express/node_modules/connect/node_modules/pause/Makefile create mode 100644 node_modules/express/node_modules/connect/node_modules/pause/Readme.md create mode 100644 node_modules/express/node_modules/connect/node_modules/pause/index.js create mode 100644 node_modules/express/node_modules/connect/node_modules/pause/package.json rename node_modules/express/node_modules/{ => connect/node_modules}/qs/.gitmodules (100%) rename node_modules/express/node_modules/{qs/.gitignore => connect/node_modules/qs/.npmignore} (100%) rename node_modules/express/node_modules/{ => connect/node_modules}/qs/.travis.yml (100%) rename node_modules/express/node_modules/{ => connect/node_modules}/qs/History.md (90%) create mode 100644 node_modules/express/node_modules/connect/node_modules/qs/Makefile rename node_modules/express/node_modules/{ => connect/node_modules}/qs/Readme.md (82%) rename node_modules/express/node_modules/{ => connect/node_modules}/qs/benchmark.js (100%) create mode 100644 node_modules/express/node_modules/connect/node_modules/qs/component.json rename node_modules/express/node_modules/{ => connect/node_modules}/qs/examples.js (100%) rename node_modules/express/node_modules/{ => connect/node_modules}/qs/index.js (100%) create mode 100644 node_modules/express/node_modules/connect/node_modules/qs/lib/head.js create mode 100644 node_modules/express/node_modules/connect/node_modules/qs/lib/querystring.js create mode 100644 node_modules/express/node_modules/connect/node_modules/qs/lib/tail.js create mode 100644 node_modules/express/node_modules/connect/node_modules/qs/package.json rename node_modules/express/node_modules/{qs/lib => connect/node_modules/qs}/querystring.js (96%) create mode 100644 node_modules/express/node_modules/connect/node_modules/qs/test/browser/expect.js create mode 100644 node_modules/express/node_modules/connect/node_modules/qs/test/browser/index.html create mode 100644 node_modules/express/node_modules/connect/node_modules/qs/test/browser/jquery.js create mode 100644 node_modules/express/node_modules/connect/node_modules/qs/test/browser/mocha.css create mode 100644 node_modules/express/node_modules/connect/node_modules/qs/test/browser/mocha.js rename node_modules/express/node_modules/connect/node_modules/{formidable/test/tmp/.empty => qs/test/browser/qs.css} (100%) create mode 100644 node_modules/express/node_modules/connect/node_modules/qs/test/browser/qs.js create mode 100644 node_modules/express/node_modules/connect/node_modules/qs/test/parse.js create mode 100644 node_modules/express/node_modules/connect/node_modules/qs/test/stringify.js create mode 100644 node_modules/express/node_modules/cookie-signature/.npmignore create mode 100644 node_modules/express/node_modules/cookie-signature/History.md create mode 100644 node_modules/express/node_modules/cookie-signature/Makefile create mode 100644 node_modules/express/node_modules/cookie-signature/Readme.md create mode 100644 node_modules/express/node_modules/cookie-signature/index.js create mode 100644 node_modules/express/node_modules/cookie-signature/package.json create mode 100644 node_modules/express/node_modules/cookie/.npmignore create mode 100644 node_modules/express/node_modules/cookie/.travis.yml create mode 100644 node_modules/express/node_modules/cookie/README.md create mode 100644 node_modules/express/node_modules/cookie/index.js create mode 100644 node_modules/express/node_modules/cookie/package.json create mode 100644 node_modules/express/node_modules/cookie/test/mocha.opts create mode 100644 node_modules/express/node_modules/cookie/test/parse.js create mode 100644 node_modules/express/node_modules/cookie/test/serialize.js create mode 100644 node_modules/express/node_modules/crc/.gitmodules create mode 100644 node_modules/express/node_modules/crc/.npmignore create mode 100644 node_modules/express/node_modules/crc/Makefile create mode 100644 node_modules/express/node_modules/crc/README.md create mode 100644 node_modules/express/node_modules/crc/lib/crc.js create mode 100644 node_modules/express/node_modules/crc/package.json create mode 100755 node_modules/express/node_modules/crc/test/crc.js create mode 100644 node_modules/express/node_modules/debug/.npmignore create mode 100644 node_modules/express/node_modules/debug/History.md create mode 100644 node_modules/express/node_modules/debug/Readme.md create mode 100644 node_modules/express/node_modules/debug/component.json create mode 100644 node_modules/express/node_modules/debug/debug.js create mode 100644 node_modules/express/node_modules/debug/example/app.js create mode 100644 node_modules/express/node_modules/debug/example/browser.html create mode 100644 node_modules/express/node_modules/debug/example/wildcards.js create mode 100644 node_modules/express/node_modules/debug/example/worker.js create mode 100644 node_modules/express/node_modules/debug/index.js create mode 100644 node_modules/express/node_modules/debug/lib/debug.js create mode 100644 node_modules/express/node_modules/debug/package.json create mode 100644 node_modules/express/node_modules/fresh/.npmignore create mode 100644 node_modules/express/node_modules/fresh/Makefile create mode 100644 node_modules/express/node_modules/fresh/Readme.md create mode 100644 node_modules/express/node_modules/fresh/index.js create mode 100644 node_modules/express/node_modules/fresh/package.json create mode 100644 node_modules/express/node_modules/methods/index.js create mode 100644 node_modules/express/node_modules/methods/package.json delete mode 100644 node_modules/express/node_modules/mime/mime.js delete mode 100644 node_modules/express/node_modules/mime/package.json create mode 100644 node_modules/express/node_modules/mkdirp/.gitignore.orig create mode 100644 node_modules/express/node_modules/mkdirp/.gitignore.rej create mode 100644 node_modules/express/node_modules/mkdirp/.npmignore create mode 100644 node_modules/express/node_modules/mkdirp/.travis.yml create mode 100644 node_modules/express/node_modules/mkdirp/LICENSE create mode 100644 node_modules/express/node_modules/mkdirp/README.markdown create mode 100644 node_modules/express/node_modules/mkdirp/examples/pow.js create mode 100644 node_modules/express/node_modules/mkdirp/examples/pow.js.orig create mode 100644 node_modules/express/node_modules/mkdirp/examples/pow.js.rej create mode 100644 node_modules/express/node_modules/mkdirp/index.js create mode 100644 node_modules/express/node_modules/mkdirp/package.json create mode 100644 node_modules/express/node_modules/mkdirp/test/chmod.js create mode 100644 node_modules/express/node_modules/mkdirp/test/clobber.js create mode 100644 node_modules/express/node_modules/mkdirp/test/mkdirp.js create mode 100644 node_modules/express/node_modules/mkdirp/test/perm.js create mode 100644 node_modules/express/node_modules/mkdirp/test/perm_sync.js create mode 100644 node_modules/express/node_modules/mkdirp/test/race.js create mode 100644 node_modules/express/node_modules/mkdirp/test/rel.js create mode 100644 node_modules/express/node_modules/mkdirp/test/return.js create mode 100644 node_modules/express/node_modules/mkdirp/test/return_sync.js create mode 100644 node_modules/express/node_modules/mkdirp/test/root.js create mode 100644 node_modules/express/node_modules/mkdirp/test/sync.js create mode 100644 node_modules/express/node_modules/mkdirp/test/umask.js create mode 100644 node_modules/express/node_modules/mkdirp/test/umask_sync.js delete mode 100644 node_modules/express/node_modules/qs/Makefile delete mode 100644 node_modules/express/node_modules/qs/package.json delete mode 100644 node_modules/express/node_modules/qs/test/mocha.opts delete mode 100644 node_modules/express/node_modules/qs/test/parse.js delete mode 100644 node_modules/express/node_modules/qs/test/stringify.js create mode 100644 node_modules/express/node_modules/range-parser/.npmignore create mode 100644 node_modules/express/node_modules/range-parser/History.md create mode 100644 node_modules/express/node_modules/range-parser/Makefile create mode 100644 node_modules/express/node_modules/range-parser/Readme.md create mode 100644 node_modules/express/node_modules/range-parser/index.js create mode 100644 node_modules/express/node_modules/range-parser/package.json create mode 100644 node_modules/express/node_modules/send/.npmignore create mode 100644 node_modules/express/node_modules/send/History.md create mode 100644 node_modules/express/node_modules/send/Makefile create mode 100644 node_modules/express/node_modules/send/Readme.md create mode 100644 node_modules/express/node_modules/send/index.js create mode 100644 node_modules/express/node_modules/send/lib/send.js create mode 100644 node_modules/express/node_modules/send/lib/utils.js rename node_modules/express/node_modules/{ => send/node_modules}/mime/LICENSE (100%) rename node_modules/express/node_modules/{ => send/node_modules}/mime/README.md (100%) create mode 100644 node_modules/express/node_modules/send/node_modules/mime/mime.js create mode 100644 node_modules/express/node_modules/send/node_modules/mime/package.json rename node_modules/express/node_modules/{ => send/node_modules}/mime/test.js (90%) rename node_modules/express/node_modules/{ => send/node_modules}/mime/types/mime.types (100%) rename node_modules/express/node_modules/{ => send/node_modules}/mime/types/node.types (73%) create mode 100644 node_modules/express/node_modules/send/package.json create mode 100644 node_modules/express/test.js delete mode 100644 node_modules/socket_manager/index.js diff --git a/node_modules/async/package.json b/node_modules/async/package.json index 5679bec..2bc0926 100644 --- a/node_modules/async/package.json +++ b/node_modules/async/package.json @@ -1,21 +1,30 @@ -{ "name": "async" -, "description": "Higher-order functions and common patterns for asynchronous code" -, "main": "./index" -, "author": "Caolan McMahon" -, "version": "0.1.18" -, "repository" : - { "type" : "git" - , "url" : "http://github.com/caolan/async.git" - } -, "bugs" : { "url" : "http://github.com/caolan/async/issues" } -, "licenses" : - [ { "type" : "MIT" - , "url" : "http://github.com/caolan/async/raw/master/LICENSE" +{ + "name": "async", + "description": "Higher-order functions and common patterns for asynchronous code", + "main": "./index", + "author": { + "name": "Caolan McMahon" + }, + "version": "0.1.18", + "repository": { + "type": "git", + "url": "http://github.com/caolan/async.git" + }, + "bugs": { + "url": "http://github.com/caolan/async/issues" + }, + "licenses": [ + { + "type": "MIT", + "url": "http://github.com/caolan/async/raw/master/LICENSE" } - ] -, "devDependencies": - { "nodeunit": ">0.0.0" - , "uglify-js": "1.2.x" - , "nodelint": ">0.0.0" - } + ], + "devDependencies": { + "nodeunit": ">0.0.0", + "uglify-js": "1.2.x", + "nodelint": ">0.0.0" + }, + "readme": "# Async.js\n\nAsync is a utility module which provides straight-forward, powerful functions\nfor working with asynchronous JavaScript. Although originally designed for\nuse with [node.js](http://nodejs.org), it can also be used directly in the\nbrowser.\n\nAsync provides around 20 functions that include the usual 'functional'\nsuspects (map, reduce, filter, forEach…) as well as some common patterns\nfor asynchronous control flow (parallel, series, waterfall…). All these\nfunctions assume you follow the node.js convention of providing a single\ncallback as the last argument of your async function.\n\n\n## Quick Examples\n\n async.map(['file1','file2','file3'], fs.stat, function(err, results){\n // results is now an array of stats for each file\n });\n\n async.filter(['file1','file2','file3'], path.exists, function(results){\n // results now equals an array of the existing files\n });\n\n async.parallel([\n function(){ ... },\n function(){ ... }\n ], callback);\n\n async.series([\n function(){ ... },\n function(){ ... }\n ]);\n\nThere are many more functions available so take a look at the docs below for a\nfull list. This module aims to be comprehensive, so if you feel anything is\nmissing please create a GitHub issue for it.\n\n\n## Download\n\nReleases are available for download from\n[GitHub](http://github.com/caolan/async/downloads).\nAlternatively, you can install using Node Package Manager (npm):\n\n npm install async\n\n\n__Development:__ [async.js](https://github.com/caolan/async/raw/master/lib/async.js) - 17.5kb Uncompressed\n\n__Production:__ [async.min.js](https://github.com/caolan/async/raw/master/dist/async.min.js) - 1.7kb Packed and Gzipped\n\n\n## In the Browser\n\nSo far its been tested in IE6, IE7, IE8, FF3.6 and Chrome 5. Usage:\n\n \n \n\n\n## Documentation\n\n### Collections\n\n* [forEach](#forEach)\n* [map](#map)\n* [filter](#filter)\n* [reject](#reject)\n* [reduce](#reduce)\n* [detect](#detect)\n* [sortBy](#sortBy)\n* [some](#some)\n* [every](#every)\n* [concat](#concat)\n\n### Control Flow\n\n* [series](#series)\n* [parallel](#parallel)\n* [whilst](#whilst)\n* [until](#until)\n* [waterfall](#waterfall)\n* [queue](#queue)\n* [auto](#auto)\n* [iterator](#iterator)\n* [apply](#apply)\n* [nextTick](#nextTick)\n\n### Utils\n\n* [memoize](#memoize)\n* [unmemoize](#unmemoize)\n* [log](#log)\n* [dir](#dir)\n* [noConflict](#noConflict)\n\n\n## Collections\n\n\n### forEach(arr, iterator, callback)\n\nApplies an iterator function to each item in an array, in parallel.\nThe iterator is called with an item from the list and a callback for when it\nhas finished. If the iterator passes an error to this callback, the main\ncallback for the forEach function is immediately called with the error.\n\nNote, that since this function applies the iterator to each item in parallel\nthere is no guarantee that the iterator functions will complete in order.\n\n__Arguments__\n\n* arr - An array to iterate over.\n* iterator(item, callback) - A function to apply to each item in the array.\n The iterator is passed a callback which must be called once it has completed.\n* callback(err) - A callback which is called after all the iterator functions\n have finished, or an error has occurred.\n\n__Example__\n\n // assuming openFiles is an array of file names and saveFile is a function\n // to save the modified contents of that file:\n\n async.forEach(openFiles, saveFile, function(err){\n // if any of the saves produced an error, err would equal that error\n });\n\n---------------------------------------\n\n\n### forEachSeries(arr, iterator, callback)\n\nThe same as forEach only the iterator is applied to each item in the array in\nseries. The next iterator is only called once the current one has completed\nprocessing. This means the iterator functions will complete in order.\n\n\n---------------------------------------\n\n\n### forEachLimit(arr, limit, iterator, callback)\n\nThe same as forEach only the iterator is applied to batches of items in the\narray, in series. The next batch of iterators is only called once the current\none has completed processing.\n\n__Arguments__\n\n* arr - An array to iterate over.\n* limit - How many items should be in each batch.\n* iterator(item, callback) - A function to apply to each item in the array.\n The iterator is passed a callback which must be called once it has completed.\n* callback(err) - A callback which is called after all the iterator functions\n have finished, or an error has occurred.\n\n__Example__\n\n // Assume documents is an array of JSON objects and requestApi is a\n // function that interacts with a rate-limited REST api.\n\n async.forEachLimit(documents, 20, requestApi, function(err){\n // if any of the saves produced an error, err would equal that error\n });\n---------------------------------------\n\n\n### map(arr, iterator, callback)\n\nProduces a new array of values by mapping each value in the given array through\nthe iterator function. The iterator is called with an item from the array and a\ncallback for when it has finished processing. The callback takes 2 arguments, \nan error and the transformed item from the array. If the iterator passes an\nerror to this callback, the main callback for the map function is immediately\ncalled with the error.\n\nNote, that since this function applies the iterator to each item in parallel\nthere is no guarantee that the iterator functions will complete in order, however\nthe results array will be in the same order as the original array.\n\n__Arguments__\n\n* arr - An array to iterate over.\n* iterator(item, callback) - A function to apply to each item in the array.\n The iterator is passed a callback which must be called once it has completed\n with an error (which can be null) and a transformed item.\n* callback(err, results) - A callback which is called after all the iterator\n functions have finished, or an error has occurred. Results is an array of the\n transformed items from the original array.\n\n__Example__\n\n async.map(['file1','file2','file3'], fs.stat, function(err, results){\n // results is now an array of stats for each file\n });\n\n---------------------------------------\n\n\n### mapSeries(arr, iterator, callback)\n\nThe same as map only the iterator is applied to each item in the array in\nseries. The next iterator is only called once the current one has completed\nprocessing. The results array will be in the same order as the original.\n\n\n---------------------------------------\n\n\n### filter(arr, iterator, callback)\n\n__Alias:__ select\n\nReturns a new array of all the values which pass an async truth test.\n_The callback for each iterator call only accepts a single argument of true or\nfalse, it does not accept an error argument first!_ This is in-line with the\nway node libraries work with truth tests like path.exists. This operation is\nperformed in parallel, but the results array will be in the same order as the\noriginal.\n\n__Arguments__\n\n* arr - An array to iterate over.\n* iterator(item, callback) - A truth test to apply to each item in the array.\n The iterator is passed a callback which must be called once it has completed.\n* callback(results) - A callback which is called after all the iterator\n functions have finished.\n\n__Example__\n\n async.filter(['file1','file2','file3'], path.exists, function(results){\n // results now equals an array of the existing files\n });\n\n---------------------------------------\n\n\n### filterSeries(arr, iterator, callback)\n\n__alias:__ selectSeries\n\nThe same as filter only the iterator is applied to each item in the array in\nseries. The next iterator is only called once the current one has completed\nprocessing. The results array will be in the same order as the original.\n\n---------------------------------------\n\n\n### reject(arr, iterator, callback)\n\nThe opposite of filter. Removes values that pass an async truth test.\n\n---------------------------------------\n\n\n### rejectSeries(arr, iterator, callback)\n\nThe same as filter, only the iterator is applied to each item in the array\nin series.\n\n\n---------------------------------------\n\n\n### reduce(arr, memo, iterator, callback)\n\n__aliases:__ inject, foldl\n\nReduces a list of values into a single value using an async iterator to return\neach successive step. Memo is the initial state of the reduction. This\nfunction only operates in series. For performance reasons, it may make sense to\nsplit a call to this function into a parallel map, then use the normal\nArray.prototype.reduce on the results. This function is for situations where\neach step in the reduction needs to be async, if you can get the data before\nreducing it then its probably a good idea to do so.\n\n__Arguments__\n\n* arr - An array to iterate over.\n* memo - The initial state of the reduction.\n* iterator(memo, item, callback) - A function applied to each item in the\n array to produce the next step in the reduction. The iterator is passed a\n callback which accepts an optional error as its first argument, and the state\n of the reduction as the second. If an error is passed to the callback, the\n reduction is stopped and the main callback is immediately called with the\n error.\n* callback(err, result) - A callback which is called after all the iterator\n functions have finished. Result is the reduced value.\n\n__Example__\n\n async.reduce([1,2,3], 0, function(memo, item, callback){\n // pointless async:\n process.nextTick(function(){\n callback(null, memo + item)\n });\n }, function(err, result){\n // result is now equal to the last value of memo, which is 6\n });\n\n---------------------------------------\n\n\n### reduceRight(arr, memo, iterator, callback)\n\n__Alias:__ foldr\n\nSame as reduce, only operates on the items in the array in reverse order.\n\n\n---------------------------------------\n\n\n### detect(arr, iterator, callback)\n\nReturns the first value in a list that passes an async truth test. The\niterator is applied in parallel, meaning the first iterator to return true will\nfire the detect callback with that result. That means the result might not be\nthe first item in the original array (in terms of order) that passes the test.\n\nIf order within the original array is important then look at detectSeries.\n\n__Arguments__\n\n* arr - An array to iterate over.\n* iterator(item, callback) - A truth test to apply to each item in the array.\n The iterator is passed a callback which must be called once it has completed.\n* callback(result) - A callback which is called as soon as any iterator returns\n true, or after all the iterator functions have finished. Result will be\n the first item in the array that passes the truth test (iterator) or the\n value undefined if none passed.\n\n__Example__\n\n async.detect(['file1','file2','file3'], path.exists, function(result){\n // result now equals the first file in the list that exists\n });\n\n---------------------------------------\n\n\n### detectSeries(arr, iterator, callback)\n\nThe same as detect, only the iterator is applied to each item in the array\nin series. This means the result is always the first in the original array (in\nterms of array order) that passes the truth test.\n\n\n---------------------------------------\n\n\n### sortBy(arr, iterator, callback)\n\nSorts a list by the results of running each value through an async iterator.\n\n__Arguments__\n\n* arr - An array to iterate over.\n* iterator(item, callback) - A function to apply to each item in the array.\n The iterator is passed a callback which must be called once it has completed\n with an error (which can be null) and a value to use as the sort criteria.\n* callback(err, results) - A callback which is called after all the iterator\n functions have finished, or an error has occurred. Results is the items from\n the original array sorted by the values returned by the iterator calls.\n\n__Example__\n\n async.sortBy(['file1','file2','file3'], function(file, callback){\n fs.stat(file, function(err, stats){\n callback(err, stats.mtime);\n });\n }, function(err, results){\n // results is now the original array of files sorted by\n // modified date\n });\n\n\n---------------------------------------\n\n\n### some(arr, iterator, callback)\n\n__Alias:__ any\n\nReturns true if at least one element in the array satisfies an async test.\n_The callback for each iterator call only accepts a single argument of true or\nfalse, it does not accept an error argument first!_ This is in-line with the\nway node libraries work with truth tests like path.exists. Once any iterator\ncall returns true, the main callback is immediately called.\n\n__Arguments__\n\n* arr - An array to iterate over.\n* iterator(item, callback) - A truth test to apply to each item in the array.\n The iterator is passed a callback which must be called once it has completed.\n* callback(result) - A callback which is called as soon as any iterator returns\n true, or after all the iterator functions have finished. Result will be\n either true or false depending on the values of the async tests.\n\n__Example__\n\n async.some(['file1','file2','file3'], path.exists, function(result){\n // if result is true then at least one of the files exists\n });\n\n---------------------------------------\n\n\n### every(arr, iterator, callback)\n\n__Alias:__ all\n\nReturns true if every element in the array satisfies an async test.\n_The callback for each iterator call only accepts a single argument of true or\nfalse, it does not accept an error argument first!_ This is in-line with the\nway node libraries work with truth tests like path.exists.\n\n__Arguments__\n\n* arr - An array to iterate over.\n* iterator(item, callback) - A truth test to apply to each item in the array.\n The iterator is passed a callback which must be called once it has completed.\n* callback(result) - A callback which is called after all the iterator\n functions have finished. Result will be either true or false depending on\n the values of the async tests.\n\n__Example__\n\n async.every(['file1','file2','file3'], path.exists, function(result){\n // if result is true then every file exists\n });\n\n---------------------------------------\n\n\n### concat(arr, iterator, callback)\n\nApplies an iterator to each item in a list, concatenating the results. Returns the\nconcatenated list. The iterators are called in parallel, and the results are\nconcatenated as they return. There is no guarantee that the results array will\nbe returned in the original order of the arguments passed to the iterator function.\n\n__Arguments__\n\n* arr - An array to iterate over\n* iterator(item, callback) - A function to apply to each item in the array.\n The iterator is passed a callback which must be called once it has completed\n with an error (which can be null) and an array of results.\n* callback(err, results) - A callback which is called after all the iterator\n functions have finished, or an error has occurred. Results is an array containing\n the concatenated results of the iterator function.\n\n__Example__\n\n async.concat(['dir1','dir2','dir3'], fs.readdir, function(err, files){\n // files is now a list of filenames that exist in the 3 directories\n });\n\n---------------------------------------\n\n\n### concatSeries(arr, iterator, callback)\n\nSame as async.concat, but executes in series instead of parallel.\n\n\n## Control Flow\n\n\n### series(tasks, [callback])\n\nRun an array of functions in series, each one running once the previous\nfunction has completed. If any functions in the series pass an error to its\ncallback, no more functions are run and the callback for the series is\nimmediately called with the value of the error. Once the tasks have completed,\nthe results are passed to the final callback as an array.\n\nIt is also possible to use an object instead of an array. Each property will be\nrun as a function and the results will be passed to the final callback as an object\ninstead of an array. This can be a more readable way of handling results from\nasync.series.\n\n\n__Arguments__\n\n* tasks - An array or object containing functions to run, each function is passed\n a callback it must call on completion.\n* callback(err, results) - An optional callback to run once all the functions\n have completed. This function gets an array of all the arguments passed to\n the callbacks used in the array.\n\n__Example__\n\n async.series([\n function(callback){\n // do some stuff ...\n callback(null, 'one');\n },\n function(callback){\n // do some more stuff ...\n callback(null, 'two');\n },\n ],\n // optional callback\n function(err, results){\n // results is now equal to ['one', 'two']\n });\n\n\n // an example using an object instead of an array\n async.series({\n one: function(callback){\n setTimeout(function(){\n callback(null, 1);\n }, 200);\n },\n two: function(callback){\n setTimeout(function(){\n callback(null, 2);\n }, 100);\n },\n },\n function(err, results) {\n // results is now equal to: {one: 1, two: 2}\n });\n\n\n---------------------------------------\n\n\n### parallel(tasks, [callback])\n\nRun an array of functions in parallel, without waiting until the previous\nfunction has completed. If any of the functions pass an error to its\ncallback, the main callback is immediately called with the value of the error.\nOnce the tasks have completed, the results are passed to the final callback as an\narray.\n\nIt is also possible to use an object instead of an array. Each property will be\nrun as a function and the results will be passed to the final callback as an object\ninstead of an array. This can be a more readable way of handling results from\nasync.parallel.\n\n\n__Arguments__\n\n* tasks - An array or object containing functions to run, each function is passed a\n callback it must call on completion.\n* callback(err, results) - An optional callback to run once all the functions\n have completed. This function gets an array of all the arguments passed to\n the callbacks used in the array.\n\n__Example__\n\n async.parallel([\n function(callback){\n setTimeout(function(){\n callback(null, 'one');\n }, 200);\n },\n function(callback){\n setTimeout(function(){\n callback(null, 'two');\n }, 100);\n },\n ],\n // optional callback\n function(err, results){\n // in this case, the results array will equal ['two','one']\n // because the functions were run in parallel and the second\n // function had a shorter timeout before calling the callback.\n });\n\n\n // an example using an object instead of an array\n async.parallel({\n one: function(callback){\n setTimeout(function(){\n callback(null, 1);\n }, 200);\n },\n two: function(callback){\n setTimeout(function(){\n callback(null, 2);\n }, 100);\n },\n },\n function(err, results) {\n // results is now equals to: {one: 1, two: 2}\n });\n\n\n---------------------------------------\n\n\n### whilst(test, fn, callback)\n\nRepeatedly call fn, while test returns true. Calls the callback when stopped,\nor an error occurs.\n\n__Arguments__\n\n* test() - synchronous truth test to perform before each execution of fn.\n* fn(callback) - A function to call each time the test passes. The function is\n passed a callback which must be called once it has completed with an optional\n error as the first argument.\n* callback(err) - A callback which is called after the test fails and repeated\n execution of fn has stopped.\n\n__Example__\n\n var count = 0;\n\n async.whilst(\n function () { return count < 5; },\n function (callback) {\n count++;\n setTimeout(callback, 1000);\n },\n function (err) {\n // 5 seconds have passed\n }\n );\n\n\n---------------------------------------\n\n\n### until(test, fn, callback)\n\nRepeatedly call fn, until test returns true. Calls the callback when stopped,\nor an error occurs.\n\nThe inverse of async.whilst.\n\n\n---------------------------------------\n\n\n### waterfall(tasks, [callback])\n\nRuns an array of functions in series, each passing their results to the next in\nthe array. However, if any of the functions pass an error to the callback, the\nnext function is not executed and the main callback is immediately called with\nthe error.\n\n__Arguments__\n\n* tasks - An array of functions to run, each function is passed a callback it\n must call on completion.\n* callback(err, [results]) - An optional callback to run once all the functions\n have completed. This will be passed the results of the last task's callback.\n\n\n\n__Example__\n\n async.waterfall([\n function(callback){\n callback(null, 'one', 'two');\n },\n function(arg1, arg2, callback){\n callback(null, 'three');\n },\n function(arg1, callback){\n // arg1 now equals 'three'\n callback(null, 'done');\n }\n ], function (err, result) {\n // result now equals 'done' \n });\n\n\n---------------------------------------\n\n\n### queue(worker, concurrency)\n\nCreates a queue object with the specified concurrency. Tasks added to the\nqueue will be processed in parallel (up to the concurrency limit). If all\nworkers are in progress, the task is queued until one is available. Once\na worker has completed a task, the task's callback is called.\n\n__Arguments__\n\n* worker(task, callback) - An asynchronous function for processing a queued\n task.\n* concurrency - An integer for determining how many worker functions should be\n run in parallel.\n\n__Queue objects__\n\nThe queue object returned by this function has the following properties and\nmethods:\n\n* length() - a function returning the number of items waiting to be processed.\n* concurrency - an integer for determining how many worker functions should be\n run in parallel. This property can be changed after a queue is created to\n alter the concurrency on-the-fly.\n* push(task, [callback]) - add a new task to the queue, the callback is called\n once the worker has finished processing the task.\n instead of a single task, an array of tasks can be submitted. the respective callback is used for every task in the list.\n* saturated - a callback that is called when the queue length hits the concurrency and further tasks will be queued\n* empty - a callback that is called when the last item from the queue is given to a worker\n* drain - a callback that is called when the last item from the queue has returned from the worker\n\n__Example__\n\n // create a queue object with concurrency 2\n\n var q = async.queue(function (task, callback) {\n console.log('hello ' + task.name);\n callback();\n }, 2);\n\n\n // assign a callback\n q.drain = function() {\n console.log('all items have been processed');\n }\n\n // add some items to the queue\n\n q.push({name: 'foo'}, function (err) {\n console.log('finished processing foo');\n });\n q.push({name: 'bar'}, function (err) {\n console.log('finished processing bar');\n });\n\n // add some items to the queue (batch-wise)\n\n q.push([{name: 'baz'},{name: 'bay'},{name: 'bax'}], function (err) {\n console.log('finished processing bar');\n });\n\n\n---------------------------------------\n\n\n### auto(tasks, [callback])\n\nDetermines the best order for running functions based on their requirements.\nEach function can optionally depend on other functions being completed first,\nand each function is run as soon as its requirements are satisfied. If any of\nthe functions pass an error to their callback, that function will not complete\n(so any other functions depending on it will not run) and the main callback\nwill be called immediately with the error. Functions also receive an object\ncontaining the results of functions which have completed so far.\n\n__Arguments__\n\n* tasks - An object literal containing named functions or an array of\n requirements, with the function itself the last item in the array. The key\n used for each function or array is used when specifying requirements. The\n syntax is easier to understand by looking at the example.\n* callback(err, results) - An optional callback which is called when all the\n tasks have been completed. The callback will receive an error as an argument\n if any tasks pass an error to their callback. If all tasks complete\n successfully, it will receive an object containing their results.\n\n__Example__\n\n async.auto({\n get_data: function(callback){\n // async code to get some data\n },\n make_folder: function(callback){\n // async code to create a directory to store a file in\n // this is run at the same time as getting the data\n },\n write_file: ['get_data', 'make_folder', function(callback){\n // once there is some data and the directory exists,\n // write the data to a file in the directory\n callback(null, filename);\n }],\n email_link: ['write_file', function(callback, results){\n // once the file is written let's email a link to it...\n // results.write_file contains the filename returned by write_file.\n }]\n });\n\nThis is a fairly trivial example, but to do this using the basic parallel and\nseries functions would look like this:\n\n async.parallel([\n function(callback){\n // async code to get some data\n },\n function(callback){\n // async code to create a directory to store a file in\n // this is run at the same time as getting the data\n }\n ],\n function(results){\n async.series([\n function(callback){\n // once there is some data and the directory exists,\n // write the data to a file in the directory\n },\n email_link: function(callback){\n // once the file is written let's email a link to it...\n }\n ]);\n });\n\nFor a complicated series of async tasks using the auto function makes adding\nnew tasks much easier and makes the code more readable.\n\n\n---------------------------------------\n\n\n### iterator(tasks)\n\nCreates an iterator function which calls the next function in the array,\nreturning a continuation to call the next one after that. Its also possible to\n'peek' the next iterator by doing iterator.next().\n\nThis function is used internally by the async module but can be useful when\nyou want to manually control the flow of functions in series.\n\n__Arguments__\n\n* tasks - An array of functions to run, each function is passed a callback it\n must call on completion.\n\n__Example__\n\n var iterator = async.iterator([\n function(){ sys.p('one'); },\n function(){ sys.p('two'); },\n function(){ sys.p('three'); }\n ]);\n\n node> var iterator2 = iterator();\n 'one'\n node> var iterator3 = iterator2();\n 'two'\n node> iterator3();\n 'three'\n node> var nextfn = iterator2.next();\n node> nextfn();\n 'three'\n\n\n---------------------------------------\n\n\n### apply(function, arguments..)\n\nCreates a continuation function with some arguments already applied, a useful\nshorthand when combined with other control flow functions. Any arguments\npassed to the returned function are added to the arguments originally passed\nto apply.\n\n__Arguments__\n\n* function - The function you want to eventually apply all arguments to.\n* arguments... - Any number of arguments to automatically apply when the\n continuation is called.\n\n__Example__\n\n // using apply\n\n async.parallel([\n async.apply(fs.writeFile, 'testfile1', 'test1'),\n async.apply(fs.writeFile, 'testfile2', 'test2'),\n ]);\n\n\n // the same process without using apply\n\n async.parallel([\n function(callback){\n fs.writeFile('testfile1', 'test1', callback);\n },\n function(callback){\n fs.writeFile('testfile2', 'test2', callback);\n },\n ]);\n\nIt's possible to pass any number of additional arguments when calling the\ncontinuation:\n\n node> var fn = async.apply(sys.puts, 'one');\n node> fn('two', 'three');\n one\n two\n three\n\n---------------------------------------\n\n\n### nextTick(callback)\n\nCalls the callback on a later loop around the event loop. In node.js this just\ncalls process.nextTick, in the browser it falls back to setTimeout(callback, 0),\nwhich means other higher priority events may precede the execution of the callback.\n\nThis is used internally for browser-compatibility purposes.\n\n__Arguments__\n\n* callback - The function to call on a later loop around the event loop.\n\n__Example__\n\n var call_order = [];\n async.nextTick(function(){\n call_order.push('two');\n // call_order now equals ['one','two]\n });\n call_order.push('one')\n\n\n## Utils\n\n\n### memoize(fn, [hasher])\n\nCaches the results of an async function. When creating a hash to store function\nresults against, the callback is omitted from the hash and an optional hash\nfunction can be used.\n\n__Arguments__\n\n* fn - the function you to proxy and cache results from.\n* hasher - an optional function for generating a custom hash for storing\n results, it has all the arguments applied to it apart from the callback, and\n must be synchronous.\n\n__Example__\n\n var slow_fn = function (name, callback) {\n // do something\n callback(null, result);\n };\n var fn = async.memoize(slow_fn);\n\n // fn can now be used as if it were slow_fn\n fn('some name', function () {\n // callback\n });\n\n\n### unmemoize(fn)\n\nUndoes a memoized function, reverting it to the original, unmemoized\nform. Comes handy in tests.\n\n__Arguments__\n\n* fn - the memoized function\n\n\n### log(function, arguments)\n\nLogs the result of an async function to the console. Only works in node.js or\nin browsers that support console.log and console.error (such as FF and Chrome).\nIf multiple arguments are returned from the async function, console.log is\ncalled on each argument in order.\n\n__Arguments__\n\n* function - The function you want to eventually apply all arguments to.\n* arguments... - Any number of arguments to apply to the function.\n\n__Example__\n\n var hello = function(name, callback){\n setTimeout(function(){\n callback(null, 'hello ' + name);\n }, 1000);\n };\n\n node> async.log(hello, 'world');\n 'hello world'\n\n\n---------------------------------------\n\n\n### dir(function, arguments)\n\nLogs the result of an async function to the console using console.dir to\ndisplay the properties of the resulting object. Only works in node.js or\nin browsers that support console.dir and console.error (such as FF and Chrome).\nIf multiple arguments are returned from the async function, console.dir is\ncalled on each argument in order.\n\n__Arguments__\n\n* function - The function you want to eventually apply all arguments to.\n* arguments... - Any number of arguments to apply to the function.\n\n__Example__\n\n var hello = function(name, callback){\n setTimeout(function(){\n callback(null, {hello: name});\n }, 1000);\n };\n\n node> async.dir(hello, 'world');\n {hello: 'world'}\n\n\n---------------------------------------\n\n\n### noConflict()\n\nChanges the value of async back to its original value, returning a reference to the\nasync object.\n", + "_id": "async@0.1.18", + "_from": "async@0.1.18" } diff --git a/node_modules/ejs/.gitmodules b/node_modules/ejs/.gitmodules index 51ea138..e69de29 100644 --- a/node_modules/ejs/.gitmodules +++ b/node_modules/ejs/.gitmodules @@ -1,3 +0,0 @@ -[submodule "support/expresso"] - path = support/expresso - url = http://github.com/visionmedia/expresso.git diff --git a/node_modules/ejs/.gitignore b/node_modules/ejs/.npmignore similarity index 79% rename from node_modules/ejs/.gitignore rename to node_modules/ejs/.npmignore index 99a4d6e..020ddac 100644 --- a/node_modules/ejs/.gitignore +++ b/node_modules/ejs/.npmignore @@ -1,3 +1,4 @@ # ignore any vim files: *.sw[a-z] vim/.netrwhist +node_modules diff --git a/node_modules/ejs/.travis.yml b/node_modules/ejs/.travis.yml new file mode 100644 index 0000000..8111245 --- /dev/null +++ b/node_modules/ejs/.travis.yml @@ -0,0 +1,4 @@ +language: node_js +node_js: + - 0.6 + - 0.8 \ No newline at end of file diff --git a/node_modules/ejs/History.md b/node_modules/ejs/History.md index 00d2b5b..4d4457e 100644 --- a/node_modules/ejs/History.md +++ b/node_modules/ejs/History.md @@ -1,4 +1,58 @@ +0.8.3 / 2012-09-13 +================== + + * allow pre-compiling into a standalone function [seanmonstar] + +0.8.2 / 2012-08-16 +================== + + * fix include "open" / "close" options. Closes #64 + +0.8.1 / 2012-08-11 +================== + + * fix comments. Closes #62 [Nate Silva] + +0.8.0 / 2012-07-25 +================== + + * add `<% include file %>` support + * fix wrapping of custom require in build step. Closes #57 + +0.7.3 / 2012-04-25 +================== + + * Added repository to package.json [isaacs] + +0.7.1 / 2012-03-26 +================== + + * Fixed exception when using express in production caused by typo. [slaskis] + +0.7.0 / 2012-03-24 +================== + + * Added newline consumption support (`-%>`) [whoatemydomain] + +0.6.1 / 2011-12-09 +================== + + * Fixed `ejs.renderFile()` + +0.6.0 / 2011-12-09 +================== + + * Changed: you no longer need `{ locals: {} }` + +0.5.0 / 2011-11-20 +================== + + * Added express 3.x support + * Added ejs.renderFile() + * Added 'json' filter + * Fixed tests for 0.5.x + 0.4.3 / 2011-06-20 ================== diff --git a/node_modules/ejs/Makefile b/node_modules/ejs/Makefile index 13c92d2..94ab5b2 100644 --- a/node_modules/ejs/Makefile +++ b/node_modules/ejs/Makefile @@ -1,8 +1,13 @@ + SRC = $(shell find lib -name "*.js" -type f) UGLIFY_FLAGS = --no-mangle +all: ejs.min.js + test: - @./support/expresso/bin/expresso -I lib test/*.test.js + @./node_modules/.bin/mocha \ + --require should \ + --reporter spec ejs.js: $(SRC) @node support/compile.js $^ diff --git a/node_modules/ejs/Readme.md b/node_modules/ejs/Readme.md index 0577dfe..af17aeb 100644 --- a/node_modules/ejs/Readme.md +++ b/node_modules/ejs/Readme.md @@ -1,3 +1,4 @@ +[![build status](https://secure.travis-ci.org/visionmedia/ejs.png)](http://travis-ci.org/visionmedia/ejs) # EJS @@ -16,7 +17,9 @@ Embedded JavaScript templates. * Unescaped buffering with `<%- code %>` * Supports tag customization * Filter support for designer-friendly templates + * Includes * Client-side support + * Newline slurping with `<% code -%>` or `<% -%>` or `<%= code -%>` or `<%- code -%>` ## Example @@ -34,17 +37,35 @@ Embedded JavaScript templates. ## Options - - `locals` Local variables object - `cache` Compiled functions are cached, requires `filename` - `filename` Used by `cache` to key caches - `scope` Function execution context - `debug` Output generated function body + - `compileDebug` When `false` no debug instrumentation is compiled + - `client` Returns standalone compiled function - `open` Open tag, defaulting to "<%" - `close` Closing tag, defaulting to "%>" + - * All others are template-local variables -## Custom Tags +## Includes -Custom tags can also be applied globally: + Includes are relative to the template with the `include` statement, + for example if you have "./views/users.ejs" and "./views/user/show.ejs" + you would use `<% include user/show %>`. The included file(s) are literally + included into the template, _no_ IO is performed after compilation, thus + local variables are available to these included templates. + +``` + +``` + +## Custom delimiters + +Custom delimiters can also be applied globally: var ejs = require('ejs'); ejs.open = '{{'; @@ -72,20 +93,18 @@ Output: Render call: ejs.render(str, { - locals: { - users: [ - { name: 'tj' }, - { name: 'mape' }, - { name: 'guillermo' } - ] - } + users: [ + { name: 'tj' }, + { name: 'mape' }, + { name: 'guillermo' } + ] }); Or perhaps capitalize the first user's name for display:

<%=: users | first | capitalize %>

-## Filter List +## Filter list Currently these filters are available: @@ -112,6 +131,16 @@ Currently these filters are available: - reverse - get:'prop' +## Adding filters + + To add a filter simply add a method to the `.filters` object: + +```js +ejs.filters.last = function(obj) { + return obj[obj.length - 1]; +}; +``` + ## client-side support include `./ejs.js` or `./ejs.min.js` and `require("ejs").compile(str)`. diff --git a/node_modules/ejs/ejs.js b/node_modules/ejs/ejs.js new file mode 100644 index 0000000..d910f11 --- /dev/null +++ b/node_modules/ejs/ejs.js @@ -0,0 +1,581 @@ +ejs = (function(){ + +// CommonJS require() + +function require(p){ + if ('fs' == p) return {}; + var path = require.resolve(p) + , mod = require.modules[path]; + if (!mod) throw new Error('failed to require "' + p + '"'); + if (!mod.exports) { + mod.exports = {}; + mod.call(mod.exports, mod, mod.exports, require.relative(path)); + } + return mod.exports; + } + +require.modules = {}; + +require.resolve = function (path){ + var orig = path + , reg = path + '.js' + , index = path + '/index.js'; + return require.modules[reg] && reg + || require.modules[index] && index + || orig; + }; + +require.register = function (path, fn){ + require.modules[path] = fn; + }; + +require.relative = function (parent) { + return function(p){ + if ('.' != p.substr(0, 1)) return require(p); + + var path = parent.split('/') + , segs = p.split('/'); + path.pop(); + + for (var i = 0; i < segs.length; i++) { + var seg = segs[i]; + if ('..' == seg) path.pop(); + else if ('.' != seg) path.push(seg); + } + + return require(path.join('/')); + }; + }; + + +require.register("ejs.js", function(module, exports, require){ + +/*! + * EJS + * Copyright(c) 2012 TJ Holowaychuk + * MIT Licensed + */ + +/** + * Module dependencies. + */ + +var utils = require('./utils') + , fs = require('fs'); + +/** + * Library version. + */ + +exports.version = '0.7.2'; + +/** + * Filters. + * + * @type Object + */ + +var filters = exports.filters = require('./filters'); + +/** + * Intermediate js cache. + * + * @type Object + */ + +var cache = {}; + +/** + * Clear intermediate js cache. + * + * @api public + */ + +exports.clearCache = function(){ + cache = {}; +}; + +/** + * Translate filtered code into function calls. + * + * @param {String} js + * @return {String} + * @api private + */ + +function filtered(js) { + return js.substr(1).split('|').reduce(function(js, filter){ + var parts = filter.split(':') + , name = parts.shift() + , args = parts.shift() || ''; + if (args) args = ', ' + args; + return 'filters.' + name + '(' + js + args + ')'; + }); +}; + +/** + * Re-throw the given `err` in context to the + * `str` of ejs, `filename`, and `lineno`. + * + * @param {Error} err + * @param {String} str + * @param {String} filename + * @param {String} lineno + * @api private + */ + +function rethrow(err, str, filename, lineno){ + var lines = str.split('\n') + , start = Math.max(lineno - 3, 0) + , end = Math.min(lines.length, lineno + 3); + + // Error context + var context = lines.slice(start, end).map(function(line, i){ + var curr = i + start + 1; + return (curr == lineno ? ' >> ' : ' ') + + curr + + '| ' + + line; + }).join('\n'); + + // Alter exception message + err.path = filename; + err.message = (filename || 'ejs') + ':' + + lineno + '\n' + + context + '\n\n' + + err.message; + + throw err; +} + +/** + * Parse the given `str` of ejs, returning the function body. + * + * @param {String} str + * @return {String} + * @api public + */ + +var parse = exports.parse = function(str, options){ + var options = options || {} + , open = options.open || exports.open || '<%' + , close = options.close || exports.close || '%>'; + + var buf = [ + "var buf = [];" + , "\nwith (locals) {" + , "\n buf.push('" + ]; + + var lineno = 1; + + var consumeEOL = false; + for (var i = 0, len = str.length; i < len; ++i) { + if (str.slice(i, open.length + i) == open) { + i += open.length + + var prefix, postfix, line = '__stack.lineno=' + lineno; + switch (str.substr(i, 1)) { + case '=': + prefix = "', escape((" + line + ', '; + postfix = ")), '"; + ++i; + break; + case '-': + prefix = "', (" + line + ', '; + postfix = "), '"; + ++i; + break; + default: + prefix = "');" + line + ';'; + postfix = "; buf.push('"; + } + + var end = str.indexOf(close, i) + , js = str.substring(i, end) + , start = i + , n = 0; + + if ('-' == js[js.length-1]){ + js = js.substring(0, js.length - 2); + consumeEOL = true; + } + + while (~(n = js.indexOf("\n", n))) n++, lineno++; + if (js.substr(0, 1) == ':') js = filtered(js); + buf.push(prefix, js, postfix); + i += end - start + close.length - 1; + + } else if (str.substr(i, 1) == "\\") { + buf.push("\\\\"); + } else if (str.substr(i, 1) == "'") { + buf.push("\\'"); + } else if (str.substr(i, 1) == "\r") { + buf.push(" "); + } else if (str.substr(i, 1) == "\n") { + if (consumeEOL) { + consumeEOL = false; + } else { + buf.push("\\n"); + lineno++; + } + } else { + buf.push(str.substr(i, 1)); + } + } + + buf.push("');\n}\nreturn buf.join('');"); + return buf.join(''); +}; + +/** + * Compile the given `str` of ejs into a `Function`. + * + * @param {String} str + * @param {Object} options + * @return {Function} + * @api public + */ + +var compile = exports.compile = function(str, options){ + options = options || {}; + + var input = JSON.stringify(str) + , filename = options.filename + ? JSON.stringify(options.filename) + : 'undefined'; + + // Adds the fancy stack trace meta info + str = [ + 'var __stack = { lineno: 1, input: ' + input + ', filename: ' + filename + ' };', + rethrow.toString(), + 'try {', + exports.parse(str, options), + '} catch (err) {', + ' rethrow(err, __stack.input, __stack.filename, __stack.lineno);', + '}' + ].join("\n"); + + if (options.debug) console.log(str); + var fn = new Function('locals, filters, escape', str); + return function(locals){ + return fn.call(this, locals, filters, utils.escape); + } +}; + +/** + * Render the given `str` of ejs. + * + * Options: + * + * - `locals` Local variables object + * - `cache` Compiled functions are cached, requires `filename` + * - `filename` Used by `cache` to key caches + * - `scope` Function execution context + * - `debug` Output generated function body + * - `open` Open tag, defaulting to "<%" + * - `close` Closing tag, defaulting to "%>" + * + * @param {String} str + * @param {Object} options + * @return {String} + * @api public + */ + +exports.render = function(str, options){ + var fn + , options = options || {}; + + if (options.cache) { + if (options.filename) { + fn = cache[options.filename] || (cache[options.filename] = compile(str, options)); + } else { + throw new Error('"cache" option requires "filename".'); + } + } else { + fn = compile(str, options); + } + + options.__proto__ = options.locals; + return fn.call(options.scope, options); +}; + +/** + * Render an EJS file at the given `path` and callback `fn(err, str)`. + * + * @param {String} path + * @param {Object|Function} options or callback + * @param {Function} fn + * @api public + */ + +exports.renderFile = function(path, options, fn){ + var key = path + ':string'; + + if ('function' == typeof options) { + fn = options, options = {}; + } + + options.filename = path; + + try { + var str = options.cache + ? cache[key] || (cache[key] = fs.readFileSync(path, 'utf8')) + : fs.readFileSync(path, 'utf8'); + + fn(null, exports.render(str, options)); + } catch (err) { + fn(err); + } +}; + +// express support + +exports.__express = exports.renderFile; + +/** + * Expose to require(). + */ + +if (require.extensions) { + require.extensions['.ejs'] = function(module, filename) { + source = require('fs').readFileSync(filename, 'utf-8'); + module._compile(compile(source, {}), filename); + }; +} else if (require.registerExtension) { + require.registerExtension('.ejs', function(src) { + return compile(src, {}); + }); +} + +}); // module: ejs.js + +require.register("filters.js", function(module, exports, require){ + +/*! + * EJS - Filters + * Copyright(c) 2010 TJ Holowaychuk + * MIT Licensed + */ + +/** + * First element of the target `obj`. + */ + +exports.first = function(obj) { + return obj[0]; +}; + +/** + * Last element of the target `obj`. + */ + +exports.last = function(obj) { + return obj[obj.length - 1]; +}; + +/** + * Capitalize the first letter of the target `str`. + */ + +exports.capitalize = function(str){ + str = String(str); + return str[0].toUpperCase() + str.substr(1, str.length); +}; + +/** + * Downcase the target `str`. + */ + +exports.downcase = function(str){ + return String(str).toLowerCase(); +}; + +/** + * Uppercase the target `str`. + */ + +exports.upcase = function(str){ + return String(str).toUpperCase(); +}; + +/** + * Sort the target `obj`. + */ + +exports.sort = function(obj){ + return Object.create(obj).sort(); +}; + +/** + * Sort the target `obj` by the given `prop` ascending. + */ + +exports.sort_by = function(obj, prop){ + return Object.create(obj).sort(function(a, b){ + a = a[prop], b = b[prop]; + if (a > b) return 1; + if (a < b) return -1; + return 0; + }); +}; + +/** + * Size or length of the target `obj`. + */ + +exports.size = exports.length = function(obj) { + return obj.length; +}; + +/** + * Add `a` and `b`. + */ + +exports.plus = function(a, b){ + return Number(a) + Number(b); +}; + +/** + * Subtract `b` from `a`. + */ + +exports.minus = function(a, b){ + return Number(a) - Number(b); +}; + +/** + * Multiply `a` by `b`. + */ + +exports.times = function(a, b){ + return Number(a) * Number(b); +}; + +/** + * Divide `a` by `b`. + */ + +exports.divided_by = function(a, b){ + return Number(a) / Number(b); +}; + +/** + * Join `obj` with the given `str`. + */ + +exports.join = function(obj, str){ + return obj.join(str || ', '); +}; + +/** + * Truncate `str` to `len`. + */ + +exports.truncate = function(str, len){ + str = String(str); + return str.substr(0, len); +}; + +/** + * Truncate `str` to `n` words. + */ + +exports.truncate_words = function(str, n){ + var str = String(str) + , words = str.split(/ +/); + return words.slice(0, n).join(' '); +}; + +/** + * Replace `pattern` with `substitution` in `str`. + */ + +exports.replace = function(str, pattern, substitution){ + return String(str).replace(pattern, substitution || ''); +}; + +/** + * Prepend `val` to `obj`. + */ + +exports.prepend = function(obj, val){ + return Array.isArray(obj) + ? [val].concat(obj) + : val + obj; +}; + +/** + * Append `val` to `obj`. + */ + +exports.append = function(obj, val){ + return Array.isArray(obj) + ? obj.concat(val) + : obj + val; +}; + +/** + * Map the given `prop`. + */ + +exports.map = function(arr, prop){ + return arr.map(function(obj){ + return obj[prop]; + }); +}; + +/** + * Reverse the given `obj`. + */ + +exports.reverse = function(obj){ + return Array.isArray(obj) + ? obj.reverse() + : String(obj).split('').reverse().join(''); +}; + +/** + * Get `prop` of the given `obj`. + */ + +exports.get = function(obj, prop){ + return obj[prop]; +}; + +/** + * Packs the given `obj` into json string + */ +exports.json = function(obj){ + return JSON.stringify(obj); +}; +}); // module: filters.js + +require.register("utils.js", function(module, exports, require){ + +/*! + * EJS + * Copyright(c) 2010 TJ Holowaychuk + * MIT Licensed + */ + +/** + * Escape the given string of `html`. + * + * @param {String} html + * @return {String} + * @api private + */ + +exports.escape = function(html){ + return String(html) + .replace(/&(?!\w+;)/g, '&') + .replace(//g, '>') + .replace(/"/g, '"'); +}; + +}); // module: utils.js + + return require("ejs"); +})(); \ No newline at end of file diff --git a/node_modules/ejs/ejs.min.js b/node_modules/ejs/ejs.min.js new file mode 100644 index 0000000..611ee42 --- /dev/null +++ b/node_modules/ejs/ejs.min.js @@ -0,0 +1 @@ +ejs=function(){function require(p){if("fs"==p)return{};var path=require.resolve(p),mod=require.modules[path];if(!mod)throw new Error('failed to require "'+p+'"');return mod.exports||(mod.exports={},mod.call(mod.exports,mod,mod.exports,require.relative(path))),mod.exports}return require.modules={},require.resolve=function(path){var orig=path,reg=path+".js",index=path+"/index.js";return require.modules[reg]&®||require.modules[index]&&index||orig},require.register=function(path,fn){require.modules[path]=fn},require.relative=function(parent){return function(p){if("."!=p.substr(0,1))return require(p);var path=parent.split("/"),segs=p.split("/");path.pop();for(var i=0;i> ":" ")+curr+"| "+line}).join("\n");throw err.path=filename,err.message=(filename||"ejs")+":"+lineno+"\n"+context+"\n\n"+err.message,err}var parse=exports.parse=function(str,options){var options=options||{},open=options.open||exports.open||"<%",close=options.close||exports.close||"%>",buf=["var buf = [];","\nwith (locals) {","\n buf.push('"],lineno=1,consumeEOL=!1;for(var i=0,len=str.length;ib?1:a/g,">").replace(/"/g,""")}}),require("ejs")}(); \ No newline at end of file diff --git a/node_modules/ejs/examples/client.html b/node_modules/ejs/examples/client.html index 7081a04..30dfea9 100644 --- a/node_modules/ejs/examples/client.html +++ b/node_modules/ejs/examples/client.html @@ -1,5 +1,24 @@ + + + + \ No newline at end of file diff --git a/node_modules/ejs/examples/list.js b/node_modules/ejs/examples/list.js index 9cd7168..ec614ed 100644 --- a/node_modules/ejs/examples/list.js +++ b/node_modules/ejs/examples/list.js @@ -8,9 +8,7 @@ var ejs = require('../') , str = fs.readFileSync(__dirname + '/list.ejs', 'utf8'); var ret = ejs.render(str, { - locals: { - names: ['foo', 'bar', 'baz'] - } + names: ['foo', 'bar', 'baz'] }); console.log(ret); \ No newline at end of file diff --git a/node_modules/ejs/lib/ejs.js b/node_modules/ejs/lib/ejs.js index 5b9b9b8..a7a5d0d 100644 --- a/node_modules/ejs/lib/ejs.js +++ b/node_modules/ejs/lib/ejs.js @@ -1,7 +1,7 @@ /*! * EJS - * Copyright(c) 2010 TJ Holowaychuk + * Copyright(c) 2012 TJ Holowaychuk * MIT Licensed */ @@ -9,13 +9,14 @@ * Module dependencies. */ -var utils = require('./utils'); - -/** - * Library version. - */ - -exports.version = '0.4.3'; +var utils = require('./utils') + , path = require('path') + , basename = path.basename + , dirname = path.dirname + , extname = path.extname + , join = path.join + , fs = require('fs') + , read = fs.readFileSync; /** * Filters. @@ -107,22 +108,24 @@ function rethrow(err, str, filename, lineno){ var parse = exports.parse = function(str, options){ var options = options || {} , open = options.open || exports.open || '<%' - , close = options.close || exports.close || '%>'; + , close = options.close || exports.close || '%>' + , filename = options.filename + , compileDebug = options.compileDebug !== false + , buf = []; + + buf.push('var buf = [];'); + if (false !== options._with) buf.push('\nwith (locals || {}) {'); + buf.push('\n buf.push(\''); - var buf = [ - "var buf = [];" - , "\nwith (locals) {" - , "\n buf.push('" - ]; - var lineno = 1; + var consumeEOL = false; for (var i = 0, len = str.length; i < len; ++i) { if (str.slice(i, open.length + i) == open) { i += open.length - var prefix, postfix, line = '__stack.lineno=' + lineno; - switch (str[i]) { + var prefix, postfix, line = (compileDebug ? '__stack.lineno=' : '') + lineno; + switch (str.substr(i, 1)) { case '=': prefix = "', escape((" + line + ', '; postfix = ")), '"; @@ -141,28 +144,53 @@ var parse = exports.parse = function(str, options){ var end = str.indexOf(close, i) , js = str.substring(i, end) , start = i + , include = null , n = 0; + if ('-' == js[js.length-1]){ + js = js.substring(0, js.length - 2); + consumeEOL = true; + } + + if (0 == js.trim().indexOf('include')) { + var name = js.trim().slice(7).trim(); + if (!filename) throw new Error('filename option is required for includes'); + var path = resolveInclude(name, filename); + include = read(path, 'utf8'); + include = exports.parse(include, { filename: path, _with: false, open: open, close: close }); + buf.push("' + (function(){" + include + "})() + '"); + js = ''; + } + while (~(n = js.indexOf("\n", n))) n++, lineno++; - if (js[0] == ':') js = filtered(js); - buf.push(prefix, js, postfix); + if (js.substr(0, 1) == ':') js = filtered(js); + if (js) { + if (js.lastIndexOf('//') > js.lastIndexOf('\n')) js += '\n'; + buf.push(prefix, js, postfix); + } i += end - start + close.length - 1; - } else if (str[i] == "\\") { + } else if (str.substr(i, 1) == "\\") { buf.push("\\\\"); - } else if (str[i] == "'") { + } else if (str.substr(i, 1) == "'") { buf.push("\\'"); - } else if (str[i] == "\r") { + } else if (str.substr(i, 1) == "\r") { buf.push(" "); - } else if (str[i] == "\n") { - buf.push("\\n"); - lineno++; + } else if (str.substr(i, 1) == "\n") { + if (consumeEOL) { + consumeEOL = false; + } else { + buf.push("\\n"); + lineno++; + } } else { - buf.push(str[i]); + buf.push(str.substr(i, 1)); } } - buf.push("');\n}\nreturn buf.join('');"); + if (false !== options._with) buf.push("');\n}\nreturn buf.join('');") + else buf.push("');\nreturn buf.join('');"); + return buf.join(''); }; @@ -179,23 +207,34 @@ var compile = exports.compile = function(str, options){ options = options || {}; var input = JSON.stringify(str) + , compileDebug = options.compileDebug !== false + , client = options.client , filename = options.filename ? JSON.stringify(options.filename) : 'undefined'; - // Adds the fancy stack trace meta info - str = [ - 'var __stack = { lineno: 1, input: ' + input + ', filename: ' + filename + ' };', - rethrow.toString(), - 'try {', - exports.parse(str, options), - '} catch (err) {', - ' rethrow(err, __stack.input, __stack.filename, __stack.lineno);', - '}' - ].join("\n"); + if (compileDebug) { + // Adds the fancy stack trace meta info + str = [ + 'var __stack = { lineno: 1, input: ' + input + ', filename: ' + filename + ' };', + rethrow.toString(), + 'try {', + exports.parse(str, options), + '} catch (err) {', + ' rethrow(err, __stack.input, __stack.filename, __stack.lineno);', + '}' + ].join("\n"); + } else { + str = exports.parse(str, options); + } if (options.debug) console.log(str); + if (client) str = 'escape = escape || ' + utils.escape.toString() + ';\n' + str; + var fn = new Function('locals, filters, escape', str); + + if (client) return fn; + return function(locals){ return fn.call(this, locals, filters, utils.escape); } @@ -223,6 +262,7 @@ var compile = exports.compile = function(str, options){ exports.render = function(str, options){ var fn , options = options || {}; + if (options.cache) { if (options.filename) { fn = cache[options.filename] || (cache[options.filename] = compile(str, options)); @@ -232,9 +272,60 @@ exports.render = function(str, options){ } else { fn = compile(str, options); } - return fn.call(options.scope, options.locals || {}); + + options.__proto__ = options.locals; + return fn.call(options.scope, options); }; +/** + * Render an EJS file at the given `path` and callback `fn(err, str)`. + * + * @param {String} path + * @param {Object|Function} options or callback + * @param {Function} fn + * @api public + */ + +exports.renderFile = function(path, options, fn){ + var key = path + ':string'; + + if ('function' == typeof options) { + fn = options, options = {}; + } + + options.filename = path; + + try { + var str = options.cache + ? cache[key] || (cache[key] = read(path, 'utf8')) + : read(path, 'utf8'); + + fn(null, exports.render(str, options)); + } catch (err) { + fn(err); + } +}; + +/** + * Resolve include `name` relative to `filename`. + * + * @param {String} name + * @param {String} filename + * @return {String} + * @api private + */ + +function resolveInclude(name, filename) { + var path = join(dirname(filename), name); + var ext = extname(name); + if (!ext) path += '.ejs'; + return path; +} + +// express support + +exports.__express = exports.renderFile; + /** * Expose to require(). */ @@ -243,7 +334,7 @@ if (require.extensions) { require.extensions['.ejs'] = function(module, filename) { source = require('fs').readFileSync(filename, 'utf-8'); module._compile(compile(source, {}), filename); - }; + }; } else if (require.registerExtension) { require.registerExtension('.ejs', function(src) { return compile(src, {}); diff --git a/node_modules/ejs/package.json b/node_modules/ejs/package.json index 810e504..fd96d24 100644 --- a/node_modules/ejs/package.json +++ b/node_modules/ejs/package.json @@ -1,8 +1,26 @@ { "name": "ejs", "description": "Embedded JavaScript templates", - "version": "0.4.3", - "author": "TJ Holowaychuk ", - "keywords": ["template", "engine", "ejs"], - "main": "./lib/ejs.js" -} \ No newline at end of file + "version": "0.8.3", + "author": { + "name": "TJ Holowaychuk", + "email": "tj@vision-media.ca" + }, + "keywords": [ + "template", + "engine", + "ejs" + ], + "devDependencies": { + "mocha": "*", + "should": "*" + }, + "main": "./lib/ejs.js", + "repository": { + "type": "git", + "url": "git://github.com/visionmedia/ejs.git" + }, + "readme": "[![build status](https://secure.travis-ci.org/visionmedia/ejs.png)](http://travis-ci.org/visionmedia/ejs)\n\n# EJS\n\nEmbedded JavaScript templates.\n\n## Installation\n\n $ npm install ejs\n\n## Features\n\n * Complies with the [Express](http://expressjs.com) view system\n * Static caching of intermediate JavaScript\n * Unbuffered code for conditionals etc `<% code %>`\n * Escapes html by default with `<%= code %>`\n * Unescaped buffering with `<%- code %>`\n * Supports tag customization\n * Filter support for designer-friendly templates\n * Includes\n * Client-side support\n * Newline slurping with `<% code -%>` or `<% -%>` or `<%= code -%>` or `<%- code -%>`\n\n## Example\n\n <% if (user) { %>\n\t

<%= user.name %>

\n <% } %>\n\n## Usage\n\n ejs.compile(str, options);\n // => Function\n\n ejs.render(str, options);\n // => str\n\n## Options\n\n - `cache` Compiled functions are cached, requires `filename`\n - `filename` Used by `cache` to key caches\n - `scope` Function execution context\n - `debug` Output generated function body\n - `compileDebug` When `false` no debug instrumentation is compiled\n - `client` Returns standalone compiled function\n - `open` Open tag, defaulting to \"<%\"\n - `close` Closing tag, defaulting to \"%>\"\n - * All others are template-local variables\n\n## Includes\n\n Includes are relative to the template with the `include` statement,\n for example if you have \"./views/users.ejs\" and \"./views/user/show.ejs\"\n you would use `<% include user/show %>`. The included file(s) are literally\n included into the template, _no_ IO is performed after compilation, thus\n local variables are available to these included templates.\n\n```\n
    \n <% users.forEach(function(user){ %>\n <% include user/show %>\n <% }) %>\n
\n```\n\n## Custom delimiters\n\nCustom delimiters can also be applied globally:\n\n var ejs = require('ejs');\n ejs.open = '{{';\n ejs.close = '}}';\n\nWhich would make the following a valid template:\n\n

{{= title }}

\n\n## Filters\n\nEJS conditionally supports the concept of \"filters\". A \"filter chain\"\nis a designer friendly api for manipulating data, without writing JavaScript.\n\nFilters can be applied by supplying the _:_ modifier, so for example if we wish to take the array `[{ name: 'tj' }, { name: 'mape' }, { name: 'guillermo' }]` and output a list of names we can do this simply with filters:\n\nTemplate:\n\n

<%=: users | map:'name' | join %>

\n\nOutput:\n\n

Tj, Mape, Guillermo

\n\nRender call:\n\n ejs.render(str, {\n users: [\n { name: 'tj' },\n { name: 'mape' },\n { name: 'guillermo' }\n ]\n });\n\nOr perhaps capitalize the first user's name for display:\n\n

<%=: users | first | capitalize %>

\n\n## Filter list\n\nCurrently these filters are available:\n\n - first\n - last\n - capitalize\n - downcase\n - upcase\n - sort\n - sort_by:'prop'\n - size\n - length\n - plus:n\n - minus:n\n - times:n\n - divided_by:n\n - join:'val'\n - truncate:n\n - truncate_words:n\n - replace:pattern,substitution\n - prepend:val\n - append:val\n - map:'prop'\n - reverse\n - get:'prop'\n\n## Adding filters\n\n To add a filter simply add a method to the `.filters` object:\n \n```js\nejs.filters.last = function(obj) {\n return obj[obj.length - 1];\n};\n```\n\n## client-side support\n\n include `./ejs.js` or `./ejs.min.js` and `require(\"ejs\").compile(str)`.\n\n## License \n\n(The MIT License)\n\nCopyright (c) 2009-2010 TJ Holowaychuk <tj@vision-media.ca>\n\nPermission is hereby granted, free of charge, to any person obtaining\na copy of this software and associated documentation files (the\n'Software'), to deal in the Software without restriction, including\nwithout limitation the rights to use, copy, modify, merge, publish,\ndistribute, sublicense, and/or sell copies of the Software, and to\npermit persons to whom the Software is furnished to do so, subject to\nthe following conditions:\n\nThe above copyright notice and this permission notice shall be\nincluded in all copies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,\nEXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\nMERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.\nIN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY\nCLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,\nTORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE\nSOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\n", + "_id": "ejs@0.8.3", + "_from": "ejs@0.8.3" +} diff --git a/node_modules/ejs/support/compile.js b/node_modules/ejs/support/compile.js index 0b419e0..497a1bb 100644 --- a/node_modules/ejs/support/compile.js +++ b/node_modules/ejs/support/compile.js @@ -88,6 +88,7 @@ function parseConditionals(js) { function compile() { var buf = ''; + buf += 'ejs = (function(){\n'; buf += '\n// CommonJS require()\n\n'; buf += browser.require + '\n\n'; buf += 'require.modules = {};\n\n'; @@ -101,6 +102,7 @@ function compile() { buf += js; buf += '\n}); // module: ' + file + '\n'; }); + buf += '\n return require("ejs");\n})();'; fs.writeFile('ejs.js', buf, function(err){ if (err) throw err; console.log(' \033[90m create : \033[0m\033[36m%s\033[0m', 'ejs.js'); @@ -118,6 +120,7 @@ var browser = { */ require: function require(p){ + if ('fs' == p) return {}; var path = require.resolve(p) , mod = require.modules[path]; if (!mod) throw new Error('failed to require "' + p + '"'); @@ -147,7 +150,7 @@ var browser = { relative: function(parent) { return function(p){ - if ('.' != p[0]) return require(p); + if ('.' != p.substr(0, 1)) return require(p); var path = parent.split('/') , segs = p.split('/'); diff --git a/node_modules/ejs/support/expresso/.gitignore b/node_modules/ejs/support/expresso/.gitignore deleted file mode 100644 index 432563f..0000000 --- a/node_modules/ejs/support/expresso/.gitignore +++ /dev/null @@ -1,3 +0,0 @@ -.DS_Store -lib-cov -*.seed \ No newline at end of file diff --git a/node_modules/ejs/support/expresso/.gitmodules b/node_modules/ejs/support/expresso/.gitmodules deleted file mode 100644 index 191ddeb..0000000 --- a/node_modules/ejs/support/expresso/.gitmodules +++ /dev/null @@ -1,3 +0,0 @@ -[submodule "deps/jscoverage"] - path = deps/jscoverage - url = git://github.com/visionmedia/node-jscoverage.git diff --git a/node_modules/ejs/support/expresso/History.md b/node_modules/ejs/support/expresso/History.md deleted file mode 100644 index e3b0141..0000000 --- a/node_modules/ejs/support/expresso/History.md +++ /dev/null @@ -1,87 +0,0 @@ - -0.6.2 / 2010-08-03 -================== - - * Added `assert.type()` - * Renamed `assert.isNotUndefined()` to `assert.isDefined()` - * Fixed `assert.includes()` param ordering - -0.6.0 / 2010-07-31 -================== - - * Added _docs/api.html_ - * Added -w, --watch - * Added `Array` support to `assert.includes()` - * Added; outputting exceptions immediately. Closes #19 - * Fixed `assert.includes()` param ordering - * Fixed `assert.length()` param ordering - * Fixed jscoverage links - -0.5.0 / 2010-07-16 -================== - - * Added support for async exports - * Added timeout support to `assert.response()`. Closes #3 - * Added 4th arg callback support to `assert.response()` - * Added `assert.length()` - * Added `assert.match()` - * Added `assert.isUndefined()` - * Added `assert.isNull()` - * Added `assert.includes()` - * Added growlnotify support via -g, --growl - * Added -o, --only TESTS. Ex: --only "test foo()" --only "test foo(), test bar()" - * Removed profanity - -0.4.0 / 2010-07-09 -================== - - * Added reporting source coverage (respects --boring for color haters) - * Added callback to assert.response(). Closes #12 - * Fixed; putting exceptions to stderr. Closes #13 - -0.3.1 / 2010-06-28 -================== - - * Faster assert.response() - -0.3.0 / 2010-06-28 -================== - - * Added -p, --port NUM flags - * Added assert.response(). Closes #11 - -0.2.1 / 2010-06-25 -================== - - * Fixed issue with reporting object assertions - -0.2.0 / 2010-06-21 -================== - - * Added `make uninstall` - * Added better readdir() failure message - * Fixed `make install` for kiwi - -0.1.0 / 2010-06-15 -================== - - * Added better usage docs via --help - * Added better conditional color support - * Added pre exit assertion support - -0.0.3 / 2010-06-02 -================== - - * Added more room for filenames in test coverage - * Added boring output support via --boring (suppress colored output) - * Fixed async failure exit status - -0.0.2 / 2010-05-30 -================== - - * Fixed exit status for CI support - -0.0.1 / 2010-05-30 -================== - - * Initial release \ No newline at end of file diff --git a/node_modules/ejs/support/expresso/Makefile b/node_modules/ejs/support/expresso/Makefile deleted file mode 100644 index 9348bbd..0000000 --- a/node_modules/ejs/support/expresso/Makefile +++ /dev/null @@ -1,50 +0,0 @@ - -BIN = bin/expresso -PREFIX = /usr/local -JSCOV = deps/jscoverage/node-jscoverage -DOCS = docs/index.md -HTMLDOCS = $(DOCS:.md=.html) - -test: $(BIN) - @./$(BIN) -I lib --growl $(TEST_FLAGS) test/*.test.js - -test-cov: - @./$(BIN) -I lib --cov $(TEST_FLAGS) test/*.test.js - -install: install-jscov install-expresso - -uninstall: - rm -f $(PREFIX)/bin/expresso - rm -f $(PREFIX)/bin/node-jscoverage - -install-jscov: $(JSCOV) - install $(JSCOV) $(PREFIX)/bin - -install-expresso: - install $(BIN) $(PREFIX)/bin - -$(JSCOV): - cd deps/jscoverage && ./configure && make && mv jscoverage node-jscoverage - -clean: - @cd deps/jscoverage && git clean -fd - -docs: docs/api.html $(HTMLDOCS) - -%.html: %.md - @echo "... $< > $@" - @ronn -5 --pipe --fragment $< \ - | cat docs/layout/head.html - docs/layout/foot.html \ - > $@ - -docs/api.html: bin/expresso - dox \ - --title "Expresso" \ - --ribbon "http://github.com/visionmedia/expresso" \ - --desc "Insanely fast TDD framework for [node](http://nodejs.org) featuring code coverage reporting." \ - $< > $@ - -docclean: - rm -f docs/*.html - -.PHONY: test test-cov install uninstall install-expresso install-jscov clean docs docclean \ No newline at end of file diff --git a/node_modules/ejs/support/expresso/Readme.md b/node_modules/ejs/support/expresso/Readme.md deleted file mode 100644 index dcc1c85..0000000 --- a/node_modules/ejs/support/expresso/Readme.md +++ /dev/null @@ -1,39 +0,0 @@ - -# Expresso - - TDD framework for [nodejs](http://nodejs.org). - -## Features - - - light-weight - - intuitive async support - - intuitive test runner executable - - test coverage support and reporting - - uses the _assert_ module - - `assert.eql()` alias of `assert.deepEqual()` - - `assert.response()` http response utility - - `assert.includes()` - - `assert.type()` - - `assert.isNull()` - - `assert.isUndefined()` - - `assert.isNotNull()` - - `assert.isDefined()` - - `assert.match()` - - `assert.length()` - -## Installation - -To install both expresso _and_ node-jscoverage run: - - $ make install - -To install expresso alone (no build required) run: - - $ make install-expresso - -Install via npm: - - $ npm install expresso - - - diff --git a/node_modules/ejs/support/expresso/bin/expresso b/node_modules/ejs/support/expresso/bin/expresso deleted file mode 100755 index 96c7ff3..0000000 --- a/node_modules/ejs/support/expresso/bin/expresso +++ /dev/null @@ -1,775 +0,0 @@ -#!/usr/bin/env node - -/*! - * Expresso - * Copyright(c) TJ Holowaychuk - * (MIT Licensed) - */ - -/** - * Module dependencies. - */ - -var assert = require('assert'), - childProcess = require('child_process'), - http = require('http'), - path = require('path'), - sys = require('sys'), - cwd = process.cwd(), - fs = require('fs'), - defer; - -/** - * Expresso version. - */ - -var version = '0.6.1'; - -/** - * Failure count. - */ - -var failures = 0; - - -/** - * Number of tests executed. - */ - -var testcount = 0; - -/** - * Whitelist of tests to run. - */ - -var only = []; - -/** - * Boring output. - */ - -var boring = false; - -/** - * Growl notifications. - */ - -var growl = false; - -/** - * Server port. - */ - -var port = 5555; - -/** - * Watch mode. - */ - -var watch = false; - -/** - * Usage documentation. - */ - -var usage = '' - + '[bold]{Usage}: expresso [options] ' - + '\n' - + '\n[bold]{Options}:' - + '\n -w, --watch Watch for modifications and re-execute tests' - + '\n -g, --growl Enable growl notifications' - + '\n -c, --coverage Generate and report test coverage' - + '\n -r, --require PATH Require the given module path' - + '\n -o, --only TESTS Execute only the comma sperated TESTS (can be set several times)' - + '\n -I, --include PATH Unshift the given path to require.paths' - + '\n -p, --port NUM Port number for test servers, starts at 5555' - + '\n -b, --boring Suppress ansi-escape colors' - + '\n -v, --version Output version number' - + '\n -h, --help Display help information' - + '\n'; - -// Parse arguments - -var files = [], - args = process.argv.slice(2); - -while (args.length) { - var arg = args.shift(); - switch (arg) { - case '-h': - case '--help': - print(usage + '\n'); - process.exit(1); - break; - case '-v': - case '--version': - sys.puts(version); - process.exit(1); - break; - case '-i': - case '-I': - case '--include': - if (arg = args.shift()) { - require.paths.unshift(arg); - } else { - throw new Error('--include requires a path'); - } - break; - case '-o': - case '--only': - if (arg = args.shift()) { - only = only.concat(arg.split(/ *, */)); - } else { - throw new Error('--only requires comma-separated test names'); - } - break; - case '-p': - case '--port': - if (arg = args.shift()) { - port = parseInt(arg, 10); - } else { - throw new Error('--port requires a number'); - } - break; - case '-r': - case '--require': - if (arg = args.shift()) { - require(arg); - } else { - throw new Error('--require requires a path'); - } - break; - case '-c': - case '--cov': - case '--coverage': - defer = true; - childProcess.exec('rm -fr lib-cov && node-jscoverage lib lib-cov', function(err){ - if (err) throw err; - require.paths.unshift('lib-cov'); - run(files); - }) - break; - case '-b': - case '--boring': - boring = true; - break; - case '-w': - case '--watch': - watch = true; - break; - case '--g': - case '--growl': - growl = true; - break; - default: - if (/\.js$/.test(arg)) { - files.push(arg); - } - break; - } -} - -/** - * Colorized sys.error(). - * - * @param {String} str - */ - -function print(str){ - sys.error(colorize(str)); -} - -/** - * Colorize the given string using ansi-escape sequences. - * Disabled when --boring is set. - * - * @param {String} str - * @return {String} - */ - -function colorize(str){ - var colors = { bold: 1, red: 31, green: 32, yellow: 33 }; - return str.replace(/\[(\w+)\]\{([^]*?)\}/g, function(_, color, str){ - return boring - ? str - : '\x1B[' + colors[color] + 'm' + str + '\x1B[0m'; - }); -} - -// Alias deepEqual as eql for complex equality - -assert.eql = assert.deepEqual; - -/** - * Assert that `val` is null. - * - * @param {Mixed} val - * @param {String} msg - */ - -assert.isNull = function(val, msg) { - assert.strictEqual(null, val, msg); -}; - -/** - * Assert that `val` is not null. - * - * @param {Mixed} val - * @param {String} msg - */ - -assert.isNotNull = function(val, msg) { - assert.notStrictEqual(null, val, msg); -}; - -/** - * Assert that `val` is undefined. - * - * @param {Mixed} val - * @param {String} msg - */ - -assert.isUndefined = function(val, msg) { - assert.strictEqual(undefined, val, msg); -}; - -/** - * Assert that `val` is not undefined. - * - * @param {Mixed} val - * @param {String} msg - */ - -assert.isDefined = function(val, msg) { - assert.notStrictEqual(undefined, val, msg); -}; - -/** - * Assert that `obj` is `type`. - * - * @param {Mixed} obj - * @param {String} type - * @api public - */ - -assert.type = function(obj, type, msg){ - var real = typeof obj; - msg = msg || 'typeof ' + sys.inspect(obj) + ' is ' + real + ', expected ' + type; - assert.ok(type === real, msg); -}; - -/** - * Assert that `str` matches `regexp`. - * - * @param {String} str - * @param {RegExp} regexp - * @param {String} msg - */ - -assert.match = function(str, regexp, msg) { - msg = msg || sys.inspect(str) + ' does not match ' + sys.inspect(regexp); - assert.ok(regexp.test(str), msg); -}; - -/** - * Assert that `val` is within `obj`. - * - * Examples: - * - * assert.includes('foobar', 'bar'); - * assert.includes(['foo', 'bar'], 'foo'); - * - * @param {String|Array} obj - * @param {Mixed} val - * @param {String} msg - */ - -assert.includes = function(obj, val, msg) { - msg = msg || sys.inspect(obj) + ' does not include ' + sys.inspect(val); - assert.ok(obj.indexOf(val) >= 0, msg); -}; - -/** - * Assert length of `val` is `n`. - * - * @param {Mixed} val - * @param {Number} n - * @param {String} msg - */ - -assert.length = function(val, n, msg) { - msg = msg || sys.inspect(val) + ' has length of ' + val.length + ', expected ' + n; - assert.equal(n, val.length, msg); -}; - -/** - * Assert response from `server` with - * the given `req` object and `res` assertions object. - * - * @param {Server} server - * @param {Object} req - * @param {Object|Function} res - * @param {String} msg - */ - -assert.response = function(server, req, res, msg){ - // Callback as third or fourth arg - var callback = typeof res === 'function' - ? res - : typeof msg === 'function' - ? msg - : function(){}; - - // Default messate to test title - if (typeof msg === 'function') msg = null; - msg = msg || assert.testTitle; - msg += '. '; - - // Pending responses - server.__pending = server.__pending || 0; - server.__pending++; - - // Create client - if (!server.fd) { - server.listen(server.__port = port++); - server.client = http.createClient(server.__port); - } - - // Issue request - var timer, - client = server.client, - method = req.method || 'GET', - status = res.status || res.statusCode, - data = req.data || req.body, - timeout = req.timeout || 0; - - var request = client.request(method, req.url, req.headers); - - // Timeout - if (timeout) { - timer = setTimeout(function(){ - --server.__pending || server.close(); - delete req.timeout; - assert.fail(msg + 'Request timed out after ' + timeout + 'ms.'); - }, timeout); - } - - if (data) request.write(data); - request.addListener('response', function(response){ - response.body = ''; - response.setEncoding('utf8'); - response.addListener('data', function(chunk){ response.body += chunk; }); - response.addListener('end', function(){ - --server.__pending || server.close(); - if (timer) clearTimeout(timer); - - // Assert response body - if (res.body !== undefined) { - assert.equal( - response.body, - res.body, - msg + 'Invalid response body.\n' - + ' Expected: ' + sys.inspect(res.body) + '\n' - + ' Got: ' + sys.inspect(response.body) - ); - } - - // Assert response status - if (typeof status === 'number') { - assert.equal( - response.statusCode, - status, - msg + colorize('Invalid response status code.\n' - + ' Expected: [green]{' + status + '}\n' - + ' Got: [red]{' + response.statusCode + '}') - ); - } - - // Assert response headers - if (res.headers) { - var keys = Object.keys(res.headers); - for (var i = 0, len = keys.length; i < len; ++i) { - var name = keys[i], - actual = response.headers[name.toLowerCase()], - expected = res.headers[name]; - assert.equal( - actual, - expected, - msg + colorize('Invalid response header [bold]{' + name + '}.\n' - + ' Expected: [green]{' + expected + '}\n' - + ' Got: [red]{' + actual + '}') - ); - } - } - - // Callback - callback(response); - }); - }); - request.end(); -}; - -/** - * Pad the given string to the maximum width provided. - * - * @param {String} str - * @param {Number} width - * @return {String} - */ - -function lpad(str, width) { - str = String(str); - var n = width - str.length; - if (n < 1) return str; - while (n--) str = ' ' + str; - return str; -} - -/** - * Pad the given string to the maximum width provided. - * - * @param {String} str - * @param {Number} width - * @return {String} - */ - -function rpad(str, width) { - str = String(str); - var n = width - str.length; - if (n < 1) return str; - while (n--) str = str + ' '; - return str; -} - -/** - * Report test coverage. - * - * @param {Object} cov - */ - -function reportCoverage(cov) { - populateCoverage(cov); - // Stats - print('\n [bold]{Test Coverage}\n'); - var sep = ' +------------------------------------------+----------+------+------+--------+', - lastSep = ' +----------+------+------+--------+'; - sys.puts(sep); - sys.puts(' | filename | coverage | LOC | SLOC | missed |'); - sys.puts(sep); - for (var name in cov) { - var file = cov[name]; - if (Array.isArray(file)) { - sys.print(' | ' + rpad(name, 40)); - sys.print(' | ' + lpad(file.coverage.toFixed(2), 8)); - sys.print(' | ' + lpad(file.LOC, 4)); - sys.print(' | ' + lpad(file.SLOC, 4)); - sys.print(' | ' + lpad(file.totalMisses, 6)); - sys.print(' |\n'); - } - } - sys.puts(sep); - sys.print(' ' + rpad('', 40)); - sys.print(' | ' + lpad(cov.coverage.toFixed(2), 8)); - sys.print(' | ' + lpad(cov.LOC, 4)); - sys.print(' | ' + lpad(cov.SLOC, 4)); - sys.print(' | ' + lpad(cov.totalMisses, 6)); - sys.print(' |\n'); - sys.puts(lastSep); - // Source - for (var name in cov) { - if (name.match(/\.js$/)) { - var file = cov[name]; - print('\n [bold]{' + name + '}:'); - print(file.source); - sys.print('\n'); - } - } -} - -/** - * Populate code coverage data. - * - * @param {Object} cov - */ - -function populateCoverage(cov) { - cov.LOC = - cov.SLOC = - cov.totalFiles = - cov.totalHits = - cov.totalMisses = - cov.coverage = 0; - for (var name in cov) { - var file = cov[name]; - if (Array.isArray(file)) { - // Stats - ++cov.totalFiles; - cov.totalHits += file.totalHits = coverage(file, true); - cov.totalMisses += file.totalMisses = coverage(file, false); - file.totalLines = file.totalHits + file.totalMisses; - cov.SLOC += file.SLOC = file.totalLines; - cov.LOC += file.LOC = file.source.length; - file.coverage = (file.totalHits / file.totalLines) * 100; - // Source - var width = file.source.length.toString().length; - file.source = file.source.map(function(line, i){ - ++i; - var hits = file[i] === 0 ? 0 : (file[i] || ' '); - if (!boring) { - if (hits === 0) { - hits = '\x1b[31m' + hits + '\x1b[0m'; - line = '\x1b[41m' + line + '\x1b[0m'; - } else { - hits = '\x1b[32m' + hits + '\x1b[0m'; - } - } - return '\n ' + lpad(i, width) + ' | ' + hits + ' | ' + line; - }).join(''); - } - } - cov.coverage = (cov.totalHits / cov.SLOC) * 100; -} - -/** - * Total coverage for the given file data. - * - * @param {Array} data - * @return {Type} - */ - -function coverage(data, val) { - var n = 0; - for (var i = 0, len = data.length; i < len; ++i) { - if (data[i] !== undefined && data[i] == val) ++n; - } - return n; -} - -/** - * Run the given test `files`, or try _test/*_. - * - * @param {Array} files - */ - -function run(files) { - if (!files.length) { - try { - files = fs.readdirSync('test').map(function(file){ - return 'test/' + file; - }); - } catch (err) { - print('\n failed to load tests in [bold]{./test}\n'); - ++failures; - process.exit(1); - } - } - if (watch) watchFiles(files); - runFiles(files); -} - -/** - * Show the cursor when `show` is true, otherwise hide it. - * - * @param {Boolean} show - */ - -function cursor(show) { - if (show) { - sys.print('\x1b[?25h'); - } else { - sys.print('\x1b[?25l'); - } -} - -/** - * Run the given test `files`. - * - * @param {Array} files - */ - -function runFiles(files) { - files.forEach(runFile); -} - -/** - * Run tests for the given `file`. - * - * @param {String} file - */ - -function runFile(file) { - if (file.match(/\.js$/)) { - var title = path.basename(file), - file = path.join(cwd, file), - mod = require(file.replace(/\.js$/, '')); - (function check(){ - var len = Object.keys(mod).length; - if (len) { - runSuite(title, mod); - } else { - setTimeout(check, 20); - } - })(); - } -} - -/** - * Clear the module cache for the given `file`. - * - * @param {String} file - */ - -function clearCache(file) { - var keys = Object.keys(module.moduleCache); - for (var i = 0, len = keys.length; i < len; ++i) { - var key = keys[i]; - if (key.indexOf(file) === key.length - file.length) { - delete module.moduleCache[key]; - } - } -} - -/** - * Watch the given `files` for changes. - * - * @param {Array} files - */ - -function watchFiles(files) { - var p = 0, - c = ['▫ ', '▫▫ ', '▫▫▫ ', ' ▫▫▫', - ' ▫▫', ' ▫', ' ▫', ' ▫▫', - '▫▫▫ ', '▫▫ ', '▫ '], - l = c.length; - cursor(false); - setInterval(function(){ - sys.print(colorize(' [green]{' + c[p++ % l] + '} watching\r')); - }, 100); - files.forEach(function(file){ - fs.watchFile(file, { interval: 100 }, function(curr, prev){ - if (curr.mtime > prev.mtime) { - print(' [yellow]{◦} ' + file); - clearCache(file); - runFile(file); - } - }); - }); -} - -/** - * Report `err` for the given `test` and `suite`. - * - * @param {String} suite - * @param {String} test - * @param {Error} err - */ - -function error(suite, test, err) { - ++failures; - var name = err.name, - stack = err.stack.replace(err.name, ''), - label = test === 'uncaught' - ? test - : suite + ' ' + test; - print('\n [bold]{' + label + '}: [red]{' + name + '}' + stack + '\n'); - if (watch) notify(label + ' failed'); -} - -/** - * Run the given tests. - * - * @param {String} title - * @param {Object} tests - */ - -function runSuite(title, tests) { - var keys = only.length - ? only.slice(0) - : Object.keys(tests); - (function next(){ - if (keys.length) { - var key, - test = tests[key = keys.shift()]; - if (test) { - try { - ++testcount; - assert.testTitle = key; - test(assert, function(fn){ - process.addListener('beforeExit', function(){ - try { - fn(); - } catch (err) { - error(title, key, err); - } - }); - }); - } catch (err) { - error(title, key, err); - } - } - next(); - } - })(); -} - -/** - * Report exceptions. - */ - -function report() { - process.emit('beforeExit'); - if (failures) { - print('\n [bold]{Failures}: [red]{' + failures + '}\n\n'); - notify('Failures: ' + failures); - } else { - print('\n [green]{100%} ' + testcount + ' tests\n'); - notify('100% ok'); - } - if (typeof _$jscoverage === 'object') { - reportCoverage(_$jscoverage); - } -} - -/** - * Growl notify the given `msg`. - * - * @param {String} msg - */ - -function notify(msg) { - if (growl) { - childProcess.exec('growlnotify -name Expresso -m "' + msg + '"'); - } -} - -// Report uncaught exceptions - -process.addListener('uncaughtException', function(err){ - error('uncaught', 'uncaught', err); -}); - -// Show cursor - -['INT', 'TERM', 'QUIT'].forEach(function(sig){ - process.addListener('SIG' + sig, function(){ - cursor(true); - process.exit(1); - }); -}); - -// Report test coverage when available -// and emit "beforeExit" event to perform -// final assertions - -var orig = process.emit; -process.emit = function(event){ - if (event === 'exit') { - report(); - process.reallyExit(failures); - } - orig.apply(this, arguments); -}; - -// Run test files - -if (!defer) run(files); diff --git a/node_modules/ejs/support/expresso/docs/api.html b/node_modules/ejs/support/expresso/docs/api.html deleted file mode 100644 index 4496371..0000000 --- a/node_modules/ejs/support/expresso/docs/api.html +++ /dev/null @@ -1,989 +0,0 @@ -
Fork me on GitHub - - Expresso - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

Expresso

Insanely fast TDD framework for node featuring code coverage reporting.

expresso

bin/expresso
-

!/usr/bin/env node

-
-
!
- * Expresso
- * Copyright(c) TJ Holowaychuk &lt;tj@vision-media.ca&gt;
- * (MIT Licensed)
- 
-
-

Module dependencies. -

-
-
var assert = require('assert'),
-    childProcess = require('child_process'),
-    http = require('http'),
-    path = require('path'),
-    sys = require('sys'),
-    cwd = process.cwd(),
-    fs = require('fs'),
-    defer;
-
-

Expresso version. -

-
-
var version = '0.6.0';
-
-

Failure count. -

-
-
var failures = 0;
-
-

Whitelist of tests to run. -

-
-
var only = [];
-
-

Boring output. -

-
-
var boring = false;
-
-

Growl notifications. -

-
-
var growl = false;
-
-

Server port. -

-
-
var port = 5555;
-
-

Watch mode. -

-
-
var watch = false;
-
-

Usage documentation. -

-
-
var usage = ''
-    + '[bold]{Usage}: expresso [options] <file ...>'
-    + '\n'
-    + '\n[bold]{Options}:'
-    + '\n  -w, --watch          Watch for modifications and re-execute tests'
-    + '\n  -g, --growl          Enable growl notifications'
-    + '\n  -c, --coverage       Generate and report test coverage'
-    + '\n  -r, --require PATH   Require the given module path'
-    + '\n  -o, --only TESTS     Execute only the comma sperated TESTS (can be set several times)'
-    + '\n  -I, --include PATH   Unshift the given path to require.paths'
-    + '\n  -p, --port NUM       Port number for test servers, starts at 5555'
-    + '\n  -b, --boring         Suppress ansi-escape colors'
-    + '\n  -v, --version        Output version number'
-    + '\n  -h, --help           Display help information'
-    + '\n';
-
-// Parse arguments
-
-var files = [],
-    args = process.argv.slice(2);
-
-while (args.length) {
-    var arg = args.shift();
-    switch (arg) {
-        case '-h':
-        case '--help':
-            print(usage + '\n');
-            process.exit(1);
-            break;
-        case '-v':
-        case '--version':
-            sys.puts(version);
-            process.exit(1);
-            break;
-        case '-i':
-        case '-I':
-        case '--include':
-            if (arg = args.shift()) {
-                require.paths.unshift(arg);
-            } else {
-                throw new Error('--include requires a path');
-            }
-            break;
-        case '-o':
-        case '--only':
-            if (arg = args.shift()) {
-                only = only.concat(arg.split(/ *, */));
-            } else {
-                throw new Error('--only requires comma-separated test names');
-            }
-            break;
-        case '-p':
-        case '--port':
-            if (arg = args.shift()) {
-                port = parseInt(arg, 10);
-            } else {
-                throw new Error('--port requires a number');
-            }
-            break;
-        case '-r':
-        case '--require':
-            if (arg = args.shift()) {
-                require(arg);
-            } else {
-                throw new Error('--require requires a path');
-            }
-            break;
-        case '-c':
-        case '--cov':
-        case '--coverage':
-            defer = true;
-            childProcess.exec('rm -fr lib-cov && node-jscoverage lib lib-cov', function(err){
-                if (err) throw err;
-                require.paths.unshift('lib-cov');
-                run(files);
-            })
-            break;
-        case '-b':
-        case '--boring':
-        	boring = true;
-        	break;
-        case '-w':
-        case '--watch':
-            watch = true;
-            break;
-        case '--g':
-        case '--growl':
-            growl = true;
-            break;
-        default:
-            if (/\.js$/.test(arg)) {
-                files.push(arg);
-            }
-            break;
-    }
-}
-
-

Colorized sys.error().

- -

- -
  • param: String str

-
-
function print(str){
-    sys.error(colorize(str));
-}
-
-

Colorize the given string using ansi-escape sequences. -Disabled when --boring is set.

- -

- -
  • param: String str

  • return: String

-
-
function colorize(str){
-    var colors = { bold: 1, red: 31, green: 32, yellow: 33 };
-    return str.replace(/\[(\w+)\]\{([^]*?)\}/g, function(_, color, str){
-        return boring
-            ? str
-            : '\x1B[' + colors[color] + 'm' + str + '\x1B[0m';
-    });
-}
-
-// Alias deepEqual as eql for complex equality
-
-assert.eql = assert.deepEqual;
-
-

Assert that val is null.

- -

- -
  • param: Mixed val

  • param: String msg

-
-
assert.isNull = function(val, msg) {
-    assert.strictEqual(null, val, msg);
-};
-
-

Assert that val is not null.

- -

- -
  • param: Mixed val

  • param: String msg

-
-
assert.isNotNull = function(val, msg) {
-    assert.notStrictEqual(null, val, msg);
-};
-
-

Assert that val is undefined.

- -

- -
  • param: Mixed val

  • param: String msg

-
-
assert.isUndefined = function(val, msg) {
-    assert.strictEqual(undefined, val, msg);
-};
-
-

Assert that val is not undefined.

- -

- -
  • param: Mixed val

  • param: String msg

-
-
assert.isDefined = function(val, msg) {
-    assert.notStrictEqual(undefined, val, msg);
-};
-
-

Assert that obj is type.

- -

- -
  • param: Mixed obj

  • param: String type

  • api: public

-
-
assert.type = function(obj, type, msg){
-    var real = typeof obj;
-    msg = msg || 'typeof ' + sys.inspect(obj) + ' is ' + real + ', expected ' + type;
-    assert.ok(type === real, msg);
-};
-
-

Assert that str matches regexp.

- -

- -
  • param: String str

  • param: RegExp regexp

  • param: String msg

-
-
assert.match = function(str, regexp, msg) {
-    msg = msg || sys.inspect(str) + ' does not match ' + sys.inspect(regexp);
-    assert.ok(regexp.test(str), msg);
-};
-
-

Assert that val is within obj.

- -

Examples

- -

assert.includes('foobar', 'bar'); - assert.includes(['foo', 'bar'], 'foo');

- -

- -
  • param: String | Array obj

  • param: Mixed val

  • param: String msg

-
-
assert.includes = function(obj, val, msg) {
-    msg = msg || sys.inspect(obj) + ' does not include ' + sys.inspect(val);
-    assert.ok(obj.indexOf(val) &gt;= 0, msg);
-};
-
-

Assert length of val is n.

- -

- -
  • param: Mixed val

  • param: Number n

  • param: String msg

-
-
assert.length = function(val, n, msg) {
-    msg = msg || sys.inspect(val) + ' has length of ' + val.length + ', expected ' + n;
-    assert.equal(n, val.length, msg);
-};
-
-

Assert response from server with -the given req object and res assertions object.

- -

- -
  • param: Server server

  • param: Object req

  • param: Object | Function res

  • param: String msg

-
-
assert.response = function(server, req, res, msg){
-    // Callback as third or fourth arg
-    var callback = typeof res === 'function'
-        ? res
-        : typeof msg === 'function'
-            ? msg
-            : function(){};
-
-    // Default messate to test title
-    msg = msg || assert.testTitle;
-    msg += '. ';
-
-    // Pending responses
-    server.__pending = server.__pending || 0;
-    server.__pending++;
-
-    // Create client
-    if (!server.fd) {
-        server.listen(server.__port = port++);
-        server.client = http.createClient(server.__port);
-    }
-
-    // Issue request
-    var timer,
-        client = server.client,
-        method = req.method || 'GET',
-        status = res.status || res.statusCode,
-        data = req.data || req.body,
-        timeout = req.timeout || 0;
-
-    var request = client.request(method, req.url, req.headers);
-
-    // Timeout
-    if (timeout) {
-        timer = setTimeout(function(){
-            --server.__pending || server.close();
-            delete req.timeout;
-            assert.fail(msg + 'Request timed out after ' + timeout + 'ms.');
-        }, timeout);
-    }
-
-    if (data) request.write(data);
-    request.addListener('response', function(response){
-        response.body = '';
-        response.setEncoding('utf8');
-        response.addListener('data', function(chunk){ response.body += chunk; });
-        response.addListener('end', function(){
-            --server.__pending || server.close();
-            if (timer) clearTimeout(timer);
-
-            // Assert response body
-            if (res.body !== undefined) {
-                assert.equal(
-                    response.body,
-                    res.body,
-                    msg + 'Invalid response body.\n'
-                        + '    Expected: ' + sys.inspect(res.body) + '\n'
-                        + '    Got: ' + sys.inspect(response.body)
-                );
-            }
-
-            // Assert response status
-            if (typeof status === 'number') {
-                assert.equal(
-                    response.statusCode,
-                    status,
-                    msg + colorize('Invalid response status code.\n'
-                        + '    Expected: [green]{' + status + '}\n'
-                        + '    Got: [red]{' + response.statusCode + '}')
-                );
-            }
-
-            // Assert response headers
-            if (res.headers) {
-                var keys = Object.keys(res.headers);
-                for (var i = 0, len = keys.length; i &lt; len; ++i) {
-                    var name = keys[i],
-                        actual = response.headers[name.toLowerCase()],
-                        expected = res.headers[name];
-                    assert.equal(
-                        actual,
-                        expected,
-                        msg + colorize('Invalid response header [bold]{' + name + '}.\n'
-                            + '    Expected: [green]{' + expected + '}\n'
-                            + '    Got: [red]{' + actual + '}')
-                    );
-                }
-            }
-
-            // Callback
-            callback(response);
-        });
-    });
-    request.end();
-};
-
-

Pad the given string to the maximum width provided.

- -

- -
  • param: String str

  • param: Number width

  • return: String

-
-
function lpad(str, width) {
-    str = String(str);
-    var n = width - str.length;
-    if (n &lt; 1) return str;
-    while (n--) str = ' ' + str;
-    return str;
-}
-
-

Pad the given string to the maximum width provided.

- -

- -
  • param: String str

  • param: Number width

  • return: String

-
-
function rpad(str, width) {
-    str = String(str);
-    var n = width - str.length;
-    if (n &lt; 1) return str;
-    while (n--) str = str + ' ';
-    return str;
-}
-
-

Report test coverage.

- -

- -
  • param: Object cov

-
-
function reportCoverage(cov) {
-    populateCoverage(cov);
-    // Stats
-    print('\n   [bold]{Test Coverage}\n');
-    var sep = '   +------------------------------------------+----------+------+------+--------+',
-        lastSep = '                                              +----------+------+------+--------+';
-    sys.puts(sep);
-    sys.puts('   | filename                                 | coverage | LOC  | SLOC | missed |');
-    sys.puts(sep);
-    for (var name in cov) {
-        var file = cov[name];
-        if (Array.isArray(file)) {
-            sys.print('   | ' + rpad(name, 40));
-            sys.print(' | ' + lpad(file.coverage.toFixed(2), 8));
-            sys.print(' | ' + lpad(file.LOC, 4));
-            sys.print(' | ' + lpad(file.SLOC, 4));
-            sys.print(' | ' + lpad(file.totalMisses, 6));
-            sys.print(' |\n');
-        }
-    }
-    sys.puts(sep);
-    sys.print('     ' + rpad('', 40));
-    sys.print(' | ' + lpad(cov.coverage.toFixed(2), 8));
-    sys.print(' | ' + lpad(cov.LOC, 4));
-    sys.print(' | ' + lpad(cov.SLOC, 4));
-    sys.print(' | ' + lpad(cov.totalMisses, 6));
-    sys.print(' |\n');
-    sys.puts(lastSep);
-    // Source
-    for (var name in cov) {
-        if (name.match(/\.js$/)) {
-            var file = cov[name];
-            print('\n   [bold]{' + name + '}:');
-            print(file.source);
-            sys.print('\n');
-        }
-    }
-}
-
-

Populate code coverage data.

- -

- -
  • param: Object cov

-
-
function populateCoverage(cov) {
-    cov.LOC = 
-    cov.SLOC =
-    cov.totalFiles =
-    cov.totalHits =
-    cov.totalMisses = 
-    cov.coverage = 0;
-    for (var name in cov) {
-        var file = cov[name];
-        if (Array.isArray(file)) {
-            // Stats
-            ++cov.totalFiles;
-            cov.totalHits += file.totalHits = coverage(file, true);
-            cov.totalMisses += file.totalMisses = coverage(file, false);
-            file.totalLines = file.totalHits + file.totalMisses;
-            cov.SLOC += file.SLOC = file.totalLines;
-            cov.LOC += file.LOC = file.source.length;
-            file.coverage = (file.totalHits / file.totalLines) * 100;
-            // Source
-            var width = file.source.length.toString().length;
-            file.source = file.source.map(function(line, i){
-                ++i;
-                var hits = file[i] === 0 ? 0 : (file[i] || ' ');
-                if (!boring) {
-                    if (hits === 0) {
-                        hits = '\x1b[31m' + hits + '\x1b[0m';
-                        line = '\x1b[41m' + line + '\x1b[0m';
-                    } else {
-                        hits = '\x1b[32m' + hits + '\x1b[0m';
-                    }
-                }
-                return '\n     ' + lpad(i, width) + ' | ' + hits + ' | ' + line;
-            }).join('');
-        }
-    }
-    cov.coverage = (cov.totalHits / cov.SLOC) * 100;
-}
-
-

Total coverage for the given file data.

- -

- -
  • param: Array data

  • return: Type

-
-
function coverage(data, val) {
-    var n = 0;
-    for (var i = 0, len = data.length; i &lt; len; ++i) {
-        if (data[i] !== undefined &amp;&amp; data[i] == val) ++n;
-    }
-    return n;  
-}
-
-

Run the given test files, or try test/*.

- -

- -
  • param: Array files

-
-
function run(files) {
-    if (!files.length) {
-        try {
-            files = fs.readdirSync('test').map(function(file){
-                return 'test/' + file;
-            });
-        } catch (err) {
-            print('\n  failed to load tests in [bold]{./test}\n');
-            ++failures;
-            process.exit(1);
-        }
-    }
-    if (watch) watchFiles(files);
-    runFiles(files);
-}
-
-

Show the cursor when show is true, otherwise hide it.

- -

- -
  • param: Boolean show

-
-
function cursor(show) {
-    if (show) {
-        sys.print('\x1b[?25h');
-    } else {
-        sys.print('\x1b[?25l');
-    }
-}
-
-

Run the given test files.

- -

- -
  • param: Array files

-
-
function runFiles(files) {
-    files.forEach(runFile);
-}
-
-

Run tests for the given file.

- -

- -
  • param: String file

-
-
function runFile(file) {
-    if (file.match(/\.js$/)) {
-        var title = path.basename(file),
-            file = path.join(cwd, file),
-            mod = require(file.replace(/\.js$/, ''));
-        (function check(){
-           var len = Object.keys(mod).length;
-           if (len) {
-               runSuite(title, mod);
-           } else {
-               setTimeout(check, 20);
-           }
-        })();
-    }
-}
-
-

Clear the module cache for the given file.

- -

- -
  • param: String file

-
-
function clearCache(file) {
-    var keys = Object.keys(module.moduleCache);
-    for (var i = 0, len = keys.length; i &lt; len; ++i) {
-        var key = keys[i];
-        if (key.indexOf(file) === key.length - file.length) {
-            delete module.moduleCache[key];
-        }
-    }
-}
-
-

Watch the given files for changes.

- -

- -
  • param: Array files

-
-
function watchFiles(files) {
-    var p = 0,
-        c = ['▫   ', '▫▫  ', '▫▫▫ ', ' ▫▫▫',
-             '  ▫▫', '   ▫', '   ▫', '  ▫▫',
-             '▫▫▫ ', '▫▫  ', '▫   '],
-        l = c.length;
-    cursor(false);
-    setInterval(function(){
-        sys.print(colorize('  [green]{' + c[p++ % l] + '} watching\r'));
-    }, 100);
-    files.forEach(function(file){
-        fs.watchFile(file, { interval: 100 }, function(curr, prev){
-            if (curr.mtime &gt; prev.mtime) {
-                print('  [yellow]{◦} ' + file);
-                clearCache(file);
-                runFile(file);
-            }
-        });
-    });
-}
-
-

Report err for the given test and suite.

- -

- -
  • param: String suite

  • param: String test

  • param: Error err

-
-
function error(suite, test, err) {
-    ++failures;
-    var name = err.name,
-        stack = err.stack.replace(err.name, ''),
-        label = test === 'uncaught'
-            ? test
-            : suite + ' ' + test;
-    print('\n   [bold]{' + label + '}: [red]{' + name + '}' + stack + '\n');
-    if (watch) notify(label + ' failed');
-}
-
-

Run the given tests.

- -

- -
  • param: String title

  • param: Object tests

-
-
function runSuite(title, tests) {
-    var keys = only.length
-        ? only.slice(0)
-        : Object.keys(tests);
-    (function next(){
-        if (keys.length) {
-            var key,
-                test = tests[key = keys.shift()];
-            if (test) {
-                try {
-                    assert.testTitle = key;
-                    test(assert, function(fn){
-                        process.addListener('beforeExit', function(){
-                            try {
-                                fn();
-                            } catch (err) {
-                                error(title, key, err);
-                            }
-                        });
-                    });
-                } catch (err) {
-                    error(title, key, err);
-                }
-            }
-            next();
-        }
-    })();
-}
-
-

Report exceptions. -

-
-
function report() {
-    process.emit('beforeExit');
-    if (failures) {
-        print('\n   [bold]{Failures}: [red]{' + failures + '}\n\n');
-        notify('Failures: ' + failures);
-    } else {
-    	print('\n   [green]{100%} ok\n');
-    	notify('100% ok');
-    }
-    if (typeof _$jscoverage === 'object') {
-        reportCoverage(_$jscoverage);
-    }
-}
-
-

Growl notify the given msg.

- -

- -
  • param: String msg

-
-
function notify(msg) {
-    if (growl) {
-        childProcess.exec('growlnotify -name Expresso -m "' + msg + '"');
-    }
-}
-
-// Report uncaught exceptions
-
-process.addListener('uncaughtException', function(err){
-    error('uncaught', 'uncaught', err);
-});
-
-// Show cursor
-
-['INT', 'TERM', 'QUIT'].forEach(function(sig){
-    process.addListener('SIG' + sig, function(){
-        cursor(true);
-        process.exit(1);
-    });
-});
-
-// Report test coverage when available
-// and emit "beforeExit" event to perform
-// final assertions
-
-var orig = process.emit;
-process.emit = function(event){
-    if (event === 'exit') {
-        report();
-        process.reallyExit(failures);
-    }
-    orig.apply(this, arguments);
-};
-
-// Run test files
-
-if (!defer) run(files);
-
-
\ No newline at end of file diff --git a/node_modules/ejs/support/expresso/docs/index.html b/node_modules/ejs/support/expresso/docs/index.html deleted file mode 100644 index 5ae18ab..0000000 --- a/node_modules/ejs/support/expresso/docs/index.html +++ /dev/null @@ -1,380 +0,0 @@ - - - Expresso - TDD Framework For Node - - - - - Fork me on GitHub - - -
-

Expresso

-
-

Expresso is a JavaScript TDD framework written for nodejs. Expresso is extremely fast, and is packed with features such as additional assertion methods, code coverage reporting, CI support, and more.

- -

Features

- -
    -
  • light-weight
  • -
  • intuitive async support
  • -
  • intuitive test runner executable
  • -
  • test coverage support and reporting via node-jscoverage
  • -
  • uses and extends the core assert module
  • -
  • assert.eql() alias of assert.deepEqual()
  • -
  • assert.response() http response utility
  • -
  • assert.includes()
  • -
  • assert.isNull()
  • -
  • assert.isUndefined()
  • -
  • assert.isNotNull()
  • -
  • assert.isDefined()
  • -
  • assert.match()
  • -
  • assert.length()
  • -
- - -

Installation

- -

To install both expresso and node-jscoverage run -the command below, which will first compile node-jscoverage:

- -
$ make install
-
- -

To install expresso alone without coverage reporting run:

- -
$ make install-expresso
-
- -

Install via npm:

- -
$ npm install expresso
-
- -

Examples

- -

Examples

- -

To define tests we simply export several functions:

- -
exports['test String#length'] = function(assert){
-    assert.equal(6, 'foobar'.length);
-};
-
- -

Alternatively for large numbers of tests you may want to -export your own object containing the tests, however this -is essentially the as above:

- -
module.exports = {
-    'test String#length': function(assert){
-        assert.equal(6, 'foobar'.length);
-    }
-};
-
- -

If you prefer not to use quoted keys:

- -
exports.testsStringLength = function(assert){
-    assert.equal(6, 'foobar'.length);
-};
-
- -

The second argument passed to each callback is beforeExit, -which is typically used to assert that callbacks have been -invoked.

- -
exports.testAsync = function(assert, beforeExit){
-    var n = 0;
-    setTimeout(function(){
-        ++n;
-        assert.ok(true);
-    }, 200);
-    setTimeout(function(){
-        ++n;
-        assert.ok(true);
-    }, 200);
-    beforeExit(function(){
-        assert.equal(2, n, 'Ensure both timeouts are called');
-    });
-};
-
- -

Assert Utilities

- -

assert.isNull(val[, msg])

- -

Asserts that the given val is null.

- -
assert.isNull(null);
-
- -

assert.isNotNull(val[, msg])

- -

Asserts that the given val is not null.

- -
assert.isNotNull(undefined);
-assert.isNotNull(false);
-
- -

assert.isUndefined(val[, msg])

- -

Asserts that the given val is undefined.

- -
assert.isUndefined(undefined);
-
- -

assert.isDefined(val[, msg])

- -

Asserts that the given val is not undefined.

- -
assert.isDefined(null);
-assert.isDefined(false);
-
- -

assert.match(str, regexp[, msg])

- -

Asserts that the given str matches regexp.

- -
assert.match('foobar', /^foo(bar)?/);
-assert.match('foo', /^foo(bar)?/);
-
- -

assert.length(val, n[, msg])

- -

Assert that the given val has a length of n.

- -
assert.length([1,2,3], 3);
-assert.length('foo', 3);
-
- -

assert.type(obj, type[, msg])

- -

Assert that the given obj is typeof type.

- -
assert.type(3, 'number');
-
- -

assert.eql(a, b[, msg])

- -

Assert that object b is equal to object a. This is an -alias for the core assert.deepEqual() method which does complex -comparisons, opposed to assert.equal() which uses ==.

- -
assert.eql('foo', 'foo');
-assert.eql([1,2], [1,2]);
-assert.eql({ foo: 'bar' }, { foo: 'bar' });
-
- -

assert.includes(obj, val[, msg])

- -

Assert that obj is within val. This method supports Array_s -and Strings_s.

- -
assert.includes([1,2,3], 3);
-assert.includes('foobar', 'foo');
-assert.includes('foobar', 'bar');
-
- -

assert.response(server, req, res|fn[, msg|fn])

- -

Performs assertions on the given server, which should not call -listen(), as this is handled internally by expresso and the server -is killed after all responses have completed. This method works with -any http.Server instance, so Connect and Express servers will work -as well.

- -

The req object may contain:

- -
    -
  • url request url
  • -
  • timeout timeout in milliseconds
  • -
  • method HTTP method
  • -
  • data request body
  • -
  • headers headers object
  • -
- - -

The res object may be a callback function which -receives the response for assertions, or an object -which is then used to perform several assertions -on the response with the following properties:

- -
    -
  • body assert response body
  • -
  • status assert response status code
  • -
  • header assert that all given headers match (unspecified are ignored)
  • -
- - -

When providing res you may then also pass a callback function -as the fourth argument for additional assertions.

- -

Below are some examples:

- -
assert.response(server, {
-    url: '/', timeout: 500
-}, {
-    body: 'foobar'
-});
-
-assert.response(server, {
-    url: '/',
-    method: 'GET'
-},{
-    body: '{"name":"tj"}',
-    status: 200,
-    headers: {
-        'Content-Type': 'application/json; charset=utf8',
-        'X-Foo': 'bar'
-    }
-});
-
-assert.response(server, {
-    url: '/foo',
-    method: 'POST',
-    data: 'bar baz'
-},{
-    body: '/foo bar baz',
-    status: 200
-}, 'Test POST');
-
-assert.response(server, {
-    url: '/foo',
-    method: 'POST',
-    data: 'bar baz'
-},{
-    body: '/foo bar baz',
-    status: 200
-}, function(res){
-    // All done, do some more tests if needed
-});
-
-assert.response(server, {
-    url: '/'
-}, function(res){
-    assert.ok(res.body.indexOf('tj') >= 0, 'Test assert.response() callback');
-});
-
- -

expresso(1)

- -

To run a single test suite (file) run:

- -
$ expresso test/a.test.js
-
- -

To run several suites we may simply append another:

- -
$ expresso test/a.test.js test/b.test.js
-
- -

We can also pass a whitelist of tests to run within all suites:

- -
$ expresso --only "foo()" --only "bar()"
-
- -

Or several with one call:

- -
$ expresso --only "foo(), bar()"
-
- -

Globbing is of course possible as well:

- -
$ expresso test/*
-
- -

When expresso is called without any files, test/* is the default, -so the following is equivalent to the command above:

- -
$ expresso
-
- -

If you wish to unshift a path to require.paths before -running tests, you may use the -I or --include flag.

- -
$ expresso --include lib test/*
-
- -

The previous example is typically what I would recommend, since expresso -supports test coverage via node-jscoverage (bundled with expresso), -so you will need to expose an instrumented version of you library.

- -

To instrument your library, simply run node-jscoverage, -passing the src and dest directories:

- -
$ node-jscoverage lib lib-cov
-
- -

Now we can run our tests again, using the lib-cov directory that has been -instrumented with coverage statements:

- -
$ expresso -I lib-cov test/*
-
- -

The output will look similar to below, depending on your test coverage of course :)

- -

node coverage

- -

To make this process easier expresso has the -c or --cov which essentially -does the same as the two commands above. The following two commands will -run the same tests, however one will auto-instrument, and unshift lib-cov, -and the other will run tests normally:

- -
$ expresso -I lib test/*
-$ expresso -I lib --cov test/*
-
- -

Currently coverage is bound to the lib directory, however in the -future --cov will most likely accept a path.

- -

Async Exports

- -

Sometimes it is useful to postpone running of tests until a callback or event has fired, currently the exports.foo = function(){}; syntax is supported for this:

- -
setTimeout(function(){
-    exports['test async exports'] = function(assert){
-        assert.ok('wahoo');
-    };
-}, 100);
-
- -
-
- - \ No newline at end of file diff --git a/node_modules/ejs/support/expresso/docs/index.md b/node_modules/ejs/support/expresso/docs/index.md deleted file mode 100644 index 169b335..0000000 --- a/node_modules/ejs/support/expresso/docs/index.md +++ /dev/null @@ -1,292 +0,0 @@ - -[Expresso](http://github.com/visionmedia/expresso) is a JavaScript [TDD](http://en.wikipedia.org/wiki/Test-driven_development) framework written for [nodejs](http://nodejs.org). Expresso is extremely fast, and is packed with features such as additional assertion methods, code coverage reporting, CI support, and more. - -## Features - - - light-weight - - intuitive async support - - intuitive test runner executable - - test coverage support and reporting via [node-jscoverage](http://github.com/visionmedia/node-jscoverage) - - uses and extends the core _assert_ module - - `assert.eql()` alias of `assert.deepEqual()` - - `assert.response()` http response utility - - `assert.includes()` - - `assert.isNull()` - - `assert.isUndefined()` - - `assert.isNotNull()` - - `assert.isDefined()` - - `assert.match()` - - `assert.length()` - -## Installation - -To install both expresso _and_ node-jscoverage run -the command below, which will first compile node-jscoverage: - - $ make install - -To install expresso alone without coverage reporting run: - - $ make install-expresso - -Install via npm: - - $ npm install expresso - -## Examples - -## Examples - -To define tests we simply export several functions: - - exports['test String#length'] = function(assert){ - assert.equal(6, 'foobar'.length); - }; - -Alternatively for large numbers of tests you may want to -export your own object containing the tests, however this -is essentially the as above: - - module.exports = { - 'test String#length': function(assert){ - assert.equal(6, 'foobar'.length); - } - }; - -If you prefer not to use quoted keys: - - exports.testsStringLength = function(assert){ - assert.equal(6, 'foobar'.length); - }; - -The second argument passed to each callback is _beforeExit_, -which is typically used to assert that callbacks have been -invoked. - - exports.testAsync = function(assert, beforeExit){ - var n = 0; - setTimeout(function(){ - ++n; - assert.ok(true); - }, 200); - setTimeout(function(){ - ++n; - assert.ok(true); - }, 200); - beforeExit(function(){ - assert.equal(2, n, 'Ensure both timeouts are called'); - }); - }; - -## Assert Utilities - -### assert.isNull(val[, msg]) - -Asserts that the given _val_ is _null_. - - assert.isNull(null); - -### assert.isNotNull(val[, msg]) - -Asserts that the given _val_ is not _null_. - - assert.isNotNull(undefined); - assert.isNotNull(false); - -### assert.isUndefined(val[, msg]) - -Asserts that the given _val_ is _undefined_. - - assert.isUndefined(undefined); - -### assert.isDefined(val[, msg]) - -Asserts that the given _val_ is not _undefined_. - - assert.isDefined(null); - assert.isDefined(false); - -### assert.match(str, regexp[, msg]) - -Asserts that the given _str_ matches _regexp_. - - assert.match('foobar', /^foo(bar)?/); - assert.match('foo', /^foo(bar)?/); - -### assert.length(val, n[, msg]) - -Assert that the given _val_ has a length of _n_. - - assert.length([1,2,3], 3); - assert.length('foo', 3); - -### assert.type(obj, type[, msg]) - -Assert that the given _obj_ is typeof _type_. - - assert.type(3, 'number'); - -### assert.eql(a, b[, msg]) - -Assert that object _b_ is equal to object _a_. This is an -alias for the core _assert.deepEqual()_ method which does complex -comparisons, opposed to _assert.equal()_ which uses _==_. - - assert.eql('foo', 'foo'); - assert.eql([1,2], [1,2]); - assert.eql({ foo: 'bar' }, { foo: 'bar' }); - -### assert.includes(obj, val[, msg]) - -Assert that _obj_ is within _val_. This method supports _Array_s -and _Strings_s. - - assert.includes([1,2,3], 3); - assert.includes('foobar', 'foo'); - assert.includes('foobar', 'bar'); - -### assert.response(server, req, res|fn[, msg|fn]) - -Performs assertions on the given _server_, which should _not_ call -listen(), as this is handled internally by expresso and the server -is killed after all responses have completed. This method works with -any _http.Server_ instance, so _Connect_ and _Express_ servers will work -as well. - -The _req_ object may contain: - - - _url_ request url - - _timeout_ timeout in milliseconds - - _method_ HTTP method - - _data_ request body - - _headers_ headers object - -The _res_ object may be a callback function which -receives the response for assertions, or an object -which is then used to perform several assertions -on the response with the following properties: - - - _body_ assert response body - - _status_ assert response status code - - _header_ assert that all given headers match (unspecified are ignored) - -When providing _res_ you may then also pass a callback function -as the fourth argument for additional assertions. - -Below are some examples: - - assert.response(server, { - url: '/', timeout: 500 - }, { - body: 'foobar' - }); - - assert.response(server, { - url: '/', - method: 'GET' - },{ - body: '{"name":"tj"}', - status: 200, - headers: { - 'Content-Type': 'application/json; charset=utf8', - 'X-Foo': 'bar' - } - }); - - assert.response(server, { - url: '/foo', - method: 'POST', - data: 'bar baz' - },{ - body: '/foo bar baz', - status: 200 - }, 'Test POST'); - - assert.response(server, { - url: '/foo', - method: 'POST', - data: 'bar baz' - },{ - body: '/foo bar baz', - status: 200 - }, function(res){ - // All done, do some more tests if needed - }); - - assert.response(server, { - url: '/' - }, function(res){ - assert.ok(res.body.indexOf('tj') >= 0, 'Test assert.response() callback'); - }); - - -## expresso(1) - -To run a single test suite (file) run: - - $ expresso test/a.test.js - -To run several suites we may simply append another: - - $ expresso test/a.test.js test/b.test.js - -We can also pass a whitelist of tests to run within all suites: - - $ expresso --only "foo()" --only "bar()" - -Or several with one call: - - $ expresso --only "foo(), bar()" - -Globbing is of course possible as well: - - $ expresso test/* - -When expresso is called without any files, _test/*_ is the default, -so the following is equivalent to the command above: - - $ expresso - -If you wish to unshift a path to `require.paths` before -running tests, you may use the `-I` or `--include` flag. - - $ expresso --include lib test/* - -The previous example is typically what I would recommend, since expresso -supports test coverage via [node-jscoverage](http://github.com/visionmedia/node-jscoverage) (bundled with expresso), -so you will need to expose an instrumented version of you library. - -To instrument your library, simply run [node-jscoverage](http://github.com/visionmedia/node-jscoverage), -passing the _src_ and _dest_ directories: - - $ node-jscoverage lib lib-cov - -Now we can run our tests again, using the _lib-cov_ directory that has been -instrumented with coverage statements: - - $ expresso -I lib-cov test/* - -The output will look similar to below, depending on your test coverage of course :) - -![node coverage](http://dl.dropbox.com/u/6396913/cov.png) - -To make this process easier expresso has the _-c_ or _--cov_ which essentially -does the same as the two commands above. The following two commands will -run the same tests, however one will auto-instrument, and unshift _lib-cov_, -and the other will run tests normally: - - $ expresso -I lib test/* - $ expresso -I lib --cov test/* - -Currently coverage is bound to the _lib_ directory, however in the -future `--cov` will most likely accept a path. - -## Async Exports - -Sometimes it is useful to postpone running of tests until a callback or event has fired, currently the _exports.foo = function(){};_ syntax is supported for this: - - setTimeout(function(){ - exports['test async exports'] = function(assert){ - assert.ok('wahoo'); - }; - }, 100); diff --git a/node_modules/ejs/support/expresso/docs/layout/foot.html b/node_modules/ejs/support/expresso/docs/layout/foot.html deleted file mode 100644 index 44d85e9..0000000 --- a/node_modules/ejs/support/expresso/docs/layout/foot.html +++ /dev/null @@ -1,3 +0,0 @@ - - - \ No newline at end of file diff --git a/node_modules/ejs/support/expresso/docs/layout/head.html b/node_modules/ejs/support/expresso/docs/layout/head.html deleted file mode 100644 index b2d42c3..0000000 --- a/node_modules/ejs/support/expresso/docs/layout/head.html +++ /dev/null @@ -1,47 +0,0 @@ - - - Expresso - TDD Framework For Node - - - - - Fork me on GitHub - - -
-

Expresso

diff --git a/node_modules/ejs/support/expresso/lib/bar.js b/node_modules/ejs/support/expresso/lib/bar.js deleted file mode 100644 index e15aad4..0000000 --- a/node_modules/ejs/support/expresso/lib/bar.js +++ /dev/null @@ -1,4 +0,0 @@ - -exports.bar = function(msg){ - return msg || 'bar'; -}; \ No newline at end of file diff --git a/node_modules/ejs/support/expresso/lib/foo.js b/node_modules/ejs/support/expresso/lib/foo.js deleted file mode 100644 index 15701a5..0000000 --- a/node_modules/ejs/support/expresso/lib/foo.js +++ /dev/null @@ -1,16 +0,0 @@ - -exports.foo = function(msg){ - if (msg) { - return msg; - } else { - return generateFoo(); - } -}; - -function generateFoo() { - return 'foo'; -} - -function Foo(msg){ - this.msg = msg || 'foo'; -} diff --git a/node_modules/ejs/support/expresso/package.json b/node_modules/ejs/support/expresso/package.json deleted file mode 100644 index ef89b5e..0000000 --- a/node_modules/ejs/support/expresso/package.json +++ /dev/null @@ -1,9 +0,0 @@ -{ "name": "expresso", - "version": "0.6.1", - "description": "TDD framework, light-weight, fast, CI-friendly", - "author": "TJ Holowaychuk ", - "bin": { "expresso": "./bin/expresso" }, - "scripts": { - "install": "make install-jscov" - } -} \ No newline at end of file diff --git a/node_modules/ejs/support/expresso/test/assert.test.js b/node_modules/ejs/support/expresso/test/assert.test.js deleted file mode 100644 index 6a5e764..0000000 --- a/node_modules/ejs/support/expresso/test/assert.test.js +++ /dev/null @@ -1,84 +0,0 @@ -module.exports = { - 'assert.eql()': function(assert){ - assert.equal(assert.deepEqual, assert.eql); - }, - - 'assert.type()': function(assert){ - assert.type('foobar', 'string'); - assert.type(2, 'number'); - assert.throws(function(){ - assert.type([1,2,3], 'string'); - }); - }, - - 'assert.includes()': function(assert){ - assert.includes('some random string', 'dom'); - assert.throws(function(){ - assert.include('some random string', 'foobar'); - }); - - assert.includes(['foo', 'bar'], 'bar'); - assert.includes(['foo', 'bar'], 'foo'); - assert.includes([1,2,3], 3); - assert.includes([1,2,3], 2); - assert.includes([1,2,3], 1); - assert.throws(function(){ - assert.includes(['foo', 'bar'], 'baz'); - }); - - assert.throws(function(){ - assert.includes({ wrong: 'type' }, 'foo'); - }); - }, - - 'assert.isNull()': function(assert){ - assert.isNull(null); - assert.throws(function(){ - assert.isNull(undefined); - }); - assert.throws(function(){ - assert.isNull(false); - }); - }, - - 'assert.isUndefined()': function(assert){ - assert.isUndefined(undefined); - assert.throws(function(){ - assert.isUndefined(null); - }); - assert.throws(function(){ - assert.isUndefined(false); - }); - }, - - 'assert.isNotNull()': function(assert){ - assert.isNotNull(false); - assert.isNotNull(undefined); - assert.throws(function(){ - assert.isNotNull(null); - }); - }, - - 'assert.isDefined()': function(assert){ - assert.isDefined(false); - assert.isDefined(null); - assert.throws(function(){ - assert.isDefined(undefined); - }); - }, - - 'assert.match()': function(assert){ - assert.match('foobar', /foo(bar)?/); - assert.throws(function(){ - assert.match('something', /rawr/); - }); - }, - - 'assert.length()': function(assert){ - assert.length('test', 4); - assert.length([1,2,3,4], 4); - assert.throws(function(){ - assert.length([1,2,3], 4); - }); - } -}; \ No newline at end of file diff --git a/node_modules/ejs/support/expresso/test/async.test.js b/node_modules/ejs/support/expresso/test/async.test.js deleted file mode 100644 index 0dc9016..0000000 --- a/node_modules/ejs/support/expresso/test/async.test.js +++ /dev/null @@ -1,6 +0,0 @@ - -setTimeout(function(){ - exports['test async exports'] = function(assert){ - assert.ok('wahoo'); - }; -}, 100); \ No newline at end of file diff --git a/node_modules/ejs/support/expresso/test/bar.test.js b/node_modules/ejs/support/expresso/test/bar.test.js deleted file mode 100644 index 68e8d48..0000000 --- a/node_modules/ejs/support/expresso/test/bar.test.js +++ /dev/null @@ -1,12 +0,0 @@ - -/** - * Module dependencies. - */ - -var bar = require('bar'); - -module.exports = { - 'bar()': function(assert){ - assert.equal('bar', bar.bar()); - } -}; \ No newline at end of file diff --git a/node_modules/ejs/support/expresso/test/foo.test.js b/node_modules/ejs/support/expresso/test/foo.test.js deleted file mode 100644 index 5d9d94e..0000000 --- a/node_modules/ejs/support/expresso/test/foo.test.js +++ /dev/null @@ -1,13 +0,0 @@ - -/** - * Module dependencies. - */ - -var foo = require('foo'); - -module.exports = { - 'foo()': function(assert){ - assert.equal('foo', foo.foo()); - assert.equal('foo', foo.foo()); - } -}; \ No newline at end of file diff --git a/node_modules/ejs/support/expresso/test/http.test.js b/node_modules/ejs/support/expresso/test/http.test.js deleted file mode 100644 index 8eff2b7..0000000 --- a/node_modules/ejs/support/expresso/test/http.test.js +++ /dev/null @@ -1,76 +0,0 @@ - -/** - * Module dependencies. - */ - -var http = require('http'); - -var server = http.createServer(function(req, res){ - if (req.method === 'GET') { - if (req.url === '/delay') { - setTimeout(function(){ - res.writeHead(200, {}); - res.end('delayed'); - }, 200); - } else { - var body = JSON.stringify({ name: 'tj' }); - res.writeHead(200, { - 'Content-Type': 'application/json; charset=utf8', - 'Content-Length': body.length - }); - res.end(body); - } - } else { - var body = ''; - req.setEncoding('utf8'); - req.addListener('data', function(chunk){ body += chunk }); - req.addListener('end', function(){ - res.writeHead(200, {}); - res.end(req.url + ' ' + body); - }); - } -}); - -module.exports = { - 'test assert.response()': function(assert, beforeExit){ - var called = 0; - - assert.response(server, { - url: '/', - method: 'GET' - },{ - body: '{"name":"tj"}', - status: 200, - headers: { - 'Content-Type': 'application/json; charset=utf8' - } - }); - - assert.response(server, { - url: '/foo', - method: 'POST', - data: 'bar baz' - },{ - body: '/foo bar baz', - status: 200 - }, function(res){ - ++called; - assert.ok(res); - }); - - assert.response(server, { - url: '/foo' - }, function(res){ - ++called; - assert.ok(res.body.indexOf('tj') >= 0, 'Test assert.response() callback'); - }); - - assert.response(server, - { url: '/delay', timeout: 300 }, - { body: 'delayed' }); - - beforeExit(function(){ - assert.equal(2, called); - }); - } -}; \ No newline at end of file diff --git a/node_modules/ejs/test/ejs.js b/node_modules/ejs/test/ejs.js new file mode 100644 index 0000000..6e8bc5c --- /dev/null +++ b/node_modules/ejs/test/ejs.js @@ -0,0 +1,213 @@ +/** + * Module dependencies. + */ + +var ejs = require('..') + , fs = require('fs') + , read = fs.readFileSync + , assert = require('assert'); + +/** + * Load fixture `name`. + */ + +function fixture(name) { + return read('test/fixtures/' + name, 'utf8'); +} + +/** + * User fixtures. + */ + +var users = []; +users.push({ name: 'tobi' }); +users.push({ name: 'loki' }); +users.push({ name: 'jane' }); + +describe('ejs.compile(str, options)', function(){ + it('should compile to a function', function(){ + var fn = ejs.compile('

yay

'); + fn().should.equal('

yay

'); + }) + + it('should allow customizing delimiters', function(){ + var fn = ejs.compile('

{= name }

', { open: '{', close: '}' }); + fn({ name: 'tobi' }).should.equal('

tobi

'); + + var fn = ejs.compile('

::= name ::

', { open: '::', close: '::' }); + fn({ name: 'tobi' }).should.equal('

tobi

'); + + var fn = ejs.compile('

(= name )

', { open: '(', close: ')' }); + fn({ name: 'tobi' }).should.equal('

tobi

'); + }) + + it('should default to using ejs.open and ejs.close', function(){ + ejs.open = '{'; + ejs.close = '}'; + var fn = ejs.compile('

{= name }

'); + fn({ name: 'tobi' }).should.equal('

tobi

'); + + var fn = ejs.compile('

|= name |

', { open: '|', close: '|' }); + fn({ name: 'tobi' }).should.equal('

tobi

'); + delete ejs.open; + delete ejs.close; + }) + + it('should have a working client option', function(){ + var fn = ejs.compile('

<%= foo %>

', { client: true }); + var str = fn.toString(); + eval('var preFn = ' + str); + preFn({ foo: 'bar' }).should.equal('

bar

'); + }) +}) + +describe('ejs.render(str, options)', function(){ + it('should render the template', function(){ + ejs.render('

yay

') + .should.equal('

yay

'); + }) + + it('should accept locals', function(){ + ejs.render('

<%= name %>

', { name: 'tobi' }) + .should.equal('

tobi

'); + }) +}) + +describe('ejs.renderFile(path, options, fn)', function(){ + it('should render a file', function(done){ + ejs.renderFile('test/fixtures/para.ejs', function(err, html){ + if (err) return done(err); + html.should.equal('

hey

'); + done(); + }); + }) + + it('should accept locals', function(done){ + var options = { name: 'tj', open: '{', close: '}' }; + ejs.renderFile('test/fixtures/user.ejs', options, function(err, html){ + if (err) return done(err); + html.should.equal('

tj

'); + done(); + }); + }) +}) + +describe('<%=', function(){ + it('should escape', function(){ + ejs.render('<%= name %>', { name: ' + + + + + + + + + +
+ + diff --git a/node_modules/express/node_modules/connect/node_modules/qs/test/browser/jquery.js b/node_modules/express/node_modules/connect/node_modules/qs/test/browser/jquery.js new file mode 100644 index 0000000..f3201aa --- /dev/null +++ b/node_modules/express/node_modules/connect/node_modules/qs/test/browser/jquery.js @@ -0,0 +1,8981 @@ +/*! + * jQuery JavaScript Library v1.6.2 + * http://jquery.com/ + * + * Copyright 2011, John Resig + * Dual licensed under the MIT or GPL Version 2 licenses. + * http://jquery.org/license + * + * Includes Sizzle.js + * http://sizzlejs.com/ + * Copyright 2011, The Dojo Foundation + * Released under the MIT, BSD, and GPL Licenses. + * + * Date: Thu Jun 30 14:16:56 2011 -0400 + */ +(function( window, undefined ) { + +// Use the correct document accordingly with window argument (sandbox) +var document = window.document, + navigator = window.navigator, + location = window.location; +var jQuery = (function() { + +// Define a local copy of jQuery +var jQuery = function( selector, context ) { + // The jQuery object is actually just the init constructor 'enhanced' + return new jQuery.fn.init( selector, context, rootjQuery ); + }, + + // Map over jQuery in case of overwrite + _jQuery = window.jQuery, + + // Map over the $ in case of overwrite + _$ = window.$, + + // A central reference to the root jQuery(document) + rootjQuery, + + // A simple way to check for HTML strings or ID strings + // (both of which we optimize for) + quickExpr = /^(?:[^<]*(<[\w\W]+>)[^>]*$|#([\w\-]*)$)/, + + // Check if a string has a non-whitespace character in it + rnotwhite = /\S/, + + // Used for trimming whitespace + trimLeft = /^\s+/, + trimRight = /\s+$/, + + // Check for digits + rdigit = /\d/, + + // Match a standalone tag + rsingleTag = /^<(\w+)\s*\/?>(?:<\/\1>)?$/, + + // JSON RegExp + rvalidchars = /^[\],:{}\s]*$/, + rvalidescape = /\\(?:["\\\/bfnrt]|u[0-9a-fA-F]{4})/g, + rvalidtokens = /"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g, + rvalidbraces = /(?:^|:|,)(?:\s*\[)+/g, + + // Useragent RegExp + rwebkit = /(webkit)[ \/]([\w.]+)/, + ropera = /(opera)(?:.*version)?[ \/]([\w.]+)/, + rmsie = /(msie) ([\w.]+)/, + rmozilla = /(mozilla)(?:.*? rv:([\w.]+))?/, + + // Matches dashed string for camelizing + rdashAlpha = /-([a-z])/ig, + + // Used by jQuery.camelCase as callback to replace() + fcamelCase = function( all, letter ) { + return letter.toUpperCase(); + }, + + // Keep a UserAgent string for use with jQuery.browser + userAgent = navigator.userAgent, + + // For matching the engine and version of the browser + browserMatch, + + // The deferred used on DOM ready + readyList, + + // The ready event handler + DOMContentLoaded, + + // Save a reference to some core methods + toString = Object.prototype.toString, + hasOwn = Object.prototype.hasOwnProperty, + push = Array.prototype.push, + slice = Array.prototype.slice, + trim = String.prototype.trim, + indexOf = Array.prototype.indexOf, + + // [[Class]] -> type pairs + class2type = {}; + +jQuery.fn = jQuery.prototype = { + constructor: jQuery, + init: function( selector, context, rootjQuery ) { + var match, elem, ret, doc; + + // Handle $(""), $(null), or $(undefined) + if ( !selector ) { + return this; + } + + // Handle $(DOMElement) + if ( selector.nodeType ) { + this.context = this[0] = selector; + this.length = 1; + return this; + } + + // The body element only exists once, optimize finding it + if ( selector === "body" && !context && document.body ) { + this.context = document; + this[0] = document.body; + this.selector = selector; + this.length = 1; + return this; + } + + // Handle HTML strings + if ( typeof selector === "string" ) { + // Are we dealing with HTML string or an ID? + if ( selector.charAt(0) === "<" && selector.charAt( selector.length - 1 ) === ">" && selector.length >= 3 ) { + // Assume that strings that start and end with <> are HTML and skip the regex check + match = [ null, selector, null ]; + + } else { + match = quickExpr.exec( selector ); + } + + // Verify a match, and that no context was specified for #id + if ( match && (match[1] || !context) ) { + + // HANDLE: $(html) -> $(array) + if ( match[1] ) { + context = context instanceof jQuery ? context[0] : context; + doc = (context ? context.ownerDocument || context : document); + + // If a single string is passed in and it's a single tag + // just do a createElement and skip the rest + ret = rsingleTag.exec( selector ); + + if ( ret ) { + if ( jQuery.isPlainObject( context ) ) { + selector = [ document.createElement( ret[1] ) ]; + jQuery.fn.attr.call( selector, context, true ); + + } else { + selector = [ doc.createElement( ret[1] ) ]; + } + + } else { + ret = jQuery.buildFragment( [ match[1] ], [ doc ] ); + selector = (ret.cacheable ? jQuery.clone(ret.fragment) : ret.fragment).childNodes; + } + + return jQuery.merge( this, selector ); + + // HANDLE: $("#id") + } else { + elem = document.getElementById( match[2] ); + + // Check parentNode to catch when Blackberry 4.6 returns + // nodes that are no longer in the document #6963 + if ( elem && elem.parentNode ) { + // Handle the case where IE and Opera return items + // by name instead of ID + if ( elem.id !== match[2] ) { + return rootjQuery.find( selector ); + } + + // Otherwise, we inject the element directly into the jQuery object + this.length = 1; + this[0] = elem; + } + + this.context = document; + this.selector = selector; + return this; + } + + // HANDLE: $(expr, $(...)) + } else if ( !context || context.jquery ) { + return (context || rootjQuery).find( selector ); + + // HANDLE: $(expr, context) + // (which is just equivalent to: $(context).find(expr) + } else { + return this.constructor( context ).find( selector ); + } + + // HANDLE: $(function) + // Shortcut for document ready + } else if ( jQuery.isFunction( selector ) ) { + return rootjQuery.ready( selector ); + } + + if (selector.selector !== undefined) { + this.selector = selector.selector; + this.context = selector.context; + } + + return jQuery.makeArray( selector, this ); + }, + + // Start with an empty selector + selector: "", + + // The current version of jQuery being used + jquery: "1.6.2", + + // The default length of a jQuery object is 0 + length: 0, + + // The number of elements contained in the matched element set + size: function() { + return this.length; + }, + + toArray: function() { + return slice.call( this, 0 ); + }, + + // Get the Nth element in the matched element set OR + // Get the whole matched element set as a clean array + get: function( num ) { + return num == null ? + + // Return a 'clean' array + this.toArray() : + + // Return just the object + ( num < 0 ? this[ this.length + num ] : this[ num ] ); + }, + + // Take an array of elements and push it onto the stack + // (returning the new matched element set) + pushStack: function( elems, name, selector ) { + // Build a new jQuery matched element set + var ret = this.constructor(); + + if ( jQuery.isArray( elems ) ) { + push.apply( ret, elems ); + + } else { + jQuery.merge( ret, elems ); + } + + // Add the old object onto the stack (as a reference) + ret.prevObject = this; + + ret.context = this.context; + + if ( name === "find" ) { + ret.selector = this.selector + (this.selector ? " " : "") + selector; + } else if ( name ) { + ret.selector = this.selector + "." + name + "(" + selector + ")"; + } + + // Return the newly-formed element set + return ret; + }, + + // Execute a callback for every element in the matched set. + // (You can seed the arguments with an array of args, but this is + // only used internally.) + each: function( callback, args ) { + return jQuery.each( this, callback, args ); + }, + + ready: function( fn ) { + // Attach the listeners + jQuery.bindReady(); + + // Add the callback + readyList.done( fn ); + + return this; + }, + + eq: function( i ) { + return i === -1 ? + this.slice( i ) : + this.slice( i, +i + 1 ); + }, + + first: function() { + return this.eq( 0 ); + }, + + last: function() { + return this.eq( -1 ); + }, + + slice: function() { + return this.pushStack( slice.apply( this, arguments ), + "slice", slice.call(arguments).join(",") ); + }, + + map: function( callback ) { + return this.pushStack( jQuery.map(this, function( elem, i ) { + return callback.call( elem, i, elem ); + })); + }, + + end: function() { + return this.prevObject || this.constructor(null); + }, + + // For internal use only. + // Behaves like an Array's method, not like a jQuery method. + push: push, + sort: [].sort, + splice: [].splice +}; + +// Give the init function the jQuery prototype for later instantiation +jQuery.fn.init.prototype = jQuery.fn; + +jQuery.extend = jQuery.fn.extend = function() { + var options, name, src, copy, copyIsArray, clone, + target = arguments[0] || {}, + i = 1, + length = arguments.length, + deep = false; + + // Handle a deep copy situation + if ( typeof target === "boolean" ) { + deep = target; + target = arguments[1] || {}; + // skip the boolean and the target + i = 2; + } + + // Handle case when target is a string or something (possible in deep copy) + if ( typeof target !== "object" && !jQuery.isFunction(target) ) { + target = {}; + } + + // extend jQuery itself if only one argument is passed + if ( length === i ) { + target = this; + --i; + } + + for ( ; i < length; i++ ) { + // Only deal with non-null/undefined values + if ( (options = arguments[ i ]) != null ) { + // Extend the base object + for ( name in options ) { + src = target[ name ]; + copy = options[ name ]; + + // Prevent never-ending loop + if ( target === copy ) { + continue; + } + + // Recurse if we're merging plain objects or arrays + if ( deep && copy && ( jQuery.isPlainObject(copy) || (copyIsArray = jQuery.isArray(copy)) ) ) { + if ( copyIsArray ) { + copyIsArray = false; + clone = src && jQuery.isArray(src) ? src : []; + + } else { + clone = src && jQuery.isPlainObject(src) ? src : {}; + } + + // Never move original objects, clone them + target[ name ] = jQuery.extend( deep, clone, copy ); + + // Don't bring in undefined values + } else if ( copy !== undefined ) { + target[ name ] = copy; + } + } + } + } + + // Return the modified object + return target; +}; + +jQuery.extend({ + noConflict: function( deep ) { + if ( window.$ === jQuery ) { + window.$ = _$; + } + + if ( deep && window.jQuery === jQuery ) { + window.jQuery = _jQuery; + } + + return jQuery; + }, + + // Is the DOM ready to be used? Set to true once it occurs. + isReady: false, + + // A counter to track how many items to wait for before + // the ready event fires. See #6781 + readyWait: 1, + + // Hold (or release) the ready event + holdReady: function( hold ) { + if ( hold ) { + jQuery.readyWait++; + } else { + jQuery.ready( true ); + } + }, + + // Handle when the DOM is ready + ready: function( wait ) { + // Either a released hold or an DOMready/load event and not yet ready + if ( (wait === true && !--jQuery.readyWait) || (wait !== true && !jQuery.isReady) ) { + // Make sure body exists, at least, in case IE gets a little overzealous (ticket #5443). + if ( !document.body ) { + return setTimeout( jQuery.ready, 1 ); + } + + // Remember that the DOM is ready + jQuery.isReady = true; + + // If a normal DOM Ready event fired, decrement, and wait if need be + if ( wait !== true && --jQuery.readyWait > 0 ) { + return; + } + + // If there are functions bound, to execute + readyList.resolveWith( document, [ jQuery ] ); + + // Trigger any bound ready events + if ( jQuery.fn.trigger ) { + jQuery( document ).trigger( "ready" ).unbind( "ready" ); + } + } + }, + + bindReady: function() { + if ( readyList ) { + return; + } + + readyList = jQuery._Deferred(); + + // Catch cases where $(document).ready() is called after the + // browser event has already occurred. + if ( document.readyState === "complete" ) { + // Handle it asynchronously to allow scripts the opportunity to delay ready + return setTimeout( jQuery.ready, 1 ); + } + + // Mozilla, Opera and webkit nightlies currently support this event + if ( document.addEventListener ) { + // Use the handy event callback + document.addEventListener( "DOMContentLoaded", DOMContentLoaded, false ); + + // A fallback to window.onload, that will always work + window.addEventListener( "load", jQuery.ready, false ); + + // If IE event model is used + } else if ( document.attachEvent ) { + // ensure firing before onload, + // maybe late but safe also for iframes + document.attachEvent( "onreadystatechange", DOMContentLoaded ); + + // A fallback to window.onload, that will always work + window.attachEvent( "onload", jQuery.ready ); + + // If IE and not a frame + // continually check to see if the document is ready + var toplevel = false; + + try { + toplevel = window.frameElement == null; + } catch(e) {} + + if ( document.documentElement.doScroll && toplevel ) { + doScrollCheck(); + } + } + }, + + // See test/unit/core.js for details concerning isFunction. + // Since version 1.3, DOM methods and functions like alert + // aren't supported. They return false on IE (#2968). + isFunction: function( obj ) { + return jQuery.type(obj) === "function"; + }, + + isArray: Array.isArray || function( obj ) { + return jQuery.type(obj) === "array"; + }, + + // A crude way of determining if an object is a window + isWindow: function( obj ) { + return obj && typeof obj === "object" && "setInterval" in obj; + }, + + isNaN: function( obj ) { + return obj == null || !rdigit.test( obj ) || isNaN( obj ); + }, + + type: function( obj ) { + return obj == null ? + String( obj ) : + class2type[ toString.call(obj) ] || "object"; + }, + + isPlainObject: function( obj ) { + // Must be an Object. + // Because of IE, we also have to check the presence of the constructor property. + // Make sure that DOM nodes and window objects don't pass through, as well + if ( !obj || jQuery.type(obj) !== "object" || obj.nodeType || jQuery.isWindow( obj ) ) { + return false; + } + + // Not own constructor property must be Object + if ( obj.constructor && + !hasOwn.call(obj, "constructor") && + !hasOwn.call(obj.constructor.prototype, "isPrototypeOf") ) { + return false; + } + + // Own properties are enumerated firstly, so to speed up, + // if last one is own, then all properties are own. + + var key; + for ( key in obj ) {} + + return key === undefined || hasOwn.call( obj, key ); + }, + + isEmptyObject: function( obj ) { + for ( var name in obj ) { + return false; + } + return true; + }, + + error: function( msg ) { + throw msg; + }, + + parseJSON: function( data ) { + if ( typeof data !== "string" || !data ) { + return null; + } + + // Make sure leading/trailing whitespace is removed (IE can't handle it) + data = jQuery.trim( data ); + + // Attempt to parse using the native JSON parser first + if ( window.JSON && window.JSON.parse ) { + return window.JSON.parse( data ); + } + + // Make sure the incoming data is actual JSON + // Logic borrowed from http://json.org/json2.js + if ( rvalidchars.test( data.replace( rvalidescape, "@" ) + .replace( rvalidtokens, "]" ) + .replace( rvalidbraces, "")) ) { + + return (new Function( "return " + data ))(); + + } + jQuery.error( "Invalid JSON: " + data ); + }, + + // Cross-browser xml parsing + // (xml & tmp used internally) + parseXML: function( data , xml , tmp ) { + + if ( window.DOMParser ) { // Standard + tmp = new DOMParser(); + xml = tmp.parseFromString( data , "text/xml" ); + } else { // IE + xml = new ActiveXObject( "Microsoft.XMLDOM" ); + xml.async = "false"; + xml.loadXML( data ); + } + + tmp = xml.documentElement; + + if ( ! tmp || ! tmp.nodeName || tmp.nodeName === "parsererror" ) { + jQuery.error( "Invalid XML: " + data ); + } + + return xml; + }, + + noop: function() {}, + + // Evaluates a script in a global context + // Workarounds based on findings by Jim Driscoll + // http://weblogs.java.net/blog/driscoll/archive/2009/09/08/eval-javascript-global-context + globalEval: function( data ) { + if ( data && rnotwhite.test( data ) ) { + // We use execScript on Internet Explorer + // We use an anonymous function so that context is window + // rather than jQuery in Firefox + ( window.execScript || function( data ) { + window[ "eval" ].call( window, data ); + } )( data ); + } + }, + + // Converts a dashed string to camelCased string; + // Used by both the css and data modules + camelCase: function( string ) { + return string.replace( rdashAlpha, fcamelCase ); + }, + + nodeName: function( elem, name ) { + return elem.nodeName && elem.nodeName.toUpperCase() === name.toUpperCase(); + }, + + // args is for internal usage only + each: function( object, callback, args ) { + var name, i = 0, + length = object.length, + isObj = length === undefined || jQuery.isFunction( object ); + + if ( args ) { + if ( isObj ) { + for ( name in object ) { + if ( callback.apply( object[ name ], args ) === false ) { + break; + } + } + } else { + for ( ; i < length; ) { + if ( callback.apply( object[ i++ ], args ) === false ) { + break; + } + } + } + + // A special, fast, case for the most common use of each + } else { + if ( isObj ) { + for ( name in object ) { + if ( callback.call( object[ name ], name, object[ name ] ) === false ) { + break; + } + } + } else { + for ( ; i < length; ) { + if ( callback.call( object[ i ], i, object[ i++ ] ) === false ) { + break; + } + } + } + } + + return object; + }, + + // Use native String.trim function wherever possible + trim: trim ? + function( text ) { + return text == null ? + "" : + trim.call( text ); + } : + + // Otherwise use our own trimming functionality + function( text ) { + return text == null ? + "" : + text.toString().replace( trimLeft, "" ).replace( trimRight, "" ); + }, + + // results is for internal usage only + makeArray: function( array, results ) { + var ret = results || []; + + if ( array != null ) { + // The window, strings (and functions) also have 'length' + // The extra typeof function check is to prevent crashes + // in Safari 2 (See: #3039) + // Tweaked logic slightly to handle Blackberry 4.7 RegExp issues #6930 + var type = jQuery.type( array ); + + if ( array.length == null || type === "string" || type === "function" || type === "regexp" || jQuery.isWindow( array ) ) { + push.call( ret, array ); + } else { + jQuery.merge( ret, array ); + } + } + + return ret; + }, + + inArray: function( elem, array ) { + + if ( indexOf ) { + return indexOf.call( array, elem ); + } + + for ( var i = 0, length = array.length; i < length; i++ ) { + if ( array[ i ] === elem ) { + return i; + } + } + + return -1; + }, + + merge: function( first, second ) { + var i = first.length, + j = 0; + + if ( typeof second.length === "number" ) { + for ( var l = second.length; j < l; j++ ) { + first[ i++ ] = second[ j ]; + } + + } else { + while ( second[j] !== undefined ) { + first[ i++ ] = second[ j++ ]; + } + } + + first.length = i; + + return first; + }, + + grep: function( elems, callback, inv ) { + var ret = [], retVal; + inv = !!inv; + + // Go through the array, only saving the items + // that pass the validator function + for ( var i = 0, length = elems.length; i < length; i++ ) { + retVal = !!callback( elems[ i ], i ); + if ( inv !== retVal ) { + ret.push( elems[ i ] ); + } + } + + return ret; + }, + + // arg is for internal usage only + map: function( elems, callback, arg ) { + var value, key, ret = [], + i = 0, + length = elems.length, + // jquery objects are treated as arrays + isArray = elems instanceof jQuery || length !== undefined && typeof length === "number" && ( ( length > 0 && elems[ 0 ] && elems[ length -1 ] ) || length === 0 || jQuery.isArray( elems ) ) ; + + // Go through the array, translating each of the items to their + if ( isArray ) { + for ( ; i < length; i++ ) { + value = callback( elems[ i ], i, arg ); + + if ( value != null ) { + ret[ ret.length ] = value; + } + } + + // Go through every key on the object, + } else { + for ( key in elems ) { + value = callback( elems[ key ], key, arg ); + + if ( value != null ) { + ret[ ret.length ] = value; + } + } + } + + // Flatten any nested arrays + return ret.concat.apply( [], ret ); + }, + + // A global GUID counter for objects + guid: 1, + + // Bind a function to a context, optionally partially applying any + // arguments. + proxy: function( fn, context ) { + if ( typeof context === "string" ) { + var tmp = fn[ context ]; + context = fn; + fn = tmp; + } + + // Quick check to determine if target is callable, in the spec + // this throws a TypeError, but we will just return undefined. + if ( !jQuery.isFunction( fn ) ) { + return undefined; + } + + // Simulated bind + var args = slice.call( arguments, 2 ), + proxy = function() { + return fn.apply( context, args.concat( slice.call( arguments ) ) ); + }; + + // Set the guid of unique handler to the same of original handler, so it can be removed + proxy.guid = fn.guid = fn.guid || proxy.guid || jQuery.guid++; + + return proxy; + }, + + // Mutifunctional method to get and set values to a collection + // The value/s can optionally be executed if it's a function + access: function( elems, key, value, exec, fn, pass ) { + var length = elems.length; + + // Setting many attributes + if ( typeof key === "object" ) { + for ( var k in key ) { + jQuery.access( elems, k, key[k], exec, fn, value ); + } + return elems; + } + + // Setting one attribute + if ( value !== undefined ) { + // Optionally, function values get executed if exec is true + exec = !pass && exec && jQuery.isFunction(value); + + for ( var i = 0; i < length; i++ ) { + fn( elems[i], key, exec ? value.call( elems[i], i, fn( elems[i], key ) ) : value, pass ); + } + + return elems; + } + + // Getting an attribute + return length ? fn( elems[0], key ) : undefined; + }, + + now: function() { + return (new Date()).getTime(); + }, + + // Use of jQuery.browser is frowned upon. + // More details: http://docs.jquery.com/Utilities/jQuery.browser + uaMatch: function( ua ) { + ua = ua.toLowerCase(); + + var match = rwebkit.exec( ua ) || + ropera.exec( ua ) || + rmsie.exec( ua ) || + ua.indexOf("compatible") < 0 && rmozilla.exec( ua ) || + []; + + return { browser: match[1] || "", version: match[2] || "0" }; + }, + + sub: function() { + function jQuerySub( selector, context ) { + return new jQuerySub.fn.init( selector, context ); + } + jQuery.extend( true, jQuerySub, this ); + jQuerySub.superclass = this; + jQuerySub.fn = jQuerySub.prototype = this(); + jQuerySub.fn.constructor = jQuerySub; + jQuerySub.sub = this.sub; + jQuerySub.fn.init = function init( selector, context ) { + if ( context && context instanceof jQuery && !(context instanceof jQuerySub) ) { + context = jQuerySub( context ); + } + + return jQuery.fn.init.call( this, selector, context, rootjQuerySub ); + }; + jQuerySub.fn.init.prototype = jQuerySub.fn; + var rootjQuerySub = jQuerySub(document); + return jQuerySub; + }, + + browser: {} +}); + +// Populate the class2type map +jQuery.each("Boolean Number String Function Array Date RegExp Object".split(" "), function(i, name) { + class2type[ "[object " + name + "]" ] = name.toLowerCase(); +}); + +browserMatch = jQuery.uaMatch( userAgent ); +if ( browserMatch.browser ) { + jQuery.browser[ browserMatch.browser ] = true; + jQuery.browser.version = browserMatch.version; +} + +// Deprecated, use jQuery.browser.webkit instead +if ( jQuery.browser.webkit ) { + jQuery.browser.safari = true; +} + +// IE doesn't match non-breaking spaces with \s +if ( rnotwhite.test( "\xA0" ) ) { + trimLeft = /^[\s\xA0]+/; + trimRight = /[\s\xA0]+$/; +} + +// All jQuery objects should point back to these +rootjQuery = jQuery(document); + +// Cleanup functions for the document ready method +if ( document.addEventListener ) { + DOMContentLoaded = function() { + document.removeEventListener( "DOMContentLoaded", DOMContentLoaded, false ); + jQuery.ready(); + }; + +} else if ( document.attachEvent ) { + DOMContentLoaded = function() { + // Make sure body exists, at least, in case IE gets a little overzealous (ticket #5443). + if ( document.readyState === "complete" ) { + document.detachEvent( "onreadystatechange", DOMContentLoaded ); + jQuery.ready(); + } + }; +} + +// The DOM ready check for Internet Explorer +function doScrollCheck() { + if ( jQuery.isReady ) { + return; + } + + try { + // If IE is used, use the trick by Diego Perini + // http://javascript.nwbox.com/IEContentLoaded/ + document.documentElement.doScroll("left"); + } catch(e) { + setTimeout( doScrollCheck, 1 ); + return; + } + + // and execute any waiting functions + jQuery.ready(); +} + +return jQuery; + +})(); + + +var // Promise methods + promiseMethods = "done fail isResolved isRejected promise then always pipe".split( " " ), + // Static reference to slice + sliceDeferred = [].slice; + +jQuery.extend({ + // Create a simple deferred (one callbacks list) + _Deferred: function() { + var // callbacks list + callbacks = [], + // stored [ context , args ] + fired, + // to avoid firing when already doing so + firing, + // flag to know if the deferred has been cancelled + cancelled, + // the deferred itself + deferred = { + + // done( f1, f2, ...) + done: function() { + if ( !cancelled ) { + var args = arguments, + i, + length, + elem, + type, + _fired; + if ( fired ) { + _fired = fired; + fired = 0; + } + for ( i = 0, length = args.length; i < length; i++ ) { + elem = args[ i ]; + type = jQuery.type( elem ); + if ( type === "array" ) { + deferred.done.apply( deferred, elem ); + } else if ( type === "function" ) { + callbacks.push( elem ); + } + } + if ( _fired ) { + deferred.resolveWith( _fired[ 0 ], _fired[ 1 ] ); + } + } + return this; + }, + + // resolve with given context and args + resolveWith: function( context, args ) { + if ( !cancelled && !fired && !firing ) { + // make sure args are available (#8421) + args = args || []; + firing = 1; + try { + while( callbacks[ 0 ] ) { + callbacks.shift().apply( context, args ); + } + } + finally { + fired = [ context, args ]; + firing = 0; + } + } + return this; + }, + + // resolve with this as context and given arguments + resolve: function() { + deferred.resolveWith( this, arguments ); + return this; + }, + + // Has this deferred been resolved? + isResolved: function() { + return !!( firing || fired ); + }, + + // Cancel + cancel: function() { + cancelled = 1; + callbacks = []; + return this; + } + }; + + return deferred; + }, + + // Full fledged deferred (two callbacks list) + Deferred: function( func ) { + var deferred = jQuery._Deferred(), + failDeferred = jQuery._Deferred(), + promise; + // Add errorDeferred methods, then and promise + jQuery.extend( deferred, { + then: function( doneCallbacks, failCallbacks ) { + deferred.done( doneCallbacks ).fail( failCallbacks ); + return this; + }, + always: function() { + return deferred.done.apply( deferred, arguments ).fail.apply( this, arguments ); + }, + fail: failDeferred.done, + rejectWith: failDeferred.resolveWith, + reject: failDeferred.resolve, + isRejected: failDeferred.isResolved, + pipe: function( fnDone, fnFail ) { + return jQuery.Deferred(function( newDefer ) { + jQuery.each( { + done: [ fnDone, "resolve" ], + fail: [ fnFail, "reject" ] + }, function( handler, data ) { + var fn = data[ 0 ], + action = data[ 1 ], + returned; + if ( jQuery.isFunction( fn ) ) { + deferred[ handler ](function() { + returned = fn.apply( this, arguments ); + if ( returned && jQuery.isFunction( returned.promise ) ) { + returned.promise().then( newDefer.resolve, newDefer.reject ); + } else { + newDefer[ action ]( returned ); + } + }); + } else { + deferred[ handler ]( newDefer[ action ] ); + } + }); + }).promise(); + }, + // Get a promise for this deferred + // If obj is provided, the promise aspect is added to the object + promise: function( obj ) { + if ( obj == null ) { + if ( promise ) { + return promise; + } + promise = obj = {}; + } + var i = promiseMethods.length; + while( i-- ) { + obj[ promiseMethods[i] ] = deferred[ promiseMethods[i] ]; + } + return obj; + } + }); + // Make sure only one callback list will be used + deferred.done( failDeferred.cancel ).fail( deferred.cancel ); + // Unexpose cancel + delete deferred.cancel; + // Call given func if any + if ( func ) { + func.call( deferred, deferred ); + } + return deferred; + }, + + // Deferred helper + when: function( firstParam ) { + var args = arguments, + i = 0, + length = args.length, + count = length, + deferred = length <= 1 && firstParam && jQuery.isFunction( firstParam.promise ) ? + firstParam : + jQuery.Deferred(); + function resolveFunc( i ) { + return function( value ) { + args[ i ] = arguments.length > 1 ? sliceDeferred.call( arguments, 0 ) : value; + if ( !( --count ) ) { + // Strange bug in FF4: + // Values changed onto the arguments object sometimes end up as undefined values + // outside the $.when method. Cloning the object into a fresh array solves the issue + deferred.resolveWith( deferred, sliceDeferred.call( args, 0 ) ); + } + }; + } + if ( length > 1 ) { + for( ; i < length; i++ ) { + if ( args[ i ] && jQuery.isFunction( args[ i ].promise ) ) { + args[ i ].promise().then( resolveFunc(i), deferred.reject ); + } else { + --count; + } + } + if ( !count ) { + deferred.resolveWith( deferred, args ); + } + } else if ( deferred !== firstParam ) { + deferred.resolveWith( deferred, length ? [ firstParam ] : [] ); + } + return deferred.promise(); + } +}); + + + +jQuery.support = (function() { + + var div = document.createElement( "div" ), + documentElement = document.documentElement, + all, + a, + select, + opt, + input, + marginDiv, + support, + fragment, + body, + testElementParent, + testElement, + testElementStyle, + tds, + events, + eventName, + i, + isSupported; + + // Preliminary tests + div.setAttribute("className", "t"); + div.innerHTML = "
a"; + + all = div.getElementsByTagName( "*" ); + a = div.getElementsByTagName( "a" )[ 0 ]; + + // Can't get basic test support + if ( !all || !all.length || !a ) { + return {}; + } + + // First batch of supports tests + select = document.createElement( "select" ); + opt = select.appendChild( document.createElement("option") ); + input = div.getElementsByTagName( "input" )[ 0 ]; + + support = { + // IE strips leading whitespace when .innerHTML is used + leadingWhitespace: ( div.firstChild.nodeType === 3 ), + + // Make sure that tbody elements aren't automatically inserted + // IE will insert them into empty tables + tbody: !div.getElementsByTagName( "tbody" ).length, + + // Make sure that link elements get serialized correctly by innerHTML + // This requires a wrapper element in IE + htmlSerialize: !!div.getElementsByTagName( "link" ).length, + + // Get the style information from getAttribute + // (IE uses .cssText instead) + style: /top/.test( a.getAttribute("style") ), + + // Make sure that URLs aren't manipulated + // (IE normalizes it by default) + hrefNormalized: ( a.getAttribute( "href" ) === "/a" ), + + // Make sure that element opacity exists + // (IE uses filter instead) + // Use a regex to work around a WebKit issue. See #5145 + opacity: /^0.55$/.test( a.style.opacity ), + + // Verify style float existence + // (IE uses styleFloat instead of cssFloat) + cssFloat: !!a.style.cssFloat, + + // Make sure that if no value is specified for a checkbox + // that it defaults to "on". + // (WebKit defaults to "" instead) + checkOn: ( input.value === "on" ), + + // Make sure that a selected-by-default option has a working selected property. + // (WebKit defaults to false instead of true, IE too, if it's in an optgroup) + optSelected: opt.selected, + + // Test setAttribute on camelCase class. If it works, we need attrFixes when doing get/setAttribute (ie6/7) + getSetAttribute: div.className !== "t", + + // Will be defined later + submitBubbles: true, + changeBubbles: true, + focusinBubbles: false, + deleteExpando: true, + noCloneEvent: true, + inlineBlockNeedsLayout: false, + shrinkWrapBlocks: false, + reliableMarginRight: true + }; + + // Make sure checked status is properly cloned + input.checked = true; + support.noCloneChecked = input.cloneNode( true ).checked; + + // Make sure that the options inside disabled selects aren't marked as disabled + // (WebKit marks them as disabled) + select.disabled = true; + support.optDisabled = !opt.disabled; + + // Test to see if it's possible to delete an expando from an element + // Fails in Internet Explorer + try { + delete div.test; + } catch( e ) { + support.deleteExpando = false; + } + + if ( !div.addEventListener && div.attachEvent && div.fireEvent ) { + div.attachEvent( "onclick", function() { + // Cloning a node shouldn't copy over any + // bound event handlers (IE does this) + support.noCloneEvent = false; + }); + div.cloneNode( true ).fireEvent( "onclick" ); + } + + // Check if a radio maintains it's value + // after being appended to the DOM + input = document.createElement("input"); + input.value = "t"; + input.setAttribute("type", "radio"); + support.radioValue = input.value === "t"; + + input.setAttribute("checked", "checked"); + div.appendChild( input ); + fragment = document.createDocumentFragment(); + fragment.appendChild( div.firstChild ); + + // WebKit doesn't clone checked state correctly in fragments + support.checkClone = fragment.cloneNode( true ).cloneNode( true ).lastChild.checked; + + div.innerHTML = ""; + + // Figure out if the W3C box model works as expected + div.style.width = div.style.paddingLeft = "1px"; + + body = document.getElementsByTagName( "body" )[ 0 ]; + // We use our own, invisible, body unless the body is already present + // in which case we use a div (#9239) + testElement = document.createElement( body ? "div" : "body" ); + testElementStyle = { + visibility: "hidden", + width: 0, + height: 0, + border: 0, + margin: 0 + }; + if ( body ) { + jQuery.extend( testElementStyle, { + position: "absolute", + left: -1000, + top: -1000 + }); + } + for ( i in testElementStyle ) { + testElement.style[ i ] = testElementStyle[ i ]; + } + testElement.appendChild( div ); + testElementParent = body || documentElement; + testElementParent.insertBefore( testElement, testElementParent.firstChild ); + + // Check if a disconnected checkbox will retain its checked + // value of true after appended to the DOM (IE6/7) + support.appendChecked = input.checked; + + support.boxModel = div.offsetWidth === 2; + + if ( "zoom" in div.style ) { + // Check if natively block-level elements act like inline-block + // elements when setting their display to 'inline' and giving + // them layout + // (IE < 8 does this) + div.style.display = "inline"; + div.style.zoom = 1; + support.inlineBlockNeedsLayout = ( div.offsetWidth === 2 ); + + // Check if elements with layout shrink-wrap their children + // (IE 6 does this) + div.style.display = ""; + div.innerHTML = "
"; + support.shrinkWrapBlocks = ( div.offsetWidth !== 2 ); + } + + div.innerHTML = "
t
"; + tds = div.getElementsByTagName( "td" ); + + // Check if table cells still have offsetWidth/Height when they are set + // to display:none and there are still other visible table cells in a + // table row; if so, offsetWidth/Height are not reliable for use when + // determining if an element has been hidden directly using + // display:none (it is still safe to use offsets if a parent element is + // hidden; don safety goggles and see bug #4512 for more information). + // (only IE 8 fails this test) + isSupported = ( tds[ 0 ].offsetHeight === 0 ); + + tds[ 0 ].style.display = ""; + tds[ 1 ].style.display = "none"; + + // Check if empty table cells still have offsetWidth/Height + // (IE < 8 fail this test) + support.reliableHiddenOffsets = isSupported && ( tds[ 0 ].offsetHeight === 0 ); + div.innerHTML = ""; + + // Check if div with explicit width and no margin-right incorrectly + // gets computed margin-right based on width of container. For more + // info see bug #3333 + // Fails in WebKit before Feb 2011 nightlies + // WebKit Bug 13343 - getComputedStyle returns wrong value for margin-right + if ( document.defaultView && document.defaultView.getComputedStyle ) { + marginDiv = document.createElement( "div" ); + marginDiv.style.width = "0"; + marginDiv.style.marginRight = "0"; + div.appendChild( marginDiv ); + support.reliableMarginRight = + ( parseInt( ( document.defaultView.getComputedStyle( marginDiv, null ) || { marginRight: 0 } ).marginRight, 10 ) || 0 ) === 0; + } + + // Remove the body element we added + testElement.innerHTML = ""; + testElementParent.removeChild( testElement ); + + // Technique from Juriy Zaytsev + // http://thinkweb2.com/projects/prototype/detecting-event-support-without-browser-sniffing/ + // We only care about the case where non-standard event systems + // are used, namely in IE. Short-circuiting here helps us to + // avoid an eval call (in setAttribute) which can cause CSP + // to go haywire. See: https://developer.mozilla.org/en/Security/CSP + if ( div.attachEvent ) { + for( i in { + submit: 1, + change: 1, + focusin: 1 + } ) { + eventName = "on" + i; + isSupported = ( eventName in div ); + if ( !isSupported ) { + div.setAttribute( eventName, "return;" ); + isSupported = ( typeof div[ eventName ] === "function" ); + } + support[ i + "Bubbles" ] = isSupported; + } + } + + // Null connected elements to avoid leaks in IE + testElement = fragment = select = opt = body = marginDiv = div = input = null; + + return support; +})(); + +// Keep track of boxModel +jQuery.boxModel = jQuery.support.boxModel; + + + + +var rbrace = /^(?:\{.*\}|\[.*\])$/, + rmultiDash = /([a-z])([A-Z])/g; + +jQuery.extend({ + cache: {}, + + // Please use with caution + uuid: 0, + + // Unique for each copy of jQuery on the page + // Non-digits removed to match rinlinejQuery + expando: "jQuery" + ( jQuery.fn.jquery + Math.random() ).replace( /\D/g, "" ), + + // The following elements throw uncatchable exceptions if you + // attempt to add expando properties to them. + noData: { + "embed": true, + // Ban all objects except for Flash (which handle expandos) + "object": "clsid:D27CDB6E-AE6D-11cf-96B8-444553540000", + "applet": true + }, + + hasData: function( elem ) { + elem = elem.nodeType ? jQuery.cache[ elem[jQuery.expando] ] : elem[ jQuery.expando ]; + + return !!elem && !isEmptyDataObject( elem ); + }, + + data: function( elem, name, data, pvt /* Internal Use Only */ ) { + if ( !jQuery.acceptData( elem ) ) { + return; + } + + var internalKey = jQuery.expando, getByName = typeof name === "string", thisCache, + + // We have to handle DOM nodes and JS objects differently because IE6-7 + // can't GC object references properly across the DOM-JS boundary + isNode = elem.nodeType, + + // Only DOM nodes need the global jQuery cache; JS object data is + // attached directly to the object so GC can occur automatically + cache = isNode ? jQuery.cache : elem, + + // Only defining an ID for JS objects if its cache already exists allows + // the code to shortcut on the same path as a DOM node with no cache + id = isNode ? elem[ jQuery.expando ] : elem[ jQuery.expando ] && jQuery.expando; + + // Avoid doing any more work than we need to when trying to get data on an + // object that has no data at all + if ( (!id || (pvt && id && !cache[ id ][ internalKey ])) && getByName && data === undefined ) { + return; + } + + if ( !id ) { + // Only DOM nodes need a new unique ID for each element since their data + // ends up in the global cache + if ( isNode ) { + elem[ jQuery.expando ] = id = ++jQuery.uuid; + } else { + id = jQuery.expando; + } + } + + if ( !cache[ id ] ) { + cache[ id ] = {}; + + // TODO: This is a hack for 1.5 ONLY. Avoids exposing jQuery + // metadata on plain JS objects when the object is serialized using + // JSON.stringify + if ( !isNode ) { + cache[ id ].toJSON = jQuery.noop; + } + } + + // An object can be passed to jQuery.data instead of a key/value pair; this gets + // shallow copied over onto the existing cache + if ( typeof name === "object" || typeof name === "function" ) { + if ( pvt ) { + cache[ id ][ internalKey ] = jQuery.extend(cache[ id ][ internalKey ], name); + } else { + cache[ id ] = jQuery.extend(cache[ id ], name); + } + } + + thisCache = cache[ id ]; + + // Internal jQuery data is stored in a separate object inside the object's data + // cache in order to avoid key collisions between internal data and user-defined + // data + if ( pvt ) { + if ( !thisCache[ internalKey ] ) { + thisCache[ internalKey ] = {}; + } + + thisCache = thisCache[ internalKey ]; + } + + if ( data !== undefined ) { + thisCache[ jQuery.camelCase( name ) ] = data; + } + + // TODO: This is a hack for 1.5 ONLY. It will be removed in 1.6. Users should + // not attempt to inspect the internal events object using jQuery.data, as this + // internal data object is undocumented and subject to change. + if ( name === "events" && !thisCache[name] ) { + return thisCache[ internalKey ] && thisCache[ internalKey ].events; + } + + return getByName ? + // Check for both converted-to-camel and non-converted data property names + thisCache[ jQuery.camelCase( name ) ] || thisCache[ name ] : + thisCache; + }, + + removeData: function( elem, name, pvt /* Internal Use Only */ ) { + if ( !jQuery.acceptData( elem ) ) { + return; + } + + var internalKey = jQuery.expando, isNode = elem.nodeType, + + // See jQuery.data for more information + cache = isNode ? jQuery.cache : elem, + + // See jQuery.data for more information + id = isNode ? elem[ jQuery.expando ] : jQuery.expando; + + // If there is already no cache entry for this object, there is no + // purpose in continuing + if ( !cache[ id ] ) { + return; + } + + if ( name ) { + var thisCache = pvt ? cache[ id ][ internalKey ] : cache[ id ]; + + if ( thisCache ) { + delete thisCache[ name ]; + + // If there is no data left in the cache, we want to continue + // and let the cache object itself get destroyed + if ( !isEmptyDataObject(thisCache) ) { + return; + } + } + } + + // See jQuery.data for more information + if ( pvt ) { + delete cache[ id ][ internalKey ]; + + // Don't destroy the parent cache unless the internal data object + // had been the only thing left in it + if ( !isEmptyDataObject(cache[ id ]) ) { + return; + } + } + + var internalCache = cache[ id ][ internalKey ]; + + // Browsers that fail expando deletion also refuse to delete expandos on + // the window, but it will allow it on all other JS objects; other browsers + // don't care + if ( jQuery.support.deleteExpando || cache != window ) { + delete cache[ id ]; + } else { + cache[ id ] = null; + } + + // We destroyed the entire user cache at once because it's faster than + // iterating through each key, but we need to continue to persist internal + // data if it existed + if ( internalCache ) { + cache[ id ] = {}; + // TODO: This is a hack for 1.5 ONLY. Avoids exposing jQuery + // metadata on plain JS objects when the object is serialized using + // JSON.stringify + if ( !isNode ) { + cache[ id ].toJSON = jQuery.noop; + } + + cache[ id ][ internalKey ] = internalCache; + + // Otherwise, we need to eliminate the expando on the node to avoid + // false lookups in the cache for entries that no longer exist + } else if ( isNode ) { + // IE does not allow us to delete expando properties from nodes, + // nor does it have a removeAttribute function on Document nodes; + // we must handle all of these cases + if ( jQuery.support.deleteExpando ) { + delete elem[ jQuery.expando ]; + } else if ( elem.removeAttribute ) { + elem.removeAttribute( jQuery.expando ); + } else { + elem[ jQuery.expando ] = null; + } + } + }, + + // For internal use only. + _data: function( elem, name, data ) { + return jQuery.data( elem, name, data, true ); + }, + + // A method for determining if a DOM node can handle the data expando + acceptData: function( elem ) { + if ( elem.nodeName ) { + var match = jQuery.noData[ elem.nodeName.toLowerCase() ]; + + if ( match ) { + return !(match === true || elem.getAttribute("classid") !== match); + } + } + + return true; + } +}); + +jQuery.fn.extend({ + data: function( key, value ) { + var data = null; + + if ( typeof key === "undefined" ) { + if ( this.length ) { + data = jQuery.data( this[0] ); + + if ( this[0].nodeType === 1 ) { + var attr = this[0].attributes, name; + for ( var i = 0, l = attr.length; i < l; i++ ) { + name = attr[i].name; + + if ( name.indexOf( "data-" ) === 0 ) { + name = jQuery.camelCase( name.substring(5) ); + + dataAttr( this[0], name, data[ name ] ); + } + } + } + } + + return data; + + } else if ( typeof key === "object" ) { + return this.each(function() { + jQuery.data( this, key ); + }); + } + + var parts = key.split("."); + parts[1] = parts[1] ? "." + parts[1] : ""; + + if ( value === undefined ) { + data = this.triggerHandler("getData" + parts[1] + "!", [parts[0]]); + + // Try to fetch any internally stored data first + if ( data === undefined && this.length ) { + data = jQuery.data( this[0], key ); + data = dataAttr( this[0], key, data ); + } + + return data === undefined && parts[1] ? + this.data( parts[0] ) : + data; + + } else { + return this.each(function() { + var $this = jQuery( this ), + args = [ parts[0], value ]; + + $this.triggerHandler( "setData" + parts[1] + "!", args ); + jQuery.data( this, key, value ); + $this.triggerHandler( "changeData" + parts[1] + "!", args ); + }); + } + }, + + removeData: function( key ) { + return this.each(function() { + jQuery.removeData( this, key ); + }); + } +}); + +function dataAttr( elem, key, data ) { + // If nothing was found internally, try to fetch any + // data from the HTML5 data-* attribute + if ( data === undefined && elem.nodeType === 1 ) { + var name = "data-" + key.replace( rmultiDash, "$1-$2" ).toLowerCase(); + + data = elem.getAttribute( name ); + + if ( typeof data === "string" ) { + try { + data = data === "true" ? true : + data === "false" ? false : + data === "null" ? null : + !jQuery.isNaN( data ) ? parseFloat( data ) : + rbrace.test( data ) ? jQuery.parseJSON( data ) : + data; + } catch( e ) {} + + // Make sure we set the data so it isn't changed later + jQuery.data( elem, key, data ); + + } else { + data = undefined; + } + } + + return data; +} + +// TODO: This is a hack for 1.5 ONLY to allow objects with a single toJSON +// property to be considered empty objects; this property always exists in +// order to make sure JSON.stringify does not expose internal metadata +function isEmptyDataObject( obj ) { + for ( var name in obj ) { + if ( name !== "toJSON" ) { + return false; + } + } + + return true; +} + + + + +function handleQueueMarkDefer( elem, type, src ) { + var deferDataKey = type + "defer", + queueDataKey = type + "queue", + markDataKey = type + "mark", + defer = jQuery.data( elem, deferDataKey, undefined, true ); + if ( defer && + ( src === "queue" || !jQuery.data( elem, queueDataKey, undefined, true ) ) && + ( src === "mark" || !jQuery.data( elem, markDataKey, undefined, true ) ) ) { + // Give room for hard-coded callbacks to fire first + // and eventually mark/queue something else on the element + setTimeout( function() { + if ( !jQuery.data( elem, queueDataKey, undefined, true ) && + !jQuery.data( elem, markDataKey, undefined, true ) ) { + jQuery.removeData( elem, deferDataKey, true ); + defer.resolve(); + } + }, 0 ); + } +} + +jQuery.extend({ + + _mark: function( elem, type ) { + if ( elem ) { + type = (type || "fx") + "mark"; + jQuery.data( elem, type, (jQuery.data(elem,type,undefined,true) || 0) + 1, true ); + } + }, + + _unmark: function( force, elem, type ) { + if ( force !== true ) { + type = elem; + elem = force; + force = false; + } + if ( elem ) { + type = type || "fx"; + var key = type + "mark", + count = force ? 0 : ( (jQuery.data( elem, key, undefined, true) || 1 ) - 1 ); + if ( count ) { + jQuery.data( elem, key, count, true ); + } else { + jQuery.removeData( elem, key, true ); + handleQueueMarkDefer( elem, type, "mark" ); + } + } + }, + + queue: function( elem, type, data ) { + if ( elem ) { + type = (type || "fx") + "queue"; + var q = jQuery.data( elem, type, undefined, true ); + // Speed up dequeue by getting out quickly if this is just a lookup + if ( data ) { + if ( !q || jQuery.isArray(data) ) { + q = jQuery.data( elem, type, jQuery.makeArray(data), true ); + } else { + q.push( data ); + } + } + return q || []; + } + }, + + dequeue: function( elem, type ) { + type = type || "fx"; + + var queue = jQuery.queue( elem, type ), + fn = queue.shift(), + defer; + + // If the fx queue is dequeued, always remove the progress sentinel + if ( fn === "inprogress" ) { + fn = queue.shift(); + } + + if ( fn ) { + // Add a progress sentinel to prevent the fx queue from being + // automatically dequeued + if ( type === "fx" ) { + queue.unshift("inprogress"); + } + + fn.call(elem, function() { + jQuery.dequeue(elem, type); + }); + } + + if ( !queue.length ) { + jQuery.removeData( elem, type + "queue", true ); + handleQueueMarkDefer( elem, type, "queue" ); + } + } +}); + +jQuery.fn.extend({ + queue: function( type, data ) { + if ( typeof type !== "string" ) { + data = type; + type = "fx"; + } + + if ( data === undefined ) { + return jQuery.queue( this[0], type ); + } + return this.each(function() { + var queue = jQuery.queue( this, type, data ); + + if ( type === "fx" && queue[0] !== "inprogress" ) { + jQuery.dequeue( this, type ); + } + }); + }, + dequeue: function( type ) { + return this.each(function() { + jQuery.dequeue( this, type ); + }); + }, + // Based off of the plugin by Clint Helfers, with permission. + // http://blindsignals.com/index.php/2009/07/jquery-delay/ + delay: function( time, type ) { + time = jQuery.fx ? jQuery.fx.speeds[time] || time : time; + type = type || "fx"; + + return this.queue( type, function() { + var elem = this; + setTimeout(function() { + jQuery.dequeue( elem, type ); + }, time ); + }); + }, + clearQueue: function( type ) { + return this.queue( type || "fx", [] ); + }, + // Get a promise resolved when queues of a certain type + // are emptied (fx is the type by default) + promise: function( type, object ) { + if ( typeof type !== "string" ) { + object = type; + type = undefined; + } + type = type || "fx"; + var defer = jQuery.Deferred(), + elements = this, + i = elements.length, + count = 1, + deferDataKey = type + "defer", + queueDataKey = type + "queue", + markDataKey = type + "mark", + tmp; + function resolve() { + if ( !( --count ) ) { + defer.resolveWith( elements, [ elements ] ); + } + } + while( i-- ) { + if (( tmp = jQuery.data( elements[ i ], deferDataKey, undefined, true ) || + ( jQuery.data( elements[ i ], queueDataKey, undefined, true ) || + jQuery.data( elements[ i ], markDataKey, undefined, true ) ) && + jQuery.data( elements[ i ], deferDataKey, jQuery._Deferred(), true ) )) { + count++; + tmp.done( resolve ); + } + } + resolve(); + return defer.promise(); + } +}); + + + + +var rclass = /[\n\t\r]/g, + rspace = /\s+/, + rreturn = /\r/g, + rtype = /^(?:button|input)$/i, + rfocusable = /^(?:button|input|object|select|textarea)$/i, + rclickable = /^a(?:rea)?$/i, + rboolean = /^(?:autofocus|autoplay|async|checked|controls|defer|disabled|hidden|loop|multiple|open|readonly|required|scoped|selected)$/i, + rinvalidChar = /\:|^on/, + formHook, boolHook; + +jQuery.fn.extend({ + attr: function( name, value ) { + return jQuery.access( this, name, value, true, jQuery.attr ); + }, + + removeAttr: function( name ) { + return this.each(function() { + jQuery.removeAttr( this, name ); + }); + }, + + prop: function( name, value ) { + return jQuery.access( this, name, value, true, jQuery.prop ); + }, + + removeProp: function( name ) { + name = jQuery.propFix[ name ] || name; + return this.each(function() { + // try/catch handles cases where IE balks (such as removing a property on window) + try { + this[ name ] = undefined; + delete this[ name ]; + } catch( e ) {} + }); + }, + + addClass: function( value ) { + var classNames, i, l, elem, + setClass, c, cl; + + if ( jQuery.isFunction( value ) ) { + return this.each(function( j ) { + jQuery( this ).addClass( value.call(this, j, this.className) ); + }); + } + + if ( value && typeof value === "string" ) { + classNames = value.split( rspace ); + + for ( i = 0, l = this.length; i < l; i++ ) { + elem = this[ i ]; + + if ( elem.nodeType === 1 ) { + if ( !elem.className && classNames.length === 1 ) { + elem.className = value; + + } else { + setClass = " " + elem.className + " "; + + for ( c = 0, cl = classNames.length; c < cl; c++ ) { + if ( !~setClass.indexOf( " " + classNames[ c ] + " " ) ) { + setClass += classNames[ c ] + " "; + } + } + elem.className = jQuery.trim( setClass ); + } + } + } + } + + return this; + }, + + removeClass: function( value ) { + var classNames, i, l, elem, className, c, cl; + + if ( jQuery.isFunction( value ) ) { + return this.each(function( j ) { + jQuery( this ).removeClass( value.call(this, j, this.className) ); + }); + } + + if ( (value && typeof value === "string") || value === undefined ) { + classNames = (value || "").split( rspace ); + + for ( i = 0, l = this.length; i < l; i++ ) { + elem = this[ i ]; + + if ( elem.nodeType === 1 && elem.className ) { + if ( value ) { + className = (" " + elem.className + " ").replace( rclass, " " ); + for ( c = 0, cl = classNames.length; c < cl; c++ ) { + className = className.replace(" " + classNames[ c ] + " ", " "); + } + elem.className = jQuery.trim( className ); + + } else { + elem.className = ""; + } + } + } + } + + return this; + }, + + toggleClass: function( value, stateVal ) { + var type = typeof value, + isBool = typeof stateVal === "boolean"; + + if ( jQuery.isFunction( value ) ) { + return this.each(function( i ) { + jQuery( this ).toggleClass( value.call(this, i, this.className, stateVal), stateVal ); + }); + } + + return this.each(function() { + if ( type === "string" ) { + // toggle individual class names + var className, + i = 0, + self = jQuery( this ), + state = stateVal, + classNames = value.split( rspace ); + + while ( (className = classNames[ i++ ]) ) { + // check each className given, space seperated list + state = isBool ? state : !self.hasClass( className ); + self[ state ? "addClass" : "removeClass" ]( className ); + } + + } else if ( type === "undefined" || type === "boolean" ) { + if ( this.className ) { + // store className if set + jQuery._data( this, "__className__", this.className ); + } + + // toggle whole className + this.className = this.className || value === false ? "" : jQuery._data( this, "__className__" ) || ""; + } + }); + }, + + hasClass: function( selector ) { + var className = " " + selector + " "; + for ( var i = 0, l = this.length; i < l; i++ ) { + if ( (" " + this[i].className + " ").replace(rclass, " ").indexOf( className ) > -1 ) { + return true; + } + } + + return false; + }, + + val: function( value ) { + var hooks, ret, + elem = this[0]; + + if ( !arguments.length ) { + if ( elem ) { + hooks = jQuery.valHooks[ elem.nodeName.toLowerCase() ] || jQuery.valHooks[ elem.type ]; + + if ( hooks && "get" in hooks && (ret = hooks.get( elem, "value" )) !== undefined ) { + return ret; + } + + ret = elem.value; + + return typeof ret === "string" ? + // handle most common string cases + ret.replace(rreturn, "") : + // handle cases where value is null/undef or number + ret == null ? "" : ret; + } + + return undefined; + } + + var isFunction = jQuery.isFunction( value ); + + return this.each(function( i ) { + var self = jQuery(this), val; + + if ( this.nodeType !== 1 ) { + return; + } + + if ( isFunction ) { + val = value.call( this, i, self.val() ); + } else { + val = value; + } + + // Treat null/undefined as ""; convert numbers to string + if ( val == null ) { + val = ""; + } else if ( typeof val === "number" ) { + val += ""; + } else if ( jQuery.isArray( val ) ) { + val = jQuery.map(val, function ( value ) { + return value == null ? "" : value + ""; + }); + } + + hooks = jQuery.valHooks[ this.nodeName.toLowerCase() ] || jQuery.valHooks[ this.type ]; + + // If set returns undefined, fall back to normal setting + if ( !hooks || !("set" in hooks) || hooks.set( this, val, "value" ) === undefined ) { + this.value = val; + } + }); + } +}); + +jQuery.extend({ + valHooks: { + option: { + get: function( elem ) { + // attributes.value is undefined in Blackberry 4.7 but + // uses .value. See #6932 + var val = elem.attributes.value; + return !val || val.specified ? elem.value : elem.text; + } + }, + select: { + get: function( elem ) { + var value, + index = elem.selectedIndex, + values = [], + options = elem.options, + one = elem.type === "select-one"; + + // Nothing was selected + if ( index < 0 ) { + return null; + } + + // Loop through all the selected options + for ( var i = one ? index : 0, max = one ? index + 1 : options.length; i < max; i++ ) { + var option = options[ i ]; + + // Don't return options that are disabled or in a disabled optgroup + if ( option.selected && (jQuery.support.optDisabled ? !option.disabled : option.getAttribute("disabled") === null) && + (!option.parentNode.disabled || !jQuery.nodeName( option.parentNode, "optgroup" )) ) { + + // Get the specific value for the option + value = jQuery( option ).val(); + + // We don't need an array for one selects + if ( one ) { + return value; + } + + // Multi-Selects return an array + values.push( value ); + } + } + + // Fixes Bug #2551 -- select.val() broken in IE after form.reset() + if ( one && !values.length && options.length ) { + return jQuery( options[ index ] ).val(); + } + + return values; + }, + + set: function( elem, value ) { + var values = jQuery.makeArray( value ); + + jQuery(elem).find("option").each(function() { + this.selected = jQuery.inArray( jQuery(this).val(), values ) >= 0; + }); + + if ( !values.length ) { + elem.selectedIndex = -1; + } + return values; + } + } + }, + + attrFn: { + val: true, + css: true, + html: true, + text: true, + data: true, + width: true, + height: true, + offset: true + }, + + attrFix: { + // Always normalize to ensure hook usage + tabindex: "tabIndex" + }, + + attr: function( elem, name, value, pass ) { + var nType = elem.nodeType; + + // don't get/set attributes on text, comment and attribute nodes + if ( !elem || nType === 3 || nType === 8 || nType === 2 ) { + return undefined; + } + + if ( pass && name in jQuery.attrFn ) { + return jQuery( elem )[ name ]( value ); + } + + // Fallback to prop when attributes are not supported + if ( !("getAttribute" in elem) ) { + return jQuery.prop( elem, name, value ); + } + + var ret, hooks, + notxml = nType !== 1 || !jQuery.isXMLDoc( elem ); + + // Normalize the name if needed + if ( notxml ) { + name = jQuery.attrFix[ name ] || name; + + hooks = jQuery.attrHooks[ name ]; + + if ( !hooks ) { + // Use boolHook for boolean attributes + if ( rboolean.test( name ) ) { + + hooks = boolHook; + + // Use formHook for forms and if the name contains certain characters + } else if ( formHook && name !== "className" && + (jQuery.nodeName( elem, "form" ) || rinvalidChar.test( name )) ) { + + hooks = formHook; + } + } + } + + if ( value !== undefined ) { + + if ( value === null ) { + jQuery.removeAttr( elem, name ); + return undefined; + + } else if ( hooks && "set" in hooks && notxml && (ret = hooks.set( elem, value, name )) !== undefined ) { + return ret; + + } else { + elem.setAttribute( name, "" + value ); + return value; + } + + } else if ( hooks && "get" in hooks && notxml && (ret = hooks.get( elem, name )) !== null ) { + return ret; + + } else { + + ret = elem.getAttribute( name ); + + // Non-existent attributes return null, we normalize to undefined + return ret === null ? + undefined : + ret; + } + }, + + removeAttr: function( elem, name ) { + var propName; + if ( elem.nodeType === 1 ) { + name = jQuery.attrFix[ name ] || name; + + if ( jQuery.support.getSetAttribute ) { + // Use removeAttribute in browsers that support it + elem.removeAttribute( name ); + } else { + jQuery.attr( elem, name, "" ); + elem.removeAttributeNode( elem.getAttributeNode( name ) ); + } + + // Set corresponding property to false for boolean attributes + if ( rboolean.test( name ) && (propName = jQuery.propFix[ name ] || name) in elem ) { + elem[ propName ] = false; + } + } + }, + + attrHooks: { + type: { + set: function( elem, value ) { + // We can't allow the type property to be changed (since it causes problems in IE) + if ( rtype.test( elem.nodeName ) && elem.parentNode ) { + jQuery.error( "type property can't be changed" ); + } else if ( !jQuery.support.radioValue && value === "radio" && jQuery.nodeName(elem, "input") ) { + // Setting the type on a radio button after the value resets the value in IE6-9 + // Reset value to it's default in case type is set after value + // This is for element creation + var val = elem.value; + elem.setAttribute( "type", value ); + if ( val ) { + elem.value = val; + } + return value; + } + } + }, + tabIndex: { + get: function( elem ) { + // elem.tabIndex doesn't always return the correct value when it hasn't been explicitly set + // http://fluidproject.org/blog/2008/01/09/getting-setting-and-removing-tabindex-values-with-javascript/ + var attributeNode = elem.getAttributeNode("tabIndex"); + + return attributeNode && attributeNode.specified ? + parseInt( attributeNode.value, 10 ) : + rfocusable.test( elem.nodeName ) || rclickable.test( elem.nodeName ) && elem.href ? + 0 : + undefined; + } + }, + // Use the value property for back compat + // Use the formHook for button elements in IE6/7 (#1954) + value: { + get: function( elem, name ) { + if ( formHook && jQuery.nodeName( elem, "button" ) ) { + return formHook.get( elem, name ); + } + return name in elem ? + elem.value : + null; + }, + set: function( elem, value, name ) { + if ( formHook && jQuery.nodeName( elem, "button" ) ) { + return formHook.set( elem, value, name ); + } + // Does not return so that setAttribute is also used + elem.value = value; + } + } + }, + + propFix: { + tabindex: "tabIndex", + readonly: "readOnly", + "for": "htmlFor", + "class": "className", + maxlength: "maxLength", + cellspacing: "cellSpacing", + cellpadding: "cellPadding", + rowspan: "rowSpan", + colspan: "colSpan", + usemap: "useMap", + frameborder: "frameBorder", + contenteditable: "contentEditable" + }, + + prop: function( elem, name, value ) { + var nType = elem.nodeType; + + // don't get/set properties on text, comment and attribute nodes + if ( !elem || nType === 3 || nType === 8 || nType === 2 ) { + return undefined; + } + + var ret, hooks, + notxml = nType !== 1 || !jQuery.isXMLDoc( elem ); + + if ( notxml ) { + // Fix name and attach hooks + name = jQuery.propFix[ name ] || name; + hooks = jQuery.propHooks[ name ]; + } + + if ( value !== undefined ) { + if ( hooks && "set" in hooks && (ret = hooks.set( elem, value, name )) !== undefined ) { + return ret; + + } else { + return (elem[ name ] = value); + } + + } else { + if ( hooks && "get" in hooks && (ret = hooks.get( elem, name )) !== undefined ) { + return ret; + + } else { + return elem[ name ]; + } + } + }, + + propHooks: {} +}); + +// Hook for boolean attributes +boolHook = { + get: function( elem, name ) { + // Align boolean attributes with corresponding properties + return jQuery.prop( elem, name ) ? + name.toLowerCase() : + undefined; + }, + set: function( elem, value, name ) { + var propName; + if ( value === false ) { + // Remove boolean attributes when set to false + jQuery.removeAttr( elem, name ); + } else { + // value is true since we know at this point it's type boolean and not false + // Set boolean attributes to the same name and set the DOM property + propName = jQuery.propFix[ name ] || name; + if ( propName in elem ) { + // Only set the IDL specifically if it already exists on the element + elem[ propName ] = true; + } + + elem.setAttribute( name, name.toLowerCase() ); + } + return name; + } +}; + +// IE6/7 do not support getting/setting some attributes with get/setAttribute +if ( !jQuery.support.getSetAttribute ) { + + // propFix is more comprehensive and contains all fixes + jQuery.attrFix = jQuery.propFix; + + // Use this for any attribute on a form in IE6/7 + formHook = jQuery.attrHooks.name = jQuery.attrHooks.title = jQuery.valHooks.button = { + get: function( elem, name ) { + var ret; + ret = elem.getAttributeNode( name ); + // Return undefined if nodeValue is empty string + return ret && ret.nodeValue !== "" ? + ret.nodeValue : + undefined; + }, + set: function( elem, value, name ) { + // Check form objects in IE (multiple bugs related) + // Only use nodeValue if the attribute node exists on the form + var ret = elem.getAttributeNode( name ); + if ( ret ) { + ret.nodeValue = value; + return value; + } + } + }; + + // Set width and height to auto instead of 0 on empty string( Bug #8150 ) + // This is for removals + jQuery.each([ "width", "height" ], function( i, name ) { + jQuery.attrHooks[ name ] = jQuery.extend( jQuery.attrHooks[ name ], { + set: function( elem, value ) { + if ( value === "" ) { + elem.setAttribute( name, "auto" ); + return value; + } + } + }); + }); +} + + +// Some attributes require a special call on IE +if ( !jQuery.support.hrefNormalized ) { + jQuery.each([ "href", "src", "width", "height" ], function( i, name ) { + jQuery.attrHooks[ name ] = jQuery.extend( jQuery.attrHooks[ name ], { + get: function( elem ) { + var ret = elem.getAttribute( name, 2 ); + return ret === null ? undefined : ret; + } + }); + }); +} + +if ( !jQuery.support.style ) { + jQuery.attrHooks.style = { + get: function( elem ) { + // Return undefined in the case of empty string + // Normalize to lowercase since IE uppercases css property names + return elem.style.cssText.toLowerCase() || undefined; + }, + set: function( elem, value ) { + return (elem.style.cssText = "" + value); + } + }; +} + +// Safari mis-reports the default selected property of an option +// Accessing the parent's selectedIndex property fixes it +if ( !jQuery.support.optSelected ) { + jQuery.propHooks.selected = jQuery.extend( jQuery.propHooks.selected, { + get: function( elem ) { + var parent = elem.parentNode; + + if ( parent ) { + parent.selectedIndex; + + // Make sure that it also works with optgroups, see #5701 + if ( parent.parentNode ) { + parent.parentNode.selectedIndex; + } + } + } + }); +} + +// Radios and checkboxes getter/setter +if ( !jQuery.support.checkOn ) { + jQuery.each([ "radio", "checkbox" ], function() { + jQuery.valHooks[ this ] = { + get: function( elem ) { + // Handle the case where in Webkit "" is returned instead of "on" if a value isn't specified + return elem.getAttribute("value") === null ? "on" : elem.value; + } + }; + }); +} +jQuery.each([ "radio", "checkbox" ], function() { + jQuery.valHooks[ this ] = jQuery.extend( jQuery.valHooks[ this ], { + set: function( elem, value ) { + if ( jQuery.isArray( value ) ) { + return (elem.checked = jQuery.inArray( jQuery(elem).val(), value ) >= 0); + } + } + }); +}); + + + + +var rnamespaces = /\.(.*)$/, + rformElems = /^(?:textarea|input|select)$/i, + rperiod = /\./g, + rspaces = / /g, + rescape = /[^\w\s.|`]/g, + fcleanup = function( nm ) { + return nm.replace(rescape, "\\$&"); + }; + +/* + * A number of helper functions used for managing events. + * Many of the ideas behind this code originated from + * Dean Edwards' addEvent library. + */ +jQuery.event = { + + // Bind an event to an element + // Original by Dean Edwards + add: function( elem, types, handler, data ) { + if ( elem.nodeType === 3 || elem.nodeType === 8 ) { + return; + } + + if ( handler === false ) { + handler = returnFalse; + } else if ( !handler ) { + // Fixes bug #7229. Fix recommended by jdalton + return; + } + + var handleObjIn, handleObj; + + if ( handler.handler ) { + handleObjIn = handler; + handler = handleObjIn.handler; + } + + // Make sure that the function being executed has a unique ID + if ( !handler.guid ) { + handler.guid = jQuery.guid++; + } + + // Init the element's event structure + var elemData = jQuery._data( elem ); + + // If no elemData is found then we must be trying to bind to one of the + // banned noData elements + if ( !elemData ) { + return; + } + + var events = elemData.events, + eventHandle = elemData.handle; + + if ( !events ) { + elemData.events = events = {}; + } + + if ( !eventHandle ) { + elemData.handle = eventHandle = function( e ) { + // Discard the second event of a jQuery.event.trigger() and + // when an event is called after a page has unloaded + return typeof jQuery !== "undefined" && (!e || jQuery.event.triggered !== e.type) ? + jQuery.event.handle.apply( eventHandle.elem, arguments ) : + undefined; + }; + } + + // Add elem as a property of the handle function + // This is to prevent a memory leak with non-native events in IE. + eventHandle.elem = elem; + + // Handle multiple events separated by a space + // jQuery(...).bind("mouseover mouseout", fn); + types = types.split(" "); + + var type, i = 0, namespaces; + + while ( (type = types[ i++ ]) ) { + handleObj = handleObjIn ? + jQuery.extend({}, handleObjIn) : + { handler: handler, data: data }; + + // Namespaced event handlers + if ( type.indexOf(".") > -1 ) { + namespaces = type.split("."); + type = namespaces.shift(); + handleObj.namespace = namespaces.slice(0).sort().join("."); + + } else { + namespaces = []; + handleObj.namespace = ""; + } + + handleObj.type = type; + if ( !handleObj.guid ) { + handleObj.guid = handler.guid; + } + + // Get the current list of functions bound to this event + var handlers = events[ type ], + special = jQuery.event.special[ type ] || {}; + + // Init the event handler queue + if ( !handlers ) { + handlers = events[ type ] = []; + + // Check for a special event handler + // Only use addEventListener/attachEvent if the special + // events handler returns false + if ( !special.setup || special.setup.call( elem, data, namespaces, eventHandle ) === false ) { + // Bind the global event handler to the element + if ( elem.addEventListener ) { + elem.addEventListener( type, eventHandle, false ); + + } else if ( elem.attachEvent ) { + elem.attachEvent( "on" + type, eventHandle ); + } + } + } + + if ( special.add ) { + special.add.call( elem, handleObj ); + + if ( !handleObj.handler.guid ) { + handleObj.handler.guid = handler.guid; + } + } + + // Add the function to the element's handler list + handlers.push( handleObj ); + + // Keep track of which events have been used, for event optimization + jQuery.event.global[ type ] = true; + } + + // Nullify elem to prevent memory leaks in IE + elem = null; + }, + + global: {}, + + // Detach an event or set of events from an element + remove: function( elem, types, handler, pos ) { + // don't do events on text and comment nodes + if ( elem.nodeType === 3 || elem.nodeType === 8 ) { + return; + } + + if ( handler === false ) { + handler = returnFalse; + } + + var ret, type, fn, j, i = 0, all, namespaces, namespace, special, eventType, handleObj, origType, + elemData = jQuery.hasData( elem ) && jQuery._data( elem ), + events = elemData && elemData.events; + + if ( !elemData || !events ) { + return; + } + + // types is actually an event object here + if ( types && types.type ) { + handler = types.handler; + types = types.type; + } + + // Unbind all events for the element + if ( !types || typeof types === "string" && types.charAt(0) === "." ) { + types = types || ""; + + for ( type in events ) { + jQuery.event.remove( elem, type + types ); + } + + return; + } + + // Handle multiple events separated by a space + // jQuery(...).unbind("mouseover mouseout", fn); + types = types.split(" "); + + while ( (type = types[ i++ ]) ) { + origType = type; + handleObj = null; + all = type.indexOf(".") < 0; + namespaces = []; + + if ( !all ) { + // Namespaced event handlers + namespaces = type.split("."); + type = namespaces.shift(); + + namespace = new RegExp("(^|\\.)" + + jQuery.map( namespaces.slice(0).sort(), fcleanup ).join("\\.(?:.*\\.)?") + "(\\.|$)"); + } + + eventType = events[ type ]; + + if ( !eventType ) { + continue; + } + + if ( !handler ) { + for ( j = 0; j < eventType.length; j++ ) { + handleObj = eventType[ j ]; + + if ( all || namespace.test( handleObj.namespace ) ) { + jQuery.event.remove( elem, origType, handleObj.handler, j ); + eventType.splice( j--, 1 ); + } + } + + continue; + } + + special = jQuery.event.special[ type ] || {}; + + for ( j = pos || 0; j < eventType.length; j++ ) { + handleObj = eventType[ j ]; + + if ( handler.guid === handleObj.guid ) { + // remove the given handler for the given type + if ( all || namespace.test( handleObj.namespace ) ) { + if ( pos == null ) { + eventType.splice( j--, 1 ); + } + + if ( special.remove ) { + special.remove.call( elem, handleObj ); + } + } + + if ( pos != null ) { + break; + } + } + } + + // remove generic event handler if no more handlers exist + if ( eventType.length === 0 || pos != null && eventType.length === 1 ) { + if ( !special.teardown || special.teardown.call( elem, namespaces ) === false ) { + jQuery.removeEvent( elem, type, elemData.handle ); + } + + ret = null; + delete events[ type ]; + } + } + + // Remove the expando if it's no longer used + if ( jQuery.isEmptyObject( events ) ) { + var handle = elemData.handle; + if ( handle ) { + handle.elem = null; + } + + delete elemData.events; + delete elemData.handle; + + if ( jQuery.isEmptyObject( elemData ) ) { + jQuery.removeData( elem, undefined, true ); + } + } + }, + + // Events that are safe to short-circuit if no handlers are attached. + // Native DOM events should not be added, they may have inline handlers. + customEvent: { + "getData": true, + "setData": true, + "changeData": true + }, + + trigger: function( event, data, elem, onlyHandlers ) { + // Event object or event type + var type = event.type || event, + namespaces = [], + exclusive; + + if ( type.indexOf("!") >= 0 ) { + // Exclusive events trigger only for the exact event (no namespaces) + type = type.slice(0, -1); + exclusive = true; + } + + if ( type.indexOf(".") >= 0 ) { + // Namespaced trigger; create a regexp to match event type in handle() + namespaces = type.split("."); + type = namespaces.shift(); + namespaces.sort(); + } + + if ( (!elem || jQuery.event.customEvent[ type ]) && !jQuery.event.global[ type ] ) { + // No jQuery handlers for this event type, and it can't have inline handlers + return; + } + + // Caller can pass in an Event, Object, or just an event type string + event = typeof event === "object" ? + // jQuery.Event object + event[ jQuery.expando ] ? event : + // Object literal + new jQuery.Event( type, event ) : + // Just the event type (string) + new jQuery.Event( type ); + + event.type = type; + event.exclusive = exclusive; + event.namespace = namespaces.join("."); + event.namespace_re = new RegExp("(^|\\.)" + namespaces.join("\\.(?:.*\\.)?") + "(\\.|$)"); + + // triggerHandler() and global events don't bubble or run the default action + if ( onlyHandlers || !elem ) { + event.preventDefault(); + event.stopPropagation(); + } + + // Handle a global trigger + if ( !elem ) { + // TODO: Stop taunting the data cache; remove global events and always attach to document + jQuery.each( jQuery.cache, function() { + // internalKey variable is just used to make it easier to find + // and potentially change this stuff later; currently it just + // points to jQuery.expando + var internalKey = jQuery.expando, + internalCache = this[ internalKey ]; + if ( internalCache && internalCache.events && internalCache.events[ type ] ) { + jQuery.event.trigger( event, data, internalCache.handle.elem ); + } + }); + return; + } + + // Don't do events on text and comment nodes + if ( elem.nodeType === 3 || elem.nodeType === 8 ) { + return; + } + + // Clean up the event in case it is being reused + event.result = undefined; + event.target = elem; + + // Clone any incoming data and prepend the event, creating the handler arg list + data = data != null ? jQuery.makeArray( data ) : []; + data.unshift( event ); + + var cur = elem, + // IE doesn't like method names with a colon (#3533, #8272) + ontype = type.indexOf(":") < 0 ? "on" + type : ""; + + // Fire event on the current element, then bubble up the DOM tree + do { + var handle = jQuery._data( cur, "handle" ); + + event.currentTarget = cur; + if ( handle ) { + handle.apply( cur, data ); + } + + // Trigger an inline bound script + if ( ontype && jQuery.acceptData( cur ) && cur[ ontype ] && cur[ ontype ].apply( cur, data ) === false ) { + event.result = false; + event.preventDefault(); + } + + // Bubble up to document, then to window + cur = cur.parentNode || cur.ownerDocument || cur === event.target.ownerDocument && window; + } while ( cur && !event.isPropagationStopped() ); + + // If nobody prevented the default action, do it now + if ( !event.isDefaultPrevented() ) { + var old, + special = jQuery.event.special[ type ] || {}; + + if ( (!special._default || special._default.call( elem.ownerDocument, event ) === false) && + !(type === "click" && jQuery.nodeName( elem, "a" )) && jQuery.acceptData( elem ) ) { + + // Call a native DOM method on the target with the same name name as the event. + // Can't use an .isFunction)() check here because IE6/7 fails that test. + // IE<9 dies on focus to hidden element (#1486), may want to revisit a try/catch. + try { + if ( ontype && elem[ type ] ) { + // Don't re-trigger an onFOO event when we call its FOO() method + old = elem[ ontype ]; + + if ( old ) { + elem[ ontype ] = null; + } + + jQuery.event.triggered = type; + elem[ type ](); + } + } catch ( ieError ) {} + + if ( old ) { + elem[ ontype ] = old; + } + + jQuery.event.triggered = undefined; + } + } + + return event.result; + }, + + handle: function( event ) { + event = jQuery.event.fix( event || window.event ); + // Snapshot the handlers list since a called handler may add/remove events. + var handlers = ((jQuery._data( this, "events" ) || {})[ event.type ] || []).slice(0), + run_all = !event.exclusive && !event.namespace, + args = Array.prototype.slice.call( arguments, 0 ); + + // Use the fix-ed Event rather than the (read-only) native event + args[0] = event; + event.currentTarget = this; + + for ( var j = 0, l = handlers.length; j < l; j++ ) { + var handleObj = handlers[ j ]; + + // Triggered event must 1) be non-exclusive and have no namespace, or + // 2) have namespace(s) a subset or equal to those in the bound event. + if ( run_all || event.namespace_re.test( handleObj.namespace ) ) { + // Pass in a reference to the handler function itself + // So that we can later remove it + event.handler = handleObj.handler; + event.data = handleObj.data; + event.handleObj = handleObj; + + var ret = handleObj.handler.apply( this, args ); + + if ( ret !== undefined ) { + event.result = ret; + if ( ret === false ) { + event.preventDefault(); + event.stopPropagation(); + } + } + + if ( event.isImmediatePropagationStopped() ) { + break; + } + } + } + return event.result; + }, + + props: "altKey attrChange attrName bubbles button cancelable charCode clientX clientY ctrlKey currentTarget data detail eventPhase fromElement handler keyCode layerX layerY metaKey newValue offsetX offsetY pageX pageY prevValue relatedNode relatedTarget screenX screenY shiftKey srcElement target toElement view wheelDelta which".split(" "), + + fix: function( event ) { + if ( event[ jQuery.expando ] ) { + return event; + } + + // store a copy of the original event object + // and "clone" to set read-only properties + var originalEvent = event; + event = jQuery.Event( originalEvent ); + + for ( var i = this.props.length, prop; i; ) { + prop = this.props[ --i ]; + event[ prop ] = originalEvent[ prop ]; + } + + // Fix target property, if necessary + if ( !event.target ) { + // Fixes #1925 where srcElement might not be defined either + event.target = event.srcElement || document; + } + + // check if target is a textnode (safari) + if ( event.target.nodeType === 3 ) { + event.target = event.target.parentNode; + } + + // Add relatedTarget, if necessary + if ( !event.relatedTarget && event.fromElement ) { + event.relatedTarget = event.fromElement === event.target ? event.toElement : event.fromElement; + } + + // Calculate pageX/Y if missing and clientX/Y available + if ( event.pageX == null && event.clientX != null ) { + var eventDocument = event.target.ownerDocument || document, + doc = eventDocument.documentElement, + body = eventDocument.body; + + event.pageX = event.clientX + (doc && doc.scrollLeft || body && body.scrollLeft || 0) - (doc && doc.clientLeft || body && body.clientLeft || 0); + event.pageY = event.clientY + (doc && doc.scrollTop || body && body.scrollTop || 0) - (doc && doc.clientTop || body && body.clientTop || 0); + } + + // Add which for key events + if ( event.which == null && (event.charCode != null || event.keyCode != null) ) { + event.which = event.charCode != null ? event.charCode : event.keyCode; + } + + // Add metaKey to non-Mac browsers (use ctrl for PC's and Meta for Macs) + if ( !event.metaKey && event.ctrlKey ) { + event.metaKey = event.ctrlKey; + } + + // Add which for click: 1 === left; 2 === middle; 3 === right + // Note: button is not normalized, so don't use it + if ( !event.which && event.button !== undefined ) { + event.which = (event.button & 1 ? 1 : ( event.button & 2 ? 3 : ( event.button & 4 ? 2 : 0 ) )); + } + + return event; + }, + + // Deprecated, use jQuery.guid instead + guid: 1E8, + + // Deprecated, use jQuery.proxy instead + proxy: jQuery.proxy, + + special: { + ready: { + // Make sure the ready event is setup + setup: jQuery.bindReady, + teardown: jQuery.noop + }, + + live: { + add: function( handleObj ) { + jQuery.event.add( this, + liveConvert( handleObj.origType, handleObj.selector ), + jQuery.extend({}, handleObj, {handler: liveHandler, guid: handleObj.handler.guid}) ); + }, + + remove: function( handleObj ) { + jQuery.event.remove( this, liveConvert( handleObj.origType, handleObj.selector ), handleObj ); + } + }, + + beforeunload: { + setup: function( data, namespaces, eventHandle ) { + // We only want to do this special case on windows + if ( jQuery.isWindow( this ) ) { + this.onbeforeunload = eventHandle; + } + }, + + teardown: function( namespaces, eventHandle ) { + if ( this.onbeforeunload === eventHandle ) { + this.onbeforeunload = null; + } + } + } + } +}; + +jQuery.removeEvent = document.removeEventListener ? + function( elem, type, handle ) { + if ( elem.removeEventListener ) { + elem.removeEventListener( type, handle, false ); + } + } : + function( elem, type, handle ) { + if ( elem.detachEvent ) { + elem.detachEvent( "on" + type, handle ); + } + }; + +jQuery.Event = function( src, props ) { + // Allow instantiation without the 'new' keyword + if ( !this.preventDefault ) { + return new jQuery.Event( src, props ); + } + + // Event object + if ( src && src.type ) { + this.originalEvent = src; + this.type = src.type; + + // Events bubbling up the document may have been marked as prevented + // by a handler lower down the tree; reflect the correct value. + this.isDefaultPrevented = (src.defaultPrevented || src.returnValue === false || + src.getPreventDefault && src.getPreventDefault()) ? returnTrue : returnFalse; + + // Event type + } else { + this.type = src; + } + + // Put explicitly provided properties onto the event object + if ( props ) { + jQuery.extend( this, props ); + } + + // timeStamp is buggy for some events on Firefox(#3843) + // So we won't rely on the native value + this.timeStamp = jQuery.now(); + + // Mark it as fixed + this[ jQuery.expando ] = true; +}; + +function returnFalse() { + return false; +} +function returnTrue() { + return true; +} + +// jQuery.Event is based on DOM3 Events as specified by the ECMAScript Language Binding +// http://www.w3.org/TR/2003/WD-DOM-Level-3-Events-20030331/ecma-script-binding.html +jQuery.Event.prototype = { + preventDefault: function() { + this.isDefaultPrevented = returnTrue; + + var e = this.originalEvent; + if ( !e ) { + return; + } + + // if preventDefault exists run it on the original event + if ( e.preventDefault ) { + e.preventDefault(); + + // otherwise set the returnValue property of the original event to false (IE) + } else { + e.returnValue = false; + } + }, + stopPropagation: function() { + this.isPropagationStopped = returnTrue; + + var e = this.originalEvent; + if ( !e ) { + return; + } + // if stopPropagation exists run it on the original event + if ( e.stopPropagation ) { + e.stopPropagation(); + } + // otherwise set the cancelBubble property of the original event to true (IE) + e.cancelBubble = true; + }, + stopImmediatePropagation: function() { + this.isImmediatePropagationStopped = returnTrue; + this.stopPropagation(); + }, + isDefaultPrevented: returnFalse, + isPropagationStopped: returnFalse, + isImmediatePropagationStopped: returnFalse +}; + +// Checks if an event happened on an element within another element +// Used in jQuery.event.special.mouseenter and mouseleave handlers +var withinElement = function( event ) { + + // Check if mouse(over|out) are still within the same parent element + var related = event.relatedTarget, + inside = false, + eventType = event.type; + + event.type = event.data; + + if ( related !== this ) { + + if ( related ) { + inside = jQuery.contains( this, related ); + } + + if ( !inside ) { + + jQuery.event.handle.apply( this, arguments ); + + event.type = eventType; + } + } +}, + +// In case of event delegation, we only need to rename the event.type, +// liveHandler will take care of the rest. +delegate = function( event ) { + event.type = event.data; + jQuery.event.handle.apply( this, arguments ); +}; + +// Create mouseenter and mouseleave events +jQuery.each({ + mouseenter: "mouseover", + mouseleave: "mouseout" +}, function( orig, fix ) { + jQuery.event.special[ orig ] = { + setup: function( data ) { + jQuery.event.add( this, fix, data && data.selector ? delegate : withinElement, orig ); + }, + teardown: function( data ) { + jQuery.event.remove( this, fix, data && data.selector ? delegate : withinElement ); + } + }; +}); + +// submit delegation +if ( !jQuery.support.submitBubbles ) { + + jQuery.event.special.submit = { + setup: function( data, namespaces ) { + if ( !jQuery.nodeName( this, "form" ) ) { + jQuery.event.add(this, "click.specialSubmit", function( e ) { + var elem = e.target, + type = elem.type; + + if ( (type === "submit" || type === "image") && jQuery( elem ).closest("form").length ) { + trigger( "submit", this, arguments ); + } + }); + + jQuery.event.add(this, "keypress.specialSubmit", function( e ) { + var elem = e.target, + type = elem.type; + + if ( (type === "text" || type === "password") && jQuery( elem ).closest("form").length && e.keyCode === 13 ) { + trigger( "submit", this, arguments ); + } + }); + + } else { + return false; + } + }, + + teardown: function( namespaces ) { + jQuery.event.remove( this, ".specialSubmit" ); + } + }; + +} + +// change delegation, happens here so we have bind. +if ( !jQuery.support.changeBubbles ) { + + var changeFilters, + + getVal = function( elem ) { + var type = elem.type, val = elem.value; + + if ( type === "radio" || type === "checkbox" ) { + val = elem.checked; + + } else if ( type === "select-multiple" ) { + val = elem.selectedIndex > -1 ? + jQuery.map( elem.options, function( elem ) { + return elem.selected; + }).join("-") : + ""; + + } else if ( jQuery.nodeName( elem, "select" ) ) { + val = elem.selectedIndex; + } + + return val; + }, + + testChange = function testChange( e ) { + var elem = e.target, data, val; + + if ( !rformElems.test( elem.nodeName ) || elem.readOnly ) { + return; + } + + data = jQuery._data( elem, "_change_data" ); + val = getVal(elem); + + // the current data will be also retrieved by beforeactivate + if ( e.type !== "focusout" || elem.type !== "radio" ) { + jQuery._data( elem, "_change_data", val ); + } + + if ( data === undefined || val === data ) { + return; + } + + if ( data != null || val ) { + e.type = "change"; + e.liveFired = undefined; + jQuery.event.trigger( e, arguments[1], elem ); + } + }; + + jQuery.event.special.change = { + filters: { + focusout: testChange, + + beforedeactivate: testChange, + + click: function( e ) { + var elem = e.target, type = jQuery.nodeName( elem, "input" ) ? elem.type : ""; + + if ( type === "radio" || type === "checkbox" || jQuery.nodeName( elem, "select" ) ) { + testChange.call( this, e ); + } + }, + + // Change has to be called before submit + // Keydown will be called before keypress, which is used in submit-event delegation + keydown: function( e ) { + var elem = e.target, type = jQuery.nodeName( elem, "input" ) ? elem.type : ""; + + if ( (e.keyCode === 13 && !jQuery.nodeName( elem, "textarea" ) ) || + (e.keyCode === 32 && (type === "checkbox" || type === "radio")) || + type === "select-multiple" ) { + testChange.call( this, e ); + } + }, + + // Beforeactivate happens also before the previous element is blurred + // with this event you can't trigger a change event, but you can store + // information + beforeactivate: function( e ) { + var elem = e.target; + jQuery._data( elem, "_change_data", getVal(elem) ); + } + }, + + setup: function( data, namespaces ) { + if ( this.type === "file" ) { + return false; + } + + for ( var type in changeFilters ) { + jQuery.event.add( this, type + ".specialChange", changeFilters[type] ); + } + + return rformElems.test( this.nodeName ); + }, + + teardown: function( namespaces ) { + jQuery.event.remove( this, ".specialChange" ); + + return rformElems.test( this.nodeName ); + } + }; + + changeFilters = jQuery.event.special.change.filters; + + // Handle when the input is .focus()'d + changeFilters.focus = changeFilters.beforeactivate; +} + +function trigger( type, elem, args ) { + // Piggyback on a donor event to simulate a different one. + // Fake originalEvent to avoid donor's stopPropagation, but if the + // simulated event prevents default then we do the same on the donor. + // Don't pass args or remember liveFired; they apply to the donor event. + var event = jQuery.extend( {}, args[ 0 ] ); + event.type = type; + event.originalEvent = {}; + event.liveFired = undefined; + jQuery.event.handle.call( elem, event ); + if ( event.isDefaultPrevented() ) { + args[ 0 ].preventDefault(); + } +} + +// Create "bubbling" focus and blur events +if ( !jQuery.support.focusinBubbles ) { + jQuery.each({ focus: "focusin", blur: "focusout" }, function( orig, fix ) { + + // Attach a single capturing handler while someone wants focusin/focusout + var attaches = 0; + + jQuery.event.special[ fix ] = { + setup: function() { + if ( attaches++ === 0 ) { + document.addEventListener( orig, handler, true ); + } + }, + teardown: function() { + if ( --attaches === 0 ) { + document.removeEventListener( orig, handler, true ); + } + } + }; + + function handler( donor ) { + // Donor event is always a native one; fix it and switch its type. + // Let focusin/out handler cancel the donor focus/blur event. + var e = jQuery.event.fix( donor ); + e.type = fix; + e.originalEvent = {}; + jQuery.event.trigger( e, null, e.target ); + if ( e.isDefaultPrevented() ) { + donor.preventDefault(); + } + } + }); +} + +jQuery.each(["bind", "one"], function( i, name ) { + jQuery.fn[ name ] = function( type, data, fn ) { + var handler; + + // Handle object literals + if ( typeof type === "object" ) { + for ( var key in type ) { + this[ name ](key, data, type[key], fn); + } + return this; + } + + if ( arguments.length === 2 || data === false ) { + fn = data; + data = undefined; + } + + if ( name === "one" ) { + handler = function( event ) { + jQuery( this ).unbind( event, handler ); + return fn.apply( this, arguments ); + }; + handler.guid = fn.guid || jQuery.guid++; + } else { + handler = fn; + } + + if ( type === "unload" && name !== "one" ) { + this.one( type, data, fn ); + + } else { + for ( var i = 0, l = this.length; i < l; i++ ) { + jQuery.event.add( this[i], type, handler, data ); + } + } + + return this; + }; +}); + +jQuery.fn.extend({ + unbind: function( type, fn ) { + // Handle object literals + if ( typeof type === "object" && !type.preventDefault ) { + for ( var key in type ) { + this.unbind(key, type[key]); + } + + } else { + for ( var i = 0, l = this.length; i < l; i++ ) { + jQuery.event.remove( this[i], type, fn ); + } + } + + return this; + }, + + delegate: function( selector, types, data, fn ) { + return this.live( types, data, fn, selector ); + }, + + undelegate: function( selector, types, fn ) { + if ( arguments.length === 0 ) { + return this.unbind( "live" ); + + } else { + return this.die( types, null, fn, selector ); + } + }, + + trigger: function( type, data ) { + return this.each(function() { + jQuery.event.trigger( type, data, this ); + }); + }, + + triggerHandler: function( type, data ) { + if ( this[0] ) { + return jQuery.event.trigger( type, data, this[0], true ); + } + }, + + toggle: function( fn ) { + // Save reference to arguments for access in closure + var args = arguments, + guid = fn.guid || jQuery.guid++, + i = 0, + toggler = function( event ) { + // Figure out which function to execute + var lastToggle = ( jQuery.data( this, "lastToggle" + fn.guid ) || 0 ) % i; + jQuery.data( this, "lastToggle" + fn.guid, lastToggle + 1 ); + + // Make sure that clicks stop + event.preventDefault(); + + // and execute the function + return args[ lastToggle ].apply( this, arguments ) || false; + }; + + // link all the functions, so any of them can unbind this click handler + toggler.guid = guid; + while ( i < args.length ) { + args[ i++ ].guid = guid; + } + + return this.click( toggler ); + }, + + hover: function( fnOver, fnOut ) { + return this.mouseenter( fnOver ).mouseleave( fnOut || fnOver ); + } +}); + +var liveMap = { + focus: "focusin", + blur: "focusout", + mouseenter: "mouseover", + mouseleave: "mouseout" +}; + +jQuery.each(["live", "die"], function( i, name ) { + jQuery.fn[ name ] = function( types, data, fn, origSelector /* Internal Use Only */ ) { + var type, i = 0, match, namespaces, preType, + selector = origSelector || this.selector, + context = origSelector ? this : jQuery( this.context ); + + if ( typeof types === "object" && !types.preventDefault ) { + for ( var key in types ) { + context[ name ]( key, data, types[key], selector ); + } + + return this; + } + + if ( name === "die" && !types && + origSelector && origSelector.charAt(0) === "." ) { + + context.unbind( origSelector ); + + return this; + } + + if ( data === false || jQuery.isFunction( data ) ) { + fn = data || returnFalse; + data = undefined; + } + + types = (types || "").split(" "); + + while ( (type = types[ i++ ]) != null ) { + match = rnamespaces.exec( type ); + namespaces = ""; + + if ( match ) { + namespaces = match[0]; + type = type.replace( rnamespaces, "" ); + } + + if ( type === "hover" ) { + types.push( "mouseenter" + namespaces, "mouseleave" + namespaces ); + continue; + } + + preType = type; + + if ( liveMap[ type ] ) { + types.push( liveMap[ type ] + namespaces ); + type = type + namespaces; + + } else { + type = (liveMap[ type ] || type) + namespaces; + } + + if ( name === "live" ) { + // bind live handler + for ( var j = 0, l = context.length; j < l; j++ ) { + jQuery.event.add( context[j], "live." + liveConvert( type, selector ), + { data: data, selector: selector, handler: fn, origType: type, origHandler: fn, preType: preType } ); + } + + } else { + // unbind live handler + context.unbind( "live." + liveConvert( type, selector ), fn ); + } + } + + return this; + }; +}); + +function liveHandler( event ) { + var stop, maxLevel, related, match, handleObj, elem, j, i, l, data, close, namespace, ret, + elems = [], + selectors = [], + events = jQuery._data( this, "events" ); + + // Make sure we avoid non-left-click bubbling in Firefox (#3861) and disabled elements in IE (#6911) + if ( event.liveFired === this || !events || !events.live || event.target.disabled || event.button && event.type === "click" ) { + return; + } + + if ( event.namespace ) { + namespace = new RegExp("(^|\\.)" + event.namespace.split(".").join("\\.(?:.*\\.)?") + "(\\.|$)"); + } + + event.liveFired = this; + + var live = events.live.slice(0); + + for ( j = 0; j < live.length; j++ ) { + handleObj = live[j]; + + if ( handleObj.origType.replace( rnamespaces, "" ) === event.type ) { + selectors.push( handleObj.selector ); + + } else { + live.splice( j--, 1 ); + } + } + + match = jQuery( event.target ).closest( selectors, event.currentTarget ); + + for ( i = 0, l = match.length; i < l; i++ ) { + close = match[i]; + + for ( j = 0; j < live.length; j++ ) { + handleObj = live[j]; + + if ( close.selector === handleObj.selector && (!namespace || namespace.test( handleObj.namespace )) && !close.elem.disabled ) { + elem = close.elem; + related = null; + + // Those two events require additional checking + if ( handleObj.preType === "mouseenter" || handleObj.preType === "mouseleave" ) { + event.type = handleObj.preType; + related = jQuery( event.relatedTarget ).closest( handleObj.selector )[0]; + + // Make sure not to accidentally match a child element with the same selector + if ( related && jQuery.contains( elem, related ) ) { + related = elem; + } + } + + if ( !related || related !== elem ) { + elems.push({ elem: elem, handleObj: handleObj, level: close.level }); + } + } + } + } + + for ( i = 0, l = elems.length; i < l; i++ ) { + match = elems[i]; + + if ( maxLevel && match.level > maxLevel ) { + break; + } + + event.currentTarget = match.elem; + event.data = match.handleObj.data; + event.handleObj = match.handleObj; + + ret = match.handleObj.origHandler.apply( match.elem, arguments ); + + if ( ret === false || event.isPropagationStopped() ) { + maxLevel = match.level; + + if ( ret === false ) { + stop = false; + } + if ( event.isImmediatePropagationStopped() ) { + break; + } + } + } + + return stop; +} + +function liveConvert( type, selector ) { + return (type && type !== "*" ? type + "." : "") + selector.replace(rperiod, "`").replace(rspaces, "&"); +} + +jQuery.each( ("blur focus focusin focusout load resize scroll unload click dblclick " + + "mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave " + + "change select submit keydown keypress keyup error").split(" "), function( i, name ) { + + // Handle event binding + jQuery.fn[ name ] = function( data, fn ) { + if ( fn == null ) { + fn = data; + data = null; + } + + return arguments.length > 0 ? + this.bind( name, data, fn ) : + this.trigger( name ); + }; + + if ( jQuery.attrFn ) { + jQuery.attrFn[ name ] = true; + } +}); + + + +/*! + * Sizzle CSS Selector Engine + * Copyright 2011, The Dojo Foundation + * Released under the MIT, BSD, and GPL Licenses. + * More information: http://sizzlejs.com/ + */ +(function(){ + +var chunker = /((?:\((?:\([^()]+\)|[^()]+)+\)|\[(?:\[[^\[\]]*\]|['"][^'"]*['"]|[^\[\]'"]+)+\]|\\.|[^ >+~,(\[\\]+)+|[>+~])(\s*,\s*)?((?:.|\r|\n)*)/g, + done = 0, + toString = Object.prototype.toString, + hasDuplicate = false, + baseHasDuplicate = true, + rBackslash = /\\/g, + rNonWord = /\W/; + +// Here we check if the JavaScript engine is using some sort of +// optimization where it does not always call our comparision +// function. If that is the case, discard the hasDuplicate value. +// Thus far that includes Google Chrome. +[0, 0].sort(function() { + baseHasDuplicate = false; + return 0; +}); + +var Sizzle = function( selector, context, results, seed ) { + results = results || []; + context = context || document; + + var origContext = context; + + if ( context.nodeType !== 1 && context.nodeType !== 9 ) { + return []; + } + + if ( !selector || typeof selector !== "string" ) { + return results; + } + + var m, set, checkSet, extra, ret, cur, pop, i, + prune = true, + contextXML = Sizzle.isXML( context ), + parts = [], + soFar = selector; + + // Reset the position of the chunker regexp (start from head) + do { + chunker.exec( "" ); + m = chunker.exec( soFar ); + + if ( m ) { + soFar = m[3]; + + parts.push( m[1] ); + + if ( m[2] ) { + extra = m[3]; + break; + } + } + } while ( m ); + + if ( parts.length > 1 && origPOS.exec( selector ) ) { + + if ( parts.length === 2 && Expr.relative[ parts[0] ] ) { + set = posProcess( parts[0] + parts[1], context ); + + } else { + set = Expr.relative[ parts[0] ] ? + [ context ] : + Sizzle( parts.shift(), context ); + + while ( parts.length ) { + selector = parts.shift(); + + if ( Expr.relative[ selector ] ) { + selector += parts.shift(); + } + + set = posProcess( selector, set ); + } + } + + } else { + // Take a shortcut and set the context if the root selector is an ID + // (but not if it'll be faster if the inner selector is an ID) + if ( !seed && parts.length > 1 && context.nodeType === 9 && !contextXML && + Expr.match.ID.test(parts[0]) && !Expr.match.ID.test(parts[parts.length - 1]) ) { + + ret = Sizzle.find( parts.shift(), context, contextXML ); + context = ret.expr ? + Sizzle.filter( ret.expr, ret.set )[0] : + ret.set[0]; + } + + if ( context ) { + ret = seed ? + { expr: parts.pop(), set: makeArray(seed) } : + Sizzle.find( parts.pop(), parts.length === 1 && (parts[0] === "~" || parts[0] === "+") && context.parentNode ? context.parentNode : context, contextXML ); + + set = ret.expr ? + Sizzle.filter( ret.expr, ret.set ) : + ret.set; + + if ( parts.length > 0 ) { + checkSet = makeArray( set ); + + } else { + prune = false; + } + + while ( parts.length ) { + cur = parts.pop(); + pop = cur; + + if ( !Expr.relative[ cur ] ) { + cur = ""; + } else { + pop = parts.pop(); + } + + if ( pop == null ) { + pop = context; + } + + Expr.relative[ cur ]( checkSet, pop, contextXML ); + } + + } else { + checkSet = parts = []; + } + } + + if ( !checkSet ) { + checkSet = set; + } + + if ( !checkSet ) { + Sizzle.error( cur || selector ); + } + + if ( toString.call(checkSet) === "[object Array]" ) { + if ( !prune ) { + results.push.apply( results, checkSet ); + + } else if ( context && context.nodeType === 1 ) { + for ( i = 0; checkSet[i] != null; i++ ) { + if ( checkSet[i] && (checkSet[i] === true || checkSet[i].nodeType === 1 && Sizzle.contains(context, checkSet[i])) ) { + results.push( set[i] ); + } + } + + } else { + for ( i = 0; checkSet[i] != null; i++ ) { + if ( checkSet[i] && checkSet[i].nodeType === 1 ) { + results.push( set[i] ); + } + } + } + + } else { + makeArray( checkSet, results ); + } + + if ( extra ) { + Sizzle( extra, origContext, results, seed ); + Sizzle.uniqueSort( results ); + } + + return results; +}; + +Sizzle.uniqueSort = function( results ) { + if ( sortOrder ) { + hasDuplicate = baseHasDuplicate; + results.sort( sortOrder ); + + if ( hasDuplicate ) { + for ( var i = 1; i < results.length; i++ ) { + if ( results[i] === results[ i - 1 ] ) { + results.splice( i--, 1 ); + } + } + } + } + + return results; +}; + +Sizzle.matches = function( expr, set ) { + return Sizzle( expr, null, null, set ); +}; + +Sizzle.matchesSelector = function( node, expr ) { + return Sizzle( expr, null, null, [node] ).length > 0; +}; + +Sizzle.find = function( expr, context, isXML ) { + var set; + + if ( !expr ) { + return []; + } + + for ( var i = 0, l = Expr.order.length; i < l; i++ ) { + var match, + type = Expr.order[i]; + + if ( (match = Expr.leftMatch[ type ].exec( expr )) ) { + var left = match[1]; + match.splice( 1, 1 ); + + if ( left.substr( left.length - 1 ) !== "\\" ) { + match[1] = (match[1] || "").replace( rBackslash, "" ); + set = Expr.find[ type ]( match, context, isXML ); + + if ( set != null ) { + expr = expr.replace( Expr.match[ type ], "" ); + break; + } + } + } + } + + if ( !set ) { + set = typeof context.getElementsByTagName !== "undefined" ? + context.getElementsByTagName( "*" ) : + []; + } + + return { set: set, expr: expr }; +}; + +Sizzle.filter = function( expr, set, inplace, not ) { + var match, anyFound, + old = expr, + result = [], + curLoop = set, + isXMLFilter = set && set[0] && Sizzle.isXML( set[0] ); + + while ( expr && set.length ) { + for ( var type in Expr.filter ) { + if ( (match = Expr.leftMatch[ type ].exec( expr )) != null && match[2] ) { + var found, item, + filter = Expr.filter[ type ], + left = match[1]; + + anyFound = false; + + match.splice(1,1); + + if ( left.substr( left.length - 1 ) === "\\" ) { + continue; + } + + if ( curLoop === result ) { + result = []; + } + + if ( Expr.preFilter[ type ] ) { + match = Expr.preFilter[ type ]( match, curLoop, inplace, result, not, isXMLFilter ); + + if ( !match ) { + anyFound = found = true; + + } else if ( match === true ) { + continue; + } + } + + if ( match ) { + for ( var i = 0; (item = curLoop[i]) != null; i++ ) { + if ( item ) { + found = filter( item, match, i, curLoop ); + var pass = not ^ !!found; + + if ( inplace && found != null ) { + if ( pass ) { + anyFound = true; + + } else { + curLoop[i] = false; + } + + } else if ( pass ) { + result.push( item ); + anyFound = true; + } + } + } + } + + if ( found !== undefined ) { + if ( !inplace ) { + curLoop = result; + } + + expr = expr.replace( Expr.match[ type ], "" ); + + if ( !anyFound ) { + return []; + } + + break; + } + } + } + + // Improper expression + if ( expr === old ) { + if ( anyFound == null ) { + Sizzle.error( expr ); + + } else { + break; + } + } + + old = expr; + } + + return curLoop; +}; + +Sizzle.error = function( msg ) { + throw "Syntax error, unrecognized expression: " + msg; +}; + +var Expr = Sizzle.selectors = { + order: [ "ID", "NAME", "TAG" ], + + match: { + ID: /#((?:[\w\u00c0-\uFFFF\-]|\\.)+)/, + CLASS: /\.((?:[\w\u00c0-\uFFFF\-]|\\.)+)/, + NAME: /\[name=['"]*((?:[\w\u00c0-\uFFFF\-]|\\.)+)['"]*\]/, + ATTR: /\[\s*((?:[\w\u00c0-\uFFFF\-]|\\.)+)\s*(?:(\S?=)\s*(?:(['"])(.*?)\3|(#?(?:[\w\u00c0-\uFFFF\-]|\\.)*)|)|)\s*\]/, + TAG: /^((?:[\w\u00c0-\uFFFF\*\-]|\\.)+)/, + CHILD: /:(only|nth|last|first)-child(?:\(\s*(even|odd|(?:[+\-]?\d+|(?:[+\-]?\d*)?n\s*(?:[+\-]\s*\d+)?))\s*\))?/, + POS: /:(nth|eq|gt|lt|first|last|even|odd)(?:\((\d*)\))?(?=[^\-]|$)/, + PSEUDO: /:((?:[\w\u00c0-\uFFFF\-]|\\.)+)(?:\((['"]?)((?:\([^\)]+\)|[^\(\)]*)+)\2\))?/ + }, + + leftMatch: {}, + + attrMap: { + "class": "className", + "for": "htmlFor" + }, + + attrHandle: { + href: function( elem ) { + return elem.getAttribute( "href" ); + }, + type: function( elem ) { + return elem.getAttribute( "type" ); + } + }, + + relative: { + "+": function(checkSet, part){ + var isPartStr = typeof part === "string", + isTag = isPartStr && !rNonWord.test( part ), + isPartStrNotTag = isPartStr && !isTag; + + if ( isTag ) { + part = part.toLowerCase(); + } + + for ( var i = 0, l = checkSet.length, elem; i < l; i++ ) { + if ( (elem = checkSet[i]) ) { + while ( (elem = elem.previousSibling) && elem.nodeType !== 1 ) {} + + checkSet[i] = isPartStrNotTag || elem && elem.nodeName.toLowerCase() === part ? + elem || false : + elem === part; + } + } + + if ( isPartStrNotTag ) { + Sizzle.filter( part, checkSet, true ); + } + }, + + ">": function( checkSet, part ) { + var elem, + isPartStr = typeof part === "string", + i = 0, + l = checkSet.length; + + if ( isPartStr && !rNonWord.test( part ) ) { + part = part.toLowerCase(); + + for ( ; i < l; i++ ) { + elem = checkSet[i]; + + if ( elem ) { + var parent = elem.parentNode; + checkSet[i] = parent.nodeName.toLowerCase() === part ? parent : false; + } + } + + } else { + for ( ; i < l; i++ ) { + elem = checkSet[i]; + + if ( elem ) { + checkSet[i] = isPartStr ? + elem.parentNode : + elem.parentNode === part; + } + } + + if ( isPartStr ) { + Sizzle.filter( part, checkSet, true ); + } + } + }, + + "": function(checkSet, part, isXML){ + var nodeCheck, + doneName = done++, + checkFn = dirCheck; + + if ( typeof part === "string" && !rNonWord.test( part ) ) { + part = part.toLowerCase(); + nodeCheck = part; + checkFn = dirNodeCheck; + } + + checkFn( "parentNode", part, doneName, checkSet, nodeCheck, isXML ); + }, + + "~": function( checkSet, part, isXML ) { + var nodeCheck, + doneName = done++, + checkFn = dirCheck; + + if ( typeof part === "string" && !rNonWord.test( part ) ) { + part = part.toLowerCase(); + nodeCheck = part; + checkFn = dirNodeCheck; + } + + checkFn( "previousSibling", part, doneName, checkSet, nodeCheck, isXML ); + } + }, + + find: { + ID: function( match, context, isXML ) { + if ( typeof context.getElementById !== "undefined" && !isXML ) { + var m = context.getElementById(match[1]); + // Check parentNode to catch when Blackberry 4.6 returns + // nodes that are no longer in the document #6963 + return m && m.parentNode ? [m] : []; + } + }, + + NAME: function( match, context ) { + if ( typeof context.getElementsByName !== "undefined" ) { + var ret = [], + results = context.getElementsByName( match[1] ); + + for ( var i = 0, l = results.length; i < l; i++ ) { + if ( results[i].getAttribute("name") === match[1] ) { + ret.push( results[i] ); + } + } + + return ret.length === 0 ? null : ret; + } + }, + + TAG: function( match, context ) { + if ( typeof context.getElementsByTagName !== "undefined" ) { + return context.getElementsByTagName( match[1] ); + } + } + }, + preFilter: { + CLASS: function( match, curLoop, inplace, result, not, isXML ) { + match = " " + match[1].replace( rBackslash, "" ) + " "; + + if ( isXML ) { + return match; + } + + for ( var i = 0, elem; (elem = curLoop[i]) != null; i++ ) { + if ( elem ) { + if ( not ^ (elem.className && (" " + elem.className + " ").replace(/[\t\n\r]/g, " ").indexOf(match) >= 0) ) { + if ( !inplace ) { + result.push( elem ); + } + + } else if ( inplace ) { + curLoop[i] = false; + } + } + } + + return false; + }, + + ID: function( match ) { + return match[1].replace( rBackslash, "" ); + }, + + TAG: function( match, curLoop ) { + return match[1].replace( rBackslash, "" ).toLowerCase(); + }, + + CHILD: function( match ) { + if ( match[1] === "nth" ) { + if ( !match[2] ) { + Sizzle.error( match[0] ); + } + + match[2] = match[2].replace(/^\+|\s*/g, ''); + + // parse equations like 'even', 'odd', '5', '2n', '3n+2', '4n-1', '-n+6' + var test = /(-?)(\d*)(?:n([+\-]?\d*))?/.exec( + match[2] === "even" && "2n" || match[2] === "odd" && "2n+1" || + !/\D/.test( match[2] ) && "0n+" + match[2] || match[2]); + + // calculate the numbers (first)n+(last) including if they are negative + match[2] = (test[1] + (test[2] || 1)) - 0; + match[3] = test[3] - 0; + } + else if ( match[2] ) { + Sizzle.error( match[0] ); + } + + // TODO: Move to normal caching system + match[0] = done++; + + return match; + }, + + ATTR: function( match, curLoop, inplace, result, not, isXML ) { + var name = match[1] = match[1].replace( rBackslash, "" ); + + if ( !isXML && Expr.attrMap[name] ) { + match[1] = Expr.attrMap[name]; + } + + // Handle if an un-quoted value was used + match[4] = ( match[4] || match[5] || "" ).replace( rBackslash, "" ); + + if ( match[2] === "~=" ) { + match[4] = " " + match[4] + " "; + } + + return match; + }, + + PSEUDO: function( match, curLoop, inplace, result, not ) { + if ( match[1] === "not" ) { + // If we're dealing with a complex expression, or a simple one + if ( ( chunker.exec(match[3]) || "" ).length > 1 || /^\w/.test(match[3]) ) { + match[3] = Sizzle(match[3], null, null, curLoop); + + } else { + var ret = Sizzle.filter(match[3], curLoop, inplace, true ^ not); + + if ( !inplace ) { + result.push.apply( result, ret ); + } + + return false; + } + + } else if ( Expr.match.POS.test( match[0] ) || Expr.match.CHILD.test( match[0] ) ) { + return true; + } + + return match; + }, + + POS: function( match ) { + match.unshift( true ); + + return match; + } + }, + + filters: { + enabled: function( elem ) { + return elem.disabled === false && elem.type !== "hidden"; + }, + + disabled: function( elem ) { + return elem.disabled === true; + }, + + checked: function( elem ) { + return elem.checked === true; + }, + + selected: function( elem ) { + // Accessing this property makes selected-by-default + // options in Safari work properly + if ( elem.parentNode ) { + elem.parentNode.selectedIndex; + } + + return elem.selected === true; + }, + + parent: function( elem ) { + return !!elem.firstChild; + }, + + empty: function( elem ) { + return !elem.firstChild; + }, + + has: function( elem, i, match ) { + return !!Sizzle( match[3], elem ).length; + }, + + header: function( elem ) { + return (/h\d/i).test( elem.nodeName ); + }, + + text: function( elem ) { + var attr = elem.getAttribute( "type" ), type = elem.type; + // IE6 and 7 will map elem.type to 'text' for new HTML5 types (search, etc) + // use getAttribute instead to test this case + return elem.nodeName.toLowerCase() === "input" && "text" === type && ( attr === type || attr === null ); + }, + + radio: function( elem ) { + return elem.nodeName.toLowerCase() === "input" && "radio" === elem.type; + }, + + checkbox: function( elem ) { + return elem.nodeName.toLowerCase() === "input" && "checkbox" === elem.type; + }, + + file: function( elem ) { + return elem.nodeName.toLowerCase() === "input" && "file" === elem.type; + }, + + password: function( elem ) { + return elem.nodeName.toLowerCase() === "input" && "password" === elem.type; + }, + + submit: function( elem ) { + var name = elem.nodeName.toLowerCase(); + return (name === "input" || name === "button") && "submit" === elem.type; + }, + + image: function( elem ) { + return elem.nodeName.toLowerCase() === "input" && "image" === elem.type; + }, + + reset: function( elem ) { + var name = elem.nodeName.toLowerCase(); + return (name === "input" || name === "button") && "reset" === elem.type; + }, + + button: function( elem ) { + var name = elem.nodeName.toLowerCase(); + return name === "input" && "button" === elem.type || name === "button"; + }, + + input: function( elem ) { + return (/input|select|textarea|button/i).test( elem.nodeName ); + }, + + focus: function( elem ) { + return elem === elem.ownerDocument.activeElement; + } + }, + setFilters: { + first: function( elem, i ) { + return i === 0; + }, + + last: function( elem, i, match, array ) { + return i === array.length - 1; + }, + + even: function( elem, i ) { + return i % 2 === 0; + }, + + odd: function( elem, i ) { + return i % 2 === 1; + }, + + lt: function( elem, i, match ) { + return i < match[3] - 0; + }, + + gt: function( elem, i, match ) { + return i > match[3] - 0; + }, + + nth: function( elem, i, match ) { + return match[3] - 0 === i; + }, + + eq: function( elem, i, match ) { + return match[3] - 0 === i; + } + }, + filter: { + PSEUDO: function( elem, match, i, array ) { + var name = match[1], + filter = Expr.filters[ name ]; + + if ( filter ) { + return filter( elem, i, match, array ); + + } else if ( name === "contains" ) { + return (elem.textContent || elem.innerText || Sizzle.getText([ elem ]) || "").indexOf(match[3]) >= 0; + + } else if ( name === "not" ) { + var not = match[3]; + + for ( var j = 0, l = not.length; j < l; j++ ) { + if ( not[j] === elem ) { + return false; + } + } + + return true; + + } else { + Sizzle.error( name ); + } + }, + + CHILD: function( elem, match ) { + var type = match[1], + node = elem; + + switch ( type ) { + case "only": + case "first": + while ( (node = node.previousSibling) ) { + if ( node.nodeType === 1 ) { + return false; + } + } + + if ( type === "first" ) { + return true; + } + + node = elem; + + case "last": + while ( (node = node.nextSibling) ) { + if ( node.nodeType === 1 ) { + return false; + } + } + + return true; + + case "nth": + var first = match[2], + last = match[3]; + + if ( first === 1 && last === 0 ) { + return true; + } + + var doneName = match[0], + parent = elem.parentNode; + + if ( parent && (parent.sizcache !== doneName || !elem.nodeIndex) ) { + var count = 0; + + for ( node = parent.firstChild; node; node = node.nextSibling ) { + if ( node.nodeType === 1 ) { + node.nodeIndex = ++count; + } + } + + parent.sizcache = doneName; + } + + var diff = elem.nodeIndex - last; + + if ( first === 0 ) { + return diff === 0; + + } else { + return ( diff % first === 0 && diff / first >= 0 ); + } + } + }, + + ID: function( elem, match ) { + return elem.nodeType === 1 && elem.getAttribute("id") === match; + }, + + TAG: function( elem, match ) { + return (match === "*" && elem.nodeType === 1) || elem.nodeName.toLowerCase() === match; + }, + + CLASS: function( elem, match ) { + return (" " + (elem.className || elem.getAttribute("class")) + " ") + .indexOf( match ) > -1; + }, + + ATTR: function( elem, match ) { + var name = match[1], + result = Expr.attrHandle[ name ] ? + Expr.attrHandle[ name ]( elem ) : + elem[ name ] != null ? + elem[ name ] : + elem.getAttribute( name ), + value = result + "", + type = match[2], + check = match[4]; + + return result == null ? + type === "!=" : + type === "=" ? + value === check : + type === "*=" ? + value.indexOf(check) >= 0 : + type === "~=" ? + (" " + value + " ").indexOf(check) >= 0 : + !check ? + value && result !== false : + type === "!=" ? + value !== check : + type === "^=" ? + value.indexOf(check) === 0 : + type === "$=" ? + value.substr(value.length - check.length) === check : + type === "|=" ? + value === check || value.substr(0, check.length + 1) === check + "-" : + false; + }, + + POS: function( elem, match, i, array ) { + var name = match[2], + filter = Expr.setFilters[ name ]; + + if ( filter ) { + return filter( elem, i, match, array ); + } + } + } +}; + +var origPOS = Expr.match.POS, + fescape = function(all, num){ + return "\\" + (num - 0 + 1); + }; + +for ( var type in Expr.match ) { + Expr.match[ type ] = new RegExp( Expr.match[ type ].source + (/(?![^\[]*\])(?![^\(]*\))/.source) ); + Expr.leftMatch[ type ] = new RegExp( /(^(?:.|\r|\n)*?)/.source + Expr.match[ type ].source.replace(/\\(\d+)/g, fescape) ); +} + +var makeArray = function( array, results ) { + array = Array.prototype.slice.call( array, 0 ); + + if ( results ) { + results.push.apply( results, array ); + return results; + } + + return array; +}; + +// Perform a simple check to determine if the browser is capable of +// converting a NodeList to an array using builtin methods. +// Also verifies that the returned array holds DOM nodes +// (which is not the case in the Blackberry browser) +try { + Array.prototype.slice.call( document.documentElement.childNodes, 0 )[0].nodeType; + +// Provide a fallback method if it does not work +} catch( e ) { + makeArray = function( array, results ) { + var i = 0, + ret = results || []; + + if ( toString.call(array) === "[object Array]" ) { + Array.prototype.push.apply( ret, array ); + + } else { + if ( typeof array.length === "number" ) { + for ( var l = array.length; i < l; i++ ) { + ret.push( array[i] ); + } + + } else { + for ( ; array[i]; i++ ) { + ret.push( array[i] ); + } + } + } + + return ret; + }; +} + +var sortOrder, siblingCheck; + +if ( document.documentElement.compareDocumentPosition ) { + sortOrder = function( a, b ) { + if ( a === b ) { + hasDuplicate = true; + return 0; + } + + if ( !a.compareDocumentPosition || !b.compareDocumentPosition ) { + return a.compareDocumentPosition ? -1 : 1; + } + + return a.compareDocumentPosition(b) & 4 ? -1 : 1; + }; + +} else { + sortOrder = function( a, b ) { + // The nodes are identical, we can exit early + if ( a === b ) { + hasDuplicate = true; + return 0; + + // Fallback to using sourceIndex (in IE) if it's available on both nodes + } else if ( a.sourceIndex && b.sourceIndex ) { + return a.sourceIndex - b.sourceIndex; + } + + var al, bl, + ap = [], + bp = [], + aup = a.parentNode, + bup = b.parentNode, + cur = aup; + + // If the nodes are siblings (or identical) we can do a quick check + if ( aup === bup ) { + return siblingCheck( a, b ); + + // If no parents were found then the nodes are disconnected + } else if ( !aup ) { + return -1; + + } else if ( !bup ) { + return 1; + } + + // Otherwise they're somewhere else in the tree so we need + // to build up a full list of the parentNodes for comparison + while ( cur ) { + ap.unshift( cur ); + cur = cur.parentNode; + } + + cur = bup; + + while ( cur ) { + bp.unshift( cur ); + cur = cur.parentNode; + } + + al = ap.length; + bl = bp.length; + + // Start walking down the tree looking for a discrepancy + for ( var i = 0; i < al && i < bl; i++ ) { + if ( ap[i] !== bp[i] ) { + return siblingCheck( ap[i], bp[i] ); + } + } + + // We ended someplace up the tree so do a sibling check + return i === al ? + siblingCheck( a, bp[i], -1 ) : + siblingCheck( ap[i], b, 1 ); + }; + + siblingCheck = function( a, b, ret ) { + if ( a === b ) { + return ret; + } + + var cur = a.nextSibling; + + while ( cur ) { + if ( cur === b ) { + return -1; + } + + cur = cur.nextSibling; + } + + return 1; + }; +} + +// Utility function for retreiving the text value of an array of DOM nodes +Sizzle.getText = function( elems ) { + var ret = "", elem; + + for ( var i = 0; elems[i]; i++ ) { + elem = elems[i]; + + // Get the text from text nodes and CDATA nodes + if ( elem.nodeType === 3 || elem.nodeType === 4 ) { + ret += elem.nodeValue; + + // Traverse everything else, except comment nodes + } else if ( elem.nodeType !== 8 ) { + ret += Sizzle.getText( elem.childNodes ); + } + } + + return ret; +}; + +// Check to see if the browser returns elements by name when +// querying by getElementById (and provide a workaround) +(function(){ + // We're going to inject a fake input element with a specified name + var form = document.createElement("div"), + id = "script" + (new Date()).getTime(), + root = document.documentElement; + + form.innerHTML = ""; + + // Inject it into the root element, check its status, and remove it quickly + root.insertBefore( form, root.firstChild ); + + // The workaround has to do additional checks after a getElementById + // Which slows things down for other browsers (hence the branching) + if ( document.getElementById( id ) ) { + Expr.find.ID = function( match, context, isXML ) { + if ( typeof context.getElementById !== "undefined" && !isXML ) { + var m = context.getElementById(match[1]); + + return m ? + m.id === match[1] || typeof m.getAttributeNode !== "undefined" && m.getAttributeNode("id").nodeValue === match[1] ? + [m] : + undefined : + []; + } + }; + + Expr.filter.ID = function( elem, match ) { + var node = typeof elem.getAttributeNode !== "undefined" && elem.getAttributeNode("id"); + + return elem.nodeType === 1 && node && node.nodeValue === match; + }; + } + + root.removeChild( form ); + + // release memory in IE + root = form = null; +})(); + +(function(){ + // Check to see if the browser returns only elements + // when doing getElementsByTagName("*") + + // Create a fake element + var div = document.createElement("div"); + div.appendChild( document.createComment("") ); + + // Make sure no comments are found + if ( div.getElementsByTagName("*").length > 0 ) { + Expr.find.TAG = function( match, context ) { + var results = context.getElementsByTagName( match[1] ); + + // Filter out possible comments + if ( match[1] === "*" ) { + var tmp = []; + + for ( var i = 0; results[i]; i++ ) { + if ( results[i].nodeType === 1 ) { + tmp.push( results[i] ); + } + } + + results = tmp; + } + + return results; + }; + } + + // Check to see if an attribute returns normalized href attributes + div.innerHTML = ""; + + if ( div.firstChild && typeof div.firstChild.getAttribute !== "undefined" && + div.firstChild.getAttribute("href") !== "#" ) { + + Expr.attrHandle.href = function( elem ) { + return elem.getAttribute( "href", 2 ); + }; + } + + // release memory in IE + div = null; +})(); + +if ( document.querySelectorAll ) { + (function(){ + var oldSizzle = Sizzle, + div = document.createElement("div"), + id = "__sizzle__"; + + div.innerHTML = "

"; + + // Safari can't handle uppercase or unicode characters when + // in quirks mode. + if ( div.querySelectorAll && div.querySelectorAll(".TEST").length === 0 ) { + return; + } + + Sizzle = function( query, context, extra, seed ) { + context = context || document; + + // Only use querySelectorAll on non-XML documents + // (ID selectors don't work in non-HTML documents) + if ( !seed && !Sizzle.isXML(context) ) { + // See if we find a selector to speed up + var match = /^(\w+$)|^\.([\w\-]+$)|^#([\w\-]+$)/.exec( query ); + + if ( match && (context.nodeType === 1 || context.nodeType === 9) ) { + // Speed-up: Sizzle("TAG") + if ( match[1] ) { + return makeArray( context.getElementsByTagName( query ), extra ); + + // Speed-up: Sizzle(".CLASS") + } else if ( match[2] && Expr.find.CLASS && context.getElementsByClassName ) { + return makeArray( context.getElementsByClassName( match[2] ), extra ); + } + } + + if ( context.nodeType === 9 ) { + // Speed-up: Sizzle("body") + // The body element only exists once, optimize finding it + if ( query === "body" && context.body ) { + return makeArray( [ context.body ], extra ); + + // Speed-up: Sizzle("#ID") + } else if ( match && match[3] ) { + var elem = context.getElementById( match[3] ); + + // Check parentNode to catch when Blackberry 4.6 returns + // nodes that are no longer in the document #6963 + if ( elem && elem.parentNode ) { + // Handle the case where IE and Opera return items + // by name instead of ID + if ( elem.id === match[3] ) { + return makeArray( [ elem ], extra ); + } + + } else { + return makeArray( [], extra ); + } + } + + try { + return makeArray( context.querySelectorAll(query), extra ); + } catch(qsaError) {} + + // qSA works strangely on Element-rooted queries + // We can work around this by specifying an extra ID on the root + // and working up from there (Thanks to Andrew Dupont for the technique) + // IE 8 doesn't work on object elements + } else if ( context.nodeType === 1 && context.nodeName.toLowerCase() !== "object" ) { + var oldContext = context, + old = context.getAttribute( "id" ), + nid = old || id, + hasParent = context.parentNode, + relativeHierarchySelector = /^\s*[+~]/.test( query ); + + if ( !old ) { + context.setAttribute( "id", nid ); + } else { + nid = nid.replace( /'/g, "\\$&" ); + } + if ( relativeHierarchySelector && hasParent ) { + context = context.parentNode; + } + + try { + if ( !relativeHierarchySelector || hasParent ) { + return makeArray( context.querySelectorAll( "[id='" + nid + "'] " + query ), extra ); + } + + } catch(pseudoError) { + } finally { + if ( !old ) { + oldContext.removeAttribute( "id" ); + } + } + } + } + + return oldSizzle(query, context, extra, seed); + }; + + for ( var prop in oldSizzle ) { + Sizzle[ prop ] = oldSizzle[ prop ]; + } + + // release memory in IE + div = null; + })(); +} + +(function(){ + var html = document.documentElement, + matches = html.matchesSelector || html.mozMatchesSelector || html.webkitMatchesSelector || html.msMatchesSelector; + + if ( matches ) { + // Check to see if it's possible to do matchesSelector + // on a disconnected node (IE 9 fails this) + var disconnectedMatch = !matches.call( document.createElement( "div" ), "div" ), + pseudoWorks = false; + + try { + // This should fail with an exception + // Gecko does not error, returns false instead + matches.call( document.documentElement, "[test!='']:sizzle" ); + + } catch( pseudoError ) { + pseudoWorks = true; + } + + Sizzle.matchesSelector = function( node, expr ) { + // Make sure that attribute selectors are quoted + expr = expr.replace(/\=\s*([^'"\]]*)\s*\]/g, "='$1']"); + + if ( !Sizzle.isXML( node ) ) { + try { + if ( pseudoWorks || !Expr.match.PSEUDO.test( expr ) && !/!=/.test( expr ) ) { + var ret = matches.call( node, expr ); + + // IE 9's matchesSelector returns false on disconnected nodes + if ( ret || !disconnectedMatch || + // As well, disconnected nodes are said to be in a document + // fragment in IE 9, so check for that + node.document && node.document.nodeType !== 11 ) { + return ret; + } + } + } catch(e) {} + } + + return Sizzle(expr, null, null, [node]).length > 0; + }; + } +})(); + +(function(){ + var div = document.createElement("div"); + + div.innerHTML = "
"; + + // Opera can't find a second classname (in 9.6) + // Also, make sure that getElementsByClassName actually exists + if ( !div.getElementsByClassName || div.getElementsByClassName("e").length === 0 ) { + return; + } + + // Safari caches class attributes, doesn't catch changes (in 3.2) + div.lastChild.className = "e"; + + if ( div.getElementsByClassName("e").length === 1 ) { + return; + } + + Expr.order.splice(1, 0, "CLASS"); + Expr.find.CLASS = function( match, context, isXML ) { + if ( typeof context.getElementsByClassName !== "undefined" && !isXML ) { + return context.getElementsByClassName(match[1]); + } + }; + + // release memory in IE + div = null; +})(); + +function dirNodeCheck( dir, cur, doneName, checkSet, nodeCheck, isXML ) { + for ( var i = 0, l = checkSet.length; i < l; i++ ) { + var elem = checkSet[i]; + + if ( elem ) { + var match = false; + + elem = elem[dir]; + + while ( elem ) { + if ( elem.sizcache === doneName ) { + match = checkSet[elem.sizset]; + break; + } + + if ( elem.nodeType === 1 && !isXML ){ + elem.sizcache = doneName; + elem.sizset = i; + } + + if ( elem.nodeName.toLowerCase() === cur ) { + match = elem; + break; + } + + elem = elem[dir]; + } + + checkSet[i] = match; + } + } +} + +function dirCheck( dir, cur, doneName, checkSet, nodeCheck, isXML ) { + for ( var i = 0, l = checkSet.length; i < l; i++ ) { + var elem = checkSet[i]; + + if ( elem ) { + var match = false; + + elem = elem[dir]; + + while ( elem ) { + if ( elem.sizcache === doneName ) { + match = checkSet[elem.sizset]; + break; + } + + if ( elem.nodeType === 1 ) { + if ( !isXML ) { + elem.sizcache = doneName; + elem.sizset = i; + } + + if ( typeof cur !== "string" ) { + if ( elem === cur ) { + match = true; + break; + } + + } else if ( Sizzle.filter( cur, [elem] ).length > 0 ) { + match = elem; + break; + } + } + + elem = elem[dir]; + } + + checkSet[i] = match; + } + } +} + +if ( document.documentElement.contains ) { + Sizzle.contains = function( a, b ) { + return a !== b && (a.contains ? a.contains(b) : true); + }; + +} else if ( document.documentElement.compareDocumentPosition ) { + Sizzle.contains = function( a, b ) { + return !!(a.compareDocumentPosition(b) & 16); + }; + +} else { + Sizzle.contains = function() { + return false; + }; +} + +Sizzle.isXML = function( elem ) { + // documentElement is verified for cases where it doesn't yet exist + // (such as loading iframes in IE - #4833) + var documentElement = (elem ? elem.ownerDocument || elem : 0).documentElement; + + return documentElement ? documentElement.nodeName !== "HTML" : false; +}; + +var posProcess = function( selector, context ) { + var match, + tmpSet = [], + later = "", + root = context.nodeType ? [context] : context; + + // Position selectors must be done after the filter + // And so must :not(positional) so we move all PSEUDOs to the end + while ( (match = Expr.match.PSEUDO.exec( selector )) ) { + later += match[0]; + selector = selector.replace( Expr.match.PSEUDO, "" ); + } + + selector = Expr.relative[selector] ? selector + "*" : selector; + + for ( var i = 0, l = root.length; i < l; i++ ) { + Sizzle( selector, root[i], tmpSet ); + } + + return Sizzle.filter( later, tmpSet ); +}; + +// EXPOSE +jQuery.find = Sizzle; +jQuery.expr = Sizzle.selectors; +jQuery.expr[":"] = jQuery.expr.filters; +jQuery.unique = Sizzle.uniqueSort; +jQuery.text = Sizzle.getText; +jQuery.isXMLDoc = Sizzle.isXML; +jQuery.contains = Sizzle.contains; + + +})(); + + +var runtil = /Until$/, + rparentsprev = /^(?:parents|prevUntil|prevAll)/, + // Note: This RegExp should be improved, or likely pulled from Sizzle + rmultiselector = /,/, + isSimple = /^.[^:#\[\.,]*$/, + slice = Array.prototype.slice, + POS = jQuery.expr.match.POS, + // methods guaranteed to produce a unique set when starting from a unique set + guaranteedUnique = { + children: true, + contents: true, + next: true, + prev: true + }; + +jQuery.fn.extend({ + find: function( selector ) { + var self = this, + i, l; + + if ( typeof selector !== "string" ) { + return jQuery( selector ).filter(function() { + for ( i = 0, l = self.length; i < l; i++ ) { + if ( jQuery.contains( self[ i ], this ) ) { + return true; + } + } + }); + } + + var ret = this.pushStack( "", "find", selector ), + length, n, r; + + for ( i = 0, l = this.length; i < l; i++ ) { + length = ret.length; + jQuery.find( selector, this[i], ret ); + + if ( i > 0 ) { + // Make sure that the results are unique + for ( n = length; n < ret.length; n++ ) { + for ( r = 0; r < length; r++ ) { + if ( ret[r] === ret[n] ) { + ret.splice(n--, 1); + break; + } + } + } + } + } + + return ret; + }, + + has: function( target ) { + var targets = jQuery( target ); + return this.filter(function() { + for ( var i = 0, l = targets.length; i < l; i++ ) { + if ( jQuery.contains( this, targets[i] ) ) { + return true; + } + } + }); + }, + + not: function( selector ) { + return this.pushStack( winnow(this, selector, false), "not", selector); + }, + + filter: function( selector ) { + return this.pushStack( winnow(this, selector, true), "filter", selector ); + }, + + is: function( selector ) { + return !!selector && ( typeof selector === "string" ? + jQuery.filter( selector, this ).length > 0 : + this.filter( selector ).length > 0 ); + }, + + closest: function( selectors, context ) { + var ret = [], i, l, cur = this[0]; + + // Array + if ( jQuery.isArray( selectors ) ) { + var match, selector, + matches = {}, + level = 1; + + if ( cur && selectors.length ) { + for ( i = 0, l = selectors.length; i < l; i++ ) { + selector = selectors[i]; + + if ( !matches[ selector ] ) { + matches[ selector ] = POS.test( selector ) ? + jQuery( selector, context || this.context ) : + selector; + } + } + + while ( cur && cur.ownerDocument && cur !== context ) { + for ( selector in matches ) { + match = matches[ selector ]; + + if ( match.jquery ? match.index( cur ) > -1 : jQuery( cur ).is( match ) ) { + ret.push({ selector: selector, elem: cur, level: level }); + } + } + + cur = cur.parentNode; + level++; + } + } + + return ret; + } + + // String + var pos = POS.test( selectors ) || typeof selectors !== "string" ? + jQuery( selectors, context || this.context ) : + 0; + + for ( i = 0, l = this.length; i < l; i++ ) { + cur = this[i]; + + while ( cur ) { + if ( pos ? pos.index(cur) > -1 : jQuery.find.matchesSelector(cur, selectors) ) { + ret.push( cur ); + break; + + } else { + cur = cur.parentNode; + if ( !cur || !cur.ownerDocument || cur === context || cur.nodeType === 11 ) { + break; + } + } + } + } + + ret = ret.length > 1 ? jQuery.unique( ret ) : ret; + + return this.pushStack( ret, "closest", selectors ); + }, + + // Determine the position of an element within + // the matched set of elements + index: function( elem ) { + if ( !elem || typeof elem === "string" ) { + return jQuery.inArray( this[0], + // If it receives a string, the selector is used + // If it receives nothing, the siblings are used + elem ? jQuery( elem ) : this.parent().children() ); + } + // Locate the position of the desired element + return jQuery.inArray( + // If it receives a jQuery object, the first element is used + elem.jquery ? elem[0] : elem, this ); + }, + + add: function( selector, context ) { + var set = typeof selector === "string" ? + jQuery( selector, context ) : + jQuery.makeArray( selector && selector.nodeType ? [ selector ] : selector ), + all = jQuery.merge( this.get(), set ); + + return this.pushStack( isDisconnected( set[0] ) || isDisconnected( all[0] ) ? + all : + jQuery.unique( all ) ); + }, + + andSelf: function() { + return this.add( this.prevObject ); + } +}); + +// A painfully simple check to see if an element is disconnected +// from a document (should be improved, where feasible). +function isDisconnected( node ) { + return !node || !node.parentNode || node.parentNode.nodeType === 11; +} + +jQuery.each({ + parent: function( elem ) { + var parent = elem.parentNode; + return parent && parent.nodeType !== 11 ? parent : null; + }, + parents: function( elem ) { + return jQuery.dir( elem, "parentNode" ); + }, + parentsUntil: function( elem, i, until ) { + return jQuery.dir( elem, "parentNode", until ); + }, + next: function( elem ) { + return jQuery.nth( elem, 2, "nextSibling" ); + }, + prev: function( elem ) { + return jQuery.nth( elem, 2, "previousSibling" ); + }, + nextAll: function( elem ) { + return jQuery.dir( elem, "nextSibling" ); + }, + prevAll: function( elem ) { + return jQuery.dir( elem, "previousSibling" ); + }, + nextUntil: function( elem, i, until ) { + return jQuery.dir( elem, "nextSibling", until ); + }, + prevUntil: function( elem, i, until ) { + return jQuery.dir( elem, "previousSibling", until ); + }, + siblings: function( elem ) { + return jQuery.sibling( elem.parentNode.firstChild, elem ); + }, + children: function( elem ) { + return jQuery.sibling( elem.firstChild ); + }, + contents: function( elem ) { + return jQuery.nodeName( elem, "iframe" ) ? + elem.contentDocument || elem.contentWindow.document : + jQuery.makeArray( elem.childNodes ); + } +}, function( name, fn ) { + jQuery.fn[ name ] = function( until, selector ) { + var ret = jQuery.map( this, fn, until ), + // The variable 'args' was introduced in + // https://github.com/jquery/jquery/commit/52a0238 + // to work around a bug in Chrome 10 (Dev) and should be removed when the bug is fixed. + // http://code.google.com/p/v8/issues/detail?id=1050 + args = slice.call(arguments); + + if ( !runtil.test( name ) ) { + selector = until; + } + + if ( selector && typeof selector === "string" ) { + ret = jQuery.filter( selector, ret ); + } + + ret = this.length > 1 && !guaranteedUnique[ name ] ? jQuery.unique( ret ) : ret; + + if ( (this.length > 1 || rmultiselector.test( selector )) && rparentsprev.test( name ) ) { + ret = ret.reverse(); + } + + return this.pushStack( ret, name, args.join(",") ); + }; +}); + +jQuery.extend({ + filter: function( expr, elems, not ) { + if ( not ) { + expr = ":not(" + expr + ")"; + } + + return elems.length === 1 ? + jQuery.find.matchesSelector(elems[0], expr) ? [ elems[0] ] : [] : + jQuery.find.matches(expr, elems); + }, + + dir: function( elem, dir, until ) { + var matched = [], + cur = elem[ dir ]; + + while ( cur && cur.nodeType !== 9 && (until === undefined || cur.nodeType !== 1 || !jQuery( cur ).is( until )) ) { + if ( cur.nodeType === 1 ) { + matched.push( cur ); + } + cur = cur[dir]; + } + return matched; + }, + + nth: function( cur, result, dir, elem ) { + result = result || 1; + var num = 0; + + for ( ; cur; cur = cur[dir] ) { + if ( cur.nodeType === 1 && ++num === result ) { + break; + } + } + + return cur; + }, + + sibling: function( n, elem ) { + var r = []; + + for ( ; n; n = n.nextSibling ) { + if ( n.nodeType === 1 && n !== elem ) { + r.push( n ); + } + } + + return r; + } +}); + +// Implement the identical functionality for filter and not +function winnow( elements, qualifier, keep ) { + + // Can't pass null or undefined to indexOf in Firefox 4 + // Set to 0 to skip string check + qualifier = qualifier || 0; + + if ( jQuery.isFunction( qualifier ) ) { + return jQuery.grep(elements, function( elem, i ) { + var retVal = !!qualifier.call( elem, i, elem ); + return retVal === keep; + }); + + } else if ( qualifier.nodeType ) { + return jQuery.grep(elements, function( elem, i ) { + return (elem === qualifier) === keep; + }); + + } else if ( typeof qualifier === "string" ) { + var filtered = jQuery.grep(elements, function( elem ) { + return elem.nodeType === 1; + }); + + if ( isSimple.test( qualifier ) ) { + return jQuery.filter(qualifier, filtered, !keep); + } else { + qualifier = jQuery.filter( qualifier, filtered ); + } + } + + return jQuery.grep(elements, function( elem, i ) { + return (jQuery.inArray( elem, qualifier ) >= 0) === keep; + }); +} + + + + +var rinlinejQuery = / jQuery\d+="(?:\d+|null)"/g, + rleadingWhitespace = /^\s+/, + rxhtmlTag = /<(?!area|br|col|embed|hr|img|input|link|meta|param)(([\w:]+)[^>]*)\/>/ig, + rtagName = /<([\w:]+)/, + rtbody = /", "" ], + legend: [ 1, "
", "
" ], + thead: [ 1, "", "
" ], + tr: [ 2, "", "
" ], + td: [ 3, "", "
" ], + col: [ 2, "", "
" ], + area: [ 1, "", "" ], + _default: [ 0, "", "" ] + }; + +wrapMap.optgroup = wrapMap.option; +wrapMap.tbody = wrapMap.tfoot = wrapMap.colgroup = wrapMap.caption = wrapMap.thead; +wrapMap.th = wrapMap.td; + +// IE can't serialize and '); -// setTimeout(function(){ -// res.end(''); -// }, 1000); -// } -// })).listen(3000); -// -// console.log('port 3000'); \ No newline at end of file +var body = 'hello' +http.createServer(function(req, res){ + res.setHeader('Content-Length', body.length); + res.end(body) +}).listen(3000) \ No newline at end of file diff --git a/node_modules/express/node_modules/cookie-signature/.npmignore b/node_modules/express/node_modules/cookie-signature/.npmignore new file mode 100644 index 0000000..f1250e5 --- /dev/null +++ b/node_modules/express/node_modules/cookie-signature/.npmignore @@ -0,0 +1,4 @@ +support +test +examples +*.sock diff --git a/node_modules/express/node_modules/cookie-signature/History.md b/node_modules/express/node_modules/cookie-signature/History.md new file mode 100644 index 0000000..c8aa68f --- /dev/null +++ b/node_modules/express/node_modules/cookie-signature/History.md @@ -0,0 +1,5 @@ + +0.0.1 / 2010-01-03 +================== + + * Initial release diff --git a/node_modules/express/node_modules/cookie-signature/Makefile b/node_modules/express/node_modules/cookie-signature/Makefile new file mode 100644 index 0000000..4e9c8d3 --- /dev/null +++ b/node_modules/express/node_modules/cookie-signature/Makefile @@ -0,0 +1,7 @@ + +test: + @./node_modules/.bin/mocha \ + --require should \ + --reporter spec + +.PHONY: test \ No newline at end of file diff --git a/node_modules/express/node_modules/cookie-signature/Readme.md b/node_modules/express/node_modules/cookie-signature/Readme.md new file mode 100644 index 0000000..2559e84 --- /dev/null +++ b/node_modules/express/node_modules/cookie-signature/Readme.md @@ -0,0 +1,42 @@ + +# cookie-signature + + Sign and unsign cookies. + +## Example + +```js +var cookie = require('cookie-signature'); + +var val = cookie.sign('hello', 'tobiiscool'); +val.should.equal('hello.DGDUkGlIkCzPz+C0B064FNgHdEjox7ch8tOBGslZ5QI'); + +var val = cookie.sign('hello', 'tobiiscool'); +cookie.unsign(val, 'tobiiscool').should.equal('hello'); +cookie.unsign(val, 'luna').should.be.false; +``` + +## License + +(The MIT License) + +Copyright (c) 2012 LearnBoost <tj@learnboost.com> + +Permission is hereby granted, free of charge, to any person obtaining +a copy of this software and associated documentation files (the +'Software'), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, sublicense, and/or sell copies of the Software, and to +permit persons to whom the Software is furnished to do so, subject to +the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. +IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY +CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, +TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE +SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. \ No newline at end of file diff --git a/node_modules/express/node_modules/cookie-signature/index.js b/node_modules/express/node_modules/cookie-signature/index.js new file mode 100644 index 0000000..93206a0 --- /dev/null +++ b/node_modules/express/node_modules/cookie-signature/index.js @@ -0,0 +1,42 @@ + +/** + * Module dependencies. + */ + +var crypto = require('crypto'); + +/** + * Sign the given `val` with `secret`. + * + * @param {String} val + * @param {String} secret + * @return {String} + * @api private + */ + +exports.sign = function(val, secret){ + if ('string' != typeof val) throw new TypeError('cookie required'); + if ('string' != typeof secret) throw new TypeError('secret required'); + return val + '.' + crypto + .createHmac('sha256', secret) + .update(val) + .digest('base64') + .replace(/\=+$/, ''); +}; + +/** + * Unsign and decode the given `val` with `secret`, + * returning `false` if the signature is invalid. + * + * @param {String} val + * @param {String} secret + * @return {String|Boolean} + * @api private + */ + +exports.unsign = function(val, secret){ + if ('string' != typeof val) throw new TypeError('cookie required'); + if ('string' != typeof secret) throw new TypeError('secret required'); + var str = val.slice(0, val.lastIndexOf('.')); + return exports.sign(str, secret) == val ? str : false; +}; \ No newline at end of file diff --git a/node_modules/express/node_modules/cookie-signature/package.json b/node_modules/express/node_modules/cookie-signature/package.json new file mode 100644 index 0000000..c750818 --- /dev/null +++ b/node_modules/express/node_modules/cookie-signature/package.json @@ -0,0 +1,23 @@ +{ + "name": "cookie-signature", + "version": "0.0.1", + "description": "Sign and unsign cookies", + "keywords": [ + "cookie", + "sign", + "unsign" + ], + "author": { + "name": "TJ Holowaychuk", + "email": "tj@learnboost.com" + }, + "dependencies": {}, + "devDependencies": { + "mocha": "*", + "should": "*" + }, + "main": "index", + "readme": "\n# cookie-signature\n\n Sign and unsign cookies.\n\n## Example\n\n```js\nvar cookie = require('cookie-signature');\n\nvar val = cookie.sign('hello', 'tobiiscool');\nval.should.equal('hello.DGDUkGlIkCzPz+C0B064FNgHdEjox7ch8tOBGslZ5QI');\n\nvar val = cookie.sign('hello', 'tobiiscool');\ncookie.unsign(val, 'tobiiscool').should.equal('hello');\ncookie.unsign(val, 'luna').should.be.false;\n```\n\n## License \n\n(The MIT License)\n\nCopyright (c) 2012 LearnBoost <tj@learnboost.com>\n\nPermission is hereby granted, free of charge, to any person obtaining\na copy of this software and associated documentation files (the\n'Software'), to deal in the Software without restriction, including\nwithout limitation the rights to use, copy, modify, merge, publish,\ndistribute, sublicense, and/or sell copies of the Software, and to\npermit persons to whom the Software is furnished to do so, subject to\nthe following conditions:\n\nThe above copyright notice and this permission notice shall be\nincluded in all copies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,\nEXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\nMERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.\nIN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY\nCLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,\nTORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE\nSOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.", + "_id": "cookie-signature@0.0.1", + "_from": "cookie-signature@0.0.1" +} diff --git a/node_modules/express/node_modules/cookie/.npmignore b/node_modules/express/node_modules/cookie/.npmignore new file mode 100644 index 0000000..3c3629e --- /dev/null +++ b/node_modules/express/node_modules/cookie/.npmignore @@ -0,0 +1 @@ +node_modules diff --git a/node_modules/express/node_modules/cookie/.travis.yml b/node_modules/express/node_modules/cookie/.travis.yml new file mode 100644 index 0000000..bced151 --- /dev/null +++ b/node_modules/express/node_modules/cookie/.travis.yml @@ -0,0 +1,3 @@ +language: node_js +node_js: + - 0.6 diff --git a/node_modules/express/node_modules/cookie/README.md b/node_modules/express/node_modules/cookie/README.md new file mode 100644 index 0000000..5187ed1 --- /dev/null +++ b/node_modules/express/node_modules/cookie/README.md @@ -0,0 +1,44 @@ +# cookie [![Build Status](https://secure.travis-ci.org/shtylman/node-cookie.png?branch=master)](http://travis-ci.org/shtylman/node-cookie) # + +cookie is a basic cookie parser and serializer. It doesn't make assumptions about how you are going to deal with your cookies. It basically just provides a way to read and write the HTTP cookie headers. + +See [RFC6265](http://tools.ietf.org/html/rfc6265) for details about the http header for cookies. + +## how? + +``` +npm install cookie +``` + +```javascript +var cookie = require('cookie'); + +var hdr = cookie.serialize('foo', 'bar'); +// hdr = 'foo=bar'; + +var cookies = cookie.parse('foo=bar; cat=meow; dog=ruff'); +// cookies = { foo: 'bar', cat: 'meow', dog: 'ruff' }; +``` + +## more + +The serialize function takes a third parameter, an object, to set cookie options. See the RFC for valid values. + +### path +> cookie path + +### expires +> absolute expiration date for the cookie (Date object) + +### maxAge +> relative max age of the cookie from when the client receives it (seconds) + +### domain +> domain for the cookie + +### secure +> true or false + +### httpOnly +> true or false + diff --git a/node_modules/express/node_modules/cookie/index.js b/node_modules/express/node_modules/cookie/index.js new file mode 100644 index 0000000..ce6c926 --- /dev/null +++ b/node_modules/express/node_modules/cookie/index.js @@ -0,0 +1,57 @@ + +/// Serialize the a name value pair into a cookie string suitable for +/// http headers. An optional options object specified cookie parameters +/// +/// serialize('foo', 'bar', { httpOnly: true }) +/// => "foo=bar; httpOnly" +/// +/// @param {String} name +/// @param {String} val +/// @param {Object} options +/// @return {String} +var serialize = function(name, val, opt){ + var pairs = [name + '=' + encode(val)]; + opt = opt || {}; + + if (opt.maxAge) pairs.push('Max-Age=' + opt.maxAge); + if (opt.domain) pairs.push('Domain=' + opt.domain); + if (opt.path) pairs.push('Path=' + opt.path); + if (opt.expires) pairs.push('Expires=' + opt.expires.toUTCString()); + if (opt.httpOnly) pairs.push('HttpOnly'); + if (opt.secure) pairs.push('Secure'); + + return pairs.join('; '); +}; + +/// Parse the given cookie header string into an object +/// The object has the various cookies as keys(names) => values +/// @param {String} str +/// @return {Object} +var parse = function(str) { + var obj = {} + var pairs = str.split(/[;,] */); + + pairs.forEach(function(pair) { + var eq_idx = pair.indexOf('=') + var key = pair.substr(0, eq_idx).trim() + var val = pair.substr(++eq_idx, pair.length).trim(); + + // quoted values + if ('"' == val[0]) { + val = val.slice(1, -1); + } + + // only assign once + if (undefined == obj[key]) { + obj[key] = decode(val); + } + }); + + return obj; +}; + +var encode = encodeURIComponent; +var decode = decodeURIComponent; + +module.exports.serialize = serialize; +module.exports.parse = parse; diff --git a/node_modules/express/node_modules/cookie/package.json b/node_modules/express/node_modules/cookie/package.json new file mode 100644 index 0000000..b82d023 --- /dev/null +++ b/node_modules/express/node_modules/cookie/package.json @@ -0,0 +1,32 @@ +{ + "author": { + "name": "Roman Shtylman", + "email": "shtylman@gmail.com" + }, + "name": "cookie", + "description": "cookie parsing and serialization", + "version": "0.0.4", + "repository": { + "type": "git", + "url": "git://github.com/shtylman/node-cookie.git" + }, + "keywords": [ + "cookie", + "cookies" + ], + "main": "index.js", + "scripts": { + "test": "mocha" + }, + "dependencies": {}, + "devDependencies": { + "mocha": "1.x.x" + }, + "optionalDependencies": {}, + "engines": { + "node": "*" + }, + "readme": "# cookie [![Build Status](https://secure.travis-ci.org/shtylman/node-cookie.png?branch=master)](http://travis-ci.org/shtylman/node-cookie) #\n\ncookie is a basic cookie parser and serializer. It doesn't make assumptions about how you are going to deal with your cookies. It basically just provides a way to read and write the HTTP cookie headers.\n\nSee [RFC6265](http://tools.ietf.org/html/rfc6265) for details about the http header for cookies.\n\n## how?\n\n```\nnpm install cookie\n```\n\n```javascript\nvar cookie = require('cookie');\n\nvar hdr = cookie.serialize('foo', 'bar');\n// hdr = 'foo=bar';\n\nvar cookies = cookie.parse('foo=bar; cat=meow; dog=ruff');\n// cookies = { foo: 'bar', cat: 'meow', dog: 'ruff' };\n```\n\n## more\n\nThe serialize function takes a third parameter, an object, to set cookie options. See the RFC for valid values.\n\n### path\n> cookie path\n\n### expires\n> absolute expiration date for the cookie (Date object)\n\n### maxAge\n> relative max age of the cookie from when the client receives it (seconds)\n\n### domain\n> domain for the cookie\n\n### secure\n> true or false\n\n### httpOnly\n> true or false\n\n", + "_id": "cookie@0.0.4", + "_from": "cookie@0.0.4" +} diff --git a/node_modules/express/node_modules/cookie/test/mocha.opts b/node_modules/express/node_modules/cookie/test/mocha.opts new file mode 100644 index 0000000..e2bfcc5 --- /dev/null +++ b/node_modules/express/node_modules/cookie/test/mocha.opts @@ -0,0 +1 @@ +--ui qunit diff --git a/node_modules/express/node_modules/cookie/test/parse.js b/node_modules/express/node_modules/cookie/test/parse.js new file mode 100644 index 0000000..4b98a20 --- /dev/null +++ b/node_modules/express/node_modules/cookie/test/parse.js @@ -0,0 +1,25 @@ + +var assert = require('assert'); + +var cookie = require('..'); + +suite('parse'); + +test('basic', function() { + assert.deepEqual({ foo: 'bar' }, cookie.parse('foo=bar')); + assert.deepEqual({ foo: '123' }, cookie.parse('foo=123')); +}); + +test('ignore spaces', function() { + assert.deepEqual({ FOO: 'bar', baz: 'raz' }, + cookie.parse('FOO = bar; baz = raz')); +}); + +test('escaping', function() { + assert.deepEqual({ foo: 'bar=123456789&name=Magic+Mouse' }, + cookie.parse('foo="bar=123456789&name=Magic+Mouse"')); + + assert.deepEqual({ email: ' ",;/' }, + cookie.parse('email=%20%22%2c%3b%2f')); +}); + diff --git a/node_modules/express/node_modules/cookie/test/serialize.js b/node_modules/express/node_modules/cookie/test/serialize.js new file mode 100644 index 0000000..d38768d --- /dev/null +++ b/node_modules/express/node_modules/cookie/test/serialize.js @@ -0,0 +1,59 @@ +// builtin +var assert = require('assert'); + +var cookie = require('..'); + +suite('serialize'); + +test('basic', function() { + assert.equal('foo=bar', cookie.serialize('foo', 'bar')); + assert.equal('foo=bar%20baz', cookie.serialize('foo', 'bar baz')); +}); + +test('path', function() { + assert.equal('foo=bar; Path=/', cookie.serialize('foo', 'bar', { + path: '/' + })); +}); + +test('secure', function() { + assert.equal('foo=bar; Secure', cookie.serialize('foo', 'bar', { + secure: true + })); + + assert.equal('foo=bar', cookie.serialize('foo', 'bar', { + secure: false + })); +}); + +test('domain', function() { + assert.equal('foo=bar; Domain=example.com', cookie.serialize('foo', 'bar', { + domain: 'example.com' + })); +}); + +test('httpOnly', function() { + assert.equal('foo=bar; HttpOnly', cookie.serialize('foo', 'bar', { + httpOnly: true + })); +}); + +test('maxAge', function() { + assert.equal('foo=bar; Max-Age=1000', cookie.serialize('foo', 'bar', { + maxAge: 1000 + })); +}); + +test('escaping', function() { + assert.deepEqual('cat=%2B%20', cookie.serialize('cat', '+ ')); +}); + +test('parse->serialize', function() { + + assert.deepEqual({ cat: 'foo=123&name=baz five' }, cookie.parse( + cookie.serialize('cat', 'foo=123&name=baz five'))); + + assert.deepEqual({ cat: ' ";/' }, cookie.parse( + cookie.serialize('cat', ' ";/'))); +}); + diff --git a/node_modules/express/node_modules/crc/.gitmodules b/node_modules/express/node_modules/crc/.gitmodules new file mode 100644 index 0000000..2319e18 --- /dev/null +++ b/node_modules/express/node_modules/crc/.gitmodules @@ -0,0 +1,3 @@ +[submodule "tests/nodeunit"] + path = tests/nodeunit + url = git://github.com/caolan/nodeunit.git diff --git a/node_modules/express/node_modules/crc/.npmignore b/node_modules/express/node_modules/crc/.npmignore new file mode 100644 index 0000000..3c3629e --- /dev/null +++ b/node_modules/express/node_modules/crc/.npmignore @@ -0,0 +1 @@ +node_modules diff --git a/node_modules/express/node_modules/crc/Makefile b/node_modules/express/node_modules/crc/Makefile new file mode 100644 index 0000000..720bf85 --- /dev/null +++ b/node_modules/express/node_modules/crc/Makefile @@ -0,0 +1,7 @@ + +test: + @./node_modules/.bin/mocha \ + --require should \ + --reporter spec + +.PHONY: test \ No newline at end of file diff --git a/node_modules/express/node_modules/crc/README.md b/node_modules/express/node_modules/crc/README.md new file mode 100644 index 0000000..26ce22f --- /dev/null +++ b/node_modules/express/node_modules/crc/README.md @@ -0,0 +1,31 @@ +# JavaScript CRC 8, 16 and 32. + +This is a basic port/copy of the JavaScript CRC implementation. The module works with any CommonJS system supporting `module.exports` notation as well as in the browser. When loaded in the browser, all functions end up under the `window.crc` "namespace". + +Original code is taken from http://www.digsys.se/JavaScript/CRC.aspx + +## Functions + +The following functions are implemented: + + crc8(String) #=> Number + crcArc(String) #=> Number + crc16(String) #=> Number + fcs16(String) #=> Number + crc32(String) #=> Number + hex8(Number) #=> String + hex16(Number) #=> String + hex32(Number) #=> String + +## Installation + + git clone git://github.com/alexgorbatchev/node-crc.git + +or + + npm install crc + +## Running tests + + $ npm install + $ make test \ No newline at end of file diff --git a/node_modules/express/node_modules/crc/lib/crc.js b/node_modules/express/node_modules/crc/lib/crc.js new file mode 100644 index 0000000..8feb542 --- /dev/null +++ b/node_modules/express/node_modules/crc/lib/crc.js @@ -0,0 +1,403 @@ +(function() +{ + // CRC-8 in table form + // + // Copyright (c) 1989 AnDan Software. You may use this program, or + // code or tables extracted from it, as long as this notice is not + // removed or changed. + var CRC8_TAB = new Array( + // C/C++ language: + // + // unsigned char CRC8_TAB[] = {...}; + 0x00,0x1B,0x36,0x2D,0x6C,0x77,0x5A,0x41,0xD8,0xC3,0xEE,0xF5,0xB4,0xAF,0x82,0x99,0xD3,0xC8,0xE5, + 0xFE,0xBF,0xA4,0x89,0x92,0x0B,0x10,0x3D,0x26,0x67,0x7C,0x51,0x4A,0xC5,0xDE,0xF3,0xE8,0xA9,0xB2, + 0x9F,0x84,0x1D,0x06,0x2B,0x30,0x71,0x6A,0x47,0x5C,0x16,0x0D,0x20,0x3B,0x7A,0x61,0x4C,0x57,0xCE, + 0xD5,0xF8,0xE3,0xA2,0xB9,0x94,0x8F,0xE9,0xF2,0xDF,0xC4,0x85,0x9E,0xB3,0xA8,0x31,0x2A,0x07,0x1C, + 0x5D,0x46,0x6B,0x70,0x3A,0x21,0x0C,0x17,0x56,0x4D,0x60,0x7B,0xE2,0xF9,0xD4,0xCF,0x8E,0x95,0xB8, + 0xA3,0x2C,0x37,0x1A,0x01,0x40,0x5B,0x76,0x6D,0xF4,0xEF,0xC2,0xD9,0x98,0x83,0xAE,0xB5,0xFF,0xE4, + 0xC9,0xD2,0x93,0x88,0xA5,0xBE,0x27,0x3C,0x11,0x0A,0x4B,0x50,0x7D,0x66,0xB1,0xAA,0x87,0x9C,0xDD, + 0xC6,0xEB,0xF0,0x69,0x72,0x5F,0x44,0x05,0x1E,0x33,0x28,0x62,0x79,0x54,0x4F,0x0E,0x15,0x38,0x23, + 0xBA,0xA1,0x8C,0x97,0xD6,0xCD,0xE0,0xFB,0x74,0x6F,0x42,0x59,0x18,0x03,0x2E,0x35,0xAC,0xB7,0x9A, + 0x81,0xC0,0xDB,0xF6,0xED,0xA7,0xBC,0x91,0x8A,0xCB,0xD0,0xFD,0xE6,0x7F,0x64,0x49,0x52,0x13,0x08, + 0x25,0x3E,0x58,0x43,0x6E,0x75,0x34,0x2F,0x02,0x19,0x80,0x9B,0xB6,0xAD,0xEC,0xF7,0xDA,0xC1,0x8B, + 0x90,0xBD,0xA6,0xE7,0xFC,0xD1,0xCA,0x53,0x48,0x65,0x7E,0x3F,0x24,0x09,0x12,0x9D,0x86,0xAB,0xB0, + 0xF1,0xEA,0xC7,0xDC,0x45,0x5E,0x73,0x68,0x29,0x32,0x1F,0x04,0x4E,0x55,0x78,0x63,0x22,0x39,0x14, + 0x0F,0x96,0x8D,0xA0,0xBB,0xFA,0xE1,0xCC,0xD7 + ); + + function crc8Add(crc,c) + // 'crc' should be initialized to 0x00. + { + return CRC8_TAB[(crc^c)&0xFF]; + }; + // C/C++ language: + // + // inline unsigned char crc8Add(unsigned char crc, unsigned char c) + // { + // return CRC8_TAB[crc^c]; + // } + + // CRC-16 (as it is in SEA's ARC) in table form + // + // The logic for this method of calculating the CRC 16 bit polynomial + // is taken from an article by David Schwaderer in the April 1985 + // issue of PC Tech Journal. + var CRC_ARC_TAB = new Array( + // C/C++ language: + // + // unsigned short CRC_ARC_TAB[] = {...}; + 0x0000,0xC0C1,0xC181,0x0140,0xC301,0x03C0,0x0280,0xC241,0xC601,0x06C0,0x0780,0xC741,0x0500, + 0xC5C1,0xC481,0x0440,0xCC01,0x0CC0,0x0D80,0xCD41,0x0F00,0xCFC1,0xCE81,0x0E40,0x0A00,0xCAC1, + 0xCB81,0x0B40,0xC901,0x09C0,0x0880,0xC841,0xD801,0x18C0,0x1980,0xD941,0x1B00,0xDBC1,0xDA81, + 0x1A40,0x1E00,0xDEC1,0xDF81,0x1F40,0xDD01,0x1DC0,0x1C80,0xDC41,0x1400,0xD4C1,0xD581,0x1540, + 0xD701,0x17C0,0x1680,0xD641,0xD201,0x12C0,0x1380,0xD341,0x1100,0xD1C1,0xD081,0x1040,0xF001, + 0x30C0,0x3180,0xF141,0x3300,0xF3C1,0xF281,0x3240,0x3600,0xF6C1,0xF781,0x3740,0xF501,0x35C0, + 0x3480,0xF441,0x3C00,0xFCC1,0xFD81,0x3D40,0xFF01,0x3FC0,0x3E80,0xFE41,0xFA01,0x3AC0,0x3B80, + 0xFB41,0x3900,0xF9C1,0xF881,0x3840,0x2800,0xE8C1,0xE981,0x2940,0xEB01,0x2BC0,0x2A80,0xEA41, + 0xEE01,0x2EC0,0x2F80,0xEF41,0x2D00,0xEDC1,0xEC81,0x2C40,0xE401,0x24C0,0x2580,0xE541,0x2700, + 0xE7C1,0xE681,0x2640,0x2200,0xE2C1,0xE381,0x2340,0xE101,0x21C0,0x2080,0xE041,0xA001,0x60C0, + 0x6180,0xA141,0x6300,0xA3C1,0xA281,0x6240,0x6600,0xA6C1,0xA781,0x6740,0xA501,0x65C0,0x6480, + 0xA441,0x6C00,0xACC1,0xAD81,0x6D40,0xAF01,0x6FC0,0x6E80,0xAE41,0xAA01,0x6AC0,0x6B80,0xAB41, + 0x6900,0xA9C1,0xA881,0x6840,0x7800,0xB8C1,0xB981,0x7940,0xBB01,0x7BC0,0x7A80,0xBA41,0xBE01, + 0x7EC0,0x7F80,0xBF41,0x7D00,0xBDC1,0xBC81,0x7C40,0xB401,0x74C0,0x7580,0xB541,0x7700,0xB7C1, + 0xB681,0x7640,0x7200,0xB2C1,0xB381,0x7340,0xB101,0x71C0,0x7080,0xB041,0x5000,0x90C1,0x9181, + 0x5140,0x9301,0x53C0,0x5280,0x9241,0x9601,0x56C0,0x5780,0x9741,0x5500,0x95C1,0x9481,0x5440, + 0x9C01,0x5CC0,0x5D80,0x9D41,0x5F00,0x9FC1,0x9E81,0x5E40,0x5A00,0x9AC1,0x9B81,0x5B40,0x9901, + 0x59C0,0x5880,0x9841,0x8801,0x48C0,0x4980,0x8941,0x4B00,0x8BC1,0x8A81,0x4A40,0x4E00,0x8EC1, + 0x8F81,0x4F40,0x8D01,0x4DC0,0x4C80,0x8C41,0x4400,0x84C1,0x8581,0x4540,0x8701,0x47C0,0x4680, + 0x8641,0x8201,0x42C0,0x4380,0x8341,0x4100,0x81C1,0x8081,0x4040 + ); + + function crcArcAdd(crc,c) + // 'crc' should be initialized to 0x0000. + { + return CRC_ARC_TAB[(crc^c)&0xFF]^((crc>>8)&0xFF); + }; + // C/C++ language: + // + // inline unsigned short crcArcAdd(unsigned short crc, unsigned char c) + // { + // return CRC_ARC_TAB[(unsigned char)crc^c]^(unsigned short)(crc>>8); + // } + + // CRC-16 (as it is in ZMODEM) in table form + // + // Copyright (c) 1989 AnDan Software. You may use this program, or + // code or tables extracted from it, as long as this notice is not + // removed or changed. + var CRC16_TAB = new Array( + // C/C++ language: + // + // unsigned short CRC16_TAB[] = {...}; + 0x0000,0x1021,0x2042,0x3063,0x4084,0x50A5,0x60C6,0x70E7,0x8108,0x9129,0xA14A,0xB16B,0xC18C, + 0xD1AD,0xE1CE,0xF1EF,0x1231,0x0210,0x3273,0x2252,0x52B5,0x4294,0x72F7,0x62D6,0x9339,0x8318, + 0xB37B,0xA35A,0xD3BD,0xC39C,0xF3FF,0xE3DE,0x2462,0x3443,0x0420,0x1401,0x64E6,0x74C7,0x44A4, + 0x5485,0xA56A,0xB54B,0x8528,0x9509,0xE5EE,0xF5CF,0xC5AC,0xD58D,0x3653,0x2672,0x1611,0x0630, + 0x76D7,0x66F6,0x5695,0x46B4,0xB75B,0xA77A,0x9719,0x8738,0xF7DF,0xE7FE,0xD79D,0xC7BC,0x48C4, + 0x58E5,0x6886,0x78A7,0x0840,0x1861,0x2802,0x3823,0xC9CC,0xD9ED,0xE98E,0xF9AF,0x8948,0x9969, + 0xA90A,0xB92B,0x5AF5,0x4AD4,0x7AB7,0x6A96,0x1A71,0x0A50,0x3A33,0x2A12,0xDBFD,0xCBDC,0xFBBF, + 0xEB9E,0x9B79,0x8B58,0xBB3B,0xAB1A,0x6CA6,0x7C87,0x4CE4,0x5CC5,0x2C22,0x3C03,0x0C60,0x1C41, + 0xEDAE,0xFD8F,0xCDEC,0xDDCD,0xAD2A,0xBD0B,0x8D68,0x9D49,0x7E97,0x6EB6,0x5ED5,0x4EF4,0x3E13, + 0x2E32,0x1E51,0x0E70,0xFF9F,0xEFBE,0xDFDD,0xCFFC,0xBF1B,0xAF3A,0x9F59,0x8F78,0x9188,0x81A9, + 0xB1CA,0xA1EB,0xD10C,0xC12D,0xF14E,0xE16F,0x1080,0x00A1,0x30C2,0x20E3,0x5004,0x4025,0x7046, + 0x6067,0x83B9,0x9398,0xA3FB,0xB3DA,0xC33D,0xD31C,0xE37F,0xF35E,0x02B1,0x1290,0x22F3,0x32D2, + 0x4235,0x5214,0x6277,0x7256,0xB5EA,0xA5CB,0x95A8,0x8589,0xF56E,0xE54F,0xD52C,0xC50D,0x34E2, + 0x24C3,0x14A0,0x0481,0x7466,0x6447,0x5424,0x4405,0xA7DB,0xB7FA,0x8799,0x97B8,0xE75F,0xF77E, + 0xC71D,0xD73C,0x26D3,0x36F2,0x0691,0x16B0,0x6657,0x7676,0x4615,0x5634,0xD94C,0xC96D,0xF90E, + 0xE92F,0x99C8,0x89E9,0xB98A,0xA9AB,0x5844,0x4865,0x7806,0x6827,0x18C0,0x08E1,0x3882,0x28A3, + 0xCB7D,0xDB5C,0xEB3F,0xFB1E,0x8BF9,0x9BD8,0xABBB,0xBB9A,0x4A75,0x5A54,0x6A37,0x7A16,0x0AF1, + 0x1AD0,0x2AB3,0x3A92,0xFD2E,0xED0F,0xDD6C,0xCD4D,0xBDAA,0xAD8B,0x9DE8,0x8DC9,0x7C26,0x6C07, + 0x5C64,0x4C45,0x3CA2,0x2C83,0x1CE0,0x0CC1,0xEF1F,0xFF3E,0xCF5D,0xDF7C,0xAF9B,0xBFBA,0x8FD9, + 0x9FF8,0x6E17,0x7E36,0x4E55,0x5E74,0x2E93,0x3EB2,0x0ED1,0x1EF0 + ); + + function crc16Add(crc,c) + // 'crc' should be initialized to 0x0000. + { + return CRC16_TAB[((crc>>8)^c)&0xFF]^((crc<<8)&0xFFFF); + }; + // C/C++ language: + // + // inline unsigned short crc16Add(unsigned short crc, unsigned char c) + // { + // return CRC16_TAB[(unsigned char)(crc>>8)^c]^(unsigned short)(crc<<8); + // } + + // FCS-16 (as it is in PPP) in table form + // + // Described in RFC-1662 by William Allen Simpson, see RFC-1662 for references. + // + // Modified by Anders Danielsson, March 10, 2006. + var FCS_16_TAB = new Array( + // C/C++ language: + // + // unsigned short FCS_16_TAB[256] = {...}; + 0x0000,0x1189,0x2312,0x329B,0x4624,0x57AD,0x6536,0x74BF,0x8C48,0x9DC1,0xAF5A,0xBED3,0xCA6C, + 0xDBE5,0xE97E,0xF8F7,0x1081,0x0108,0x3393,0x221A,0x56A5,0x472C,0x75B7,0x643E,0x9CC9,0x8D40, + 0xBFDB,0xAE52,0xDAED,0xCB64,0xF9FF,0xE876,0x2102,0x308B,0x0210,0x1399,0x6726,0x76AF,0x4434, + 0x55BD,0xAD4A,0xBCC3,0x8E58,0x9FD1,0xEB6E,0xFAE7,0xC87C,0xD9F5,0x3183,0x200A,0x1291,0x0318, + 0x77A7,0x662E,0x54B5,0x453C,0xBDCB,0xAC42,0x9ED9,0x8F50,0xFBEF,0xEA66,0xD8FD,0xC974,0x4204, + 0x538D,0x6116,0x709F,0x0420,0x15A9,0x2732,0x36BB,0xCE4C,0xDFC5,0xED5E,0xFCD7,0x8868,0x99E1, + 0xAB7A,0xBAF3,0x5285,0x430C,0x7197,0x601E,0x14A1,0x0528,0x37B3,0x263A,0xDECD,0xCF44,0xFDDF, + 0xEC56,0x98E9,0x8960,0xBBFB,0xAA72,0x6306,0x728F,0x4014,0x519D,0x2522,0x34AB,0x0630,0x17B9, + 0xEF4E,0xFEC7,0xCC5C,0xDDD5,0xA96A,0xB8E3,0x8A78,0x9BF1,0x7387,0x620E,0x5095,0x411C,0x35A3, + 0x242A,0x16B1,0x0738,0xFFCF,0xEE46,0xDCDD,0xCD54,0xB9EB,0xA862,0x9AF9,0x8B70,0x8408,0x9581, + 0xA71A,0xB693,0xC22C,0xD3A5,0xE13E,0xF0B7,0x0840,0x19C9,0x2B52,0x3ADB,0x4E64,0x5FED,0x6D76, + 0x7CFF,0x9489,0x8500,0xB79B,0xA612,0xD2AD,0xC324,0xF1BF,0xE036,0x18C1,0x0948,0x3BD3,0x2A5A, + 0x5EE5,0x4F6C,0x7DF7,0x6C7E,0xA50A,0xB483,0x8618,0x9791,0xE32E,0xF2A7,0xC03C,0xD1B5,0x2942, + 0x38CB,0x0A50,0x1BD9,0x6F66,0x7EEF,0x4C74,0x5DFD,0xB58B,0xA402,0x9699,0x8710,0xF3AF,0xE226, + 0xD0BD,0xC134,0x39C3,0x284A,0x1AD1,0x0B58,0x7FE7,0x6E6E,0x5CF5,0x4D7C,0xC60C,0xD785,0xE51E, + 0xF497,0x8028,0x91A1,0xA33A,0xB2B3,0x4A44,0x5BCD,0x6956,0x78DF,0x0C60,0x1DE9,0x2F72,0x3EFB, + 0xD68D,0xC704,0xF59F,0xE416,0x90A9,0x8120,0xB3BB,0xA232,0x5AC5,0x4B4C,0x79D7,0x685E,0x1CE1, + 0x0D68,0x3FF3,0x2E7A,0xE70E,0xF687,0xC41C,0xD595,0xA12A,0xB0A3,0x8238,0x93B1,0x6B46,0x7ACF, + 0x4854,0x59DD,0x2D62,0x3CEB,0x0E70,0x1FF9,0xF78F,0xE606,0xD49D,0xC514,0xB1AB,0xA022,0x92B9, + 0x8330,0x7BC7,0x6A4E,0x58D5,0x495C,0x3DE3,0x2C6A,0x1EF1,0x0F78 + ); + + function fcs16Add(fcs,c) + // 'fcs' should be initialized to 0xFFFF and after the computation it should be + // complemented (inverted). + // + // If the FCS-16 is calculated over the data and over the complemented FCS-16, the + // result will always be 0xF0B8 (without the complementation). + { + return FCS_16_TAB[(fcs^c)&0xFF]^((fcs>>8)&0xFF); + }; + + // C/C++ language: + // + // inline unsigned short fcs16Add(unsigned short fcs, unsigned char c) + // { + // return FCS_16_TAB[(unsigned char)fcs^c]^(unsigned short)(fcs>>8); + // } + + // + // CRC-32 (as it is in ZMODEM) in table form + // + // Copyright (C) 1986 Gary S. Brown. You may use this program, or + // code or tables extracted from it, as desired without restriction. + // + // Modified by Anders Danielsson, February 5, 1989 and March 10, 2006. + // + // This is also known as FCS-32 (as it is in PPP), described in + // RFC-1662 by William Allen Simpson, see RFC-1662 for references. + // + var CRC32_TAB = new Array( /* CRC polynomial 0xEDB88320 */ + // C/C++ language: + // + // unsigned long CRC32_TAB[] = {...}; + 0x00000000,0x77073096,0xEE0E612C,0x990951BA,0x076DC419,0x706AF48F,0xE963A535,0x9E6495A3, + 0x0EDB8832,0x79DCB8A4,0xE0D5E91E,0x97D2D988,0x09B64C2B,0x7EB17CBD,0xE7B82D07,0x90BF1D91, + 0x1DB71064,0x6AB020F2,0xF3B97148,0x84BE41DE,0x1ADAD47D,0x6DDDE4EB,0xF4D4B551,0x83D385C7, + 0x136C9856,0x646BA8C0,0xFD62F97A,0x8A65C9EC,0x14015C4F,0x63066CD9,0xFA0F3D63,0x8D080DF5, + 0x3B6E20C8,0x4C69105E,0xD56041E4,0xA2677172,0x3C03E4D1,0x4B04D447,0xD20D85FD,0xA50AB56B, + 0x35B5A8FA,0x42B2986C,0xDBBBC9D6,0xACBCF940,0x32D86CE3,0x45DF5C75,0xDCD60DCF,0xABD13D59, + 0x26D930AC,0x51DE003A,0xC8D75180,0xBFD06116,0x21B4F4B5,0x56B3C423,0xCFBA9599,0xB8BDA50F, + 0x2802B89E,0x5F058808,0xC60CD9B2,0xB10BE924,0x2F6F7C87,0x58684C11,0xC1611DAB,0xB6662D3D, + 0x76DC4190,0x01DB7106,0x98D220BC,0xEFD5102A,0x71B18589,0x06B6B51F,0x9FBFE4A5,0xE8B8D433, + 0x7807C9A2,0x0F00F934,0x9609A88E,0xE10E9818,0x7F6A0DBB,0x086D3D2D,0x91646C97,0xE6635C01, + 0x6B6B51F4,0x1C6C6162,0x856530D8,0xF262004E,0x6C0695ED,0x1B01A57B,0x8208F4C1,0xF50FC457, + 0x65B0D9C6,0x12B7E950,0x8BBEB8EA,0xFCB9887C,0x62DD1DDF,0x15DA2D49,0x8CD37CF3,0xFBD44C65, + 0x4DB26158,0x3AB551CE,0xA3BC0074,0xD4BB30E2,0x4ADFA541,0x3DD895D7,0xA4D1C46D,0xD3D6F4FB, + 0x4369E96A,0x346ED9FC,0xAD678846,0xDA60B8D0,0x44042D73,0x33031DE5,0xAA0A4C5F,0xDD0D7CC9, + 0x5005713C,0x270241AA,0xBE0B1010,0xC90C2086,0x5768B525,0x206F85B3,0xB966D409,0xCE61E49F, + 0x5EDEF90E,0x29D9C998,0xB0D09822,0xC7D7A8B4,0x59B33D17,0x2EB40D81,0xB7BD5C3B,0xC0BA6CAD, + 0xEDB88320,0x9ABFB3B6,0x03B6E20C,0x74B1D29A,0xEAD54739,0x9DD277AF,0x04DB2615,0x73DC1683, + 0xE3630B12,0x94643B84,0x0D6D6A3E,0x7A6A5AA8,0xE40ECF0B,0x9309FF9D,0x0A00AE27,0x7D079EB1, + 0xF00F9344,0x8708A3D2,0x1E01F268,0x6906C2FE,0xF762575D,0x806567CB,0x196C3671,0x6E6B06E7, + 0xFED41B76,0x89D32BE0,0x10DA7A5A,0x67DD4ACC,0xF9B9DF6F,0x8EBEEFF9,0x17B7BE43,0x60B08ED5, + 0xD6D6A3E8,0xA1D1937E,0x38D8C2C4,0x4FDFF252,0xD1BB67F1,0xA6BC5767,0x3FB506DD,0x48B2364B, + 0xD80D2BDA,0xAF0A1B4C,0x36034AF6,0x41047A60,0xDF60EFC3,0xA867DF55,0x316E8EEF,0x4669BE79, + 0xCB61B38C,0xBC66831A,0x256FD2A0,0x5268E236,0xCC0C7795,0xBB0B4703,0x220216B9,0x5505262F, + 0xC5BA3BBE,0xB2BD0B28,0x2BB45A92,0x5CB36A04,0xC2D7FFA7,0xB5D0CF31,0x2CD99E8B,0x5BDEAE1D, + 0x9B64C2B0,0xEC63F226,0x756AA39C,0x026D930A,0x9C0906A9,0xEB0E363F,0x72076785,0x05005713, + 0x95BF4A82,0xE2B87A14,0x7BB12BAE,0x0CB61B38,0x92D28E9B,0xE5D5BE0D,0x7CDCEFB7,0x0BDBDF21, + 0x86D3D2D4,0xF1D4E242,0x68DDB3F8,0x1FDA836E,0x81BE16CD,0xF6B9265B,0x6FB077E1,0x18B74777, + 0x88085AE6,0xFF0F6A70,0x66063BCA,0x11010B5C,0x8F659EFF,0xF862AE69,0x616BFFD3,0x166CCF45, + 0xA00AE278,0xD70DD2EE,0x4E048354,0x3903B3C2,0xA7672661,0xD06016F7,0x4969474D,0x3E6E77DB, + 0xAED16A4A,0xD9D65ADC,0x40DF0B66,0x37D83BF0,0xA9BCAE53,0xDEBB9EC5,0x47B2CF7F,0x30B5FFE9, + 0xBDBDF21C,0xCABAC28A,0x53B39330,0x24B4A3A6,0xBAD03605,0xCDD70693,0x54DE5729,0x23D967BF, + 0xB3667A2E,0xC4614AB8,0x5D681B02,0x2A6F2B94,0xB40BBE37,0xC30C8EA1,0x5A05DF1B,0x2D02EF8D + ); + + function crc32Add(crc,c) + // 'crc' should be initialized to 0xFFFFFFFF and after the computation it should be + // complemented (inverted). + // + // CRC-32 is also known as FCS-32. + // + // If the FCS-32 is calculated over the data and over the complemented FCS-32, the + // result will always be 0xDEBB20E3 (without the complementation). + { + return CRC32_TAB[(crc^c)&0xFF]^((crc>>8)&0xFFFFFF); + }; + // + // C/C++ language: + // + // inline unsigned long crc32Add(unsigned long crc, unsigned char c) + // { + // return CRC32_TAB[(unsigned char)crc^c]^(crc>>8); + // } + // + + function crc8(str) + { + var n, + len = str.length, + crc = 0 + ; + + for(var i = 0; i < len; i++) + crc = crc8Add(crc, str.charCodeAt(i)); + + return crc; + }; + + function crc8Buffer(buf) + { + var crc = 0; + + for (var i = 0, len = buf.length; i < len; ++i) + { + crc = crc8Add(crc, buf[i]); + } + + return crc; + } + + function crcArc(str) + { + var i, + len = str.length, + crc = 0 + ; + + for(i = 0; i < len; i++) + crc = crcArcAdd(crc, str.charCodeAt(i)); + + return crc; + }; + + function crc16(str) + { + var i, + len = str.length, + crc = 0 + ; + + for(i = 0; i < len; i++) + crc = crc16Add(crc, str.charCodeAt(i)); + + return crc; + }; + + function crc16Buffer(buf) + { + var crc = 0; + + for (var i = 0, len = buf.length; i < len; ++i) + { + crc = crc16Add(crc, buf[i]); + } + + return crc; + } + + function fcs16(str) + { + var i, + len = str.length, + fcs = 0xFFFF + ; + + for(i = 0; i < len; i++) + fcs = fcs16Add(fcs,str.charCodeAt(i)); + + return fcs^0xFFFF; + }; + + function crc32(str) + { + var i, + len = str.length, + crc = 0xFFFFFFFF + ; + + for(i = 0; i < len; i++) + crc = crc32Add(crc, str.charCodeAt(i)); + + return crc^0xFFFFFFFF; + }; + + function crc32Buffer(buf) + { + var crc = 0xFFFFFFFF; + + for (var i = 0, len = buf.length; i < len; ++i) + { + crc = crc32Add(crc, buf[i]); + } + + return crc ^ 0xFFFFFFFF; + } + + /** + * Convert value as 8-bit unsigned integer to 2 digit hexadecimal number. + */ + function hex8(val) + { + var n = val & 0xFF, + str = n.toString(16).toUpperCase() + ; + + while(str.length < 2) + str = "0" + str; + + return str; + }; + + /** + * Convert value as 16-bit unsigned integer to 4 digit hexadecimal number. + */ + function hex16(val) + { + return hex8(val >> 8) + hex8(val); + }; + + /** + * Convert value as 32-bit unsigned integer to 8 digit hexadecimal number. + */ + function hex32(val) + { + return hex16(val >> 16) + hex16(val); + }; + + var target, property; + + if(typeof(window) == 'undefined') + { + target = module; + property = 'exports'; + } + else + { + target = window; + property = 'crc'; + } + + target[property] = { + 'crc8' : crc8, + 'crcArc' : crcArc, + 'crc16' : crc16, + 'fcs16' : fcs16, + 'crc32' : crc32, + 'hex8' : hex8, + 'hex16' : hex16, + 'hex32' : hex32, + 'buffer' : { + crc8 : crc8Buffer, + crc16 : crc16Buffer, + crc32 : crc32Buffer + } + }; +})(); diff --git a/node_modules/express/node_modules/crc/package.json b/node_modules/express/node_modules/crc/package.json new file mode 100644 index 0000000..093f6ec --- /dev/null +++ b/node_modules/express/node_modules/crc/package.json @@ -0,0 +1,24 @@ +{ + "name": "crc", + "version": "0.2.0", + "description": "CRC JavaScript implementation", + "author": { + "name": "Alex Gorbatchev", + "email": "alex.gorbatchev@gmail.com" + }, + "contributors": [], + "main": "./lib/crc.js", + "scripts": {}, + "directories": {}, + "devDependencies": { + "mocha": "*", + "should": "*" + }, + "repository": { + "type": "git", + "url": "git://github.com/alexgorbatchev/node-crc.git" + }, + "readme": "# JavaScript CRC 8, 16 and 32.\n\nThis is a basic port/copy of the JavaScript CRC implementation. The module works with any CommonJS system supporting `module.exports` notation as well as in the browser. When loaded in the browser, all functions end up under the `window.crc` \"namespace\".\n\nOriginal code is taken from http://www.digsys.se/JavaScript/CRC.aspx \n\n## Functions\n\nThe following functions are implemented:\n\n crc8(String)\t#=> Number\n crcArc(String)\t#=> Number\n crc16(String)\t#=> Number\n fcs16(String)\t#=> Number\n crc32(String)\t#=> Number\n hex8(Number)\t#=> String\n hex16(Number)\t#=> String\n hex32(Number)\t#=> String\n\n## Installation\n\n\tgit clone git://github.com/alexgorbatchev/node-crc.git\n\nor\n\n npm install crc\n\n## Running tests\n\n $ npm install\n $ make test", + "_id": "crc@0.2.0", + "_from": "crc@0.2.0" +} diff --git a/node_modules/express/node_modules/crc/test/crc.js b/node_modules/express/node_modules/crc/test/crc.js new file mode 100755 index 0000000..faf2d1d --- /dev/null +++ b/node_modules/express/node_modules/crc/test/crc.js @@ -0,0 +1,63 @@ +#!/usr/bin/env ./nodeunit/bin/nodeunit + +var crc = require('../lib/crc'); + +describe('crc8()', function(){ + it('should work with strings', function(){ + crc.crc8('hello world').should.equal(64); + }) + + it('should work with Buffers', function(){ + crc.buffer.crc8(new Buffer('hello world')).should.equal(64); + }) +}) + +describe('crc16()', function(){ + it('should work with strings', function(){ + crc.crc16('hello world').should.equal(15332); + }) + + it('should work with Buffers', function(){ + crc.buffer.crc16(new Buffer('hello world')).should.equal(15332); + }) +}) + +describe('crc32()', function(){ + it('should work with strings', function(){ + crc.crc32('hello world').should.equal(222957957); + }) + + it('should work with Buffers', function(){ + crc.buffer.crc32(new Buffer('hello world')).should.equal(222957957); + }) +}) + +describe('crcArc()', function(){ + it('should work with strings', function(){ + crc.crcArc('hello world').should.equal(14785); + }) +}) + +describe('fcs16()', function(){ + it('should work with strings', function(){ + crc.fcs16('hello world').should.equal(44550); + }) +}) + +describe('hex8()', function(){ + it('should work with strings', function(){ + crc.hex8(64).should.equal('40'); + }) +}) + +describe('hex16()', function(){ + it('should work with strings', function(){ + crc.hex16(15332).should.equal('3BE4'); + }) +}) + +describe('hex32()', function(){ + it('should work with strings', function(){ + crc.hex32(222957957).should.equal('0D4A1185'); + }) +}) diff --git a/node_modules/express/node_modules/debug/.npmignore b/node_modules/express/node_modules/debug/.npmignore new file mode 100644 index 0000000..f1250e5 --- /dev/null +++ b/node_modules/express/node_modules/debug/.npmignore @@ -0,0 +1,4 @@ +support +test +examples +*.sock diff --git a/node_modules/express/node_modules/debug/History.md b/node_modules/express/node_modules/debug/History.md new file mode 100644 index 0000000..f023269 --- /dev/null +++ b/node_modules/express/node_modules/debug/History.md @@ -0,0 +1,62 @@ + +0.7.2 / 2013-02-06 +================== + + * fix package.json + * fix: Mobile Safari (private mode) is broken with debug + * fix: Use unicode to send escape character to shell instead of octal to work with strict mode javascript + +0.7.1 / 2013-02-05 +================== + + * add repository URL to package.json + * add DEBUG_COLORED to force colored output + * add browserify support + * fix component. Closes #24 + +0.7.0 / 2012-05-04 +================== + + * Added .component to package.json + * Added debug.component.js build + +0.6.0 / 2012-03-16 +================== + + * Added support for "-" prefix in DEBUG [Vinay Pulim] + * Added `.enabled` flag to the node version [TooTallNate] + +0.5.0 / 2012-02-02 +================== + + * Added: humanize diffs. Closes #8 + * Added `debug.disable()` to the CS variant + * Removed padding. Closes #10 + * Fixed: persist client-side variant again. Closes #9 + +0.4.0 / 2012-02-01 +================== + + * Added browser variant support for older browsers [TooTallNate] + * Added `debug.enable('project:*')` to browser variant [TooTallNate] + * Added padding to diff (moved it to the right) + +0.3.0 / 2012-01-26 +================== + + * Added millisecond diff when isatty, otherwise UTC string + +0.2.0 / 2012-01-22 +================== + + * Added wildcard support + +0.1.0 / 2011-12-02 +================== + + * Added: remove colors unless stderr isatty [TooTallNate] + +0.0.1 / 2010-01-03 +================== + + * Initial release diff --git a/node_modules/express/node_modules/debug/Readme.md b/node_modules/express/node_modules/debug/Readme.md new file mode 100644 index 0000000..15ee501 --- /dev/null +++ b/node_modules/express/node_modules/debug/Readme.md @@ -0,0 +1,115 @@ + +# debug + + tiny node.js debugging utility modelled after node core's debugging technique. + +## Installation + +``` +$ npm install debug +``` + +## Usage + + With `debug` you simply invoke the exported function to generate your debug function, passing it a name which will determine if a noop function is returned, or a decorated `console.error`, so all of the `console` format string goodies you're used to work fine. A unique color is selected per-function for visibility. + +Example _app.js_: + +```js +var debug = require('debug')('http') + , http = require('http') + , name = 'My App'; + +// fake app + +debug('booting %s', name); + +http.createServer(function(req, res){ + debug(req.method + ' ' + req.url); + res.end('hello\n'); +}).listen(3000, function(){ + debug('listening'); +}); + +// fake worker of some kind + +require('./worker'); +``` + +Example _worker.js_: + +```js +var debug = require('debug')('worker'); + +setInterval(function(){ + debug('doing some work'); +}, 1000); +``` + + The __DEBUG__ environment variable is then used to enable these based on space or comma-delimited names. Here are some examples: + + ![debug http and worker](http://f.cl.ly/items/18471z1H402O24072r1J/Screenshot.png) + + ![debug worker](http://f.cl.ly/items/1X413v1a3M0d3C2c1E0i/Screenshot.png) + +## Millisecond diff + + When actively developing an application it can be useful to see when the time spent between one `debug()` call and the next. Suppose for example you invoke `debug()` before requesting a resource, and after as well, the "+NNNms" will show you how much time was spent between calls. + + ![](http://f.cl.ly/items/2i3h1d3t121M2Z1A3Q0N/Screenshot.png) + + When stdout is not a TTY, `Date#toUTCString()` is used, making it more useful for logging the debug information as shown below: + + ![](http://f.cl.ly/items/112H3i0e0o0P0a2Q2r11/Screenshot.png) + +## Conventions + + If you're using this in one or more of your libraries, you _should_ use the name of your library so that developers may toggle debugging as desired without guessing names. If you have more than one debuggers you _should_ prefix them with your library name and use ":" to separate features. For example "bodyParser" from Connect would then be "connect:bodyParser". + +## Wildcards + + The "*" character may be used as a wildcard. Suppose for example your library has debuggers named "connect:bodyParser", "connect:compress", "connect:session", instead of listing all three with `DEBUG=connect:bodyParser,connect.compress,connect:session`, you may simply do `DEBUG=connect:*`, or to run everything using this module simply use `DEBUG=*`. + + You can also exclude specific debuggers by prefixing them with a "-" character. For example, `DEBUG=* -connect:*` would include all debuggers except those starting with "connect:". + +## Browser support + + Debug works in the browser as well, currently persisted by `localStorage`. For example if you have `worker:a` and `worker:b` as shown below, and wish to debug both type `debug.enable('worker:*')` in the console and refresh the page, this will remain until you disable with `debug.disable()`. + +```js +a = debug('worker:a'); +b = debug('worker:b'); + +setInterval(function(){ + a('doing some work'); +}, 1000); + +setInterval(function(){ + a('doing some work'); +}, 1200); +``` + +## License + +(The MIT License) + +Copyright (c) 2011 TJ Holowaychuk <tj@vision-media.ca> + +Permission is hereby granted, free of charge, to any person obtaining +a copy of this software and associated documentation files (the +'Software'), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, sublicense, and/or sell copies of the Software, and to +permit persons to whom the Software is furnished to do so, subject to +the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. +IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY +CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, +TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE +SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. \ No newline at end of file diff --git a/node_modules/express/node_modules/debug/component.json b/node_modules/express/node_modules/debug/component.json new file mode 100644 index 0000000..4ad0971 --- /dev/null +++ b/node_modules/express/node_modules/debug/component.json @@ -0,0 +1,9 @@ +{ + "name": "debug", + "repo": "visionmedia/debug", + "description": "small debugging utility", + "version": "0.7.2", + "keywords": ["debug", "log", "debugger"], + "scripts": ["index.js", "debug.js"], + "dependencies": {} +} diff --git a/node_modules/express/node_modules/debug/debug.js b/node_modules/express/node_modules/debug/debug.js new file mode 100644 index 0000000..e47ba5b --- /dev/null +++ b/node_modules/express/node_modules/debug/debug.js @@ -0,0 +1,124 @@ + +/** + * Expose `debug()` as the module. + */ + +module.exports = debug; + +/** + * Create a debugger with the given `name`. + * + * @param {String} name + * @return {Type} + * @api public + */ + +function debug(name) { + if (!debug.enabled(name)) return function(){}; + + return function(fmt){ + var curr = new Date; + var ms = curr - (debug[name] || curr); + debug[name] = curr; + + fmt = name + + ' ' + + fmt + + ' +' + debug.humanize(ms); + + // This hackery is required for IE8 + // where `console.log` doesn't have 'apply' + window.console + && console.log + && Function.prototype.apply.call(console.log, console, arguments); + } +} + +/** + * The currently active debug mode names. + */ + +debug.names = []; +debug.skips = []; + +/** + * Enables a debug mode by name. This can include modes + * separated by a colon and wildcards. + * + * @param {String} name + * @api public + */ + +debug.enable = function(name) { + try { + localStorage.debug = name; + } catch(e){} + + var split = (name || '').split(/[\s,]+/) + , len = split.length; + + for (var i = 0; i < len; i++) { + name = split[i].replace('*', '.*?'); + if (name[0] === '-') { + debug.skips.push(new RegExp('^' + name.substr(1) + '$')); + } + else { + debug.names.push(new RegExp('^' + name + '$')); + } + } +}; + +/** + * Disable debug output. + * + * @api public + */ + +debug.disable = function(){ + debug.enable(''); +}; + +/** + * Humanize the given `ms`. + * + * @param {Number} m + * @return {String} + * @api private + */ + +debug.humanize = function(ms) { + var sec = 1000 + , min = 60 * 1000 + , hour = 60 * min; + + if (ms >= hour) return (ms / hour).toFixed(1) + 'h'; + if (ms >= min) return (ms / min).toFixed(1) + 'm'; + if (ms >= sec) return (ms / sec | 0) + 's'; + return ms + 'ms'; +}; + +/** + * Returns true if the given mode name is enabled, false otherwise. + * + * @param {String} name + * @return {Boolean} + * @api public + */ + +debug.enabled = function(name) { + for (var i = 0, len = debug.skips.length; i < len; i++) { + if (debug.skips[i].test(name)) { + return false; + } + } + for (var i = 0, len = debug.names.length; i < len; i++) { + if (debug.names[i].test(name)) { + return true; + } + } + return false; +}; + +// persist + +if (window.localStorage) debug.enable(localStorage.debug); diff --git a/node_modules/express/node_modules/debug/example/app.js b/node_modules/express/node_modules/debug/example/app.js new file mode 100644 index 0000000..05374d9 --- /dev/null +++ b/node_modules/express/node_modules/debug/example/app.js @@ -0,0 +1,19 @@ + +var debug = require('../')('http') + , http = require('http') + , name = 'My App'; + +// fake app + +debug('booting %s', name); + +http.createServer(function(req, res){ + debug(req.method + ' ' + req.url); + res.end('hello\n'); +}).listen(3000, function(){ + debug('listening'); +}); + +// fake worker of some kind + +require('./worker'); \ No newline at end of file diff --git a/node_modules/express/node_modules/debug/example/browser.html b/node_modules/express/node_modules/debug/example/browser.html new file mode 100644 index 0000000..7510eee --- /dev/null +++ b/node_modules/express/node_modules/debug/example/browser.html @@ -0,0 +1,24 @@ + + + debug() + + + + + + + diff --git a/node_modules/express/node_modules/debug/example/wildcards.js b/node_modules/express/node_modules/debug/example/wildcards.js new file mode 100644 index 0000000..1fdac20 --- /dev/null +++ b/node_modules/express/node_modules/debug/example/wildcards.js @@ -0,0 +1,10 @@ + +var debug = { + foo: require('../')('test:foo'), + bar: require('../')('test:bar'), + baz: require('../')('test:baz') +}; + +debug.foo('foo') +debug.bar('bar') +debug.baz('baz') \ No newline at end of file diff --git a/node_modules/express/node_modules/debug/example/worker.js b/node_modules/express/node_modules/debug/example/worker.js new file mode 100644 index 0000000..7f6d288 --- /dev/null +++ b/node_modules/express/node_modules/debug/example/worker.js @@ -0,0 +1,22 @@ + +// DEBUG=* node example/worker +// DEBUG=worker:* node example/worker +// DEBUG=worker:a node example/worker +// DEBUG=worker:b node example/worker + +var a = require('../')('worker:a') + , b = require('../')('worker:b'); + +function work() { + a('doing lots of uninteresting work'); + setTimeout(work, Math.random() * 1000); +} + +work(); + +function workb() { + b('doing some work'); + setTimeout(workb, Math.random() * 2000); +} + +workb(); \ No newline at end of file diff --git a/node_modules/express/node_modules/debug/index.js b/node_modules/express/node_modules/debug/index.js new file mode 100644 index 0000000..e02c13b --- /dev/null +++ b/node_modules/express/node_modules/debug/index.js @@ -0,0 +1,5 @@ +if ('undefined' == typeof window) { + module.exports = require('./lib/debug'); +} else { + module.exports = require('./debug'); +} diff --git a/node_modules/express/node_modules/debug/lib/debug.js b/node_modules/express/node_modules/debug/lib/debug.js new file mode 100644 index 0000000..0b07aa1 --- /dev/null +++ b/node_modules/express/node_modules/debug/lib/debug.js @@ -0,0 +1,134 @@ +/** + * Module dependencies. + */ + +var tty = require('tty'); + +/** + * Expose `debug()` as the module. + */ + +module.exports = debug; + +/** + * Enabled debuggers. + */ + +var names = [] + , skips = []; + +(process.env.DEBUG || '') + .split(/[\s,]+/) + .forEach(function(name){ + name = name.replace('*', '.*?'); + if (name[0] === '-') { + skips.push(new RegExp('^' + name.substr(1) + '$')); + } else { + names.push(new RegExp('^' + name + '$')); + } + }); + +/** + * Colors. + */ + +var colors = [6, 2, 3, 4, 5, 1]; + +/** + * Previous debug() call. + */ + +var prev = {}; + +/** + * Previously assigned color. + */ + +var prevColor = 0; + +/** + * Is stdout a TTY? Colored output is disabled when `true`. + */ + +var isatty = tty.isatty(2); + +/** + * Select a color. + * + * @return {Number} + * @api private + */ + +function color() { + return colors[prevColor++ % colors.length]; +} + +/** + * Humanize the given `ms`. + * + * @param {Number} m + * @return {String} + * @api private + */ + +function humanize(ms) { + var sec = 1000 + , min = 60 * 1000 + , hour = 60 * min; + + if (ms >= hour) return (ms / hour).toFixed(1) + 'h'; + if (ms >= min) return (ms / min).toFixed(1) + 'm'; + if (ms >= sec) return (ms / sec | 0) + 's'; + return ms + 'ms'; +} + +/** + * Create a debugger with the given `name`. + * + * @param {String} name + * @return {Type} + * @api public + */ + +function debug(name) { + function disabled(){} + disabled.enabled = false; + + var match = skips.some(function(re){ + return re.test(name); + }); + + if (match) return disabled; + + match = names.some(function(re){ + return re.test(name); + }); + + if (!match) return disabled; + var c = color(); + + function colored(fmt) { + var curr = new Date; + var ms = curr - (prev[name] || curr); + prev[name] = curr; + + fmt = ' \u001b[9' + c + 'm' + name + ' ' + + '\u001b[3' + c + 'm\u001b[90m' + + fmt + '\u001b[3' + c + 'm' + + ' +' + humanize(ms) + '\u001b[0m'; + + console.error.apply(this, arguments); + } + + function plain(fmt) { + fmt = new Date().toUTCString() + + ' ' + name + ' ' + fmt; + console.error.apply(this, arguments); + } + + colored.enabled = plain.enabled = true; + + return isatty || process.env.DEBUG_COLORS + ? colored + : plain; +} diff --git a/node_modules/express/node_modules/debug/package.json b/node_modules/express/node_modules/debug/package.json new file mode 100644 index 0000000..2f6302d --- /dev/null +++ b/node_modules/express/node_modules/debug/package.json @@ -0,0 +1,36 @@ +{ + "name": "debug", + "version": "0.7.2", + "repository": { + "type": "git", + "url": "git://github.com/visionmedia/debug.git" + }, + "description": "small debugging utility", + "keywords": [ + "debug", + "log", + "debugger" + ], + "author": { + "name": "TJ Holowaychuk", + "email": "tj@vision-media.ca" + }, + "dependencies": {}, + "devDependencies": { + "mocha": "*" + }, + "main": "lib/debug.js", + "browserify": "debug.js", + "engines": { + "node": "*" + }, + "component": { + "scripts": { + "debug/index.js": "index.js", + "debug/debug.js": "debug.js" + } + }, + "readme": "\n# debug\n\n tiny node.js debugging utility modelled after node core's debugging technique.\n\n## Installation\n\n```\n$ npm install debug\n```\n\n## Usage\n\n With `debug` you simply invoke the exported function to generate your debug function, passing it a name which will determine if a noop function is returned, or a decorated `console.error`, so all of the `console` format string goodies you're used to work fine. A unique color is selected per-function for visibility.\n \nExample _app.js_:\n\n```js\nvar debug = require('debug')('http')\n , http = require('http')\n , name = 'My App';\n\n// fake app\n\ndebug('booting %s', name);\n\nhttp.createServer(function(req, res){\n debug(req.method + ' ' + req.url);\n res.end('hello\\n');\n}).listen(3000, function(){\n debug('listening');\n});\n\n// fake worker of some kind\n\nrequire('./worker');\n```\n\nExample _worker.js_:\n\n```js\nvar debug = require('debug')('worker');\n\nsetInterval(function(){\n debug('doing some work');\n}, 1000);\n```\n\n The __DEBUG__ environment variable is then used to enable these based on space or comma-delimited names. Here are some examples:\n\n ![debug http and worker](http://f.cl.ly/items/18471z1H402O24072r1J/Screenshot.png)\n\n ![debug worker](http://f.cl.ly/items/1X413v1a3M0d3C2c1E0i/Screenshot.png)\n\n## Millisecond diff\n\n When actively developing an application it can be useful to see when the time spent between one `debug()` call and the next. Suppose for example you invoke `debug()` before requesting a resource, and after as well, the \"+NNNms\" will show you how much time was spent between calls.\n\n ![](http://f.cl.ly/items/2i3h1d3t121M2Z1A3Q0N/Screenshot.png)\n\n When stdout is not a TTY, `Date#toUTCString()` is used, making it more useful for logging the debug information as shown below:\n \n ![](http://f.cl.ly/items/112H3i0e0o0P0a2Q2r11/Screenshot.png)\n\n## Conventions\n\n If you're using this in one or more of your libraries, you _should_ use the name of your library so that developers may toggle debugging as desired without guessing names. If you have more than one debuggers you _should_ prefix them with your library name and use \":\" to separate features. For example \"bodyParser\" from Connect would then be \"connect:bodyParser\". \n\n## Wildcards\n\n The \"*\" character may be used as a wildcard. Suppose for example your library has debuggers named \"connect:bodyParser\", \"connect:compress\", \"connect:session\", instead of listing all three with `DEBUG=connect:bodyParser,connect.compress,connect:session`, you may simply do `DEBUG=connect:*`, or to run everything using this module simply use `DEBUG=*`.\n\n You can also exclude specific debuggers by prefixing them with a \"-\" character. For example, `DEBUG=* -connect:*` would include all debuggers except those starting with \"connect:\".\n\n## Browser support\n\n Debug works in the browser as well, currently persisted by `localStorage`. For example if you have `worker:a` and `worker:b` as shown below, and wish to debug both type `debug.enable('worker:*')` in the console and refresh the page, this will remain until you disable with `debug.disable()`. \n\n```js\na = debug('worker:a');\nb = debug('worker:b');\n\nsetInterval(function(){\n a('doing some work');\n}, 1000);\n\nsetInterval(function(){\n a('doing some work');\n}, 1200);\n```\n\n## License \n\n(The MIT License)\n\nCopyright (c) 2011 TJ Holowaychuk <tj@vision-media.ca>\n\nPermission is hereby granted, free of charge, to any person obtaining\na copy of this software and associated documentation files (the\n'Software'), to deal in the Software without restriction, including\nwithout limitation the rights to use, copy, modify, merge, publish,\ndistribute, sublicense, and/or sell copies of the Software, and to\npermit persons to whom the Software is furnished to do so, subject to\nthe following conditions:\n\nThe above copyright notice and this permission notice shall be\nincluded in all copies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,\nEXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\nMERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.\nIN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY\nCLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,\nTORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE\nSOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.", + "_id": "debug@0.7.2", + "_from": "debug@*" +} diff --git a/node_modules/express/node_modules/fresh/.npmignore b/node_modules/express/node_modules/fresh/.npmignore new file mode 100644 index 0000000..9daeafb --- /dev/null +++ b/node_modules/express/node_modules/fresh/.npmignore @@ -0,0 +1 @@ +test diff --git a/node_modules/express/node_modules/fresh/Makefile b/node_modules/express/node_modules/fresh/Makefile new file mode 100644 index 0000000..8e8640f --- /dev/null +++ b/node_modules/express/node_modules/fresh/Makefile @@ -0,0 +1,7 @@ + +test: + @./node_modules/.bin/mocha \ + --reporter spec \ + --require should + +.PHONY: test \ No newline at end of file diff --git a/node_modules/express/node_modules/fresh/Readme.md b/node_modules/express/node_modules/fresh/Readme.md new file mode 100644 index 0000000..273130d --- /dev/null +++ b/node_modules/express/node_modules/fresh/Readme.md @@ -0,0 +1,32 @@ + +# node-fresh + + HTTP response freshness testing + +## fresh(req, res) + + Check freshness of `req` and `res` headers. + + When the cache is "fresh" __true__ is returned, + otherwise __false__ is returned to indicate that + the cache is now stale. + +## Example: + +```js +var req = { 'if-none-match': 'tobi' }; +var res = { 'etag': 'luna' }; +fresh(req, res); +// => false + +var req = { 'if-none-match': 'tobi' }; +var res = { 'etag': 'tobi' }; +fresh(req, res); +// => true +``` + +## Installation + +``` +$ npm install fresh +``` \ No newline at end of file diff --git a/node_modules/express/node_modules/fresh/index.js b/node_modules/express/node_modules/fresh/index.js new file mode 100644 index 0000000..b2f4d41 --- /dev/null +++ b/node_modules/express/node_modules/fresh/index.js @@ -0,0 +1,49 @@ + +/** + * Expose `fresh()`. + */ + +module.exports = fresh; + +/** + * Check freshness of `req` and `res` headers. + * + * When the cache is "fresh" __true__ is returned, + * otherwise __false__ is returned to indicate that + * the cache is now stale. + * + * @param {Object} req + * @param {Object} res + * @return {Boolean} + * @api public + */ + +function fresh(req, res) { + // defaults + var etagMatches = true; + var notModified = true; + + // fields + var modifiedSince = req['if-modified-since']; + var noneMatch = req['if-none-match']; + var lastModified = res['last-modified']; + var etag = res['etag']; + + // unconditional request + if (!modifiedSince && !noneMatch) return false; + + // parse if-none-match + if (noneMatch) noneMatch = noneMatch.split(/ *, */); + + // if-none-match + if (noneMatch) etagMatches = ~noneMatch.indexOf(etag) || '*' == noneMatch[0]; + + // if-modified-since + if (modifiedSince) { + modifiedSince = new Date(modifiedSince); + lastModified = new Date(lastModified); + notModified = lastModified <= modifiedSince; + } + + return !! (etagMatches && notModified); +} \ No newline at end of file diff --git a/node_modules/express/node_modules/fresh/package.json b/node_modules/express/node_modules/fresh/package.json new file mode 100644 index 0000000..e1f985e --- /dev/null +++ b/node_modules/express/node_modules/fresh/package.json @@ -0,0 +1,19 @@ +{ + "name": "fresh", + "author": { + "name": "TJ Holowaychuk", + "email": "tj@vision-media.ca", + "url": "http://tjholowaychuk.com" + }, + "description": "HTTP response freshness testing", + "version": "0.1.0", + "main": "index.js", + "dependencies": {}, + "devDependencies": { + "mocha": "*", + "should": "*" + }, + "readme": "\n# node-fresh\n\n HTTP response freshness testing\n\n## fresh(req, res)\n\n Check freshness of `req` and `res` headers.\n\n When the cache is \"fresh\" __true__ is returned,\n otherwise __false__ is returned to indicate that\n the cache is now stale.\n\n## Example:\n\n```js\nvar req = { 'if-none-match': 'tobi' };\nvar res = { 'etag': 'luna' };\nfresh(req, res);\n// => false\n\nvar req = { 'if-none-match': 'tobi' };\nvar res = { 'etag': 'tobi' };\nfresh(req, res);\n// => true\n```\n\n## Installation\n\n```\n$ npm install fresh\n```", + "_id": "fresh@0.1.0", + "_from": "fresh@0.1.0" +} diff --git a/node_modules/express/node_modules/methods/index.js b/node_modules/express/node_modules/methods/index.js new file mode 100644 index 0000000..297d022 --- /dev/null +++ b/node_modules/express/node_modules/methods/index.js @@ -0,0 +1,26 @@ + +module.exports = [ + 'get' + , 'post' + , 'put' + , 'head' + , 'delete' + , 'options' + , 'trace' + , 'copy' + , 'lock' + , 'mkcol' + , 'move' + , 'propfind' + , 'proppatch' + , 'unlock' + , 'report' + , 'mkactivity' + , 'checkout' + , 'merge' + , 'm-search' + , 'notify' + , 'subscribe' + , 'unsubscribe' + , 'patch' +]; \ No newline at end of file diff --git a/node_modules/express/node_modules/methods/package.json b/node_modules/express/node_modules/methods/package.json new file mode 100644 index 0000000..341b226 --- /dev/null +++ b/node_modules/express/node_modules/methods/package.json @@ -0,0 +1,20 @@ +{ + "name": "methods", + "version": "0.0.1", + "description": "HTTP methods that node supports", + "main": "index.js", + "scripts": { + "test": "echo \"Error: no test specified\" && exit 1" + }, + "keywords": [ + "http", + "methods" + ], + "author": { + "name": "TJ Holowaychuk" + }, + "license": "MIT", + "_id": "methods@0.0.1", + "readme": "ERROR: No README.md file found!", + "_from": "methods@0.0.1" +} diff --git a/node_modules/express/node_modules/mime/mime.js b/node_modules/express/node_modules/mime/mime.js deleted file mode 100644 index 64dbeec..0000000 --- a/node_modules/express/node_modules/mime/mime.js +++ /dev/null @@ -1,93 +0,0 @@ -var path = require('path'), - fs = require('fs'); - -var mime = module.exports = { - // Map of extension to mime type - types: Object.create(null), - - // Map of mime type to extension - extensions :Object.create(null), - - /** - * Define mimetype -> extension mappings. Each key is a mime-type that maps - * to an array of extensions associated with the type. The first extension is - * used as the default extension for the type. - * - * e.g. mime.define({'audio/ogg', ['oga', 'ogg', 'spx']}); - * - * @param map (Object) type definitions - */ - define: function(map) { - for (var type in map) { - var exts = map[type]; - - for (var i = 0; i < exts.length; i++) { - mime.types[exts[i]] = type; - } - - // Default extension is the first one we encounter - if (!mime.extensions[type]) { - mime.extensions[type] = exts[0]; - } - } - }, - - /** - * Load an Apache2-style ".types" file - * - * This may be called multiple times (it's expected). Where files declare - * overlapping types/extensions, the last file wins. - * - * @param file (String) path of file to load. - */ - load: function(file) { - // Read file and split into lines - var map = {}, - content = fs.readFileSync(file, 'ascii'), - lines = content.split(/[\r\n]+/); - - lines.forEach(function(line, lineno) { - // Clean up whitespace/comments, and split into fields - var fields = line.replace(/\s*#.*|^\s*|\s*$/g, '').split(/\s+/); - map[fields.shift()] = fields; - }); - - mime.define(map); - }, - - /** - * Lookup a mime type based on extension - */ - lookup: function(path, fallback) { - var ext = path.replace(/.*[\.\/]/, '').toLowerCase(); - - return mime.types[ext] || fallback || mime.default_type - }, - - /** - * Return file extension associated with a mime type - */ - extension: function(mimeType) { - return mime.extensions[mimeType]; - }, - - /** - * Lookup a charset based on mime type. - */ - charsets: { - lookup: function (mimeType, fallback) { - // Assume text types are utf8. Modify mime logic as needed. - return (/^text\//).test(mimeType) ? 'UTF-8' : fallback; - } - } -}; - -// Load our local copy of -// http://svn.apache.org/repos/asf/httpd/httpd/trunk/docs/conf/mime.types -mime.load(path.join(__dirname, 'types/mime.types')); - -// Overlay enhancements submitted by the node.js community -mime.load(path.join(__dirname, 'types/node.types')); - -// Set the default type -mime.default_type = mime.types.bin; diff --git a/node_modules/express/node_modules/mime/package.json b/node_modules/express/node_modules/mime/package.json deleted file mode 100644 index 31d4e20..0000000 --- a/node_modules/express/node_modules/mime/package.json +++ /dev/null @@ -1,22 +0,0 @@ -{ - "author": { - "name": "Robert Kieffer", - "url": "http://github.com/broofa", - "email": "robert@broofa.com" - }, - "contributors": [ - { - "name": "Benjamin Thomas", - "url": "http://github.com/bentomas", - "email": "benjamin@benjaminthomas.org" - } - ], - "dependencies": {}, - "description": "A comprehensive library for mime-type mapping", - "devDependencies": {}, - "keywords": ["util", "mime"], - "main": "mime.js", - "name": "mime", - "repository": {"url": "http://github.com/bentomas/node-mime", "type": "git"}, - "version": "1.2.5" -} diff --git a/node_modules/express/node_modules/mkdirp/.gitignore.orig b/node_modules/express/node_modules/mkdirp/.gitignore.orig new file mode 100644 index 0000000..9303c34 --- /dev/null +++ b/node_modules/express/node_modules/mkdirp/.gitignore.orig @@ -0,0 +1,2 @@ +node_modules/ +npm-debug.log \ No newline at end of file diff --git a/node_modules/express/node_modules/mkdirp/.gitignore.rej b/node_modules/express/node_modules/mkdirp/.gitignore.rej new file mode 100644 index 0000000..69244ff --- /dev/null +++ b/node_modules/express/node_modules/mkdirp/.gitignore.rej @@ -0,0 +1,5 @@ +--- /dev/null ++++ .gitignore +@@ -0,0 +1,2 @@ ++node_modules/ ++npm-debug.log \ No newline at end of file diff --git a/node_modules/express/node_modules/mkdirp/.npmignore b/node_modules/express/node_modules/mkdirp/.npmignore new file mode 100644 index 0000000..9303c34 --- /dev/null +++ b/node_modules/express/node_modules/mkdirp/.npmignore @@ -0,0 +1,2 @@ +node_modules/ +npm-debug.log \ No newline at end of file diff --git a/node_modules/express/node_modules/mkdirp/.travis.yml b/node_modules/express/node_modules/mkdirp/.travis.yml new file mode 100644 index 0000000..f1d0f13 --- /dev/null +++ b/node_modules/express/node_modules/mkdirp/.travis.yml @@ -0,0 +1,4 @@ +language: node_js +node_js: + - 0.4 + - 0.6 diff --git a/node_modules/express/node_modules/mkdirp/LICENSE b/node_modules/express/node_modules/mkdirp/LICENSE new file mode 100644 index 0000000..432d1ae --- /dev/null +++ b/node_modules/express/node_modules/mkdirp/LICENSE @@ -0,0 +1,21 @@ +Copyright 2010 James Halliday (mail@substack.net) + +This project is free software released under the MIT/X11 license: + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. diff --git a/node_modules/express/node_modules/mkdirp/README.markdown b/node_modules/express/node_modules/mkdirp/README.markdown new file mode 100644 index 0000000..40de04f --- /dev/null +++ b/node_modules/express/node_modules/mkdirp/README.markdown @@ -0,0 +1,61 @@ +mkdirp +====== + +Like `mkdir -p`, but in node.js! + +[![build status](https://secure.travis-ci.org/substack/node-mkdirp.png)](http://travis-ci.org/substack/node-mkdirp) + +example +======= + +pow.js +------ + var mkdirp = require('mkdirp'); + + mkdirp('/tmp/foo/bar/baz', function (err) { + if (err) console.error(err) + else console.log('pow!') + }); + +Output + pow! + +And now /tmp/foo/bar/baz exists, huzzah! + +methods +======= + +var mkdirp = require('mkdirp'); + +mkdirp(dir, mode, cb) +--------------------- + +Create a new directory and any necessary subdirectories at `dir` with octal +permission string `mode`. + +If `mode` isn't specified, it defaults to `0777 & (~process.umask())`. + +`cb(err, made)` fires with the error or the first directory `made` +that had to be created, if any. + +mkdirp.sync(dir, mode) +---------------------- + +Synchronously create a new directory and any necessary subdirectories at `dir` +with octal permission string `mode`. + +If `mode` isn't specified, it defaults to `0777 & (~process.umask())`. + +Returns the first directory that had to be created, if any. + +install +======= + +With [npm](http://npmjs.org) do: + + npm install mkdirp + +license +======= + +MIT/X11 diff --git a/node_modules/express/node_modules/mkdirp/examples/pow.js b/node_modules/express/node_modules/mkdirp/examples/pow.js new file mode 100644 index 0000000..e692421 --- /dev/null +++ b/node_modules/express/node_modules/mkdirp/examples/pow.js @@ -0,0 +1,6 @@ +var mkdirp = require('mkdirp'); + +mkdirp('/tmp/foo/bar/baz', function (err) { + if (err) console.error(err) + else console.log('pow!') +}); diff --git a/node_modules/express/node_modules/mkdirp/examples/pow.js.orig b/node_modules/express/node_modules/mkdirp/examples/pow.js.orig new file mode 100644 index 0000000..7741462 --- /dev/null +++ b/node_modules/express/node_modules/mkdirp/examples/pow.js.orig @@ -0,0 +1,6 @@ +var mkdirp = require('mkdirp'); + +mkdirp('/tmp/foo/bar/baz', 0755, function (err) { + if (err) console.error(err) + else console.log('pow!') +}); diff --git a/node_modules/express/node_modules/mkdirp/examples/pow.js.rej b/node_modules/express/node_modules/mkdirp/examples/pow.js.rej new file mode 100644 index 0000000..81e7f43 --- /dev/null +++ b/node_modules/express/node_modules/mkdirp/examples/pow.js.rej @@ -0,0 +1,19 @@ +--- examples/pow.js ++++ examples/pow.js +@@ -1,6 +1,15 @@ +-var mkdirp = require('mkdirp').mkdirp; ++var mkdirp = require('../').mkdirp, ++ mkdirpSync = require('../').mkdirpSync; + + mkdirp('/tmp/foo/bar/baz', 0755, function (err) { + if (err) console.error(err) + else console.log('pow!') + }); ++ ++try { ++ mkdirpSync('/tmp/bar/foo/baz', 0755); ++ console.log('double pow!'); ++} ++catch (ex) { ++ console.log(ex); ++} \ No newline at end of file diff --git a/node_modules/express/node_modules/mkdirp/index.js b/node_modules/express/node_modules/mkdirp/index.js new file mode 100644 index 0000000..874b310 --- /dev/null +++ b/node_modules/express/node_modules/mkdirp/index.js @@ -0,0 +1,94 @@ +var path = require('path'); +var fs = require('fs'); + +module.exports = mkdirP.mkdirp = mkdirP.mkdirP = mkdirP; + +function mkdirP (p, mode, f, made) { + if (typeof mode === 'function' || mode === undefined) { + f = mode; + mode = 0777 & (~process.umask()); + } + if (!made) made = null; + + var cb = f || function () {}; + if (typeof mode === 'string') mode = parseInt(mode, 8); + p = path.resolve(p); + + fs.mkdir(p, mode, function (er) { + if (!er) { + made = made || p; + return cb(null, made); + } + switch (er.code) { + case 'ENOENT': + mkdirP(path.dirname(p), mode, function (er, made) { + if (er) cb(er, made); + else mkdirP(p, mode, cb, made); + }); + break; + + case 'EISDIR': + case 'EPERM': + // Operation not permitted or already is a dir. + // This is the error you get when trying to mkdir('c:/') + // on windows, or mkdir('/') on unix. Make sure it's a + // dir by falling through to the EEXIST case. + case 'EROFS': + // a read-only file system. + // However, the dir could already exist, in which case + // the EROFS error will be obscuring a EEXIST! + // Fallthrough to that case. + case 'EEXIST': + fs.stat(p, function (er2, stat) { + // if the stat fails, then that's super weird. + // let the original error be the failure reason. + if (er2 || !stat.isDirectory()) cb(er, made) + else cb(null, made); + }); + break; + + default: + cb(er, made); + break; + } + }); +} + +mkdirP.sync = function sync (p, mode, made) { + if (mode === undefined) { + mode = 0777 & (~process.umask()); + } + if (!made) made = null; + + if (typeof mode === 'string') mode = parseInt(mode, 8); + p = path.resolve(p); + + try { + fs.mkdirSync(p, mode); + made = made || p; + } + catch (err0) { + switch (err0.code) { + case 'ENOENT' : + made = sync(path.dirname(p), mode, made); + sync(p, mode, made); + break; + + case 'EEXIST' : + var stat; + try { + stat = fs.statSync(p); + } + catch (err1) { + throw err0; + } + if (!stat.isDirectory()) throw err0; + break; + default : + throw err0 + break; + } + } + + return made; +}; diff --git a/node_modules/express/node_modules/mkdirp/package.json b/node_modules/express/node_modules/mkdirp/package.json new file mode 100644 index 0000000..b5a2c99 --- /dev/null +++ b/node_modules/express/node_modules/mkdirp/package.json @@ -0,0 +1,32 @@ +{ + "name": "mkdirp", + "description": "Recursively mkdir, like `mkdir -p`", + "version": "0.3.3", + "author": { + "name": "James Halliday", + "email": "mail@substack.net", + "url": "http://substack.net" + }, + "main": "./index", + "keywords": [ + "mkdir", + "directory" + ], + "repository": { + "type": "git", + "url": "http://github.com/substack/node-mkdirp.git" + }, + "scripts": { + "test": "tap test/*.js" + }, + "devDependencies": { + "tap": "~0.2.4" + }, + "license": "MIT/X11", + "engines": { + "node": "*" + }, + "readme": "mkdirp\n======\n\nLike `mkdir -p`, but in node.js!\n\n[![build status](https://secure.travis-ci.org/substack/node-mkdirp.png)](http://travis-ci.org/substack/node-mkdirp)\n\nexample\n=======\n\npow.js\n------\n var mkdirp = require('mkdirp');\n \n mkdirp('/tmp/foo/bar/baz', function (err) {\n if (err) console.error(err)\n else console.log('pow!')\n });\n\nOutput\n pow!\n\nAnd now /tmp/foo/bar/baz exists, huzzah!\n\nmethods\n=======\n\nvar mkdirp = require('mkdirp');\n\nmkdirp(dir, mode, cb)\n---------------------\n\nCreate a new directory and any necessary subdirectories at `dir` with octal\npermission string `mode`.\n\nIf `mode` isn't specified, it defaults to `0777 & (~process.umask())`.\n\n`cb(err, made)` fires with the error or the first directory `made`\nthat had to be created, if any.\n\nmkdirp.sync(dir, mode)\n----------------------\n\nSynchronously create a new directory and any necessary subdirectories at `dir`\nwith octal permission string `mode`.\n\nIf `mode` isn't specified, it defaults to `0777 & (~process.umask())`.\n\nReturns the first directory that had to be created, if any.\n\ninstall\n=======\n\nWith [npm](http://npmjs.org) do:\n\n npm install mkdirp\n\nlicense\n=======\n\nMIT/X11\n", + "_id": "mkdirp@0.3.3", + "_from": "mkdirp@0.3.3" +} diff --git a/node_modules/express/node_modules/mkdirp/test/chmod.js b/node_modules/express/node_modules/mkdirp/test/chmod.js new file mode 100644 index 0000000..520dcb8 --- /dev/null +++ b/node_modules/express/node_modules/mkdirp/test/chmod.js @@ -0,0 +1,38 @@ +var mkdirp = require('../').mkdirp; +var path = require('path'); +var fs = require('fs'); +var test = require('tap').test; + +var ps = [ '', 'tmp' ]; + +for (var i = 0; i < 25; i++) { + var dir = Math.floor(Math.random() * Math.pow(16,4)).toString(16); + ps.push(dir); +} + +var file = ps.join('/'); + +test('chmod-pre', function (t) { + var mode = 0744 + mkdirp(file, mode, function (er) { + t.ifError(er, 'should not error'); + fs.stat(file, function (er, stat) { + t.ifError(er, 'should exist'); + t.ok(stat && stat.isDirectory(), 'should be directory'); + t.equal(stat && stat.mode & 0777, mode, 'should be 0744'); + t.end(); + }); + }); +}); + +test('chmod', function (t) { + var mode = 0755 + mkdirp(file, mode, function (er) { + t.ifError(er, 'should not error'); + fs.stat(file, function (er, stat) { + t.ifError(er, 'should exist'); + t.ok(stat && stat.isDirectory(), 'should be directory'); + t.end(); + }); + }); +}); diff --git a/node_modules/express/node_modules/mkdirp/test/clobber.js b/node_modules/express/node_modules/mkdirp/test/clobber.js new file mode 100644 index 0000000..0eb7099 --- /dev/null +++ b/node_modules/express/node_modules/mkdirp/test/clobber.js @@ -0,0 +1,37 @@ +var mkdirp = require('../').mkdirp; +var path = require('path'); +var fs = require('fs'); +var test = require('tap').test; + +var ps = [ '', 'tmp' ]; + +for (var i = 0; i < 25; i++) { + var dir = Math.floor(Math.random() * Math.pow(16,4)).toString(16); + ps.push(dir); +} + +var file = ps.join('/'); + +// a file in the way +var itw = ps.slice(0, 3).join('/'); + + +test('clobber-pre', function (t) { + console.error("about to write to "+itw) + fs.writeFileSync(itw, 'I AM IN THE WAY, THE TRUTH, AND THE LIGHT.'); + + fs.stat(itw, function (er, stat) { + t.ifError(er) + t.ok(stat && stat.isFile(), 'should be file') + t.end() + }) +}) + +test('clobber', function (t) { + t.plan(2); + mkdirp(file, 0755, function (err) { + t.ok(err); + t.equal(err.code, 'ENOTDIR'); + t.end(); + }); +}); diff --git a/node_modules/express/node_modules/mkdirp/test/mkdirp.js b/node_modules/express/node_modules/mkdirp/test/mkdirp.js new file mode 100644 index 0000000..b07cd70 --- /dev/null +++ b/node_modules/express/node_modules/mkdirp/test/mkdirp.js @@ -0,0 +1,28 @@ +var mkdirp = require('../'); +var path = require('path'); +var fs = require('fs'); +var test = require('tap').test; + +test('woo', function (t) { + t.plan(2); + var x = Math.floor(Math.random() * Math.pow(16,4)).toString(16); + var y = Math.floor(Math.random() * Math.pow(16,4)).toString(16); + var z = Math.floor(Math.random() * Math.pow(16,4)).toString(16); + + var file = '/tmp/' + [x,y,z].join('/'); + + mkdirp(file, 0755, function (err) { + if (err) t.fail(err); + else path.exists(file, function (ex) { + if (!ex) t.fail('file not created') + else fs.stat(file, function (err, stat) { + if (err) t.fail(err) + else { + t.equal(stat.mode & 0777, 0755); + t.ok(stat.isDirectory(), 'target not a directory'); + t.end(); + } + }) + }) + }); +}); diff --git a/node_modules/express/node_modules/mkdirp/test/perm.js b/node_modules/express/node_modules/mkdirp/test/perm.js new file mode 100644 index 0000000..23a7abb --- /dev/null +++ b/node_modules/express/node_modules/mkdirp/test/perm.js @@ -0,0 +1,32 @@ +var mkdirp = require('../'); +var path = require('path'); +var fs = require('fs'); +var test = require('tap').test; + +test('async perm', function (t) { + t.plan(2); + var file = '/tmp/' + (Math.random() * (1<<30)).toString(16); + + mkdirp(file, 0755, function (err) { + if (err) t.fail(err); + else path.exists(file, function (ex) { + if (!ex) t.fail('file not created') + else fs.stat(file, function (err, stat) { + if (err) t.fail(err) + else { + t.equal(stat.mode & 0777, 0755); + t.ok(stat.isDirectory(), 'target not a directory'); + t.end(); + } + }) + }) + }); +}); + +test('async root perm', function (t) { + mkdirp('/tmp', 0755, function (err) { + if (err) t.fail(err); + t.end(); + }); + t.end(); +}); diff --git a/node_modules/express/node_modules/mkdirp/test/perm_sync.js b/node_modules/express/node_modules/mkdirp/test/perm_sync.js new file mode 100644 index 0000000..f685f60 --- /dev/null +++ b/node_modules/express/node_modules/mkdirp/test/perm_sync.js @@ -0,0 +1,39 @@ +var mkdirp = require('../'); +var path = require('path'); +var fs = require('fs'); +var test = require('tap').test; + +test('sync perm', function (t) { + t.plan(2); + var file = '/tmp/' + (Math.random() * (1<<30)).toString(16) + '.json'; + + mkdirp.sync(file, 0755); + path.exists(file, function (ex) { + if (!ex) t.fail('file not created') + else fs.stat(file, function (err, stat) { + if (err) t.fail(err) + else { + t.equal(stat.mode & 0777, 0755); + t.ok(stat.isDirectory(), 'target not a directory'); + t.end(); + } + }) + }); +}); + +test('sync root perm', function (t) { + t.plan(1); + + var file = '/tmp'; + mkdirp.sync(file, 0755); + path.exists(file, function (ex) { + if (!ex) t.fail('file not created') + else fs.stat(file, function (err, stat) { + if (err) t.fail(err) + else { + t.ok(stat.isDirectory(), 'target not a directory'); + t.end(); + } + }) + }); +}); diff --git a/node_modules/express/node_modules/mkdirp/test/race.js b/node_modules/express/node_modules/mkdirp/test/race.js new file mode 100644 index 0000000..96a0447 --- /dev/null +++ b/node_modules/express/node_modules/mkdirp/test/race.js @@ -0,0 +1,41 @@ +var mkdirp = require('../').mkdirp; +var path = require('path'); +var fs = require('fs'); +var test = require('tap').test; + +test('race', function (t) { + t.plan(4); + var ps = [ '', 'tmp' ]; + + for (var i = 0; i < 25; i++) { + var dir = Math.floor(Math.random() * Math.pow(16,4)).toString(16); + ps.push(dir); + } + var file = ps.join('/'); + + var res = 2; + mk(file, function () { + if (--res === 0) t.end(); + }); + + mk(file, function () { + if (--res === 0) t.end(); + }); + + function mk (file, cb) { + mkdirp(file, 0755, function (err) { + if (err) t.fail(err); + else path.exists(file, function (ex) { + if (!ex) t.fail('file not created') + else fs.stat(file, function (err, stat) { + if (err) t.fail(err) + else { + t.equal(stat.mode & 0777, 0755); + t.ok(stat.isDirectory(), 'target not a directory'); + if (cb) cb(); + } + }) + }) + }); + } +}); diff --git a/node_modules/express/node_modules/mkdirp/test/rel.js b/node_modules/express/node_modules/mkdirp/test/rel.js new file mode 100644 index 0000000..7985824 --- /dev/null +++ b/node_modules/express/node_modules/mkdirp/test/rel.js @@ -0,0 +1,32 @@ +var mkdirp = require('../'); +var path = require('path'); +var fs = require('fs'); +var test = require('tap').test; + +test('rel', function (t) { + t.plan(2); + var x = Math.floor(Math.random() * Math.pow(16,4)).toString(16); + var y = Math.floor(Math.random() * Math.pow(16,4)).toString(16); + var z = Math.floor(Math.random() * Math.pow(16,4)).toString(16); + + var cwd = process.cwd(); + process.chdir('/tmp'); + + var file = [x,y,z].join('/'); + + mkdirp(file, 0755, function (err) { + if (err) t.fail(err); + else path.exists(file, function (ex) { + if (!ex) t.fail('file not created') + else fs.stat(file, function (err, stat) { + if (err) t.fail(err) + else { + process.chdir(cwd); + t.equal(stat.mode & 0777, 0755); + t.ok(stat.isDirectory(), 'target not a directory'); + t.end(); + } + }) + }) + }); +}); diff --git a/node_modules/express/node_modules/mkdirp/test/return.js b/node_modules/express/node_modules/mkdirp/test/return.js new file mode 100644 index 0000000..bce68e5 --- /dev/null +++ b/node_modules/express/node_modules/mkdirp/test/return.js @@ -0,0 +1,25 @@ +var mkdirp = require('../'); +var path = require('path'); +var fs = require('fs'); +var test = require('tap').test; + +test('return value', function (t) { + t.plan(4); + var x = Math.floor(Math.random() * Math.pow(16,4)).toString(16); + var y = Math.floor(Math.random() * Math.pow(16,4)).toString(16); + var z = Math.floor(Math.random() * Math.pow(16,4)).toString(16); + + var file = '/tmp/' + [x,y,z].join('/'); + + // should return the first dir created. + // By this point, it would be profoundly surprising if /tmp didn't + // already exist, since every other test makes things in there. + mkdirp(file, function (err, made) { + t.ifError(err); + t.equal(made, '/tmp/' + x); + mkdirp(file, function (err, made) { + t.ifError(err); + t.equal(made, null); + }); + }); +}); diff --git a/node_modules/express/node_modules/mkdirp/test/return_sync.js b/node_modules/express/node_modules/mkdirp/test/return_sync.js new file mode 100644 index 0000000..7c222d3 --- /dev/null +++ b/node_modules/express/node_modules/mkdirp/test/return_sync.js @@ -0,0 +1,24 @@ +var mkdirp = require('../'); +var path = require('path'); +var fs = require('fs'); +var test = require('tap').test; + +test('return value', function (t) { + t.plan(2); + var x = Math.floor(Math.random() * Math.pow(16,4)).toString(16); + var y = Math.floor(Math.random() * Math.pow(16,4)).toString(16); + var z = Math.floor(Math.random() * Math.pow(16,4)).toString(16); + + var file = '/tmp/' + [x,y,z].join('/'); + + // should return the first dir created. + // By this point, it would be profoundly surprising if /tmp didn't + // already exist, since every other test makes things in there. + // Note that this will throw on failure, which will fail the test. + var made = mkdirp.sync(file); + t.equal(made, '/tmp/' + x); + + // making the same file again should have no effect. + made = mkdirp.sync(file); + t.equal(made, null); +}); diff --git a/node_modules/express/node_modules/mkdirp/test/root.js b/node_modules/express/node_modules/mkdirp/test/root.js new file mode 100644 index 0000000..97ad7a2 --- /dev/null +++ b/node_modules/express/node_modules/mkdirp/test/root.js @@ -0,0 +1,18 @@ +var mkdirp = require('../'); +var path = require('path'); +var fs = require('fs'); +var test = require('tap').test; + +test('root', function (t) { + // '/' on unix, 'c:/' on windows. + var file = path.resolve('/'); + + mkdirp(file, 0755, function (err) { + if (err) throw err + fs.stat(file, function (er, stat) { + if (er) throw er + t.ok(stat.isDirectory(), 'target is a directory'); + t.end(); + }) + }); +}); diff --git a/node_modules/express/node_modules/mkdirp/test/sync.js b/node_modules/express/node_modules/mkdirp/test/sync.js new file mode 100644 index 0000000..7530cad --- /dev/null +++ b/node_modules/express/node_modules/mkdirp/test/sync.js @@ -0,0 +1,32 @@ +var mkdirp = require('../'); +var path = require('path'); +var fs = require('fs'); +var test = require('tap').test; + +test('sync', function (t) { + t.plan(2); + var x = Math.floor(Math.random() * Math.pow(16,4)).toString(16); + var y = Math.floor(Math.random() * Math.pow(16,4)).toString(16); + var z = Math.floor(Math.random() * Math.pow(16,4)).toString(16); + + var file = '/tmp/' + [x,y,z].join('/'); + + try { + mkdirp.sync(file, 0755); + } catch (err) { + t.fail(err); + return t.end(); + } + + path.exists(file, function (ex) { + if (!ex) t.fail('file not created') + else fs.stat(file, function (err, stat) { + if (err) t.fail(err) + else { + t.equal(stat.mode & 0777, 0755); + t.ok(stat.isDirectory(), 'target not a directory'); + t.end(); + } + }); + }); +}); diff --git a/node_modules/express/node_modules/mkdirp/test/umask.js b/node_modules/express/node_modules/mkdirp/test/umask.js new file mode 100644 index 0000000..64ccafe --- /dev/null +++ b/node_modules/express/node_modules/mkdirp/test/umask.js @@ -0,0 +1,28 @@ +var mkdirp = require('../'); +var path = require('path'); +var fs = require('fs'); +var test = require('tap').test; + +test('implicit mode from umask', function (t) { + t.plan(2); + var x = Math.floor(Math.random() * Math.pow(16,4)).toString(16); + var y = Math.floor(Math.random() * Math.pow(16,4)).toString(16); + var z = Math.floor(Math.random() * Math.pow(16,4)).toString(16); + + var file = '/tmp/' + [x,y,z].join('/'); + + mkdirp(file, function (err) { + if (err) t.fail(err); + else path.exists(file, function (ex) { + if (!ex) t.fail('file not created') + else fs.stat(file, function (err, stat) { + if (err) t.fail(err) + else { + t.equal(stat.mode & 0777, 0777 & (~process.umask())); + t.ok(stat.isDirectory(), 'target not a directory'); + t.end(); + } + }) + }) + }); +}); diff --git a/node_modules/express/node_modules/mkdirp/test/umask_sync.js b/node_modules/express/node_modules/mkdirp/test/umask_sync.js new file mode 100644 index 0000000..35bd5cb --- /dev/null +++ b/node_modules/express/node_modules/mkdirp/test/umask_sync.js @@ -0,0 +1,32 @@ +var mkdirp = require('../'); +var path = require('path'); +var fs = require('fs'); +var test = require('tap').test; + +test('umask sync modes', function (t) { + t.plan(2); + var x = Math.floor(Math.random() * Math.pow(16,4)).toString(16); + var y = Math.floor(Math.random() * Math.pow(16,4)).toString(16); + var z = Math.floor(Math.random() * Math.pow(16,4)).toString(16); + + var file = '/tmp/' + [x,y,z].join('/'); + + try { + mkdirp.sync(file); + } catch (err) { + t.fail(err); + return t.end(); + } + + path.exists(file, function (ex) { + if (!ex) t.fail('file not created') + else fs.stat(file, function (err, stat) { + if (err) t.fail(err) + else { + t.equal(stat.mode & 0777, (0777 & (~process.umask()))); + t.ok(stat.isDirectory(), 'target not a directory'); + t.end(); + } + }); + }); +}); diff --git a/node_modules/express/node_modules/qs/Makefile b/node_modules/express/node_modules/qs/Makefile deleted file mode 100644 index e4df837..0000000 --- a/node_modules/express/node_modules/qs/Makefile +++ /dev/null @@ -1,5 +0,0 @@ - -test: - @./node_modules/.bin/mocha - -.PHONY: test \ No newline at end of file diff --git a/node_modules/express/node_modules/qs/package.json b/node_modules/express/node_modules/qs/package.json deleted file mode 100644 index 68dd5a6..0000000 --- a/node_modules/express/node_modules/qs/package.json +++ /dev/null @@ -1,16 +0,0 @@ -{ - "name": "qs", - "description": "querystring parser", - "version": "0.4.2", - "repository": { - "type" : "git", - "url" : "git://github.com/visionmedia/node-querystring.git" - }, - "devDependencies": { - "mocha": "*" - , "should": "*" - }, - "author": "TJ Holowaychuk (http://tjholowaychuk.com)", - "main": "index", - "engines": { "node": "*" } -} \ No newline at end of file diff --git a/node_modules/express/node_modules/qs/test/mocha.opts b/node_modules/express/node_modules/qs/test/mocha.opts deleted file mode 100644 index 521cbb2..0000000 --- a/node_modules/express/node_modules/qs/test/mocha.opts +++ /dev/null @@ -1,2 +0,0 @@ ---require should ---ui exports diff --git a/node_modules/express/node_modules/qs/test/parse.js b/node_modules/express/node_modules/qs/test/parse.js deleted file mode 100644 index f219e27..0000000 --- a/node_modules/express/node_modules/qs/test/parse.js +++ /dev/null @@ -1,167 +0,0 @@ - -/** - * Module dependencies. - */ - -var qs = require('../'); - -module.exports = { - 'test basics': function(){ - qs.parse('0=foo').should.eql({ '0': 'foo' }); - - qs.parse('foo=c++') - .should.eql({ foo: 'c ' }); - - qs.parse('a[>=]=23') - .should.eql({ a: { '>=': '23' }}); - - qs.parse('a[<=>]==23') - .should.eql({ a: { '<=>': '=23' }}); - - qs.parse('a[==]=23') - .should.eql({ a: { '==': '23' }}); - - qs.parse('foo') - .should.eql({ foo: '' }); - - qs.parse('foo=bar') - .should.eql({ foo: 'bar' }); - - qs.parse('foo%3Dbar=baz') - .should.eql({ foo: 'bar=baz' }); - - qs.parse(' foo = bar = baz ') - .should.eql({ ' foo ': ' bar = baz ' }); - - qs.parse('foo=bar=baz') - .should.eql({ foo: 'bar=baz' }); - - qs.parse('foo=bar&bar=baz') - .should.eql({ foo: 'bar', bar: 'baz' }); - - qs.parse('foo=bar&baz') - .should.eql({ foo: 'bar', baz: '' }); - - qs.parse('cht=p3&chd=t:60,40&chs=250x100&chl=Hello|World') - .should.eql({ - cht: 'p3' - , chd: 't:60,40' - , chs: '250x100' - , chl: 'Hello|World' - }); - }, - - 'test nesting': function(){ - qs.parse('ops[>=]=25') - .should.eql({ ops: { '>=': '25' }}); - - qs.parse('user[name]=tj') - .should.eql({ user: { name: 'tj' }}); - - qs.parse('user[name][first]=tj&user[name][last]=holowaychuk') - .should.eql({ user: { name: { first: 'tj', last: 'holowaychuk' }}}); - }, - - 'test escaping': function(){ - qs.parse('foo=foo%20bar') - .should.eql({ foo: 'foo bar' }); - }, - - 'test arrays': function(){ - qs.parse('images[]') - .should.eql({ images: [] }); - - qs.parse('user[]=tj') - .should.eql({ user: ['tj'] }); - - qs.parse('user[]=tj&user[]=tobi&user[]=jane') - .should.eql({ user: ['tj', 'tobi', 'jane'] }); - - qs.parse('user[names][]=tj&user[names][]=tyler') - .should.eql({ user: { names: ['tj', 'tyler'] }}); - - qs.parse('user[names][]=tj&user[names][]=tyler&user[email]=tj@vision-media.ca') - .should.eql({ user: { names: ['tj', 'tyler'], email: 'tj@vision-media.ca' }}); - - qs.parse('items=a&items=b') - .should.eql({ items: ['a', 'b'] }); - - qs.parse('user[names]=tj&user[names]=holowaychuk&user[names]=TJ') - .should.eql({ user: { names: ['tj', 'holowaychuk', 'TJ'] }}); - - qs.parse('user[name][first]=tj&user[name][first]=TJ') - .should.eql({ user: { name: { first: ['tj', 'TJ'] }}}); - - var o = qs.parse('existing[fcbaebfecc][name][last]=tj') - o.should.eql({ existing: { 'fcbaebfecc': { name: { last: 'tj' }}}}) - Array.isArray(o.existing).should.be.false; - }, - - 'test right-hand brackets': function(){ - qs.parse('pets=["tobi"]') - .should.eql({ pets: '["tobi"]' }); - - qs.parse('operators=[">=", "<="]') - .should.eql({ operators: '[">=", "<="]' }); - - qs.parse('op[>=]=[1,2,3]') - .should.eql({ op: { '>=': '[1,2,3]' }}); - - qs.parse('op[>=]=[1,2,3]&op[=]=[[[[1]]]]') - .should.eql({ op: { '>=': '[1,2,3]', '=': '[[[[1]]]]' }}); - }, - - 'test duplicates': function(){ - qs.parse('items=bar&items=baz&items=raz') - .should.eql({ items: ['bar', 'baz', 'raz'] }); - }, - - 'test empty': function(){ - qs.parse('').should.eql({}); - qs.parse(undefined).should.eql({}); - qs.parse(null).should.eql({}); - }, - - 'test arrays with indexes': function(){ - qs.parse('foo[0]=bar&foo[1]=baz').should.eql({ foo: ['bar', 'baz'] }); - qs.parse('foo[1]=bar&foo[0]=baz').should.eql({ foo: ['baz', 'bar'] }); - qs.parse('foo[base64]=RAWR').should.eql({ foo: { base64: 'RAWR' }}); - qs.parse('foo[64base]=RAWR').should.eql({ foo: { '64base': 'RAWR' }}); - }, - - 'test arrays becoming objects': function(){ - qs.parse('foo[0]=bar&foo[bad]=baz').should.eql({ foo: { 0: "bar", bad: "baz" }}); - qs.parse('foo[bad]=baz&foo[0]=bar').should.eql({ foo: { 0: "bar", bad: "baz" }}); - }, - - 'test bleed-through of Array native properties/methods': function(){ - Array.prototype.protoProperty = true; - Array.prototype.protoFunction = function () {}; - qs.parse('foo=bar').should.eql({ foo: 'bar' }); - }, - - 'test malformed uri': function(){ - qs.parse('{%:%}').should.eql({ '{%:%}': '' }); - qs.parse('foo=%:%}').should.eql({ 'foo': '%:%}' }); - }, - - 'test semi-parsed': function(){ - qs.parse({ 'user[name]': 'tobi' }) - .should.eql({ user: { name: 'tobi' }}); - - qs.parse({ 'user[name]': 'tobi', 'user[email][main]': 'tobi@lb.com' }) - .should.eql({ user: { name: 'tobi', email: { main: 'tobi@lb.com' } }}); - } - - // 'test complex': function(){ - // qs.parse('users[][name][first]=tj&users[foo]=bar') - // .should.eql({ - // users: [ { name: 'tj' }, { name: 'tobi' }, { foo: 'bar' }] - // }); - // - // qs.parse('users[][name][first]=tj&users[][name][first]=tobi') - // .should.eql({ - // users: [ { name: 'tj' }, { name: 'tobi' }] - // }); - // } -}; diff --git a/node_modules/express/node_modules/qs/test/stringify.js b/node_modules/express/node_modules/qs/test/stringify.js deleted file mode 100644 index c2195cb..0000000 --- a/node_modules/express/node_modules/qs/test/stringify.js +++ /dev/null @@ -1,103 +0,0 @@ - -/** - * Module dependencies. - */ - -var qs = require('../') - , should = require('should') - , str_identities = { - 'basics': [ - { str: 'foo=bar', obj: {'foo' : 'bar'}}, - { str: 'foo=%22bar%22', obj: {'foo' : '\"bar\"'}}, - { str: 'foo=', obj: {'foo': ''}}, - { str: 'foo=1&bar=2', obj: {'foo' : '1', 'bar' : '2'}}, - { str: 'my%20weird%20field=q1!2%22\'w%245%267%2Fz8)%3F', obj: {'my weird field': "q1!2\"'w$5&7/z8)?"}}, - { str: 'foo%3Dbaz=bar', obj: {'foo=baz': 'bar'}}, - { str: 'foo=bar&bar=baz', obj: {foo: 'bar', bar: 'baz'}} - ], - 'escaping': [ - { str: 'foo=foo%20bar', obj: {foo: 'foo bar'}}, - { str: 'cht=p3&chd=t%3A60%2C40&chs=250x100&chl=Hello%7CWorld', obj: { - cht: 'p3' - , chd: 't:60,40' - , chs: '250x100' - , chl: 'Hello|World' - }} - ], - 'nested': [ - { str: 'foo[]=bar&foo[]=quux', obj: {'foo' : ['bar', 'quux']}}, - { str: 'foo[]=bar', obj: {foo: ['bar']}}, - { str: 'foo[]=1&foo[]=2', obj: {'foo' : ['1', '2']}}, - { str: 'foo=bar&baz[]=1&baz[]=2&baz[]=3', obj: {'foo' : 'bar', 'baz' : ['1', '2', '3']}}, - { str: 'foo[]=bar&baz[]=1&baz[]=2&baz[]=3', obj: {'foo' : ['bar'], 'baz' : ['1', '2', '3']}}, - { str: 'x[y][z]=1', obj: {'x' : {'y' : {'z' : '1'}}}}, - { str: 'x[y][z][]=1', obj: {'x' : {'y' : {'z' : ['1']}}}}, - { str: 'x[y][z]=2', obj: {'x' : {'y' : {'z' : '2'}}}}, - { str: 'x[y][z][]=1&x[y][z][]=2', obj: {'x' : {'y' : {'z' : ['1', '2']}}}}, - { str: 'x[y][][z]=1', obj: {'x' : {'y' : [{'z' : '1'}]}}}, - { str: 'x[y][][z][]=1', obj: {'x' : {'y' : [{'z' : ['1']}]}}}, - { str: 'x[y][][z]=1&x[y][][w]=2', obj: {'x' : {'y' : [{'z' : '1', 'w' : '2'}]}}}, - { str: 'x[y][][v][w]=1', obj: {'x' : {'y' : [{'v' : {'w' : '1'}}]}}}, - { str: 'x[y][][z]=1&x[y][][v][w]=2', obj: {'x' : {'y' : [{'z' : '1', 'v' : {'w' : '2'}}]}}}, - { str: 'x[y][][z]=1&x[y][][z]=2', obj: {'x' : {'y' : [{'z' : '1'}, {'z' : '2'}]}}}, - { str: 'x[y][][z]=1&x[y][][w]=a&x[y][][z]=2&x[y][][w]=3', obj: {'x' : {'y' : [{'z' : '1', 'w' : 'a'}, {'z' : '2', 'w' : '3'}]}}}, - { str: 'user[name][first]=tj&user[name][last]=holowaychuk', obj: { user: { name: { first: 'tj', last: 'holowaychuk' }}}} - ], - 'errors': [ - { obj: 'foo=bar', message: 'stringify expects an object' }, - { obj: ['foo', 'bar'], message: 'stringify expects an object' } - ], - 'numbers': [ - { str: 'limit[]=1&limit[]=2&limit[]=3', obj: { limit: [1, 2, '3'] }}, - { str: 'limit=1', obj: { limit: 1 }} - ] - }; - - -// Assert error -function err(fn, msg){ - var err; - try { - fn(); - } catch (e) { - should.equal(e.message, msg); - return; - } - throw new Error('no exception thrown, expected "' + msg + '"'); -} - -function test(type) { - var str, obj; - for (var i = 0; i < str_identities[type].length; i++) { - str = str_identities[type][i].str; - obj = str_identities[type][i].obj; - qs.stringify(obj).should.eql(str); - } -} - -module.exports = { - 'test basics': function() { - test('basics'); - }, - - 'test escaping': function() { - test('escaping'); - }, - - 'test nested': function() { - test('nested'); - }, - - 'test numbers': function(){ - test('numbers'); - }, - - 'test errors': function() { - var obj, message; - for (var i = 0; i < str_identities['errors'].length; i++) { - message = str_identities['errors'][i].message; - obj = str_identities['errors'][i].obj; - err(function(){ qs.stringify(obj) }, message); - } - } -}; \ No newline at end of file diff --git a/node_modules/express/node_modules/range-parser/.npmignore b/node_modules/express/node_modules/range-parser/.npmignore new file mode 100644 index 0000000..9daeafb --- /dev/null +++ b/node_modules/express/node_modules/range-parser/.npmignore @@ -0,0 +1 @@ +test diff --git a/node_modules/express/node_modules/range-parser/History.md b/node_modules/express/node_modules/range-parser/History.md new file mode 100644 index 0000000..82df7b1 --- /dev/null +++ b/node_modules/express/node_modules/range-parser/History.md @@ -0,0 +1,15 @@ + +0.0.4 / 2012-06-17 +================== + + * changed: ret -1 for unsatisfiable and -2 when invalid + +0.0.3 / 2012-06-17 +================== + + * fix last-byte-pos default to len - 1 + +0.0.2 / 2012-06-14 +================== + + * add `.type` diff --git a/node_modules/express/node_modules/range-parser/Makefile b/node_modules/express/node_modules/range-parser/Makefile new file mode 100644 index 0000000..8e8640f --- /dev/null +++ b/node_modules/express/node_modules/range-parser/Makefile @@ -0,0 +1,7 @@ + +test: + @./node_modules/.bin/mocha \ + --reporter spec \ + --require should + +.PHONY: test \ No newline at end of file diff --git a/node_modules/express/node_modules/range-parser/Readme.md b/node_modules/express/node_modules/range-parser/Readme.md new file mode 100644 index 0000000..b2a67fe --- /dev/null +++ b/node_modules/express/node_modules/range-parser/Readme.md @@ -0,0 +1,28 @@ + +# node-range-parser + + Range header field parser. + +## Example: + +```js +assert(-1 == parse(200, 'bytes=500-20')); +assert(-2 == parse(200, 'bytes=malformed')); +parse(200, 'bytes=0-499').should.eql(arr('bytes', [{ start: 0, end: 199 }])); +parse(1000, 'bytes=0-499').should.eql(arr('bytes', [{ start: 0, end: 499 }])); +parse(1000, 'bytes=40-80').should.eql(arr('bytes', [{ start: 40, end: 80 }])); +parse(1000, 'bytes=-500').should.eql(arr('bytes', [{ start: 500, end: 999 }])); +parse(1000, 'bytes=-400').should.eql(arr('bytes', [{ start: 600, end: 999 }])); +parse(1000, 'bytes=500-').should.eql(arr('bytes', [{ start: 500, end: 999 }])); +parse(1000, 'bytes=400-').should.eql(arr('bytes', [{ start: 400, end: 999 }])); +parse(1000, 'bytes=0-0').should.eql(arr('bytes', [{ start: 0, end: 0 }])); +parse(1000, 'bytes=-1').should.eql(arr('bytes', [{ start: 999, end: 999 }])); +parse(1000, 'items=0-5').should.eql(arr('items', [{ start: 0, end: 5 }])); +parse(1000, 'bytes=40-80,-1').should.eql(arr('bytes', [{ start: 40, end: 80 }, { start: 999, end: 999 }])); +``` + +## Installation + +``` +$ npm install range-parser +``` \ No newline at end of file diff --git a/node_modules/express/node_modules/range-parser/index.js b/node_modules/express/node_modules/range-parser/index.js new file mode 100644 index 0000000..9b0f7a8 --- /dev/null +++ b/node_modules/express/node_modules/range-parser/index.js @@ -0,0 +1,49 @@ + +/** + * Parse "Range" header `str` relative to the given file `size`. + * + * @param {Number} size + * @param {String} str + * @return {Array} + * @api public + */ + +module.exports = function(size, str){ + var valid = true; + var i = str.indexOf('='); + + if (-1 == i) return -2; + + var arr = str.slice(i + 1).split(',').map(function(range){ + var range = range.split('-') + , start = parseInt(range[0], 10) + , end = parseInt(range[1], 10); + + // -nnn + if (isNaN(start)) { + start = size - end; + end = size - 1; + // nnn- + } else if (isNaN(end)) { + end = size - 1; + } + + // limit last-byte-pos to current length + if (end > size - 1) end = size - 1; + + // invalid + if (isNaN(start) + || isNaN(end) + || start > end + || start < 0) valid = false; + + return { + start: start, + end: end + }; + }); + + arr.type = str.slice(0, i); + + return valid ? arr : -1; +}; \ No newline at end of file diff --git a/node_modules/express/node_modules/range-parser/package.json b/node_modules/express/node_modules/range-parser/package.json new file mode 100644 index 0000000..8ff3a32 --- /dev/null +++ b/node_modules/express/node_modules/range-parser/package.json @@ -0,0 +1,19 @@ +{ + "name": "range-parser", + "author": { + "name": "TJ Holowaychuk", + "email": "tj@vision-media.ca", + "url": "http://tjholowaychuk.com" + }, + "description": "Range header field string parser", + "version": "0.0.4", + "main": "index.js", + "dependencies": {}, + "devDependencies": { + "mocha": "*", + "should": "*" + }, + "readme": "\n# node-range-parser\n\n Range header field parser.\n\n## Example:\n\n```js\nassert(-1 == parse(200, 'bytes=500-20'));\nassert(-2 == parse(200, 'bytes=malformed'));\nparse(200, 'bytes=0-499').should.eql(arr('bytes', [{ start: 0, end: 199 }]));\nparse(1000, 'bytes=0-499').should.eql(arr('bytes', [{ start: 0, end: 499 }]));\nparse(1000, 'bytes=40-80').should.eql(arr('bytes', [{ start: 40, end: 80 }]));\nparse(1000, 'bytes=-500').should.eql(arr('bytes', [{ start: 500, end: 999 }]));\nparse(1000, 'bytes=-400').should.eql(arr('bytes', [{ start: 600, end: 999 }]));\nparse(1000, 'bytes=500-').should.eql(arr('bytes', [{ start: 500, end: 999 }]));\nparse(1000, 'bytes=400-').should.eql(arr('bytes', [{ start: 400, end: 999 }]));\nparse(1000, 'bytes=0-0').should.eql(arr('bytes', [{ start: 0, end: 0 }]));\nparse(1000, 'bytes=-1').should.eql(arr('bytes', [{ start: 999, end: 999 }]));\nparse(1000, 'items=0-5').should.eql(arr('items', [{ start: 0, end: 5 }]));\nparse(1000, 'bytes=40-80,-1').should.eql(arr('bytes', [{ start: 40, end: 80 }, { start: 999, end: 999 }]));\n```\n\n## Installation\n\n```\n$ npm install range-parser\n```", + "_id": "range-parser@0.0.4", + "_from": "range-parser@0.0.4" +} diff --git a/node_modules/express/node_modules/send/.npmignore b/node_modules/express/node_modules/send/.npmignore new file mode 100644 index 0000000..f1250e5 --- /dev/null +++ b/node_modules/express/node_modules/send/.npmignore @@ -0,0 +1,4 @@ +support +test +examples +*.sock diff --git a/node_modules/express/node_modules/send/History.md b/node_modules/express/node_modules/send/History.md new file mode 100644 index 0000000..20c5319 --- /dev/null +++ b/node_modules/express/node_modules/send/History.md @@ -0,0 +1,25 @@ + +0.1.0 / 2012-08-25 +================== + + * add options parameter to send() that is passed to fs.createReadStream() [kanongil] + +0.0.4 / 2012-08-16 +================== + + * allow custom "Accept-Ranges" definition + +0.0.3 / 2012-07-16 +================== + + * fix normalization of the root directory. Closes #3 + +0.0.2 / 2012-07-09 +================== + + * add passing of req explicitly for now (YUCK) + +0.0.1 / 2010-01-03 +================== + + * Initial release diff --git a/node_modules/express/node_modules/send/Makefile b/node_modules/express/node_modules/send/Makefile new file mode 100644 index 0000000..a9dcfd5 --- /dev/null +++ b/node_modules/express/node_modules/send/Makefile @@ -0,0 +1,8 @@ + +test: + @./node_modules/.bin/mocha \ + --require should \ + --reporter spec \ + --bail + +.PHONY: test \ No newline at end of file diff --git a/node_modules/express/node_modules/send/Readme.md b/node_modules/express/node_modules/send/Readme.md new file mode 100644 index 0000000..85171a9 --- /dev/null +++ b/node_modules/express/node_modules/send/Readme.md @@ -0,0 +1,123 @@ + +# send + + Send is Connect's `static()` extracted for generalized use, a streaming static file + server supporting partial responses (Ranges), conditional-GET negotiation, high test coverage, and granular events which may be leveraged to take appropriate actions in your application or framework. + +## Installation + + $ npm install send + +## Examples + + Small: + +```js +var http = require('http'); +var send = require('send'); + +var app = http.createServer(function(req, res){ + send(req, req.url).pipe(res); +}); +``` + + Serving from a root directory with custom error-handling: + +```js +var http = require('http'); +var send = require('send'); + +var app = http.createServer(function(req, res){ + // your custom error-handling logic: + function error(err) { + res.statusCode = err.status || 500; + res.end(err.message); + } + + // your custom directory handling logic: + function redirect() { + res.statusCode = 301; + res.setHeader('Location', req.url + '/'); + res.end('Redirecting to ' + req.url + '/'); + } + + // transfer arbitrary files from within + // /www/example.com/public/* + send(req, url.parse(req.url).pathname) + .root('/www/example.com/public') + .on('error', error) + .on('directory', redirect) + .pipe(res); +}); +``` + +## API + +### Events + + - `error` an error occurred `(err)` + - `directory` a directory was requested + - `stream` file streaming has started `(stream)` + - `end` streaming has completed + +### .root(dir) + + Serve files relative to `path`. Aliased as `.from(dir)`. + +### .index(path) + + By default send supports "index.html" files, to disable this + invoke `.index(false)` or to supply a new index pass a string. + +### .maxage(ms) + + Provide a max-age in milliseconds for http caching, defaults to 0. + +## Error-handling + + By default when no `error` listeners are present an automatic response will be made, otherwise you have full control over the response, aka you may show a 5xx page etc. + +## Caching + + It does _not_ perform internal caching, you should use a reverse proxy cache such + as Varnish for this, or those fancy things called CDNs. If your application is small enough that it would benefit from single-node memory caching, it's small enough that it does not need caching at all ;). + +## Debugging + + To enable `debug()` instrumentation output export __DEBUG__: + +``` +$ DEBUG=send node app +``` + +## Running tests + +``` +$ npm install +$ make test +``` + +## License + +(The MIT License) + +Copyright (c) 2012 TJ Holowaychuk <tj@vision-media.ca> + +Permission is hereby granted, free of charge, to any person obtaining +a copy of this software and associated documentation files (the +'Software'), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, sublicense, and/or sell copies of the Software, and to +permit persons to whom the Software is furnished to do so, subject to +the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. +IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY +CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, +TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE +SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. \ No newline at end of file diff --git a/node_modules/express/node_modules/send/index.js b/node_modules/express/node_modules/send/index.js new file mode 100644 index 0000000..f17158d --- /dev/null +++ b/node_modules/express/node_modules/send/index.js @@ -0,0 +1,2 @@ + +module.exports = require('./lib/send'); \ No newline at end of file diff --git a/node_modules/express/node_modules/send/lib/send.js b/node_modules/express/node_modules/send/lib/send.js new file mode 100644 index 0000000..de72146 --- /dev/null +++ b/node_modules/express/node_modules/send/lib/send.js @@ -0,0 +1,473 @@ + +/** + * Module dependencies. + */ + +var debug = require('debug')('send') + , parseRange = require('range-parser') + , Stream = require('stream') + , mime = require('mime') + , fresh = require('fresh') + , path = require('path') + , http = require('http') + , fs = require('fs') + , basename = path.basename + , normalize = path.normalize + , join = path.join + , utils = require('./utils'); + +/** + * Expose `send`. + */ + +exports = module.exports = send; + +/** + * Expose mime module. + */ + +exports.mime = mime; + +/** + * Return a `SendStream` for `req` and `path`. + * + * @param {Request} req + * @param {String} path + * @param {Object} options + * @return {SendStream} + * @api public + */ + +function send(req, path, options) { + return new SendStream(req, path, options); +} + +/** + * Initialize a `SendStream` with the given `path`. + * + * Events: + * + * - `error` an error occurred + * - `stream` file streaming has started + * - `end` streaming has completed + * - `directory` a directory was requested + * + * @param {Request} req + * @param {String} path + * @param {Object} options + * @api private + */ + +function SendStream(req, path, options) { + var self = this; + this.req = req; + this.path = path; + this.options = options || {}; + this.maxage(0); + this.hidden(false); + this.index('index.html'); +} + +/** + * Inherits from `Stream.prototype`. + */ + +SendStream.prototype.__proto__ = Stream.prototype; + +/** + * Enable or disable "hidden" (dot) files. + * + * @param {Boolean} path + * @return {SendStream} + * @api public + */ + +SendStream.prototype.hidden = function(val){ + debug('hidden %s', val); + this._hidden = val; + return this; +}; + +/** + * Set index `path`, set to a falsy + * value to disable index support. + * + * @param {String|Boolean} path + * @return {SendStream} + * @api public + */ + +SendStream.prototype.index = function(path){ + debug('index %s', path); + this._index = path; + return this; +}; + +/** + * Set root `path`. + * + * @param {String} path + * @return {SendStream} + * @api public + */ + +SendStream.prototype.root = +SendStream.prototype.from = function(path){ + this._root = normalize(path); + return this; +}; + +/** + * Set max-age to `ms`. + * + * @param {Number} ms + * @return {SendStream} + * @api public + */ + +SendStream.prototype.maxage = function(ms){ + if (Infinity == ms) ms = 60 * 60 * 24 * 365 * 1000; + debug('max-age %d', ms); + this._maxage = ms; + return this; +}; + +/** + * Emit error with `status`. + * + * @param {Number} status + * @api private + */ + +SendStream.prototype.error = function(status, err){ + var res = this.res; + var msg = http.STATUS_CODES[status]; + err = err || new Error(msg); + err.status = status; + if (this.listeners('error').length) return this.emit('error', err); + res.statusCode = err.status; + res.end(msg); +}; + +/** + * Check if the pathname is potentially malicious. + * + * @return {Boolean} + * @api private + */ + +SendStream.prototype.isMalicious = function(){ + return !this._root && ~this.path.indexOf('..'); +}; + +/** + * Check if the pathname ends with "/". + * + * @return {Boolean} + * @api private + */ + +SendStream.prototype.hasTrailingSlash = function(){ + return '/' == this.path[this.path.length - 1]; +}; + +/** + * Check if the basename leads with ".". + * + * @return {Boolean} + * @api private + */ + +SendStream.prototype.hasLeadingDot = function(){ + return '.' == basename(this.path)[0]; +}; + +/** + * Check if this is a conditional GET request. + * + * @return {Boolean} + * @api private + */ + +SendStream.prototype.isConditionalGET = function(){ + return this.req.headers['if-none-match'] + || this.req.headers['if-modified-since']; +}; + +/** + * Strip content-* header fields. + * + * @api private + */ + +SendStream.prototype.removeContentHeaderFields = function(){ + var res = this.res; + Object.keys(res._headers).forEach(function(field){ + if (0 == field.indexOf('content')) { + res.removeHeader(field); + } + }); +}; + +/** + * Respond with 304 not modified. + * + * @api private + */ + +SendStream.prototype.notModified = function(){ + var res = this.res; + debug('not modified'); + this.removeContentHeaderFields(); + res.statusCode = 304; + res.end(); +}; + +/** + * Check if the request is cacheable, aka + * responded with 2xx or 304 (see RFC 2616 section 14.2{5,6}). + * + * @return {Boolean} + * @api private + */ + +SendStream.prototype.isCachable = function(){ + var res = this.res; + return (res.statusCode >= 200 && res.statusCode < 300) || 304 == res.statusCode; +}; + +/** + * Handle stat() error. + * + * @param {Error} err + * @api private + */ + +SendStream.prototype.onStatError = function(err){ + var notfound = ['ENOENT', 'ENAMETOOLONG', 'ENOTDIR']; + if (~notfound.indexOf(err.code)) return this.error(404, err); + this.error(500, err); +}; + +/** + * Check if the cache is fresh. + * + * @return {Boolean} + * @api private + */ + +SendStream.prototype.isFresh = function(){ + return fresh(this.req.headers, this.res._headers); +}; + +/** + * Redirect to `path`. + * + * @param {String} path + * @api private + */ + +SendStream.prototype.redirect = function(path){ + if (this.listeners('directory').length) return this.emit('directory'); + var res = this.res; + path += '/'; + res.statusCode = 301; + res.setHeader('Location', path); + res.end('Redirecting to ' + utils.escape(path)); +}; + +/** + * Pipe to `res. + * + * @param {Stream} res + * @return {Stream} res + * @api public + */ + +SendStream.prototype.pipe = function(res){ + var self = this + , args = arguments + , path = this.path + , root = this._root; + + // references + this.res = res; + + // invalid request uri + path = utils.decode(path); + if (-1 == path) return this.error(400); + + // null byte(s) + if (~path.indexOf('\0')) return this.error(400); + + // join / normalize from optional root dir + if (root) path = normalize(join(this._root, path)); + + // ".." is malicious without "root" + if (this.isMalicious()) return this.error(403); + + // malicious path + if (root && 0 != path.indexOf(root)) return this.error(403); + + // hidden file support + if (!this._hidden && this.hasLeadingDot()) return this.error(404); + + // index file support + if (this._index && this.hasTrailingSlash()) path += this._index; + + debug('stat "%s"', path); + fs.stat(path, function(err, stat){ + if (err) return self.onStatError(err); + if (stat.isDirectory()) return self.redirect(self.path); + self.send(path, stat); + }); + + return res; +}; + +/** + * Transfer `path`. + * + * @param {String} path + * @api public + */ + +SendStream.prototype.send = function(path, stat){ + var options = this.options; + var len = stat.size; + var res = this.res; + var req = this.req; + var ranges = req.headers.range; + var offset = options.start || 0; + + // set header fields + this.setHeader(stat); + + // set content-type + this.type(path); + + // conditional GET support + if (this.isConditionalGET() + && this.isCachable() + && this.isFresh()) { + return this.notModified(); + } + + // adjust len to start/end options + len = Math.max(0, len - offset); + if (options.end !== undefined) { + var bytes = options.end - offset + 1; + if (len > bytes) len = bytes; + } + + // Range support + if (ranges) { + ranges = parseRange(len, ranges); + + // unsatisfiable + if (-1 == ranges) { + res.setHeader('Content-Range', 'bytes */' + stat.size); + return this.error(416); + } + + // valid (syntactically invalid ranges are treated as a regular response) + if (-2 != ranges) { + options.start = offset + ranges[0].start; + options.end = offset + ranges[0].end; + + // Content-Range + res.statusCode = 206; + res.setHeader('Content-Range', 'bytes ' + + ranges[0].start + + '-' + + ranges[0].end + + '/' + + len); + len = options.end - options.start + 1; + } + } + + // content-length + res.setHeader('Content-Length', len); + + // HEAD support + if ('HEAD' == req.method) return res.end(); + + this.stream(path, options); +}; + +/** + * Stream `path` to the response. + * + * @param {String} path + * @param {Object} options + * @api private + */ + +SendStream.prototype.stream = function(path, options){ + // TODO: this is all lame, refactor meeee + var self = this; + var res = this.res; + var req = this.req; + + // pipe + var stream = fs.createReadStream(path, options); + this.emit('stream', stream); + stream.pipe(res); + + // socket closed, done with the fd + req.on('close', stream.destroy.bind(stream)); + + // error handling code-smell + stream.on('error', function(err){ + // no hope in responding + if (res._header) { + console.error(err.stack); + req.destroy(); + return; + } + + // 500 + err.status = 500; + self.emit('error', err); + }); + + // end + stream.on('end', function(){ + self.emit('end'); + }); +}; + +/** + * Set content-type based on `path` + * if it hasn't been explicitly set. + * + * @param {String} path + * @api private + */ + +SendStream.prototype.type = function(path){ + var res = this.res; + if (res.getHeader('Content-Type')) return; + var type = mime.lookup(path); + var charset = mime.charsets.lookup(type); + debug('content-type %s', type); + res.setHeader('Content-Type', type + (charset ? '; charset=' + charset : '')); +}; + +/** + * Set reaponse header fields, most + * fields may be pre-defined. + * + * @param {Object} stat + * @api private + */ + +SendStream.prototype.setHeader = function(stat){ + var res = this.res; + if (!res.getHeader('Accept-Ranges')) res.setHeader('Accept-Ranges', 'bytes'); + if (!res.getHeader('ETag')) res.setHeader('ETag', utils.etag(stat)); + if (!res.getHeader('Date')) res.setHeader('Date', new Date().toUTCString()); + if (!res.getHeader('Cache-Control')) res.setHeader('Cache-Control', 'public, max-age=' + (this._maxage / 1000)); + if (!res.getHeader('Last-Modified')) res.setHeader('Last-Modified', stat.mtime.toUTCString()); +}; diff --git a/node_modules/express/node_modules/send/lib/utils.js b/node_modules/express/node_modules/send/lib/utils.js new file mode 100644 index 0000000..950e5a2 --- /dev/null +++ b/node_modules/express/node_modules/send/lib/utils.js @@ -0,0 +1,47 @@ + +/** + * Return an ETag in the form of `"-"` + * from the given `stat`. + * + * @param {Object} stat + * @return {String} + * @api private + */ + +exports.etag = function(stat) { + return '"' + stat.size + '-' + Number(stat.mtime) + '"'; +}; + +/** + * decodeURIComponent. + * + * Allows V8 to only deoptimize this fn instead of all + * of send(). + * + * @param {String} path + * @api private + */ + +exports.decode = function(path){ + try { + return decodeURIComponent(path); + } catch (err) { + return -1; + } +}; + +/** + * Escape the given string of `html`. + * + * @param {String} html + * @return {String} + * @api private + */ + +exports.escape = function(html){ + return String(html) + .replace(/&(?!\w+;)/g, '&') + .replace(//g, '>') + .replace(/"/g, '"'); +}; \ No newline at end of file diff --git a/node_modules/express/node_modules/mime/LICENSE b/node_modules/express/node_modules/send/node_modules/mime/LICENSE similarity index 100% rename from node_modules/express/node_modules/mime/LICENSE rename to node_modules/express/node_modules/send/node_modules/mime/LICENSE diff --git a/node_modules/express/node_modules/mime/README.md b/node_modules/express/node_modules/send/node_modules/mime/README.md similarity index 100% rename from node_modules/express/node_modules/mime/README.md rename to node_modules/express/node_modules/send/node_modules/mime/README.md diff --git a/node_modules/express/node_modules/send/node_modules/mime/mime.js b/node_modules/express/node_modules/send/node_modules/mime/mime.js new file mode 100644 index 0000000..1e00585 --- /dev/null +++ b/node_modules/express/node_modules/send/node_modules/mime/mime.js @@ -0,0 +1,104 @@ +var path = require('path'); +var fs = require('fs'); + +function Mime() { + // Map of extension -> mime type + this.types = Object.create(null); + + // Map of mime type -> extension + this.extensions = Object.create(null); +} + +/** + * Define mimetype -> extension mappings. Each key is a mime-type that maps + * to an array of extensions associated with the type. The first extension is + * used as the default extension for the type. + * + * e.g. mime.define({'audio/ogg', ['oga', 'ogg', 'spx']}); + * + * @param map (Object) type definitions + */ +Mime.prototype.define = function (map) { + for (var type in map) { + var exts = map[type]; + + for (var i = 0; i < exts.length; i++) { + this.types[exts[i]] = type; + } + + // Default extension is the first one we encounter + if (!this.extensions[type]) { + this.extensions[type] = exts[0]; + } + } +}; + +/** + * Load an Apache2-style ".types" file + * + * This may be called multiple times (it's expected). Where files declare + * overlapping types/extensions, the last file wins. + * + * @param file (String) path of file to load. + */ +Mime.prototype.load = function(file) { + // Read file and split into lines + var map = {}, + content = fs.readFileSync(file, 'ascii'), + lines = content.split(/[\r\n]+/); + + lines.forEach(function(line) { + // Clean up whitespace/comments, and split into fields + var fields = line.replace(/\s*#.*|^\s*|\s*$/g, '').split(/\s+/); + map[fields.shift()] = fields; + }); + + this.define(map); +}; + +/** + * Lookup a mime type based on extension + */ +Mime.prototype.lookup = function(path, fallback) { + var ext = path.replace(/.*[\.\/]/, '').toLowerCase(); + + return this.types[ext] || fallback || this.default_type; +}; + +/** + * Return file extension associated with a mime type + */ +Mime.prototype.extension = function(mimeType) { + return this.extensions[mimeType]; +}; + +// Default instance +var mime = new Mime(); + +// Load local copy of +// http://svn.apache.org/repos/asf/httpd/httpd/trunk/docs/conf/mime.types +mime.load(path.join(__dirname, 'types/mime.types')); + +// Load additional types from node.js community +mime.load(path.join(__dirname, 'types/node.types')); + +// Default type +mime.default_type = mime.lookup('bin'); + +// +// Additional API specific to the default instance +// + +mime.Mime = Mime; + +/** + * Lookup a charset based on mime type. + */ +mime.charsets = { + lookup: function(mimeType, fallback) { + // Assume text types are utf8 + return (/^text\//).test(mimeType) ? 'UTF-8' : fallback; + } +} + +module.exports = mime; diff --git a/node_modules/express/node_modules/send/node_modules/mime/package.json b/node_modules/express/node_modules/send/node_modules/mime/package.json new file mode 100644 index 0000000..a265300 --- /dev/null +++ b/node_modules/express/node_modules/send/node_modules/mime/package.json @@ -0,0 +1,31 @@ +{ + "author": { + "name": "Robert Kieffer", + "email": "robert@broofa.com", + "url": "http://github.com/broofa" + }, + "contributors": [ + { + "name": "Benjamin Thomas", + "email": "benjamin@benjaminthomas.org", + "url": "http://github.com/bentomas" + } + ], + "dependencies": {}, + "description": "A comprehensive library for mime-type mapping", + "devDependencies": {}, + "keywords": [ + "util", + "mime" + ], + "main": "mime.js", + "name": "mime", + "repository": { + "url": "https://github.com/broofa/node-mime", + "type": "git" + }, + "version": "1.2.6", + "readme": "# mime\n\nComprehensive MIME type mapping API. Includes all 600+ types and 800+ extensions defined by the Apache project, plus additional types submitted by the node.js community.\n\n## Install\n\nInstall with [npm](http://github.com/isaacs/npm):\n\n npm install mime\n\n## API - Queries\n\n### mime.lookup(path)\nGet the mime type associated with a file. Performs a case-insensitive lookup using the extension in `path` (the substring after the last '/' or '.'). E.g.\n\n var mime = require('mime');\n\n mime.lookup('/path/to/file.txt'); // => 'text/plain'\n mime.lookup('file.txt'); // => 'text/plain'\n mime.lookup('.TXT'); // => 'text/plain'\n mime.lookup('htm'); // => 'text/html'\n\n### mime.extension(type)\nGet the default extension for `type`\n\n mime.extension('text/html'); // => 'html'\n mime.extension('application/octet-stream'); // => 'bin'\n\n### mime.charsets.lookup()\n\nMap mime-type to charset\n\n mime.charsets.lookup('text/plain'); // => 'UTF-8'\n\n(The logic for charset lookups is pretty rudimentary. Feel free to suggest improvements.)\n\n## API - Defining Custom Types\n\nThe following APIs allow you to add your own type mappings within your project. If you feel a type should be included as part of node-mime, see [requesting new types](https://github.com/bentomas/node-mime/wiki/Requesting-New-Types).\n\n### mime.define()\n\nAdd custom mime/extension mappings\n\n mime.define({\n 'text/x-some-format': ['x-sf', 'x-sft', 'x-sfml'],\n 'application/x-my-type': ['x-mt', 'x-mtt'],\n // etc ...\n });\n\n mime.lookup('x-sft'); // => 'text/x-some-format'\n\nThe first entry in the extensions array is returned by `mime.extension()`. E.g.\n\n mime.extension('text/x-some-format'); // => 'x-sf'\n\n### mime.load(filepath)\n\nLoad mappings from an Apache \".types\" format file\n\n mime.load('./my_project.types');\n\nThe .types file format is simple - See the `types` dir for examples.\n", + "_id": "mime@1.2.6", + "_from": "mime@1.2.6" +} diff --git a/node_modules/express/node_modules/mime/test.js b/node_modules/express/node_modules/send/node_modules/mime/test.js similarity index 90% rename from node_modules/express/node_modules/mime/test.js rename to node_modules/express/node_modules/send/node_modules/mime/test.js index 8a8a5b1..cbad034 100644 --- a/node_modules/express/node_modules/mime/test.js +++ b/node_modules/express/node_modules/send/node_modules/mime/test.js @@ -25,6 +25,8 @@ eq('application/octet-stream', mime.lookup('text.nope')); eq('fallback', mime.lookup('text.fallback', 'fallback')); eq('application/octet-stream', mime.lookup('constructor')); eq('text/plain', mime.lookup('TEXT.TXT')); +eq('text/event-stream', mime.lookup('text/event-stream')); +eq('application/x-web-app-manifest+json', mime.lookup('text.webapp')); // // Test extensions diff --git a/node_modules/express/node_modules/mime/types/mime.types b/node_modules/express/node_modules/send/node_modules/mime/types/mime.types similarity index 100% rename from node_modules/express/node_modules/mime/types/mime.types rename to node_modules/express/node_modules/send/node_modules/mime/types/mime.types diff --git a/node_modules/express/node_modules/mime/types/node.types b/node_modules/express/node_modules/send/node_modules/mime/types/node.types similarity index 73% rename from node_modules/express/node_modules/mime/types/node.types rename to node_modules/express/node_modules/send/node_modules/mime/types/node.types index f7da49f..b7fe8c0 100644 --- a/node_modules/express/node_modules/mime/types/node.types +++ b/node_modules/express/node_modules/send/node_modules/mime/types/node.types @@ -45,4 +45,21 @@ video/MP2T ts # What: The FLAC lossless codec format # Why: Streaming and serving FLAC audio # Added by: jacobrask -audio/flac flac \ No newline at end of file +audio/flac flac + +# What: EventSource mime type +# Why: mime type of Server-Sent Events stream +# http://www.w3.org/TR/eventsource/#text-event-stream +# Added by: francois2metz +text/event-stream event-stream + +# What: Mozilla App manifest mime type +# Why: https://developer.mozilla.org/en/Apps/Manifest#Serving_manifests +# Added by: ednapiranha +application/x-web-app-manifest+json webapp + +# What: Matroska Mime Types +# Why: http://en.wikipedia.org/wiki/Matroska +# Added by: aduncan88 +video/x-matroska mkv +audio/x-matroska mka diff --git a/node_modules/express/node_modules/send/package.json b/node_modules/express/node_modules/send/package.json new file mode 100644 index 0000000..78fadcb --- /dev/null +++ b/node_modules/express/node_modules/send/package.json @@ -0,0 +1,33 @@ +{ + "name": "send", + "version": "0.1.0", + "description": "Better streaming static file server with Range and conditional-GET support", + "keywords": [ + "static", + "file", + "server" + ], + "author": { + "name": "TJ Holowaychuk", + "email": "tj@vision-media.ca" + }, + "dependencies": { + "debug": "*", + "mime": "1.2.6", + "fresh": "0.1.0", + "range-parser": "0.0.4" + }, + "devDependencies": { + "mocha": "*", + "should": "*", + "supertest": "0.0.1", + "connect": "2.x" + }, + "scripts": { + "test": "make test" + }, + "main": "index", + "readme": "\n# send\n\n Send is Connect's `static()` extracted for generalized use, a streaming static file\n server supporting partial responses (Ranges), conditional-GET negotiation, high test coverage, and granular events which may be leveraged to take appropriate actions in your application or framework.\n\n## Installation\n\n $ npm install send\n\n## Examples\n\n Small:\n\n```js\nvar http = require('http');\nvar send = require('send');\n\nvar app = http.createServer(function(req, res){\n send(req, req.url).pipe(res);\n});\n```\n\n Serving from a root directory with custom error-handling:\n\n```js\nvar http = require('http');\nvar send = require('send');\n\nvar app = http.createServer(function(req, res){\n // your custom error-handling logic:\n function error(err) {\n res.statusCode = err.status || 500;\n res.end(err.message);\n }\n\n // your custom directory handling logic:\n function redirect() {\n res.statusCode = 301;\n res.setHeader('Location', req.url + '/');\n res.end('Redirecting to ' + req.url + '/');\n }\n\n // transfer arbitrary files from within\n // /www/example.com/public/*\n send(req, url.parse(req.url).pathname)\n .root('/www/example.com/public')\n .on('error', error)\n .on('directory', redirect)\n .pipe(res);\n});\n```\n\n## API\n\n### Events\n\n - `error` an error occurred `(err)`\n - `directory` a directory was requested\n - `stream` file streaming has started `(stream)`\n - `end` streaming has completed\n\n### .root(dir)\n\n Serve files relative to `path`. Aliased as `.from(dir)`.\n\n### .index(path)\n\n By default send supports \"index.html\" files, to disable this\n invoke `.index(false)` or to supply a new index pass a string.\n\n### .maxage(ms)\n\n Provide a max-age in milliseconds for http caching, defaults to 0.\n\n## Error-handling\n\n By default when no `error` listeners are present an automatic response will be made, otherwise you have full control over the response, aka you may show a 5xx page etc.\n\n## Caching\n\n It does _not_ perform internal caching, you should use a reverse proxy cache such\n as Varnish for this, or those fancy things called CDNs. If your application is small enough that it would benefit from single-node memory caching, it's small enough that it does not need caching at all ;).\n\n## Debugging\n\n To enable `debug()` instrumentation output export __DEBUG__:\n\n```\n$ DEBUG=send node app\n```\n\n## Running tests\n\n```\n$ npm install\n$ make test\n```\n\n## License \n\n(The MIT License)\n\nCopyright (c) 2012 TJ Holowaychuk <tj@vision-media.ca>\n\nPermission is hereby granted, free of charge, to any person obtaining\na copy of this software and associated documentation files (the\n'Software'), to deal in the Software without restriction, including\nwithout limitation the rights to use, copy, modify, merge, publish,\ndistribute, sublicense, and/or sell copies of the Software, and to\npermit persons to whom the Software is furnished to do so, subject to\nthe following conditions:\n\nThe above copyright notice and this permission notice shall be\nincluded in all copies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,\nEXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\nMERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.\nIN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY\nCLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,\nTORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE\nSOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.", + "_id": "send@0.1.0", + "_from": "send@0.1.0" +} diff --git a/node_modules/express/package.json b/node_modules/express/package.json index 6e52528..77915eb 100644 --- a/node_modules/express/package.json +++ b/node_modules/express/package.json @@ -1,38 +1,80 @@ { "name": "express", "description": "Sinatra inspired web development framework", - "version": "2.4.6", - "author": "TJ Holowaychuk ", - "contributors": [ - { "name": "TJ Holowaychuk", "email": "tj@vision-media.ca" }, - { "name": "Aaron Heckmann", "email": "aaron.heckmann+github@gmail.com" }, - { "name": "Ciaran Jessup", "email": "ciaranj@gmail.com" }, - { "name": "Guillermo Rauch", "email": "rauchg@gmail.com" } + "version": "3.0.2", + "author": { + "name": "TJ Holowaychuk", + "email": "tj@vision-media.ca" + }, + "contributors": [ + { + "name": "TJ Holowaychuk", + "email": "tj@vision-media.ca" + }, + { + "name": "Aaron Heckmann", + "email": "aaron.heckmann+github@gmail.com" + }, + { + "name": "Ciaran Jessup", + "email": "ciaranj@gmail.com" + }, + { + "name": "Guillermo Rauch", + "email": "rauchg@gmail.com" + } ], "dependencies": { - "connect": ">= 1.5.2 < 2.0.0", - "mime": ">= 0.0.1", - "qs": ">= 0.3.1" + "connect": "2.6.2", + "commander": "0.6.1", + "range-parser": "0.0.4", + "mkdirp": "0.3.3", + "cookie": "0.0.4", + "crc": "0.2.0", + "fresh": "0.1.0", + "methods": "0.0.1", + "send": "0.1.0", + "cookie-signature": "0.0.1", + "debug": "*" }, "devDependencies": { - "connect-form": "0.2.1", - "ejs": "0.4.2", - "expresso": "0.7.2", - "hamljs": "0.5.1", - "jade": "0.11.0", - "stylus": "0.13.0", - "should": "0.2.1", - "express-messages": "0.0.2", - "node-markdown": ">= 0.0.1", - "connect-redis": ">= 0.0.1" + "ejs": "*", + "mocha": "*", + "jade": "*", + "hjs": "*", + "stylus": "*", + "should": "*", + "connect-redis": "*", + "github-flavored-markdown": "*", + "supertest": "0.0.1" + }, + "keywords": [ + "express", + "framework", + "sinatra", + "web", + "rest", + "restful", + "router", + "app", + "api" + ], + "repository": { + "type": "git", + "url": "git://github.com/visionmedia/express" }, - "keywords": ["framework", "sinatra", "web", "rest", "restful"], - "repository": "git://github.com/visionmedia/express", "main": "index", - "bin": { "express": "./bin/express" }, + "bin": { + "express": "./bin/express" + }, "scripts": { - "test": "make test", - "prepublish" : "npm prune" + "prepublish": "npm prune", + "test": "make test" + }, + "engines": { + "node": "*" }, - "engines": { "node": ">= 0.4.1 < 0.5.0" } -} \ No newline at end of file + "readme": "![express logo](http://f.cl.ly/items/0V2S1n0K1i3y1c122g04/Screen%20Shot%202012-04-11%20at%209.59.42%20AM.png)\n\n Fast, unopinionated, minimalist web framework for [node](http://nodejs.org). [![Build Status](https://secure.travis-ci.org/visionmedia/express.png)](http://travis-ci.org/visionmedia/express)\n\n```js\nvar express = require('express');\nvar app = express();\n\napp.get('/', function(req, res){\n res.send('Hello World');\n});\n\napp.listen(3000);\n```\n\n## Installation\n\n $ npm install -g express\n\n To install the 3.0 alpha:\n \n $ npm install -g express@3.0\n\n## Quick Start\n\n The quickest way to get started with express is to utilize the executable `express(1)` to generate an application as shown below:\n\n Create the app:\n\n $ npm install -g express\n $ express /tmp/foo && cd /tmp/foo\n\n Install dependencies:\n\n $ npm install\n\n Start the server:\n\n $ node app\n\n## Features\n\n * Built on [Connect](http://github.com/senchalabs/connect)\n * Robust routing\n * HTTP helpers (redirection, caching, etc)\n * View system supporting 14+ template engines\n * Content negotiation\n * Focus on high performance\n * Environment based configuration\n * Executable for generating applications quickly\n * High test coverage\n\n## Philosophy\n\n The Express philosophy is to provide small, robust tooling for HTTP servers. Making\n it a great solution for single page applications, web sites, hybrids, or public\n HTTP APIs.\n \n Built on Connect you can use _only_ what you need, and nothing more, applications\n can be as big or as small as you like, even a single file. Express does\n not force you to use any specific ORM or template engine. With support for over\n 14 template engines via [Consolidate.js](http://github.com/visionmedia/consolidate.js)\n you can quickly craft your perfect framework.\n\n## More Information\n\n * Join #express on freenode\n * [Google Group](http://groups.google.com/group/express-js) for discussion\n * Follow [tjholowaychuk](http://twitter.com/tjholowaychuk) on twitter for updates\n * Visit the [Wiki](http://github.com/visionmedia/express/wiki)\n * [日本語ドキュメンテーション](http://hideyukisaito.com/doc/expressjs/) by [hideyukisaito](https://github.com/hideyukisaito)\n * [Русскоязычная документация](http://express-js.ru/)\n\n## Viewing Examples\n\nClone the Express repo, then install the dev dependencies to install all the example / test suite deps:\n\n $ git clone git://github.com/visionmedia/express.git --depth 1\n $ cd express\n $ npm install\n\nthen run whichever tests you want:\n\n $ node examples/content-negotiation\n\n## Running Tests\n\nTo run the test suite first invoke the following command within the repo, installing the development dependencies:\n\n $ npm install\n\nthen run the tests:\n\n $ make test\n\n## Contributors\n\n```\nproject: express\ncommits: 3559\nactive : 468 days\nfiles : 237\nauthors: \n 1891\tTj Holowaychuk 53.1%\n 1285\tvisionmedia 36.1%\n 182\tTJ Holowaychuk 5.1%\n 54\tAaron Heckmann 1.5%\n 34\tcsausdev 1.0%\n 26\tciaranj 0.7%\n 21\tRobert Sköld 0.6%\n 6\tGuillermo Rauch 0.2%\n 3\tDav Glass 0.1%\n 3\tNick Poulden 0.1%\n 2\tRandy Merrill 0.1%\n 2\tBenny Wong 0.1%\n 2\tHunter Loftis 0.1%\n 2\tJake Gordon 0.1%\n 2\tBrian McKinney 0.1%\n 2\tRoman Shtylman 0.1%\n 2\tBen Weaver 0.1%\n 2\tDave Hoover 0.1%\n 2\tEivind Fjeldstad 0.1%\n 2\tDaniel Shaw 0.1%\n 1\tMatt Colyer 0.0%\n 1\tPau Ramon 0.0%\n 1\tPero Pejovic 0.0%\n 1\tPeter Rekdal Sunde 0.0%\n 1\tRaynos 0.0%\n 1\tTeng Siong Ong 0.0%\n 1\tViktor Kelemen 0.0%\n 1\tctide 0.0%\n 1\t8bitDesigner 0.0%\n 1\tisaacs 0.0%\n 1\tmgutz 0.0%\n 1\tpikeas 0.0%\n 1\tshuwatto 0.0%\n 1\ttstrimple 0.0%\n 1\tewoudj 0.0%\n 1\tAdam Sanderson 0.0%\n 1\tAndrii Kostenko 0.0%\n 1\tAndy Hiew 0.0%\n 1\tArpad Borsos 0.0%\n 1\tAshwin Purohit 0.0%\n 1\tBenjen 0.0%\n 1\tDarren Torpey 0.0%\n 1\tGreg Ritter 0.0%\n 1\tGregory Ritter 0.0%\n 1\tJames Herdman 0.0%\n 1\tJim Snodgrass 0.0%\n 1\tJoe McCann 0.0%\n 1\tJonathan Dumaine 0.0%\n 1\tJonathan Palardy 0.0%\n 1\tJonathan Zacsh 0.0%\n 1\tJustin Lilly 0.0%\n 1\tKen Sato 0.0%\n 1\tMaciej Małecki 0.0%\n 1\tMasahiro Hayashi 0.0%\n```\n\n## License \n\n(The MIT License)\n\nCopyright (c) 2009-2012 TJ Holowaychuk <tj@vision-media.ca>\n\nPermission is hereby granted, free of charge, to any person obtaining\na copy of this software and associated documentation files (the\n'Software'), to deal in the Software without restriction, including\nwithout limitation the rights to use, copy, modify, merge, publish,\ndistribute, sublicense, and/or sell copies of the Software, and to\npermit persons to whom the Software is furnished to do so, subject to\nthe following conditions:\n\nThe above copyright notice and this permission notice shall be\nincluded in all copies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,\nEXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\nMERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.\nIN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY\nCLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,\nTORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE\nSOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\n", + "_id": "express@3.0.2", + "_from": "express@3.0.2" +} diff --git a/node_modules/express/test.js b/node_modules/express/test.js new file mode 100644 index 0000000..96250ea --- /dev/null +++ b/node_modules/express/test.js @@ -0,0 +1,20 @@ + +/** + * Module dependencies. + */ + +var express = require('./') + , app = express() + +console.log(express.json()); +app.use(express.favicon()); +app.use(express.logger('dev')); +app.use(express.cookieParser('foobar')); +app.use(express.session()); + +app.get('/', function(req, res){ + res.send('hello'); +}); + +app.listen(3000); +console.log('listening on 3000'); \ No newline at end of file diff --git a/node_modules/faceplate/node_modules/b64url/package.json b/node_modules/faceplate/node_modules/b64url/package.json index 9e3b260..8ff72cc 100644 --- a/node_modules/faceplate/node_modules/b64url/package.json +++ b/node_modules/faceplate/node_modules/b64url/package.json @@ -3,15 +3,25 @@ "description": "URL safe base64 encoding/decoding.", "version": "1.0.3", "homepage": "https://github.com/nshah/nodejs-b64url", - "author": "Naitik Shah ", + "author": { + "name": "Naitik Shah", + "email": "n@daaku.org" + }, "main": "lib/b64url", "repository": { "type": "git", "url": "https://github.com/nshah/nodejs-b64url" }, - "scripts": { "test": "./node_modules/.bin/expresso -c" }, + "scripts": { + "test": "./node_modules/.bin/expresso -c" + }, "devDependencies": { "expresso": ">= 0.8.1" }, - "engines": { "node": ">= 0.4.1" } + "engines": { + "node": ">= 0.4.1" + }, + "readme": "b64url\n======\n\nURL safe base64 encoding/decoding as described\n[here](http://tools.ietf.org/html/rfc3548#section-4).\n\n```javascript\nvar encoded = b64url.encode(data)\nvar decoded = b64url.decode(encoded)\n```\n", + "_id": "b64url@1.0.3", + "_from": "b64url@1.0.3" } diff --git a/node_modules/faceplate/node_modules/restler/package.json b/node_modules/faceplate/node_modules/restler/package.json index f68449b..9224e23 100644 --- a/node_modules/faceplate/node_modules/restler/package.json +++ b/node_modules/faceplate/node_modules/restler/package.json @@ -1,18 +1,29 @@ { - "name": "restler", - "version": "2.0.0", - "description": "An HTTP client library for node.js", - "contributors": [{ "name": "Dan Webb", "email": "dan@danwebb.net" }], - "homepage": "https://github.com/danwrong/restler", - "directories" : { "lib" : "./lib" }, - "main" : "./lib/restler", - "engines": { "node": ">= 0.6.x" }, - "dependencies": { - }, - "devDependencies": { - "nodeunit": ">=0.5.0", - "xml2js" : ">=0.1.0", - "yaml" : ">=0.2.0", - "iconv": ">=1.0.0" + "name": "restler", + "version": "2.0.0", + "description": "An HTTP client library for node.js", + "contributors": [ + { + "name": "Dan Webb", + "email": "dan@danwebb.net" } + ], + "homepage": "https://github.com/danwrong/restler", + "directories": { + "lib": "./lib" + }, + "main": "./lib/restler", + "engines": { + "node": ">= 0.6.x" + }, + "dependencies": {}, + "devDependencies": { + "nodeunit": ">=0.5.0", + "xml2js": ">=0.1.0", + "yaml": ">=0.2.0", + "iconv": ">=1.0.0" + }, + "readme": "Restler\n=======\n\n(C) Dan Webb (dan@danwebb.net/@danwrong) 2011, Licensed under the MIT-LICENSE\n\nAn HTTP client library for node.js (0.3 and up). Hides most of the complexity of creating and using http.Client. Very early days yet.\n\n**Release 2.x.x** will be dedicated to modifying how errors are handled and emitted. Currently errors are being fired as an on 'error' event but as [@ctavan](https://github.com/ctavan) pointed out on [issue #36](https://github.com/danwrong/restler/pull/36) a better approach (and more commonly in vogue now) would be to pass the error obj to the callback.\n\nThs change will inevitably affect those using older < 0.2.x versions of restler. Those not ready to upgrade yet are encouraged to stay on the 0.2.x version.\n\nSee [Version History](https://github.com/danwrong/restler/wiki/Version-History) for changes\n\n\nFeatures\n--------\n\n* Easy interface for common operations via http.request\n* Automatic serialization of post data\n* Automatic serialization of query string data\n* Automatic deserialization of XML, JSON and YAML responses to JavaScript objects (if you have js-yaml and/or xml2js in the require path)\n* Provide your own deserialization functions for other datatypes\n* Automatic following of redirects\n* Send files with multipart requests\n* Transparently handle SSL (just specify https in the URL)\n* Deals with basic auth for you, just provide username and password options\n* Simple service wrapper that allows you to easily put together REST API libraries\n* Transparently handle content-encoded responses (gzip, deflate) (requires node 0.6+)\n* Transparently handle different content charsets via [iconv](https://github.com/bnoordhuis/node-iconv) (if available)\n\n\nAPI\n---\n\n### request(url, options)\n\nBasic method to make a request of any type. The function returns a RestRequest object that emits events:\n\n#### events\n\n* `complete: function(result, response)` - emitted when the request has finished whether it was successful or not. Gets passed the response result and the response object as arguments. If some error has occurred, `result` is always instance of `Error`, otherwise it contains response data.\n* `success: function(data, response)` - emitted when the request was successful. Gets passed the response data and the response object as arguments.\n* `fail: function(data, response)` - emitted when the request was successful, but 4xx status code returned. Gets passed the response data and the response object as arguments.\n* `error: function(err, response)` - emitted when some errors have occurred (eg. connection aborted, parse, encoding, decoding failed or some other unhandled errors). Gets passed the `Error` object and the response object (when available) as arguments.\n* `abort: function()` - emitted when `request.abort()` is called.\n* `2XX`, `3XX`, `4XX`, `5XX: function(data, response)` - emitted for all requests with response codes in the range (eg. `2XX` emitted for 200, 201, 203).\n* actual response code: function(data, response) - emitted for every single response code (eg. 404, 201, etc).\n\n#### members\n\n* `abort([error])` Cancels request. `abort` event is emitted. `request.aborted` is set to `true`. If non-falsy `error` is passed, then `error` will be additionaly emitted (with `error` passed as a param and `error.type` is set to `\"abort\"`). Otherwise only `complete` event will raise.\n* `retry([timeout])` Re-sends request after `timeout` ms. Pending request is aborted.\n* `aborted` Determines if request was aborted.\n\n\n### get(url, options)\n\nCreate a GET request.\n\n### post(url, options)\n\nCreate a POST request.\n\n### put(url, options)\n\nCreate a PUT request.\n\n### del(url, options)\n\nCreate a DELETE request.\n\n### head(url, options)\n\nCreate a HEAD request.\n\n### json(url, data, options)\n\nSend json `data` via GET method.\n\n### postJson(url, data, options)\n\nSend json `data` via POST method.\n\n\n### Parsers\n\nYou can give any of these to the parsers option to specify how the response data is deserialized.\nIn case of malformed content, parsers emit `error` event. Original data returned by server is stored in `response.raw`.\n\n#### parsers.auto\n\nChecks the content-type and then uses parsers.xml, parsers.json or parsers.yaml.\nIf the content type isn't recognised it just returns the data untouched.\n\n#### parsers.json, parsers.xml, parsers.yaml\n\nAll of these attempt to turn the response into a JavaScript object. In order to use the YAML and XML parsers you must have yaml and/or xml2js installed.\n\n### Options\n\n* `method` Request method, can be get, post, put, del. Defaults to `\"get\"`.\n* `query` Query string variables as a javascript object, will override the querystring in the URL. Defaults to empty.\n* `data` The data to be added to the body of the request. Can be a string or any object.\nNote that if you want your request body to be JSON with the `Content-Type: application/json`, you need to\n`JSON.stringify` your object first. Otherwise, it will be sent as `application/x-www-form-urlencoded` and encoded accordingly.\nAlso you can use `json()` and `postJson()` methods.\n* `parser` A function that will be called on the returned data. Use any of predefined `restler.parsers`. See parsers section below. Defaults to `restler.parsers.auto`.\n* `encoding` The encoding of the request body. Defaults to `\"utf8\"`.\n* `decoding` The encoding of the response body. For a list of supported values see [Buffers](http://nodejs.org/docs/latest/api/buffers.html#buffers). Additionally accepts `\"buffer\"` - returns response as `Buffer`. Defaults to `\"utf8\"`.\n* `headers` A hash of HTTP headers to be sent. Defaults to `{ 'Accept': '*/*', 'User-Agent': 'Restler for node.js' }`.\n* `username` Basic auth username. Defaults to empty.\n* `password` Basic auth password. Defaults to empty.\n* `multipart` If set the data passed will be formated as `multipart/form-encoded`. See multipart example below. Defaults to `false`.\n* `client` A http.Client instance if you want to reuse or implement some kind of connection pooling. Defaults to empty.\n* `followRedirects` If set will recursively follow redirects. Defaults to `true`.\n\n\nExample usage\n-------------\n\n```javascript\nvar sys = require('util'),\n rest = require('./restler');\n\nrest.get('http://google.com').on('complete', function(result) {\n if (result instanceof Error) {\n sys.puts('Error: ' + result.message);\n this.retry(5000); // try again after 5 sec\n } else {\n sys.puts(result);\n }\n});\n\nrest.get('http://twaud.io/api/v1/users/danwrong.json').on('complete', function(data) {\n sys.puts(data[0].message); // auto convert to object\n});\n\nrest.get('http://twaud.io/api/v1/users/danwrong.xml').on('complete', function(data) {\n sys.puts(data[0].sounds[0].sound[0].message); // auto convert to object\n});\n\nrest.post('http://user:pass@service.com/action', {\n data: { id: 334 },\n}).on('complete', function(data, response) {\n if (response.statusCode == 201) {\n // you can get at the raw response like this...\n }\n});\n\n// multipart request sending a file and using https\nrest.post('https://twaud.io/api/v1/upload.json', {\n multipart: true,\n username: 'danwrong',\n password: 'wouldntyouliketoknow',\n data: {\n 'sound[message]': 'hello from restler!',\n 'sound[file]': rest.file('doug-e-fresh_the-show.mp3', null, null, null, 'audio/mpeg')\n }\n}).on('complete', function(data) {\n sys.puts(data.audio_url);\n});\n\n// create a service constructor for very easy API wrappers a la HTTParty...\nTwitter = rest.service(function(u, p) {\n this.defaults.username = u;\n this.defaults.password = p;\n}, {\n baseURL: 'http://twitter.com'\n}, {\n update: function(message) {\n return this.post('/statuses/update.json', { data: { status: message } });\n }\n});\n\nvar client = new Twitter('danwrong', 'password');\nclient.update('Tweeting using a Restler service thingy').on('complete', function(data) {\n sys.p(data);\n});\n\n// post JSON\nvar jsonData = { id: 334 };\nrest.postJson('http://example.com/action', jsonData).on('complete', function(data, response) {\n // handle response\n});\n\n```\n\nRunning the tests\n-----------------\ninstall **[nodeunit](https://github.com/caolan/nodeunit)**\n\n```bash\nnpm install nodeunit\n```\n\nthen\n\n```bash\nnode test/all.js\n```\n\nor\n\n```bash\nnodeunit test/restler.js\n```\n\nTODO\n----\n* What do you need? Let me know or fork.\n", + "_id": "restler@2.0.0", + "_from": "restler@2.0.0" } diff --git a/node_modules/faceplate/package.json b/node_modules/faceplate/package.json index 97dc566..cce7c57 100644 --- a/node_modules/faceplate/package.json +++ b/node_modules/faceplate/package.json @@ -1,18 +1,20 @@ { - "name": "faceplate", - "version": "0.0.4", - "author": "Heroku", + "name": "faceplate", + "version": "0.0.4", + "author": { + "name": "Heroku" + }, "homepage": "https://github.com/heroku/faceplate", - "description": "Wrapper for Facebook authentication and API", - "repository": { "type": "git", - "url": "https://github.com/heroku/faceplate" + "url": "https://github.com/heroku/faceplate" }, - "dependencies": { - "b64url": "1.0.3", + "b64url": "1.0.3", "restler": "2.0.0" - } + }, + "readme": "# faceplate\n\nA Node.js wrapper for Facebook authentication and API\n\n## Usage\n\nUse as a connect middleware\n\n```javascript\n// create an express webserver\nvar app = require('express').createServer(\n express.bodyParser(),\n express.cookieParser(),\n require('faceplate').middleware({\n app_id: process.env.FACEBOOK_APP_ID,\n secret: process.env.FACEBOOK_SECRET,\n scope: 'user_likes,user_photos,user_photo_video_tags'\n })\n);\n\n// show friends\napp.get('/friends', function(req, res) {\n req.facebook.get('/me/friends', { limit: 4 }, function(friends) {\n req.send('friends: ' + require('util').inspect(friends));\n });\n});\n\n// use fql to show my friends using this app\napp.get('/friends_using_app', function(req, res) {\n req.facebook.fql('SELECT uid, name, is_app_user, pic_square FROM user WHERE uid in (SELECT uid2 FROM friend WHERE uid1 = me()) AND is_app_user = 1', function(friends_using_app) {\n req.send('friends using app: ' + require('util').inspect(friends_using_app));\n });\n});\n```\n\n## License\n\nMIT\n", + "_id": "faceplate@0.0.4", + "_from": "faceplate@0.0.4" } diff --git a/node_modules/socket_manager/index.js b/node_modules/socket_manager/index.js deleted file mode 100644 index 89c596c..0000000 --- a/node_modules/socket_manager/index.js +++ /dev/null @@ -1,66 +0,0 @@ -var SocketManager = function(io) { - - this.io = io; - this.sockets = {}; - this.queues = {}; - - var manager = this; - - io.sockets.on('connection', function(socket) { - - // when a socket sends an auth message, associate it with - // that socket id - socket.on('auth', function(socket_id) { - manager.sockets[socket_id] = socket; - socket.set('socket_id', socket_id); - }); - - // clean up - socket.on('disconnect', function() { - socket.get('socket_id', function(err, socket_id) { - delete manager.sockets[socket_id]; - delete manager.queues[socket_id]; - }); - }); - - }); - - // send a message to a socket - this.send = function(socket_id, topic, message) { - - // build a queue if it doesn't exist - if (! manager.queues[socket_id]) { - manager.queues[socket_id] = []; - } - - // add this message to the socket's queue - manager.queues[socket_id].push([ topic, message ]); - - }; - - // attempt to send all queued messages to the available sockets - this.flush = function() { - - for (var socket_id in manager.queues) { - - // if a socket exists for this socket_id - if (manager.sockets[socket_id]) { - - // send all outstanding messages to the socket - manager.queues[socket_id].forEach(function(item) { - manager.sockets[socket_id].emit(item[0], item[1]); - }); - - // clear the queue - manager.queues[socket_id] = []; - } - }; - }; - - // attempt to flush the socket queues every 1000ms - setInterval(this.flush, 1000); -}; - -module.exports.create = function(io) { - return new SocketManager(io); -} diff --git a/package.json b/package.json index 47f46fa..ec5ff7f 100644 --- a/package.json +++ b/package.json @@ -8,8 +8,7 @@ "async": "0.1.18", "express": "3.0.2", "ejs": "0.8.3", - "faceplate": "0.0.4", - "socket.io": "*" + "faceplate": "0.0.4" }, "engines": {